diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
230 files changed, 407 insertions, 8208 deletions
diff --git a/bean/Jar_officebean.mk b/bean/Jar_officebean.mk index 852788318cd5..d7883a5fa7e6 100644 --- a/bean/Jar_officebean.mk +++ b/bean/Jar_officebean.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Jar_add_sourcefiles,officebean,\ bean/com/sun/star/beans/NativeConnection \ bean/com/sun/star/beans/NativeService \ bean/com/sun/star/beans/OfficeConnection \ - bean/com/sun/star/beans/OfficeWindow \ bean/com/sun/star/comp/beans/ContainerFactory \ bean/com/sun/star/comp/beans/Controller \ bean/com/sun/star/comp/beans/Frame \ diff --git a/bean/com/sun/star/beans/ContainerFactory.java b/bean/com/sun/star/beans/ContainerFactory.java index e3c0c9d9d7e2..7b8e93f42717 100644 --- a/bean/com/sun/star/beans/ContainerFactory.java +++ b/bean/com/sun/star/beans/ContainerFactory.java @@ -29,10 +29,5 @@ import java.awt.Container; public interface ContainerFactory { - /** - * Creates an AWT container. - * - * @return An AWT container. - */ - Container createContainer(); + } diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java index b4b59359a32b..34c33f90e314 100644 --- a/bean/com/sun/star/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/beans/LocalOfficeConnection.java @@ -159,19 +159,6 @@ public class LocalOfficeConnection } /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * @param container This is an AWT container. - * @return The office window instance. - */ - public OfficeWindow createOfficeWindow(Container container) - { - return new LocalOfficeWindow(this); - } - - /** * Closes the connection. */ public void dispose() diff --git a/bean/com/sun/star/beans/LocalOfficeWindow.java b/bean/com/sun/star/beans/LocalOfficeWindow.java index 63dc9ce53b33..0d2021b92f5e 100644 --- a/bean/com/sun/star/beans/LocalOfficeWindow.java +++ b/bean/com/sun/star/beans/LocalOfficeWindow.java @@ -42,7 +42,7 @@ import com.sun.star.uno.XComponentContext; */ public class LocalOfficeWindow extends java.awt.Canvas - implements OfficeWindow, XEventListener + implements XEventListener { private transient OfficeConnection mConnection; private transient XWindowPeer mParentProxy; diff --git a/bean/com/sun/star/beans/OfficeConnection.java b/bean/com/sun/star/beans/OfficeConnection.java index 4301600590c0..272d2376f754 100644 --- a/bean/com/sun/star/beans/OfficeConnection.java +++ b/bean/com/sun/star/beans/OfficeConnection.java @@ -39,13 +39,7 @@ public interface OfficeConnection void setUnoUrl(String url) throws java.net.MalformedURLException; - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - void setContainerFactory(ContainerFactory containerFactory); + /** * Retrieves the UNO component context. @@ -56,15 +50,5 @@ public interface OfficeConnection */ XComponentContext getComponentContext(); - /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * This method does not add add the office window to its container. - * - * @param container This is an AWT container. - * @return The office window instance. - */ - OfficeWindow createOfficeWindow(Container container); + } diff --git a/bean/com/sun/star/beans/OfficeWindow.java b/bean/com/sun/star/beans/OfficeWindow.java deleted file mode 100644 index ebc46b8335de..000000000000 --- a/bean/com/sun/star/beans/OfficeWindow.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package com.sun.star.beans; - -import java.awt.Component; - -import com.sun.star.awt.XWindowPeer; - -/** - * The concreate implementation of the OfficeWindow extends an - * approperate type of visual component (java.awt.Canvas for local - * and java.awt.Container for remote). - * @deprecated - */ -public interface OfficeWindow -{ - /** - * Retrieves an AWT component object associated with the OfficeWindow. - * - * @return The AWT component object associated with the OfficeWindow. - */ - Component getAWTComponent(); - - /** - * Retrieves an UNO XWindowPeer object associated with the OfficeWindow. - * - * @return The UNO XWindowPeer object associated with the OfficeWindow. - */ - XWindowPeer getUNOWindowPeer(); -} diff --git a/bean/com/sun/star/comp/beans/ContainerFactory.java b/bean/com/sun/star/comp/beans/ContainerFactory.java index d06a082c7db6..8e54884d9a36 100644 --- a/bean/com/sun/star/comp/beans/ContainerFactory.java +++ b/bean/com/sun/star/comp/beans/ContainerFactory.java @@ -29,10 +29,5 @@ import java.awt.Container; public interface ContainerFactory { - /** - * Creates an AWT container. - * - * @return An AWT container. - */ - Container createContainer(); + } diff --git a/bean/com/sun/star/comp/beans/Controller.java b/bean/com/sun/star/comp/beans/Controller.java index 9e93c5878b2f..4a68980a8866 100644 --- a/bean/com/sun/star/comp/beans/Controller.java +++ b/bean/com/sun/star/comp/beans/Controller.java @@ -83,13 +83,7 @@ public class Controller // com.sun.star.frame.XDispatchProvider - public com.sun.star.frame.XDispatch queryDispatch( - /*IN*/ com.sun.star.util.URL aURL, - /*IN*/ String aTargetFrameName, - /*IN*/ int nSearchFlags ) - { - return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags ); - } + public com.sun.star.frame.XDispatch[] queryDispatches( /*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests ) diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java index 85daec2e1cf0..1357f6adcad0 100644 --- a/bean/com/sun/star/comp/beans/OOoBean.java +++ b/bean/com/sun/star/comp/beans/OOoBean.java @@ -181,25 +181,7 @@ public class OOoBean xConnectionListener = this.new EventListener("setOOoConnection"); } - // @requirement FUNC.CON.STRT/0.4 - /** Starts a connection to an OOo instance which is lauched if not running. - @throws HasConnectionException - if a connection was already established. - - @throws NoConnectionException - if the specified connection cannot be established - */ - public void startOOoConnection( String aConnectionURL ) - throws java.net.MalformedURLException, - HasConnectionException, - NoConnectionException - { - // create a new connection from the given connection URL - LocalOfficeConnection aConnection = new LocalOfficeConnection(); - aConnection.setUnoUrl( aConnectionURL ); - setOOoConnection( aConnection ); - } // @requirement FUNC.CON.CHK/0.7 /** Returns true if this OOoBean is connected to an OOo instance, @@ -331,31 +313,7 @@ public class OOoBean return xDesktop; } - /** Resets this bean to an empty document. - - If a document is loaded and the content modified, - the changes are dismissed. Otherwise nothing happens. - - This method is intended to be overridden in derived classes. - This implementation simply calls clear. - @param bClearStateToo - Not only the document content but also the state of the bean, - like visibility of child components is cleared. - - @deprecated There is currently no way to dismiss changes, except for loading - of the unchanged initial document. Furthermore it is unclear how derived classes - handle this and what exactly their state is (e.g. what members make up their state). - Calling this method on a derived class requires knowledge about their implementation. - Therefore a deriving class should declare their own clearDocument if needed. Clients - should call the clearDocument of the deriving class or {@link #clear} which discards - the currently displayed document. - */ - public synchronized void clearDocument( boolean bClearStateToo ) - { - // TBD - clear(); - } /** Resets the OOoBean to an empty status. @@ -696,79 +654,9 @@ public class OOoBean } } - /** Loads a document from a Java stream. - - See loadFromURL() for further information. - */ - public void loadFromStream( - final java.io.InputStream iInStream, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - com.sun.star.util.CloseVetoException - { - // wrap Java stream into UNO stream - - // copy stream.... - int s = 4096; - int r=0 ,n = 0; - byte[] buffer = new byte[s]; - byte[] newBuffer = null; - while ((r = iInStream.read(buffer, n, buffer.length-n))>0) { - n += r; - if (iInStream.available() > buffer.length - n) { - newBuffer = new byte[buffer.length*2]; - System.arraycopy(buffer, 0, newBuffer, 0, n); - buffer = newBuffer; - } - } - if (buffer.length != n) { - newBuffer = new byte[n]; - System.arraycopy(buffer, 0, newBuffer, 0, n); - buffer = newBuffer; - } - com.sun.star.io.XInputStream xStream = - new com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter(buffer); - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - // call normal load method - loadFromURL( "private:stream", aExtendedArguments ); - } - /** Loads a document from a byte array. - - See loadFromURL() for further information. - */ - public void loadFromByteArray( - final byte aInBuffer[], - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - com.sun.star.util.CloseVetoException - { - // wrap byte arrray into UNO stream - com.sun.star.io.XInputStream xStream = - new com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter( - aInBuffer ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal load method - loadFromURL( "private:stream", aExtendedArguments ); - } /** Stores a document to the given URL. <p> @@ -831,84 +719,9 @@ public class OOoBean { throw new NoConnectionException(); } } - /** Stores a document to a stream. - See {@link #storeToURL storeToURL} for further information. - @see #storeToURL storeToURL - */ - public java.io.OutputStream storeToStream( - java.io.OutputStream aOutStream, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - NoDocumentException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException - { - // wrap Java stream into UNO stream - com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter aStream = - new com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter( - aOutStream ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal store method - storeToURL( "private:stream", aExtendedArguments ); - - // get byte array from document stream - try { aStream.closeOutput(); } - catch ( com.sun.star.io.NotConnectedException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.BufferSizeExceededException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - return aOutStream; - } - /** Stores a document to a byte array. - - See {@link #storeToURL storeToURL} for further information. - @see #storeToURL storeToURL - */ - public byte[] storeToByteArray( - byte aOutBuffer[], - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - NoDocumentException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException - { - // wrap byte arrray into UNO stream - com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter aStream = - new com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter( - aOutBuffer ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal store method - storeToURL( "private:stream", aExtendedArguments ); - - // get byte array from document stream - try { aStream.closeOutput(); } - catch ( com.sun.star.io.NotConnectedException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.BufferSizeExceededException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - return aStream.getBuffer(); - } // @requirement FUNC.BEAN.PROG/0.5 // @requirement API.SIM.SEAP/0.2 diff --git a/bean/com/sun/star/comp/beans/OfficeConnection.java b/bean/com/sun/star/comp/beans/OfficeConnection.java index 2786810654d8..ec239d480c56 100644 --- a/bean/com/sun/star/comp/beans/OfficeConnection.java +++ b/bean/com/sun/star/comp/beans/OfficeConnection.java @@ -40,13 +40,7 @@ public interface OfficeConnection void setUnoUrl(String url) throws java.net.MalformedURLException; - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - void setContainerFactory(ContainerFactory containerFactory); + /** * Retrieves the UNO component context. diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java index b2e08164f44c..679d41e1b469 100644 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java +++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java @@ -56,11 +56,11 @@ public class NativeStorageAccess { public native int read(String name,String key,byte[] b, int off, int len) throws java.io.IOException; - public native int readInt(String name,String key) throws java.io.IOException; + public native void seek(String name,String key,long position) throws java.io.IOException; public native void write(String name,String key,byte[] b, int offset, int length) throws java.io.IOException; - public native void writeInt(String name,String key,int v) throws java.io.IOException; + } diff --git a/connectivity/qa/connectivity/tools/sdb/Connection.java b/connectivity/qa/connectivity/tools/sdb/Connection.java index f530fa9af92e..e3c006aefbb8 100644 --- a/connectivity/qa/connectivity/tools/sdb/Connection.java +++ b/connectivity/qa/connectivity/tools/sdb/Connection.java @@ -48,24 +48,6 @@ public class Connection return m_connection; } - public boolean execute( final String _sql ) throws SQLException - { - XStatement statement = createStatement(); - return statement.execute( _sql ); - } - - public XResultSet executeQuery( final String _sql ) throws SQLException - { - XStatement statement = createStatement(); - return statement.executeQuery( _sql ); - } - - public int executeUpdate( final String _sql ) throws SQLException - { - XStatement statement = createStatement(); - return statement.executeUpdate( _sql ); - } - public void refreshTables() { final XTablesSupplier suppTables = UnoRuntime.queryInterface(XTablesSupplier.class, m_connection); diff --git a/extensions/qa/integration/extensions/MethodHandler.java b/extensions/qa/integration/extensions/MethodHandler.java index 56eda09b2912..c362016f9538 100644 --- a/extensions/qa/integration/extensions/MethodHandler.java +++ b/extensions/qa/integration/extensions/MethodHandler.java @@ -50,10 +50,7 @@ public class MethodHandler implements XPropertyHandler } } - static public XSingleComponentFactory getFactory() - { - return new ComponentFactory( MethodHandler.class ); - } + public void actuatingPropertyChanged(String _propertyName, Object _newValue, Object _oldValue, com.sun.star.inspection.XObjectInspectorUI _objectInspectorUI, boolean _firstTimeInit) throws com.sun.star.lang.NullPointerException { diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java index 987af1367e85..6f048a6aa160 100644 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java @@ -179,10 +179,7 @@ public class CheckOGroupBoxModel return propertiesChanged; } - public void reset() - { - propertiesChanged = false; - } + } private XMultiServiceFactory getMSF() diff --git a/forms/qa/integration/forms/DocumentHelper.java b/forms/qa/integration/forms/DocumentHelper.java index cbbb73d7385b..41e620593e65 100644 --- a/forms/qa/integration/forms/DocumentHelper.java +++ b/forms/qa/integration/forms/DocumentHelper.java @@ -108,11 +108,7 @@ public class DocumentHelper return blankDocument( orb, DocumentType.WRITER ); } - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankXMLForm( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception - { - return blankDocument( orb, DocumentType.XMLFORM ); - } + /* ------------------------------------------------------------------ */ public static DocumentHelper blankDocument( XMultiServiceFactory orb, DocumentType eType ) throws com.sun.star.uno.Exception @@ -260,22 +256,7 @@ public class DocumentHelper return createSubForm( xContainer, sInitialName ); } - /* ------------------------------------------------------------------ */ - /** retrieves the document model which a given form component belongs to - */ - static public DocumentHelper getDocumentForComponent( Object aFormComponent, XMultiServiceFactory orb ) - { - XChild xChild = UnoRuntime.queryInterface( XChild.class, aFormComponent ); - XModel xModel = null; - while ( ( null != xChild ) && ( null == xModel ) ) - { - XInterface xParent = (XInterface)xChild.getParent(); - xModel = UnoRuntime.queryInterface( XModel.class, xParent ); - xChild = UnoRuntime.queryInterface( XChild.class, xParent ); - } - return new DocumentHelper( orb, xModel ); - } /* ------------------------------------------------------------------ */ /** returns a URL which can be used to create a document of a certain type diff --git a/forms/qa/integration/forms/DocumentType.java b/forms/qa/integration/forms/DocumentType.java index 94e2fa4e54ae..105c31fc2614 100644 --- a/forms/qa/integration/forms/DocumentType.java +++ b/forms/qa/integration/forms/DocumentType.java @@ -26,10 +26,7 @@ public class DocumentType extends com.sun.star.uno.Enum super( value ); } - public static DocumentType getDefault() - { - return WRITER; - } + public static final DocumentType WRITER = new DocumentType(0); public static final DocumentType CALC = new DocumentType(1); @@ -37,16 +34,6 @@ public class DocumentType extends com.sun.star.uno.Enum public static final DocumentType XMLFORM = new DocumentType(3); public static final DocumentType UNKNOWN = new DocumentType(-1); - public static DocumentType fromInt(int value) - { - switch(value) - { - case 0: return WRITER; - case 1: return CALC; - case 2: return DRAWING; - case 3: return XMLFORM; - default: return UNKNOWN; - } - } + } diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java index b2b06cad3990..4026ba3c9751 100644 --- a/forms/qa/integration/forms/DocumentViewHelper.java +++ b/forms/qa/integration/forms/DocumentViewHelper.java @@ -213,36 +213,6 @@ public class DocumentViewHelper xControlWindow.setFocus(); } - /* ------------------------------------------------------------------ */ - /** sets the focus to the first control - */ - protected void grabControlFocus( ) throws java.lang.Exception - { - // the forms container of our document - XIndexContainer xForms = dbfTools.queryIndexContainer( m_document.getFormComponentTreeRoot( ) ); - // the first form - XIndexContainer xForm = dbfTools.queryIndexContainer( xForms.getByIndex( 0 ) ); - // the first control model which is no FixedText (FixedText's can't have the focus) - for ( int i = 0; i<xForm.getCount(); ++i ) - { - XPropertySet xControlProps = dbfTools.queryPropertySet( xForm.getByIndex( i ) ); - if ( FormComponentType.FIXEDTEXT != ((Short)xControlProps.getPropertyValue( "ClassId" )).shortValue() ) - { - XControlModel xControlModel = UnoRuntime.queryInterface( - XControlModel.class, xControlProps ); - // set the focus to this control - grabControlFocus( xControlModel ); - // outta here - break; - } - } - - // Note that we simply took the first control model from the hierarchy. This does state nothing - // about the location of the respective control in the view. A control model is tied to a control - // shape, and the shapes are where the geometry information such as position and size is hung up. - // So you could easily have a document where the first control model is bound to a shape which - // has a greater ordinate than any other control model. - } } diff --git a/forms/qa/integration/forms/FormComponent.java b/forms/qa/integration/forms/FormComponent.java index 51f92a142aba..89b8f91b83c7 100644 --- a/forms/qa/integration/forms/FormComponent.java +++ b/forms/qa/integration/forms/FormComponent.java @@ -108,13 +108,7 @@ public class FormComponent return new String[]{}; } - /* ------------------------------------------------------------------ */ - public boolean hasByName( String name ) - { - if ( m_nameAccess != null ) - return m_nameAccess.hasByName( name ); - return false; - } + /* ------------------------------------------------------------------ */ public int getCount() @@ -150,15 +144,7 @@ public class FormComponent return new com.sun.star.uno.Type( String.class ); } - /* ------------------------------------------------------------------ */ - public boolean hasElements() - { - if ( m_indexAccess != null ) - return m_indexAccess.hasElements(); - else if ( m_nameAccess != null ) - return m_nameAccess.hasElements(); - return false; - } + /* ------------------------------------------------------------------ */ public FormComponent getParent() diff --git a/forms/qa/integration/forms/FormLayer.java b/forms/qa/integration/forms/FormLayer.java index 4c5ccbea5ba8..67c2c266696c 100644 --- a/forms/qa/integration/forms/FormLayer.java +++ b/forms/qa/integration/forms/FormLayer.java @@ -276,29 +276,7 @@ public class FormLayer return null; } - /* ------------------------------------------------------------------ */ - /** retrieves the radio button model with the given name and the given tag - * @param form - * the parent form of the radio button model to find - * @param name - * the name of the radio button - * @param tag - * the tag of the radio button - */ - public XPropertySet getRadioModelByTag( XPropertySet form, String name, String tag ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, form ); - for ( int i=0; i<indexAccess.getCount(); ++i ) - { - XPropertySet control = dbfTools.queryPropertySet( indexAccess.getByIndex( i ) ); - - if ( ((String)control.getPropertyValue( "Name" )).equals( name ) ) - if ( ((String)control.getPropertyValue( "Tag" )).equals( tag ) ) - return control; - } - return null; - } /* ------------------------------------------------------------------ */ /** retrieves a control model with a given (integer) access path @@ -320,24 +298,7 @@ public class FormLayer return controlModel; } - /* ------------------------------------------------------------------ */ - /** retrieves a control model with a given (string) access path - */ - public XPropertySet getControlModel( String[] _accessPath ) throws com.sun.star.uno.Exception - { - XNameAccess nameAcc = m_document.getFormComponentTreeRoot(); - XPropertySet controlModel = null; - int i=0; - while ( ( nameAcc != null ) && ( i < _accessPath.length ) ) - { - controlModel = UnoRuntime.queryInterface( XPropertySet.class, - nameAcc.getByName( _accessPath[i] ) ); - nameAcc = UnoRuntime.queryInterface( XNameAccess.class, - controlModel ); - ++i; - } - return controlModel; - } + /* ------------------------------------------------------------------ */ /** simulates a user's text input into a control given by control model diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java index e9614bb5c0e7..e60a8e4ec448 100644 --- a/forms/qa/org/openoffice/xforms/Instance.java +++ b/forms/qa/org/openoffice/xforms/Instance.java @@ -47,18 +47,7 @@ public class Instance return createElement( m_domInstance, _elementName, null ); } - /** creates a new element in the instance - * - * The element will be inserted immediately below a given XNode. - * - * @param _parentElement the node whose child shall be created - * @param _elementName the name of the to-be-created element - * @return the node of the newly created element - */ - public XNode createElement( XNode _parentElement, String _elementName ) throws DOMException - { - return createElement( _parentElement, _elementName, null ); - } + /** creates a new element in the instance * @@ -115,31 +104,9 @@ public class Instance throw new NoSuchElementException(); } - /** creates an attribute for the root node of the instance - * - * @param _attribName - * the name of the to-be-created attribute - * @return - * the DOM node, which has already been inserted into the DOM tree - */ - public XNode createAttribute( String _attribName ) throws DOMException - { - return createAttribute( m_domInstance, _attribName, null ); - } - /** creates an attribute for the root node of the instance - * - * @param _attribName - * the name of the to-be-created attribute - * @param _initialNodeValue - * the initial value to set at the node. Might be null, in this case no value is set. - * @return - * the DOM node, which has already been inserted into the DOM tree - */ - public XNode createAttribute( String _attribName, String _initialNodeValue ) throws DOMException - { - return createAttribute( m_domInstance, _attribName, _initialNodeValue ); - } + + /** creates an attribute for the given node * diff --git a/forms/qa/org/openoffice/xforms/Model.java b/forms/qa/org/openoffice/xforms/Model.java index ff3829c9e745..c8e5c880042a 100644 --- a/forms/qa/org/openoffice/xforms/Model.java +++ b/forms/qa/org/openoffice/xforms/Model.java @@ -38,10 +38,7 @@ public class Model m_model ); } - protected XModel getXModel() - { - return m_model; - } + protected XFormsUIHelper1 getUIHelper() { diff --git a/framework/qa/complex/framework/autosave/ConfigHelper.java b/framework/qa/complex/framework/autosave/ConfigHelper.java index 38a26a1975b6..d9ab6f50d5b3 100644 --- a/framework/qa/complex/framework/autosave/ConfigHelper.java +++ b/framework/qa/complex/framework/autosave/ConfigHelper.java @@ -61,20 +61,7 @@ class ConfigHelper } - public Object readRelativeKey(String sRelPath, - String sKey ) - throws com.sun.star.container.NoSuchElementException - { - try - { - XPropertySet xPath = UnoRuntime.queryInterface(XPropertySet.class, m_xConfig.getByHierarchicalName(sRelPath)); - return xPath.getPropertyValue(sKey); - } - catch(com.sun.star.uno.Exception ex) - { - throw new com.sun.star.container.NoSuchElementException(ex.getMessage()); - } - } + public void writeRelativeKey(String sRelPath, diff --git a/framework/qa/complex/framework/autosave/Protocol.java b/framework/qa/complex/framework/autosave/Protocol.java index c22372d0853b..db53ea6adb6b 100644 --- a/framework/qa/complex/framework/autosave/Protocol.java +++ b/framework/qa/complex/framework/autosave/Protocol.java @@ -473,24 +473,7 @@ public class Protocol extends JComponent } - /** - * For some modes it's necessary, that we write some additional - * information to the log. E.g. for html we must generate close targets. - */ - public synchronized void finish() - { - // Preferr HTML ... because we can't write ASCII and HTML contents to the same log file! - String sContent; - if ((m_nMode & MODE_HTML) == MODE_HTML) - sContent = impl_generateHTMLFooter(); - else - if ((m_nMode & MODE_ASCII) == MODE_ASCII) - sContent = impl_generateAsciiFooter(); - else - return; - impl_writeToLogFile(m_sFileName, true, sContent); - } /** @@ -533,47 +516,13 @@ public class Protocol extends JComponent } - /** - * log different property arrays. - * - * @param lProps - * the array of properties - */ - public synchronized void log( /*IN*/ com.sun.star.beans.NamedValue[] lProps ) - { - StringBuffer sValues = new StringBuffer(1000); - impl_logPropertyArray(sValues, lProps); - log(TYPE_SCOPE_OPEN | TYPE_INFO, "property array ["+lProps.length+"]:"); - log(TYPE_SCOPE_CLOSE | TYPE_INFO, sValues.toString() ); - } - public synchronized void log( /*IN*/ com.sun.star.beans.PropertyValue[] lProps ) - { - StringBuffer sValues = new StringBuffer(1000); - impl_logPropertyArray(sValues, lProps); - log(TYPE_SCOPE_OPEN | TYPE_INFO, "property array ["+lProps.length+"]:"); - log(TYPE_SCOPE_CLOSE | TYPE_INFO, sValues.toString() ); - } - public synchronized void log( /*IN*/ com.sun.star.beans.NamedValue aProp ) - { - StringBuffer sValue = new StringBuffer(1000); - impl_logProperty(sValue, aProp); - log(TYPE_SCOPE_OPEN | TYPE_INFO, "property:" ); - log(TYPE_SCOPE_CLOSE | TYPE_INFO, sValue.toString()); - } - public synchronized void log( /*IN*/ com.sun.star.beans.PropertyValue aProp ) - { - StringBuffer sValue = new StringBuffer(1000); - impl_logProperty(sValue, aProp); - log(TYPE_SCOPE_OPEN | TYPE_INFO, "property:" ); - log(TYPE_SCOPE_CLOSE | TYPE_INFO, sValue.toString()); - } public synchronized void log( /*IN*/ Object aAny ) { @@ -672,21 +621,7 @@ public class Protocol extends JComponent } - public synchronized void defineHyperlink( /*IN*/ String sTarget , - /*IN*/ String sDescription) - { - if ((m_nMode & MODE_HTML) != MODE_HTML) - return; - - StringBuffer sLog = new StringBuffer(1000); - sLog.append("<a href=\""); - sLog.append(sTarget ); - sLog.append("\">" ); - sLog.append(sDescription); - sLog.append("</a>" ); - log(TYPE_LINK, sLog.toString()); - } /** diff --git a/framework/qa/complex/framework/recovery/RecoveryTools.java b/framework/qa/complex/framework/recovery/RecoveryTools.java index feb10f4b255a..623f14141813 100644 --- a/framework/qa/complex/framework/recovery/RecoveryTools.java +++ b/framework/qa/complex/framework/recovery/RecoveryTools.java @@ -191,30 +191,7 @@ public class RecoveryTools { } } - /** - * This function close the office while calling terminate on the desktop. If - * this failed, the <CODE>ProcessHandler</CODE> kills the process. - * @param xMSF the <CODE>XMultiServiceFactory</CODE> - * @return <CODE>TRUE</CODE> if no exception was thrown, otherwise <CODE>FALSE</CODE> - */ - public boolean closeOffice(XMultiServiceFactory xMSF) { - try { - XDesktop desk = UnoRuntime.queryInterface( - XDesktop.class, xMSF.createInstance( - "com.sun.star.frame.Desktop")); - xMSF = null; - desk.terminate(); - log.println("Waiting until ProcessHandler loses the office..."); - - } - catch (java.lang.Exception e) { - e.printStackTrace(); - return false; - } - waitForClosedOffice(); - return true; - } /** * This function waits until the office is closed. If the closing time reach @@ -237,10 +214,7 @@ public class RecoveryTools { if (ph != null) ph.kill(); } - public void killOffice(){ - helper.ProcessHandler ph = (helper.ProcessHandler) param.get("AppProvider"); - ph.kill(); - } + /** * The office must be started WITH restore and crashreporter functionality. diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java index 383e9c2ed202..39413006ab13 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/BasicBound.java @@ -64,21 +64,7 @@ public class BasicBound { return value; } - public static BasicBound getBound(double[] data) { - BasicBound bound = new BasicBound(); - if(data!=null) { - if(data.length>0) { - bound.minValue = data[0]; - bound.maxValue = data[0]; - for(int i=1; i<data.length; i++) { - bound.minValue = Math.min(bound.minValue, data[i]); - bound.maxValue = Math.max(bound.maxValue, data[i]); - } - } - } - return bound; - } public double randomAdjust (double value){ if(value > maxValue || value < minValue) { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java index 1721b240217c..8cbfaa158747 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java @@ -26,19 +26,5 @@ public class GlobalCompare { return CompareValue.EQUAL_TO; } -/* check the magnitude of two array, the frontial is more important - **/ - public static int compareArray(double[] fit1, double[] fit2) { - if (fit1.length!=fit2.length) { - return CompareValue.INVALID; //error - } - for (int i=0; i<fit1.length; i++) { - if (fit1[i]>fit2[i]) { - return CompareValue.LARGER_THAN; //Large than - } else if (fit1[i]<fit2[i]){ - return CompareValue.LESS_THAN; //Less than - } - } - return CompareValue.EQUAL_TO; //same - } + } diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java index 78f08e5dc213..bb7bf8d8dfe8 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java @@ -45,13 +45,9 @@ public class GlobalString { return v.toArray(new String[v.size()]); } - public static String[] getMeaningfulLines(String srcStr) throws Exception { - return getMeaningfulLines(srcStr, NEGLECT_TAG); - } - public static String getMeaningfulLine(BufferedReader outReader) throws Exception { - return getMeaningfulLine(outReader, NEGLECT_TAG); - } + + private static int getCharLoc(char data, String str) { for(int i=0; i<str.length(); i++) { @@ -126,18 +122,8 @@ public class GlobalString { return nObj.toString(); } - static public int toInteger(Object oVal) throws Exception { - if(oVal==null) throw new Exception("Null string"); - return Integer.parseInt(oVal.toString()); - } - static public double toDouble(Object oVal) throws Exception { - if(oVal==null) throw new Exception("Null string"); - return Double.parseDouble(oVal.toString()); - } - public static Object toObject(String key) throws Exception{ - Class cls = Class.forName(key); - return cls.newInstance(); - } + + }
\ No newline at end of file diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java index b2177b8dfdb8..666a8a0bd758 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/OutputMethods.java @@ -28,18 +28,7 @@ public class OutputMethods { public OutputMethods() { } - public static String outputVectorAsStr(double[] vector){ - if(vector==null) return "NULL"; - String totalStr = ""; - for(int i=0;i<vector.length;i++){ - totalStr += vector[i]; - if(i!=vector.length-1) { - totalStr += "\t"; - } - } - totalStr+="\r\n"; - return totalStr; - } + public static void outputVector(double[] vector){ for(int i=0;i<vector.length;i++){ diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java index 5a3f44612592..48d3b6d799e5 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java @@ -45,49 +45,13 @@ public static double doubleRangeRandom(double lowLimit,double upLimit){ return(num); } -/**This function returns true or false with a random probability. - * @return int return value - */ - public static boolean booleanRandom(){ - boolean value = true; - double temp=Math.random(); - if (temp<0.5) value=false; - return value; - } - public static int[] randomSelection(boolean[] types, int times) { - int validNum = 0; - for(int i=0; i<types.length; i++) { - if(!types[i]) { - validNum++; - } - } - int[] totalIndices = new int[validNum]; - validNum = 0; - for(int i=0; i<types.length; i++) { - if(!types[i]) { - totalIndices[validNum] = i; - validNum++; - if(validNum==totalIndices.length) break; - } - } - return randomSelection(totalIndices, times); - } - public static int[] randomSelection(int low, int up, int times){ - int[] totalIndices = new int[up-low]; - for (int i=low; i<up; i++) { - totalIndices[i] = i; - } - return randomSelection(totalIndices, times); - } - public static int getRealV(double randTypeV) { - if(randTypeV<=0) return 0; - int realV = (int)Math.ceil(randTypeV); - if(Math.random()<(randTypeV-realV)) realV++; - return realV; - } + + + + private static int[] randomSelection(int[] totalIndices, int times) { if (times>=totalIndices.length) { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java index c33d6490b4be..6fee1b7367e4 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/knowledge/SearchPoint.java @@ -68,10 +68,5 @@ public class SearchPoint extends BasicPoint implements IEncodeEngine { return encodeInfo[0] == 0; //no constraint violations } - public void outputSelf() { - System.out.println("#--> Location:"); - OutputMethods.outputVector(getLocation()); - System.out.println("#--> (CON & OPTIM):"); - OutputMethods.outputVector(getEncodeInfo()); - } + }
\ No newline at end of file diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java index 5bbd88a26a45..98c6824b73d6 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/problem/ProblemEncoder.java @@ -65,11 +65,7 @@ public abstract class ProblemEncoder { designSpace.setElemAt(dd, i); } - protected void setDefaultXAt(int i, double min, double max) { - DesignDim dd = new DesignDim(); - dd.paramBound = new BasicBound(min, max); - designSpace.setElemAt(dd, i); - } + //set the default information for evaluation each response protected void setDefaultYAt(int i, double min, double max) { @@ -78,12 +74,7 @@ public abstract class ProblemEncoder { evalStruct.setElemAt(ee, i); } - protected void setDefaultYAt(int i, double min, double max, double weight) { - EvalElement ee = new EvalElement(); - ee.targetBound = new BasicBound(min, max); - ee.weight = weight; - evalStruct.setElemAt(ee, i); - } + //get a fresh point public SearchPoint getFreshSearchPoint() { diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java index aa9988c1b3a9..2ddbf1b891a8 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignDim.java @@ -29,10 +29,7 @@ public class DesignDim { public BasicBound paramBound = new BasicBound(); //the range of a parameter - public void importData(DesignDim ipr) { - this.grain = ipr.grain; - this.paramBound = ipr.paramBound; - } + public boolean isDiscrete() { return grain!=0; diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java index bd620fa5bb9c..0b98752acb80 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/DesignSpace.java @@ -35,9 +35,7 @@ public class DesignSpace { dimProps = new DesignDim[dim]; } - public DesignDim getDimAt(int index) { - return dimProps[index]; - } + public void setElemAt(DesignDim elem, int index) { dimProps[index] = elem; @@ -60,56 +58,26 @@ public class DesignSpace { } } - public void randomAdjust (double[] location){ - for (int i=0; i<getDimension(); i++) { - location[i] = dimProps[i].paramBound.randomAdjust(location[i]); - } - } - public boolean satisfyCondition(double[] location){ - for (int i=0; i<getDimension(); i++) { - if (!dimProps[i].paramBound.isSatisfyCondition(location[i])) { - return false; - } - } - /*If the limits are not violated, return TRUE*/ - return(true); - } + + public void mutationAt(double[] location, int i){ location[i] = dimProps[i].paramBound.getRandomValue(); } - public double mutationUniformAtPointAsCenter (double pointX, int i){ - double length = this.getMagnitudeIn(i)/2; - pointX += RandomGenerator.doubleRangeRandom(-1*length, length); - return pointX; - } - public double getUpValueAt(int dimensionIndex) { - return dimProps[dimensionIndex].paramBound.maxValue; - } - public double getLowValueAt(int dimensionIndex) { - return dimProps[dimensionIndex].paramBound.minValue; - } + + public double getMagnitudeIn(int dimensionIndex) { return dimProps[dimensionIndex].paramBound.getLength(); } - public boolean initilizeGeneAtPointAsCenter(double[] tempX){ - if (tempX.length!=this.getDimension()) { - return false; - } - for(int i=0;i<tempX.length;i++) { - double length = this.getMagnitudeIn(i)/2; - tempX[i]+=RandomGenerator.doubleRangeRandom(-1*length, length); - } - return true; - } + public void initializeGene(double[] tempX){ for(int i=0;i<tempX.length;i++) tempX[i] = dimProps[i].paramBound.getRandomValue(); //Global.RandomGenerator.doubleRangeRandom(9.8, 10); @@ -129,11 +97,5 @@ public class DesignSpace { } } - public double[] getRealLoc(double[] imageLoc) { - double[] realLoc = new double[imageLoc.length]; - System.arraycopy(imageLoc, 0, realLoc, 0, imageLoc.length); - annulusAdjust(realLoc); - return realLoc; - } } diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java index 7401af7eda0c..8a85b5ad2d87 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java @@ -360,10 +360,7 @@ public abstract class BaseNLPSolver extends WeakBase return null; } - protected XCellRangeData getCellRangeData(CellRangeAddress cellRangeAddress) { - return getCellRangeData(cellRangeAddress.Sheet, cellRangeAddress.StartColumn, - cellRangeAddress.StartRow, cellRangeAddress.EndColumn, cellRangeAddress.EndRow); - } + private XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) { try { diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java index 2aaa534ddff2..6c76260a62d3 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java @@ -142,16 +142,9 @@ public abstract class BaseDialog extends BaseControl { super.finalize(); } - public ModalState showModal() { - xWindow.setVisible(true); - xDialog.execute(); - return modalState; - } - public void close() { - xDialog.endExecute(); - xWindow.setVisible(false); - } + + public void setCloseable(boolean closeable) { setProperty("Closeable", new Boolean(closeable)); diff --git a/odk/examples/DevelopersGuide/Charts/Helper.java b/odk/examples/DevelopersGuide/Charts/Helper.java index 0bad5c5e7588..003fd3398c2d 100644 --- a/odk/examples/DevelopersGuide/Charts/Helper.java +++ b/odk/examples/DevelopersGuide/Charts/Helper.java @@ -81,10 +81,7 @@ public class Helper - public XModel createPresentationDocument() - { - return createDocument( "simpress" ); - } + diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java index 6c4bdf287926..6fc9d90e62d4 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java @@ -91,79 +91,13 @@ public class DialogComponent { } } - // XTestDialogHandler - public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) { - m_xFrame = xFrame; - try { - XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager(); - Object obj; - - // If valid we must pass the XModel when creating a DialogProvider object - if( xModel != null ) { - Object[] args = new Object[1]; - args[0] = xModel; - - obj = xMCF.createInstanceWithArgumentsAndContext( - "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx ); - } - else { - obj = xMCF.createInstanceWithContext( - "com.sun.star.awt.DialogProvider2", m_xCmpCtx ); - } - - XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface( XDialogProvider2.class, obj ); - XDialog xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this ); - if( xDialog != null ) - xDialog.execute(); - } - catch (Exception e) { - e.printStackTrace(); - } - return "Created dialog \"" + DialogURL + "\""; - } - public void copyText( XDialog xDialog ) { - XControlContainer xControlContainer = UnoRuntime.queryInterface( - XControlContainer.class, xDialog ); - String aTextPropertyStr = "Text"; - String aText = ""; - XControl xTextField1Control = xControlContainer.getControl( "TextField1" ); - XControlModel xControlModel1 = xTextField1Control.getModel(); - XPropertySet xPropertySet1 = UnoRuntime.queryInterface( - XPropertySet.class, xControlModel1 ); - try - { - aText = (String)xPropertySet1.getPropertyValue( aTextPropertyStr ); - } - catch (Exception e) { - e.printStackTrace(); - } - XControl xTextField2Control = xControlContainer.getControl( "TextField2" ); - XControlModel xControlModel2 = xTextField2Control.getModel(); - XPropertySet xPropertySet2 = UnoRuntime.queryInterface( - XPropertySet.class, xControlModel2 ); - try - { - xPropertySet2.setPropertyValue( aTextPropertyStr, aText ); - } - catch (Exception e) { - e.printStackTrace(); - } - showMessageBox( "DialogComponent", "copyText() called" ); - } - public void handleEvent() { - showMessageBox( "DialogComponent", "handleEvent() called" ); - } - public void handleEventWithArguments( XDialog xDialog, Object aEventObject ) { - showMessageBox( "DialogComponent", "handleEventWithArguments() called\n\n" + - "Event Object = " + aEventObject ); - } private final String aHandlerMethod1 = "doit1"; private final String aHandlerMethod2 = "doit2"; diff --git a/odk/examples/DevelopersGuide/Database/RowSet.java b/odk/examples/DevelopersGuide/Database/RowSet.java index 9b67a5078613..4c783bf965f1 100644 --- a/odk/examples/DevelopersGuide/Database/RowSet.java +++ b/odk/examples/DevelopersGuide/Database/RowSet.java @@ -74,17 +74,7 @@ public class RowSet System.exit(0); } - public static void printDataSources() throws com.sun.star.uno.Exception - { - // create a DatabaseContext and print all DataSource names - XNameAccess xNameAccess = UnoRuntime.queryInterface( - XNameAccess.class, - xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext", - xContext)); - String aNames [] = xNameAccess.getElementNames(); - for(int i=0;i<aNames.length;++i) - System.out.println(aNames[i]); - } + private static void useRowSet() throws com.sun.star.uno.Exception { diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java index a18b0cd85745..ef1be66ae4f2 100644 --- a/odk/examples/DevelopersGuide/Database/Sales.java +++ b/odk/examples/DevelopersGuide/Database/Sales.java @@ -106,40 +106,7 @@ public class Sales } } - // create a scrollable resultset. - public void retrieveSalesData2() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet srs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,srs); - - srs.afterLast(); - while (srs.previous()) { - String name = row.getString(1); - float price = row.getFloat(2); - System.out.println(name + " " + price); - } - - srs.last(); - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,srs); - updateRow.updateFloat(2, (float)0.69); - - XResultSetUpdate updateRs = UnoRuntime.queryInterface( - XResultSetUpdate.class,srs); - updateRs.updateRow(); // this call updates the data in DBMS - - srs.last(); - updateRow.updateFloat(2, (float)0.99); - updateRs.cancelRowUpdates(); - updateRow.updateFloat(2, (float)0.79); - updateRs.updateRow(); - } // inserts a row programmatically. private void insertRow() throws com.sun.star.uno.Exception @@ -186,38 +153,7 @@ public class Sales updateRs.deleteRow(); } - // refresh a row - public void refreshRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - // first we need the 4 row - insertRow(); - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.READ_ONLY)); - XResultSet rs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class, rs); - rs.absolute(4); - float price1 = row.getFloat(2); - - // modifiy the 4 row - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - updateRow.updateFloat(2, 150); - updateRs.updateRow(); - // repositioning - rs.absolute(4); - rs.refreshRow(); - float price2 = row.getFloat(2); - if (price2 != price1) { - System.out.println("Prices are different."); - } - else - System.out.println("Prices are equal."); - deleteRow(); - } // displays the column names public void displayColumnNames() throws com.sun.star.uno.Exception diff --git a/odk/examples/DevelopersGuide/Drawing/PageHelper.java b/odk/examples/DevelopersGuide/Drawing/PageHelper.java index b6bb684453ed..cbf8d9cdcfd3 100644 --- a/odk/examples/DevelopersGuide/Drawing/PageHelper.java +++ b/odk/examples/DevelopersGuide/Drawing/PageHelper.java @@ -95,16 +95,7 @@ public class PageHelper return xDrawPages.insertNewByIndex( nIndex ); } - /** removes the given page - */ - static public void removeDrawPage( XComponent xComponent, XDrawPage xDrawPage ) - { - XDrawPagesSupplier xDrawPagesSupplier = - UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); - XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); - xDrawPages.remove( xDrawPage ); - } + /** get size of the given page */ @@ -156,26 +147,9 @@ public class PageHelper return xDrawPages.insertNewByIndex( nIndex ); } - /** removes the given page - */ - static public void removeMasterPage( XComponent xComponent, XDrawPage xDrawPage ) - { - XMasterPagesSupplier xMasterPagesSupplier = - UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); - XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); - xDrawPages.remove( xDrawPage ); - } - /** return the corresponding masterpage for the giving drawpage - */ - static public XDrawPage getMasterPage( XDrawPage xDrawPage ) - { - XMasterPageTarget xMasterPageTarget = - UnoRuntime.queryInterface( - XMasterPageTarget.class, xDrawPage ); - return xMasterPageTarget.getMasterPage(); - } + + /** sets given masterpage at the drawpage */ diff --git a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java index ec772949cfc4..3bae7b154847 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java @@ -76,11 +76,7 @@ public class DocumentHelper ); } - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankTextDocument( XComponentContext xCtx ) throws com.sun.star.uno.Exception - { - return blankDocument( xCtx, DocumentType.WRITER ); - } + /* ------------------------------------------------------------------ */ public static DocumentHelper blankDocument( XComponentContext xCtx, DocumentType eType ) throws com.sun.star.uno.Exception diff --git a/odk/examples/DevelopersGuide/Forms/DocumentType.java b/odk/examples/DevelopersGuide/Forms/DocumentType.java index b5c943306ee7..9835a26cabe7 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentType.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentType.java @@ -26,25 +26,13 @@ public class DocumentType extends com.sun.star.uno.Enum super( value ); } - public static DocumentType getDefault() - { - return WRITER; - } + public static final DocumentType WRITER = new DocumentType(0); public static final DocumentType CALC = new DocumentType(1); public static final DocumentType DRAWING = new DocumentType(2); public static final DocumentType UNKNOWN = new DocumentType(-1); - public static DocumentType fromInt(int value) - { - switch(value) - { - case 0: return WRITER; - case 1: return CALC; - case 2: return DRAWING; - default: return UNKNOWN; - } - } + } diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java index 75948937b448..9cac2a864ca7 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java @@ -104,15 +104,7 @@ class DocumentViewHelper return xReturn; } - /* ------------------------------------------------------------------ */ - /** retrieves a dispatcher for the given URL, obtained at the current view of the document - */ - public XDispatch getDispatcher( String sURL ) throws java.lang.Exception - { - URL[] aURL = new URL[] { new URL() }; - aURL[0].Complete = sURL; - return getDispatcher( aURL ); - } + /* ------------------------------------------------------------------ */ /* retrieves the form controller belonging to a given logical form diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java b/odk/examples/DevelopersGuide/Forms/FLTools.java index 614d72790d27..e15c454de4c8 100644 --- a/odk/examples/DevelopersGuide/Forms/FLTools.java +++ b/odk/examples/DevelopersGuide/Forms/FLTools.java @@ -45,33 +45,9 @@ import com.sun.star.form.*; */ public class FLTools { - /* ------------------------------------------------------------------ */ - static void dump_Object( Object aObject ) - { - XServiceInfo xSI = UNO.queryServiceInfo( aObject ); - if ( null != xSI ) - System.out.println( "dumping object with name \"" + xSI.getImplementationName() + "\"" ); - else - System.out.println( "object has no service info!" ); - } - /* ------------------------------------------------------------------ */ - /** translates a string containing an URL into a complete - <type scope="com.sun.star.util">URL</type> object. - */ - static public URL parseURL( String sURL, XComponentContext xCtx ) throws java.lang.Exception - { - URL[] aURL = new URL[] { new URL() }; - aURL[0].Complete = sURL; - // need an URLTransformer - XURLTransformer xTransformer = UnoRuntime.queryInterface( - XURLTransformer.class, - xCtx.getServiceManager().createInstanceWithContext( - "com.sun.star.util.URLTransformer", xCtx ) ); - xTransformer.parseStrict( aURL ); - return aURL[0]; - } + /* ------------------------------------------------------------------ */ /** returns the name of the given form component @@ -122,39 +98,7 @@ public class FLTools return sLabel; } - /* ------------------------------------------------------------------ */ - /** retrieves the index of a form component within its parent - */ - static public int getIndexInParent( Object aContainer, Object aElement ) throws com.sun.star.uno.Exception - { - int nIndex = -1; - - // norm the element - XInterface xElement = UnoRuntime.queryInterface( - XInterface.class, aElement ); - - // get the container - XIndexContainer xIndexCont = UNO.queryIndexContainer( aContainer ); - if ( null != xIndexCont ) - { - // loop through all children - int nCount = xIndexCont.getCount(); - for ( int i = 0; i < nCount; ++i ) - { - // compare with the element - XInterface xCurrent = UnoRuntime.queryInterface( - XInterface.class, xIndexCont.getByIndex( 0 ) ); - if ( xCurrent.equals( xElement ) ) - { // found - nIndex = i; - break; - } - } - } - // outta here - return nIndex; - } /* ------------------------------------------------------------------ */ /** retrieves the parent of the given object diff --git a/odk/examples/DevelopersGuide/Forms/FormLayer.java b/odk/examples/DevelopersGuide/Forms/FormLayer.java index 1bd48667d75b..b582ee4fe701 100644 --- a/odk/examples/DevelopersGuide/Forms/FormLayer.java +++ b/odk/examples/DevelopersGuide/Forms/FormLayer.java @@ -43,21 +43,9 @@ public class FormLayer m_insertPage = -1; } - /* ------------------------------------------------------------------ */ - /** sets the page which is to be used for subsequent insertions of controls/shapes - */ - void setInsertPage( int page ) - { - m_insertPage = page; - } - /* ------------------------------------------------------------------ */ - /** retrieves the page which is to be used for subsequent insertions of controls/shapes - */ - final int getInsertPage( ) - { - return m_insertPage; - } + + /* ------------------------------------------------------------------ */ /** creates a control in the document diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java index 29593b04cbae..df2c1b53ec5b 100644 --- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java +++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java @@ -106,25 +106,9 @@ public class HsqlDatabase return m_connection; } - /** executes the given SQL statement via the defaultConnection - */ - public void executeSQL( String statementString ) throws SQLException - { - XStatement statement = defaultConnection().createStatement(); - statement.execute( statementString ); - } - /** stores the database document - */ - public void store() throws IOException - { - if ( m_databaseDocument != null ) - { - XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class, - m_databaseDocument ); - storeDoc.store(); - } - } + + /** closes the database document * @@ -198,12 +182,7 @@ public class HsqlDatabase return m_databaseDocument.getDataSource(); } - /** returns the model interface of the underlying database document - */ - XModel getModel() - { - return UnoRuntime.queryInterface( XModel.class, m_databaseDocument ); - } + /** returns the URL of the ODB document represented by this instance */ @@ -212,12 +191,7 @@ public class HsqlDatabase return m_databaseDocumentFile; } - /** creates a row set operating the database, with a given command/type - */ - public RowSet createRowSet( int _commandType, String _command ) - { - return new RowSet( m_context, getDocumentURL(), _commandType, _command ); - } + @Override protected void finalize() throws Throwable diff --git a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java index 8239e9410359..e961fc8b8a3a 100644 --- a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java +++ b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java @@ -52,12 +52,7 @@ class InteractionRequest implements XInteractionRequest m_aContinuations = new ArrayList<XInteractionContinuation>(); } - /* ------------------------------------------------------------------ */ - public void addContinuation( XInteractionContinuation xCont ) - { - if ( null != xCont ) - m_aContinuations.add( xCont ); - } + /* ------------------------------------------------------------------ */ public Object getRequest( ) diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java index 21dfb947d048..402ffe2e7fb8 100644 --- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java +++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java @@ -36,28 +36,5 @@ public class SpreadsheetView extends DocumentViewHelper super( orb, document, controller ); } - /** activates the sheet with the given index - */ - void activateSheet( int sheetIndex ) - { - try - { - // get the sheet to activate - XSpreadsheetDocument doc = UnoRuntime.queryInterface( - XSpreadsheetDocument.class, getDocument().getDocument() ); - XIndexAccess sheets = UnoRuntime.queryInterface( - XIndexAccess.class, doc.getSheets() ); - - XSpreadsheet sheet = UnoRuntime.queryInterface( - XSpreadsheet.class, sheets.getByIndex( sheetIndex ) ); - // activate - XSpreadsheetView view = UnoRuntime.queryInterface( - XSpreadsheetView.class, getController() ); - view.setActiveSheet( sheet ); - } - catch( com.sun.star.uno.Exception e ) - { - } - } } diff --git a/odk/examples/DevelopersGuide/Forms/UNO.java b/odk/examples/DevelopersGuide/Forms/UNO.java index f777c769cb88..cd292499edc2 100644 --- a/odk/examples/DevelopersGuide/Forms/UNO.java +++ b/odk/examples/DevelopersGuide/Forms/UNO.java @@ -73,10 +73,7 @@ public class UNO return UnoRuntime.queryInterface( XComponent.class, aObject ); } - public static XTablesSupplier queryTablesSupplier( Object aObject ) - { - return UnoRuntime.queryInterface( XTablesSupplier.class, aObject ); - } + /* replace Foo with the identifier of your choice. diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 27df9513b953..d332979d2559 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -205,37 +205,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - /** - * @param _sRegistryPath the path a registryNode - * @param _sImageName the name of the image - */ - public String getImageUrl(String _sRegistryPath, String _sImageName) { - String sImageUrl = ""; - try { - // retrieve the configuration node of the extension - XNameAccess xNameAccess = getRegistryKeyContent(_sRegistryPath); - if (xNameAccess != null){ - if (xNameAccess.hasByName(_sImageName)){ - // get the Image Url and process the Url by the macroexpander... - sImageUrl = (String) xNameAccess.getByName(_sImageName); - Object oMacroExpander = this.m_xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); - XMacroExpander xMacroExpander = UnoRuntime.queryInterface(XMacroExpander.class, oMacroExpander); - sImageUrl = xMacroExpander.expandMacros(sImageUrl); - sImageUrl = sImageUrl.substring(new String("vnd.sun.star.expand:").length(), sImageUrl.length()); - sImageUrl = sImageUrl.trim(); - sImageUrl += "/" + _sImageName; - } - } - } catch (Exception ex) { - /* perform individual exception handling here. - * Possible exception types are: - * com.sun.star.lang.IllegalArgumentException, - * com.sun.star.lang.WrappedTargetException, - */ - ex.printStackTrace(System.err); - } - return sImageUrl; - } + protected void createDialog(XMultiComponentFactory _xMCF) { try { @@ -266,16 +236,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis - public short executeDialogWithembeddedExampleSnippets() { - if (m_xWindowPeer == null){ - createWindowPeer(); - } - addRoadmap(); - insertRoadmapItem(0, true, "Introduction", 1); - insertRoadmapItem(1, true, "Documents", 2); - xDialog = UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); - return xDialog.execute(); - } + public short executeDialog() { @@ -329,17 +290,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - public void calculateDialogPosition(XWindow _xWindow) { - Rectangle aFramePosSize = m_xModel.getCurrentController().getFrame().getComponentWindow().getPosSize(); - Rectangle CurPosSize = _xWindow.getPosSize(); - int WindowHeight = aFramePosSize.Height; - int WindowWidth = aFramePosSize.Width; - int DialogWidth = CurPosSize.Width; - int DialogHeight = CurPosSize.Height; - int iXPos = ((WindowWidth / 2) - (DialogWidth / 2)); - int iYPos = ((WindowHeight / 2) - (DialogHeight / 2)); - _xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS); - } + @@ -352,23 +303,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return createWindowPeer(null); } - public void endExecute() { - xDialog.endExecute(); - } - public Object insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) { - try { - Object oControlModel = m_xMSFDialogModel.createInstance(ServiceName); - XMultiPropertySet xControlMultiPropertySet = UnoRuntime.queryInterface(XMultiPropertySet.class, oControlModel); - xControlMultiPropertySet.setPropertyValues(sProperties, sValues); - m_xDlgModelNameContainer.insertByName(sName, oControlModel); - return oControlModel; - } catch (com.sun.star.uno.Exception exception) { - exception.printStackTrace(System.err); - return null; - } - } + + private XFixedText insertFixedText(XMouseListener _xMouseListener, int _nPosX, int _nPosY, int _nWidth, int _nStep, String _sLabel){ @@ -1094,9 +1032,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return xFFModelPSet; } - public void convertUnits(){ - // iXPixelFactor = (int) (100000/xDevice.getInfo().PixelPerMeterX); - } + private XTextComponent insertFileControl(XTextListener _xTextListener, int _nPosX, int _nPosY, int _nWidth){ @@ -1184,17 +1120,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return xButton; } - /** gets the WindowPeer of a frame - * @param _xTextDocument the instance of a textdocument - * @return the windowpeer of the frame - */ - public XWindowPeer getWindowPeer(XTextDocument _xTextDocument){ - XModel xModel = UnoRuntime.queryInterface(XModel.class, _xTextDocument); - XFrame xFrame = xModel.getCurrentController().getFrame(); - XWindow xWindow = xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow); - return xWindowPeer; - } + public XFrame getCurrentFrame(){ XFrame xRetFrame = null; diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index dcedef25482c..5dbb0154484c 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -152,10 +152,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { return xTopWindow; } - public void addMenuBar(XWindow _xWindow){ - XTopWindow xTopWindow = UnoRuntime.queryInterface(XTopWindow.class, _xWindow); - addMenuBar(xTopWindow, this); - } + public void itemSelected(MenuEvent menuEvent){ // find out which menu item has been triggered, diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java index 44159959398d..7439b31fe898 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java @@ -490,50 +490,7 @@ public class FunctionHelper - /** - * Dispatch an URL to given frame. - * Caller can register himself for following result events for dispatched - * URL too. Notifications are guaranteed (instead of dispatch()) - * Returning of the dispatch object isn't necessary. - * Nobody must hold it alive longer the dispatch needs. - * - * @param xFrame frame which should be the target of this dispatch - * @param aURL full parsed and converted office URL for dispatch - * @param lProperties optional arguments for dispatch - * @param xListener optional listener which is registered automatically for status events - * (Note: Deregistration is not supported. Dispatcher does it automatically.) - */ - public static void executeWithNotification(com.sun.star.frame.XFrame xFrame , - com.sun.star.util.URL aURL , - com.sun.star.beans.PropertyValue[] lProperties, - com.sun.star.frame.XDispatchResultListener xListener ) - { - try - { - // Query the frame for right interface which provides access to all available dispatch objects. - com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface( - com.sun.star.frame.XDispatchProvider.class, - xFrame); - // Ask himn for right dispatch object for given URL. - // Force THIS frame as target for following dispatch. - // Attention: The interface XNotifyingDispatch is an optional one! - com.sun.star.frame.XDispatch xDispatcher = xProvider.queryDispatch(aURL,"",0); - com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = UnoRuntime.queryInterface( - com.sun.star.frame.XNotifyingDispatch.class, - xDispatcher); - - // Dispatch the URL. - if(xNotifyingDispatcher!=null) - xNotifyingDispatcher.dispatchWithNotification(aURL,lProperties,xListener); - } - catch(com.sun.star.uno.RuntimeException exUno) - { - // Any UNO method of this scope can throw this exception. - // But there is nothing we can do then. - exUno.printStackTrace(); - } - } @@ -782,78 +739,7 @@ public class FunctionHelper - /** - * Try to close the document without any saving of modifications. - * We can try it only! Controller and/or model of this document - * can disagree with that. But mostly they doesn't do so. - * - * @param xDocument document which should be clcosed - */ - public static void closeDocument(com.sun.star.lang.XComponent xDocument) - { - try - { - // Check supported functionality of the document (model or controller). - com.sun.star.frame.XModel xModel = - UnoRuntime.queryInterface( - com.sun.star.frame.XModel.class, xDocument); - if(xModel!=null) - { - // It's a full featured office document. - // Reset the modify state of it and close it. - // Note: Model can disgree by throwing a veto exception. - com.sun.star.util.XModifiable xModify = - UnoRuntime.queryInterface( - com.sun.star.util.XModifiable.class, xModel); - - xModify.setModified(false); - xDocument.dispose(); - } - else - { - // It's a document which supports a controller .. or may by a pure - // window only. If it's at least a controller - we can try to - // suspend him. But - he can disagree with that! - com.sun.star.frame.XController xController = - UnoRuntime.queryInterface( - com.sun.star.frame.XController.class, xDocument); - - if(xController!=null) - { - if(xController.suspend(true)==true) - { - // Note: Don't dispose the controller - destroy the frame - // to make it right! - com.sun.star.frame.XFrame xFrame = xController.getFrame(); - xFrame.dispose(); - } - } - } - } - catch(com.sun.star.beans.PropertyVetoException exVeto) - { - // Can be thrown by "setModified()" call on model. - // He disagree with our request. - // But there is nothing to do then. Following "dispose()" call wasn't - // never called (because we catch it before). Closing failed -that's it. - exVeto.printStackTrace(); - } - catch(com.sun.star.lang.DisposedException exDisposed) - { - // If an UNO object was already disposed before - he throw this special - // runtime exception. Of course every UNO call must be look for that - - // but it's a question of error handling. - // For demonstration this exception is handled here. - exDisposed.printStackTrace(); - } - catch(com.sun.star.uno.RuntimeException exRuntime) - { - // Every uno call can throw that. - // Do nothing - closing failed - that's it. - exRuntime.printStackTrace(); - } - } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java index d6e0563359ef..782a3d2d6d11 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java @@ -67,18 +67,7 @@ public class OfficeConnect - /** - * close connection to remote office if it exist - */ - public static synchronized void disconnect() - { - if(maConnection!=null) - { - mxServiceManager=null; - mxOfficeContext=null; - maConnection=null; - } - } + @@ -112,69 +101,7 @@ public class OfficeConnect - /** - * create uno components inside remote office process - * After connection of these process to a running office we have access to - * remote service manager of it. - * So we can use it to create all existing services. Use this method to create - * components by name and get her interface. Casting of it to right target - * interface is part of your implementation. - * - * @param aType describe class type of created service - * Returned object can be casted directly to this one. - * Uno query was done by this method automatically. - * @param sServiceSpecifier name of service which should be created - * @return the new created service object - */ - public static synchronized <T> T createRemoteInstance( - Class<T> aType, String sServiceSpecifier) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface(aType, - mxServiceManager.createInstanceWithContext( - sServiceSpecifier, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " - + sServiceSpecifier + ": " + ex); - System.exit(0); - } - return aResult; - } - - - /** - * same as "createRemoteInstance()" but supports additional parameter for - * initializing created object - * - * @param lArguments optional arguments - * They are used to initialize new created service. - * @param aType Description of Parameter - * @param sServiceSpecifier Description of Parameter - * @return the new create service object - */ - public static synchronized <T> T createRemoteInstanceWithArguments( - Class<T> aType, String sServiceSpecifier, Any[] lArguments) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface(aType, - mxServiceManager.createInstanceWithArgumentsAndContext( - sServiceSpecifier, lArguments, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " - + sServiceSpecifier + ": " + ex); - System.exit(0); - } - return aResult; - } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java index c1ab8438467b..45b2d04d04f7 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java @@ -72,10 +72,7 @@ public class PropChgHelper implements return xPropSet; } - public String[] GetPropNames() - { - return aPropNames; - } + public void LaunchEvent( LinguServiceEvent aEvt ) { diff --git a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java index faecbe5e6513..f49e6a1d314e 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java @@ -71,10 +71,7 @@ public class OfficeConnect - public static synchronized OfficeConnect getConnection() - { - return maConnection; - } + @@ -127,32 +124,7 @@ public class OfficeConnect - /** - * same as "createRemoteInstance()" but supports additional parameter for initializing created object - * - * @param lArguments optional arguments - * They are used to initialize new created service. - * @param aType Description of Parameter - * @param sServiceSpecifier Description of Parameter - * @return Description of the Returned Value - */ - public <T> T createRemoteInstanceWithArguments(Class<T> aType, String sServiceSpecifier, Any[] lArguments) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface( - aType, mxServiceManager.createInstanceWithArgumentsAndContext( - sServiceSpecifier, lArguments, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " + sServiceSpecifier + ": " + ex); - ex.printStackTrace(); - System.exit(0); - } - return aResult; - } + diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java index b0092d9d123f..a289359e51b6 100644 --- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java +++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java @@ -274,25 +274,9 @@ class ScriptSelectorPanel extends JPanel { add(textField, BorderLayout.SOUTH); } - public void removeNode(DefaultMutableTreeNode node) { - MutableTreeNode parent = (MutableTreeNode)(node.getParent()); - if (parent != null) { - treeModel.removeNodeFromParent(node); - } - } - public void addNode(DefaultMutableTreeNode parent, XBrowseNode xbn) { - DefaultMutableTreeNode newNode = - new DefaultMutableTreeNode(xbn) { - @Override - public String toString() { - return ((XBrowseNode)getUserObject()).getName(); - } - }; - treeModel.insertNodeInto(newNode, parent, parent.getChildCount()); - tree.scrollPathToVisible(new TreePath(newNode.getPath())); - } + private void initNodes(XBrowseNode parent, DefaultMutableTreeNode top) { if ( parent == null || parent.hasChildNodes() == false ) diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java index 109335f3cbea..513bfa1517d4 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java @@ -163,30 +163,9 @@ public class ExampleAddIn // XExampleAddIn - public int getIncremented( int nValue ) - { - return nValue + 1; - } - public com.sun.star.sheet.XVolatileResult getCounter(String aName) - { - if ( aResults == null ) - { - // create the table of results, and start a thread to increment - // all counters - aResults = new java.util.HashMap<String, ExampleAddInResult>(); - ExampleAddInThread aThread = new ExampleAddInThread( aResults ); - aThread.start(); - } - ExampleAddInResult aResult = aResults.get(aName); - if ( aResult == null ) - { - aResult = new ExampleAddInResult(aName); - aResults.put( aName, aResult ); - } - return aResult; - } + // XAddIn diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java index 7add3d723cd7..6fea28681b7b 100644 --- a/odk/examples/java/Inspector/HideableTreeModel.java +++ b/odk/examples/java/Inspector/HideableTreeModel.java @@ -84,9 +84,7 @@ public class HideableTreeModel implements TreeModel { } - public void reload() { - reload(getRoot()); - } + private void reload(Object node) { @@ -101,9 +99,7 @@ public class HideableTreeModel implements TreeModel { nodeChanged(path.getLastPathComponent()); } - public void nodeInserted(Object node, Object child) { - nodeInserted(node, child, -1); - } + public void nodeInserted(Object node, Object child, int index) { @@ -164,11 +160,7 @@ public class HideableTreeModel implements TreeModel { } - public ArrayList<TreePath> getExpandedPaths(JTree tree) { - ArrayList<TreePath> expandedPaths = new ArrayList<TreePath>(); - addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths); - return expandedPaths; - } + private void addExpandedPaths(JTree tree, TreePath path, ArrayList<TreePath> pathlist) { @@ -181,11 +173,7 @@ public class HideableTreeModel implements TreeModel { } - public void expandPaths(JTree tree, ArrayList<TreePath> pathlist) { - for(int i = 0; i < pathlist.size(); i++) { - tree.expandPath(pathlist.get(i)); - } - } + public boolean isLeaf(Object _oNode) { @@ -241,23 +229,10 @@ public class HideableTreeModel implements TreeModel { } - public boolean isPathToNodeVisible(Object node) { - Object[] path = getPathToRoot(node); - for(int i = 0; i < path.length; i++) { - if(!isNodeVisible(path[i])) { - return false; - } - } - return true; - } - public void ensurePathToNodeVisible(Object node) { - Object[] path = getPathToRoot(node); - for(int i = 0; i < path.length; i++) { - setNodeVisible(path[i], true); - } - } + + public Object getChild(Object parent, int index) { diff --git a/odk/examples/java/Inspector/Inspector.java b/odk/examples/java/Inspector/Inspector.java index a537d9c77941..e28ca5f8a624 100644 --- a/odk/examples/java/Inspector/Inspector.java +++ b/odk/examples/java/Inspector/Inspector.java @@ -441,17 +441,6 @@ public class Inspector{ return xFactory; } - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return (Factory.writeRegistryServiceInfo(_Inspector.class.getName(), _Inspector.getServiceNames(), regKey) - && InspectorAddon.__writeRegistryServiceInfo(regKey)); - } + } diff --git a/odk/examples/java/Inspector/Introspector.java b/odk/examples/java/Inspector/Introspector.java index e3cfc97e47d6..db4c40b2fecb 100644 --- a/odk/examples/java/Inspector/Introspector.java +++ b/odk/examples/java/Inspector/Introspector.java @@ -201,15 +201,7 @@ public class Introspector extends WeakBase{ }} - protected XIdlField[] getFieldsOfType(Type _aType){ - try{ - XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName()); - return xIdlClass.getFields(); - } - catch( Exception e ) { - System.err.println( e ); - return null; - }} + public boolean hasMethods(Object _oUnoObject){ @@ -552,12 +544,7 @@ public class Introspector extends WeakBase{ } - public static boolean isValid(Object _oObject){ - if (_oObject != null){ - return (!AnyConverter.isVoid(_oObject)); - } - return false; - } + public static boolean isArray(Object _oObject){ diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java index edd7c7eb8abb..de41566c6081 100644 --- a/odk/examples/java/Inspector/SourceCodeGenerator.java +++ b/odk/examples/java/Inspector/SourceCodeGenerator.java @@ -659,13 +659,7 @@ private class UnoObjectDefinition{ } - public boolean hasParameterObjects(){ - boolean breturn = false; - if (m_oParameterObjects != null){ - breturn = m_oParameterObjects.length > 0; - } - return breturn; - } + private String getVariableStemName(TypeClass _aTypeClass){ diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java index 0439554e0108..51e99324ccad 100644 --- a/odk/examples/java/Inspector/UnoNode.java +++ b/odk/examples/java/Inspector/UnoNode.java @@ -324,9 +324,7 @@ public class UnoNode{ } - public static String getNodeDescription(Object _oUnoObject, int _nIndex){ - return getNodeDescription(_oUnoObject) + "[" + (_nIndex + 1) + "]"; - } + public static String getNodeDescription(Object _oUnoObject){ diff --git a/odk/examples/java/Inspector/XDialogProvider.java b/odk/examples/java/Inspector/XDialogProvider.java index e8bfadc1873f..4bcc8e8baf1a 100644 --- a/odk/examples/java/Inspector/XDialogProvider.java +++ b/odk/examples/java/Inspector/XDialogProvider.java @@ -56,7 +56,7 @@ public interface XDialogProvider { public void selectSourceCodeLanguage(int _nLanguage); - public void paint(); + // returns one of the constants defined in XLanguageSourceCodeGenerator public int getLanguage(); diff --git a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java index 630f3d9626c1..6f5f9f46daae 100644 --- a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java +++ b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java @@ -67,7 +67,7 @@ public interface XLanguageSourceCodeGenerator { public String getshortTypeDescription(); - public String getunsignedshortTypeDescription(); + public String getlongTypeDescription(); @@ -85,11 +85,11 @@ public interface XLanguageSourceCodeGenerator { public String getstringTypeDescription(boolean _bAsHeaderSourceCode); - public String gettypeTypeDescription(boolean _bAsHeaderSourceCode); + public String getanyTypeDescription(boolean _bAsHeaderSourceCode); - public String getArrayDeclaration(String sVariableDeclaration); + public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean _bIsArray, TypeClass aTypeClass, boolean _bInitialize); diff --git a/odk/examples/java/Inspector/XTreePathProvider.java b/odk/examples/java/Inspector/XTreePathProvider.java index fc29af5eb8c2..37a51b18918d 100644 --- a/odk/examples/java/Inspector/XTreePathProvider.java +++ b/odk/examples/java/Inspector/XTreePathProvider.java @@ -26,5 +26,5 @@ public interface XTreePathProvider { public XTreePathProvider getParentPath(); - public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode); + } diff --git a/odk/examples/java/Spreadsheet/CalcAddins.java b/odk/examples/java/Spreadsheet/CalcAddins.java index b044eac50e2a..afe636e13611 100644 --- a/odk/examples/java/Spreadsheet/CalcAddins.java +++ b/odk/examples/java/Spreadsheet/CalcAddins.java @@ -90,23 +90,9 @@ public class CalcAddins { private static final short shortGETMYSECONDVALUE = 1; -/** TO DO: - * This is where you implement all methods of your interface. The parameters have to - * be the same as in your IDL file and their types have to be the correct - * IDL-to-Java mappings of their types in the IDL file. - */ - public int getMyFirstValue( - com.sun.star.beans.XPropertySet xOptions - ) { - return 1; - } - public int getMySecondValue( - com.sun.star.beans.XPropertySet xOptions, - int intDummy - ) { - return( 2 + intDummy ); - } + + // Implement method from interface XServiceName diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java index 74fad940051f..575ec0793f69 100644 --- a/qadevOOo/runner/complexlib/Assurance.java +++ b/qadevOOo/runner/complexlib/Assurance.java @@ -55,109 +55,27 @@ public class Assurance assure(msg, s, false); } - /** - * Assure that two boolean values are equal - * @param expected specifies the expected boolean value - * @param actual specifies the actual boolean value - */ - protected void assureEquals( boolean expected, boolean actual ) { - assureEquals( "Equality test failed", expected, new Boolean( actual ), false ); - } - /** - * Assure that two boolean values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected boolean value - * @param actual specifies the actual boolean value - */ - protected void assureEquals( String message, boolean expected, boolean actual ) { - assureEquals( message, expected, actual, false ); - } - /** - * Assure that two byte values are equal - * @param expected specifies the expected byte value - * @param actual specifies the actual byte value - */ - protected void assureEquals( byte expected, byte actual ) { - assureEquals( "Equality test failed", new Byte( expected ), new Byte( actual ), false ); - } - /** - * Assure that two byte values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected byte value - * @param actual specifies the actual byte value - */ - protected void assureEquals( String message, byte expected, byte actual ) { - assureEquals( message, new Byte( expected ), new Byte( actual ), false ); - } - /** - * Assure that two double values are equal - * @param expected specifies the expected double value - * @param actual specifies the actual double value - */ - protected void assureEquals( double expected, double actual ) { - assureEquals( "Equality test failed", new Double( expected ), new Double( actual ), false ); - } - /** - * Assure that two double values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected double value - * @param actual specifies the actual double value - */ - protected void assureEquals( String message, double expected, double actual ) { - assureEquals( message, new Double( expected ), new Double( actual ), false ); - } - /** - * Assure that two float values are equal - * @param expected specifies the expected float value - * @param actual specifies the actual float value - */ - protected void assureEquals( float expected, float actual ) { - assureEquals( "Equality test failed", new Float( expected ), new Float( actual ), false ); - } - /** - * Assure that two float values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected float value - * @param actual specifies the actual float value - */ - protected void assureEquals( String message, float expected, float actual ) { - assureEquals( message, new Float( expected ), new Float( actual ), false ); - } - /** - * Assure that two short values are equal - * @param expected specifies the expected short value - * @param actual specifies the actual short value - */ - protected void assureEquals( short expected, short actual ) { - assureEquals( "Equality test failed", new Short( expected ), new Short( actual ), false ); - } - /** - * Assure that two short values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected short value - * @param actual specifies the actual short value - */ - protected void assureEquals( String message, short expected, short actual ) { - assureEquals( message, new Short( expected ), new Short( actual ), false ); - } - /** - * Assure that two int values are equal - * @param expected specifies the expected int value - * @param actual specifies the actual int value - */ - protected void assureEquals( int expected, int actual ) { - assureEquals( "Equality test failed", new Integer( expected ), new Integer( actual ), false ); - } + + + + + + + + + + + /** * Assure that two int values are equal @@ -169,33 +87,11 @@ public class Assurance assureEquals( message, new Integer( expected ), new Integer( actual ), false ); } - /** - * Assure that two long values are equal - * @param expected specifies the expected long value - * @param actual specifies the actual long value - */ - protected void assureEquals( long expected, long actual ) { - assureEquals( "Equality test failed", new Long( expected ), new Long( actual ), false ); - } - /** - * Assure that two long values are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected long value - * @param actual specifies the actual long value - */ - protected void assureEquals( String message, long expected, long actual ) { - assureEquals( message, new Long( expected ), new Long( actual ), false ); - } - /** - * Assure that two string values are equal - * @param expected specifies the expected string value - * @param actual specifies the actual string value - */ - protected void assureEquals( String expected, String actual ) { - assureEquals( "Equality test failed", expected, actual, false ); - } + + + /** * Assure that two string values are equal @@ -207,24 +103,9 @@ public class Assurance assureEquals( message, expected, actual, false ); } - /** - * Assure that two object are equal - * @param expected specifies the expected object value - * @param actual specifies the actual object value - */ - protected void assureEquals( Object expected, Object actual ) { - assureEquals( "Equality test failed", expected, actual, false ); - } - /** - * Assure that two objects are equal - * @param message the message to print when the equality test fails - * @param expected specifies the expected object value - * @param actual specifies the actual object value - */ - protected void assureEquals( String message, Object expected, Object actual ) { - assureEquals( message, expected, actual, false ); - } + + /** * assures the two given sequences are of equal length, and have equal content @@ -239,13 +120,7 @@ public class Assurance } } - /** - * assures the two given sequences are of equal length, and have equal content - */ - public <T> void assureEquals( String i_message, T[] i_expected, T[] i_actual ) - { - assureEquals( i_message, i_expected, i_actual, false ); - } + /** 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 @@ -301,49 +176,11 @@ public class Assurance assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method. Those implicitly define - * the classes of the arguments of the method which is called. - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, - final Class<?> _expectedExceptionClass ) - { - assureException( - "did not catch the expected exception (" + - ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + - ") while calling " + _object.getClass().getName() + "." + _methodName, - _object, _methodName, _methodArgs, _expectedExceptionClass ); - } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param _object is the object to invoke the method on - * @param _methodName is the name of the method to invoke - * @param _methodArgs are the arguments to pass to the method - * @param _argClasses are the classes to assume for the arguments of the methods - * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - protected void assureException( final Object _object, final String _methodName, final Class<?>[] _argClasses, - final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) - { - assureException( - "did not catch the expected exception (" + - ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + - ") while calling " + _object.getClass().getName() + "." + _methodName, - _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); - } - /** - * Mark the currently executed method as failed. - * This function generates "Test did fail." as standard message. - */ - protected void failed() { - assure("Test did fail.", false, false); - } + + + /** * Mark the currently executed method as failed. diff --git a/qadevOOo/runner/convwatch/DBHelper.java b/qadevOOo/runner/convwatch/DBHelper.java index 12b2651613b0..e6381f027ccf 100644 --- a/qadevOOo/runner/convwatch/DBHelper.java +++ b/qadevOOo/runner/convwatch/DBHelper.java @@ -188,44 +188,7 @@ public class DBHelper aSQLThread.start(); } - public int QueryIntFromSQL(Connection _aCon, String _sSQL, String _sColumnName) - throws ValueNotFoundException - { - Statement oStmt = null; - int nValue = 0; - try - { - oStmt = _aCon.createStatement(); - - ResultSet oResult = oStmt.executeQuery(_sSQL); - oResult.next(); - try - { - if (_sColumnName.length() == 0) - { - // take the first row value (started with 1) - nValue = oResult.getInt(1); - } - else - { - nValue = oResult.getInt(_sColumnName); - } - } - catch (SQLException e) - { - String sError = e.getMessage(); - GlobalLogWriter.get().println("DB: Original SQL error: " + sError); - throw new ValueNotFoundException("Can't execute SQL: " + _sSQL); - } - } - catch(SQLException e) - { - String sError = e.getMessage(); - GlobalLogWriter.get().println("DB: Couldn't execute sql string " + _sSQL + "\n" + sError); - } - return nValue; - } public String Quote(String _sToQuote) { diff --git a/qadevOOo/runner/convwatch/DirectoryHelper.java b/qadevOOo/runner/convwatch/DirectoryHelper.java index ac0b94de12c7..ee338d3e09d5 100644 --- a/qadevOOo/runner/convwatch/DirectoryHelper.java +++ b/qadevOOo/runner/convwatch/DirectoryHelper.java @@ -71,13 +71,7 @@ public class DirectoryHelper return a.m_aFileList.toArray(); } - public static Object[] traverse( String _sDirectory, boolean _bRecursiveIsAllowed ) - { - DirectoryHelper a = new DirectoryHelper(); - a.setRecursiveIsAllowed(_bRecursiveIsAllowed); - a.traverse_impl(_sDirectory, null); - return a.m_aFileList.toArray(); - } + private void traverse_impl( String afileDirectory, FileFilter _aFileFilter ) { diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java index 221be5fa74be..3cf88eb267b4 100644 --- a/qadevOOo/runner/convwatch/FileHelper.java +++ b/qadevOOo/runner/convwatch/FileHelper.java @@ -39,12 +39,7 @@ public class FileHelper } - public static void MessageBox(String _sStr) - { - String sVersion = System.getProperty("java.version"); - String sOSName = System.getProperty("os.name"); - JOptionPane.showMessageDialog( null, _sStr, sVersion + " " + sOSName + " Hello World Debugger", JOptionPane.INFORMATION_MESSAGE ); - } + public static boolean exists(String _sFile) { diff --git a/qadevOOo/runner/convwatch/FilenameHelper.java b/qadevOOo/runner/convwatch/FilenameHelper.java index 9d2919fcaf95..bc64b148ee62 100644 --- a/qadevOOo/runner/convwatch/FilenameHelper.java +++ b/qadevOOo/runner/convwatch/FilenameHelper.java @@ -175,13 +175,7 @@ abstract class FilenameHelper_impl implements Filenamer return FileHelper.isDir(getSystemPath()); } - /** - * @return true, if the file really exist. - */ - public boolean exists() - { - return FileHelper.exists(createAbsoluteFilename()); - } + /** * @return the current suffix diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java index 0f8182b998c7..23e975815837 100644 --- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java +++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java @@ -191,16 +191,7 @@ public class GraphicalDifferenceCheck return bOk; } - /** - * Used for the comparance of graphical differences. - * Method compares one document (_sInputFile) with an older document of the same name in the provided directory (_sReferencePath). - * - * The path _sOutputPath must be writeable - */ - public static boolean checkOneFile(String _sInputFile, String _sOutputPath, String _sReferencePath, GraphicalTestArguments _aGTA) throws ConvWatchException - { - return checkOneFile( _sInputFile, _sOutputPath, _sReferencePath, null, _aGTA); - } + /** diff --git a/qadevOOo/runner/convwatch/HTMLOutputter.java b/qadevOOo/runner/convwatch/HTMLOutputter.java index 6425ec96816b..087101c97576 100644 --- a/qadevOOo/runner/convwatch/HTMLOutputter.java +++ b/qadevOOo/runner/convwatch/HTMLOutputter.java @@ -206,168 +206,13 @@ public class HTMLOutputter private final static String DIFFER_BM_TABLETITLE = "Diff file (RB)"; private final static String OK_TABLETITLE = "OK?"; - public void checkSection(String _sDocumentName) - { - try - { - m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls); - m_aOut.write( "<p>Legend:<br>"); - m_aOut.write( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<br>"); - m_aOut.write( stronghtml(SECONDGFX_TABLETITLE) + " contains the same document opened within OpenOffice.org also printed via ghostscript as jpeg.<br>"); - m_aOut.write( stronghtml(DIFFER_TABLETITLE)+" is build via composite from original and new picture. The result should be a whole black picture, if there are no differences.<br>At the moment "+stronghtml(STATUS_TABLETITLE)+" is only ok, if the difference file contains only one color (black).</p>" ); - m_aOut.write( stronghtml(DIFFER_BM_TABLETITLE) + " is build via composite from original and new picture after the border of both pictures are removed, so differences based on center problems may solved here"); - m_aOut.write( "</p>"); - m_aOut.write( "<p>Some words about the percentage value<br>"); - m_aOut.write( "If a character is on the original page (a) and on the new page this character is moved to an other position only (b) , this means the difference is 100%.<br>"); - m_aOut.write( "If character (b) is also bigger than character (a) the percentage is grow over the 100% mark.<br>"); - m_aOut.write( "This tool count only the pixels which are differ to it's background color. It makes no sense to count all pixels, or the difference percentage will most the time in a very low percentage range."); - m_aOut.write( "</p>"); - m_aOut.write( "<table class=\"infotable\">" + ls); - m_aOut.write( "<TR>" + ls); - m_aOut.write( tableHeaderCell( FIRSTGFX_TABLETITLE) ); - m_aOut.write( tableHeaderCell( SECONDGFX_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(DIFFER_BM_TABLETITLE) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_BM_TABLETITLE ) ); - m_aOut.write( tableHeaderCell( OK_TABLETITLE) ); - m_aOut.write( "</TR>" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } - } - - public void checkLine(StatusHelper _aStatus, boolean _bCurrentResult) - { - try - { - m_aOut.write( "<TR>" + ls); - String sLink = getHREF(FileHelper.getBasename(_aStatus.m_sOldGfx), FileHelper.getBasename(_aStatus.m_sOldGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx)); - m_aOut.write( tableDataCell(sLink) ); - String sPercent = String.valueOf(_aStatus.nPercent) + "%"; - if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5) - { - sPercent += " (less 5% is ok)"; - } - m_aOut.write(tableDataCell( sPercent ) ); - - if (_aStatus.m_sDiff_BM_Gfx == null) - { - sLink = "No diffs, therefore no moves"; - m_aOut.write( tableDataCell(sLink) ); - m_aOut.write(tableDataCell( "" ) ); - } - else - { - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx), FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx)); - m_aOut.write( tableDataCell(sLink) ); - - String sPercent2 = String.valueOf(_aStatus.nPercent2) + "%"; - if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5) - { - sPercent2 += " (less 5% is ok)"; - } - m_aOut.write(tableDataCell( sPercent2 ) ); - } - - // is the check positiv, in a defined range - if (_bCurrentResult) - { - m_aOut.write(tableDataCell( "YES" ) ); - } - else - { - m_aOut.write(tableDataCell( "NO" ) ); - } - - m_aOut.write( "</TR>" + ls); - } - catch (java.io.IOException e) - { - } - } - public void checkDiffDiffSection(String _sDocumentName) - { - try - { - m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls); - - m_aOut.write( "<p>Legend:<br>"); - m_aOut.write( "</p>"); - - m_aOut.write( "<table class=\"infotable\">" + ls); - - m_aOut.write( "<TR>" + ls); - m_aOut.write( tableHeaderCell( "Source to actual difference" ) ); - m_aOut.write( tableHeaderCell( "Actual difference" ) ); - m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) ); - m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) ); - - m_aOut.write( tableHeaderCell( OK_TABLETITLE) ); - - m_aOut.write( "</TR>" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } - } - - public void checkDiffDiffLine(StatusHelper _aStatus, boolean _bCurrentResult) - { - try - { - m_aOut.write( "<TR>" + ls); - // the link to the old difference can't offer here - - String sBasename = FileHelper.getBasename(m_sFilename); - String sNew = sBasename.substring(m_sNamePrefix.length()); - - String sLink; - sLink = getHREF(sNew, sNew); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx)); - m_aOut.write( tableDataCell(sLink) ); - - sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx)); - m_aOut.write( tableDataCell(sLink) ); - - String sPercent = String.valueOf(_aStatus.nPercent) + "%"; - m_aOut.write(tableDataCell( sPercent ) ); - - // is the check positiv, in a defined range - if (_bCurrentResult) - { - m_aOut.write(tableDataCell( "YES" ) ); - } - else - { - m_aOut.write(tableDataCell( "NO" ) ); - } - - m_aOut.write( "</TR>" + ls); - } - catch (java.io.IOException e) - { - } - } - } diff --git a/qadevOOo/runner/convwatch/INIOutputter.java b/qadevOOo/runner/convwatch/INIOutputter.java index 673b8789be46..3c9745fbe198 100644 --- a/qadevOOo/runner/convwatch/INIOutputter.java +++ b/qadevOOo/runner/convwatch/INIOutputter.java @@ -98,10 +98,7 @@ public class INIOutputter } } - public void startSection(int _nNumber) - { - writeSection( "page" + String.valueOf(_nNumber)); - } + public void close() { diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 1b3f46942dc5..dc3b55a50774 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -267,91 +267,10 @@ class IniFile return sValue; } - /** - write back the ini file to the disk, only if there exist changes - */ - public void store() - { - if (m_bListContainUnsavedChanges == false) - { - // nothing has changed, so no need to store - return; - } - File aFile = new File(m_sFilename); - if (aFile.exists()) - { - aFile.delete(); - if (aFile.exists()) - { - GlobalLogWriter.get().println("Couldn't delete the file " + m_sFilename); - return; - } - } - try - { - RandomAccessFile aWriter = new RandomAccessFile(aFile, "rw"); - for (int i=0; i<m_aList.size();i++) - { - String sLine = getItem(i); - aWriter.writeBytes(sLine); - aWriter.writeByte('\n'); - } - aWriter.close(); - } - catch (java.io.FileNotFoundException fne) - { - GlobalLogWriter.get().println("couldn't open file for writing " + m_sFilename); - GlobalLogWriter.get().println("Message: " + fne.getMessage()); - } - catch(java.io.IOException ie) - { - GlobalLogWriter.get().println("Exception occurs while writing to file " + m_sFilename); - GlobalLogWriter.get().println("Message: " + ie.getMessage()); - } - } - /** - insert a value - there are 3 cases - 1. section doesn't exist, goto end and insert a new section, insert a new key value pair - 2. section exist but key not, search section, search key, if key is -1 get last known key position and insert new key value pair there - 3. section exist and key exist, remove the old key and insert the key value pair at the same position - */ - public void insertValue(String _sSection, String _sKey, String _sValue) - { - int i = findSection(_sSection); - if (i == -1) - { - // case 1: section doesn't exist - String sFindSection = buildSectionName(_sSection); - - m_aList.add(sFindSection); - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.add(sKeyValuePair); - m_bListContainUnsavedChanges = true; - return; - } - int j = findKeyFromKnownSection(i, _sKey); - if (j == -1) - { - // case 2: section exist, but not the key - j = findLastKnownKeyIndex(i, _sKey); - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.add(j, sKeyValuePair); - m_bListContainUnsavedChanges = true; - return; - } - else - { - // case 3: section exist, and also the key - String sKeyValuePair = _sKey + "=" + _sValue; - m_aList.set(j, sKeyValuePair); - m_bListContainUnsavedChanges = true; - } - } } diff --git a/qadevOOo/runner/convwatch/LISTOutputter.java b/qadevOOo/runner/convwatch/LISTOutputter.java index 3053953f1f3c..175b32d3b2a6 100644 --- a/qadevOOo/runner/convwatch/LISTOutputter.java +++ b/qadevOOo/runner/convwatch/LISTOutputter.java @@ -56,17 +56,7 @@ public class LISTOutputter } public String getFilename() {return m_sFilename;} - public void createHeader() - { - try - { - m_aOut.write("# This file is automatically created by a convwatch run" + ls); - m_aOut.write("# " + ls); - } - catch (java.io.IOException e) - { - } - } + public void writeValue(String _sValue) { diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java index 376d0a6edbe7..83da79d511d6 100644 --- a/qadevOOo/runner/convwatch/OfficePrint.java +++ b/qadevOOo/runner/convwatch/OfficePrint.java @@ -787,35 +787,7 @@ public class OfficePrint { // TODO: move this away! - static void showType(String _sInputURL, XMultiServiceFactory _xMSF) - { - if (_sInputURL.length() == 0) - { - return; - } - if (_xMSF == null) - { - GlobalLogWriter.get().println("MultiServiceFactory not set."); - return; - } - XTypeDetection aTypeDetection = null; - try - { - Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection"); - aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.get().println("Can't get com.sun.star.document.TypeDetection."); - return; - } - if (aTypeDetection != null) - { - String sType = aTypeDetection.queryTypeByURL(_sInputURL); - GlobalLogWriter.get().println("Type is: " + sType); - } - } diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java index e7aea95609dc..dc9b9eb2344f 100644 --- a/qadevOOo/runner/convwatch/PRNCompare.java +++ b/qadevOOo/runner/convwatch/PRNCompare.java @@ -39,18 +39,6 @@ public class PRNCompare fs = System.getProperty("file.separator"); } - String executeSynchronously(String _sCommand) - { - ProcessHandler aHandler = new ProcessHandler(_sCommand); - aHandler.executeSynchronously(); - - String sText = aHandler.getOutputText(); - - GlobalLogWriter.get().println("Exitcode: " + String.valueOf(aHandler.getExitCode())); - return sText; - } - - private int getMaxNumOfFileEntry(String _sDirectory, String _sBasename) { // TODO: check if directory exist should be done earlier @@ -140,18 +128,7 @@ public class PRNCompare return aList; } - public StatusHelper[] compare_new() - { - String[] aRefList = createJPEGFromPostscript(m_sOutputPath, m_sReferencePath, m_sReferenceFile, getResolutionInDPI()); -// TODO: Assume, that Postscript is already in the OutputPath, this may change. - String[] aPSList = createJPEGFromPostscript(m_sOutputPath, m_sOutputPath, m_sPostScriptFile, getResolutionInDPI()); - StatusHelper[] aList = createDiffs(aRefList, - aPSList, - getMaxPages(), - m_tUseBorderMove); - return aList; - } private static String getJPEGName(String _sOutputPath, String _sBasename, String _sGS_PageOutput) { diff --git a/qadevOOo/runner/convwatch/PixelCounter.java b/qadevOOo/runner/convwatch/PixelCounter.java index 29c244d57465..240e973e3282 100644 --- a/qadevOOo/runner/convwatch/PixelCounter.java +++ b/qadevOOo/runner/convwatch/PixelCounter.java @@ -75,23 +75,7 @@ class CountNotBlack extends CountPixel class graphics_stuff { - public int stuff() - { -// (1) decoding - int rgba = 0; // ...; // comes from PixelGrabber, BufferedImage.getRGB etc. - int red = (rgba >> 16) & 0xff; - int green = (rgba >> 8) & 0xff; - int blue = rgba & 0xff; - int alpha = (rgba >> 24) & 0xff; -// (2) now modify red, green, blue and alpha as you like; -// make sure that each of the four values stays in the -// interval 0 to 255 -// ... -// (3) and encode back to an int, e.g. to give it to MemoryImageSource or -// BufferedImage.setRGB - rgba = (alpha << 24) | (red << 16) | (green << 8) | blue; - return 0; - } + private static void countPixel(ImageHelper img, int _w, int _h, CountPixel _aPixelCounter) { diff --git a/qadevOOo/runner/graphical/BuildID.java b/qadevOOo/runner/graphical/BuildID.java index 2a83aa9ce2c3..1e08fb8c20bc 100644 --- a/qadevOOo/runner/graphical/BuildID.java +++ b/qadevOOo/runner/graphical/BuildID.java @@ -139,25 +139,8 @@ public class BuildID return sBuildID; } - public static String getMinor(String _sOfficePath) - { - final String sOfficePath = getOfficePath(_sOfficePath); - final String sMinor = "m" + getBuildID(sOfficePath, "ProductMinor"); - return sMinor; - } - public static String getCWSName(String _sOfficePath) - { - final String sOfficePath = getOfficePath(_sOfficePath); - final String sBuildID = getBuildID(sOfficePath, "buildid"); - String sCWSName = "MWS"; - int nIdx = sBuildID.indexOf("[CWS:"); - if (nIdx > 0) - { - int nIdx2 = sBuildID.indexOf("]", nIdx); - sCWSName = sBuildID.substring(nIdx + 5, nIdx2); - } - return sCWSName; - } + + } diff --git a/qadevOOo/runner/graphical/DirectoryHelper.java b/qadevOOo/runner/graphical/DirectoryHelper.java index a52add895a0b..2acb91154ae8 100644 --- a/qadevOOo/runner/graphical/DirectoryHelper.java +++ b/qadevOOo/runner/graphical/DirectoryHelper.java @@ -72,13 +72,7 @@ public class DirectoryHelper return a.m_aFileList.toArray(); } - public static Object[] traverse( String _sDirectory, boolean _bRecursiveIsAllowed ) - { - DirectoryHelper a = new DirectoryHelper(); - a.setRecursiveIsAllowed(_bRecursiveIsAllowed); - a.traverse_impl(_sDirectory, null); - return a.m_aFileList.toArray(); - } + private void traverse_impl( String afileDirectory, FileFilter _aFileFilter ) { diff --git a/qadevOOo/runner/graphical/FileHelper.java b/qadevOOo/runner/graphical/FileHelper.java index bee04eb64622..440e6273743a 100644 --- a/qadevOOo/runner/graphical/FileHelper.java +++ b/qadevOOo/runner/graphical/FileHelper.java @@ -44,12 +44,7 @@ public class FileHelper } - public static void MessageBox(String _sStr) - { - String sVersion = System.getProperty("java.version"); - String sOSName = System.getProperty("os.name"); - JOptionPane.showMessageDialog( null, _sStr, sVersion + " " + sOSName + " Hello World Debugger", JOptionPane.INFORMATION_MESSAGE ); - } + public static boolean exists(String _sFile) { @@ -66,27 +61,7 @@ public class FileHelper return false; } - public static boolean isDir(String _sDir) - { - if (_sDir == null) - { - return false; - } - try - { - File aFile = new File(_sDir); - if (aFile.exists() && aFile.isDirectory()) - { - return true; - } - } - catch (NullPointerException e) - { - GlobalLogWriter.println("Exception caught. FileHelper.isDir('" + _sDir + "')"); - e.printStackTrace(); - } - return false; - } + public static String getBasename(String _sFilename) { @@ -456,33 +431,7 @@ public class FileHelper }; return aFileFilter; } - /** - * Within the directory run through, it's possible to say which file extension types should not - * consider like '*.ini' because it's not a document. - * - * @return a FileFilter function - */ - public static FileFilter getFileFilterINI() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - String sPathname = pathname.getName().toLowerCase(); - if (sPathname.endsWith("index.ini")) - { - // don't consider the index.ini file - return false; - } - if (sPathname.endsWith(".ini")) - { - return true; - } - return false; - } - }; - return aFileFilter; - } + public static String appendPath(String _sPath, String _sRelativePathToAdd) { @@ -616,12 +565,6 @@ public class FileHelper aIniFile.close(); } - public static void addBasenameToPostscript(String _sOutputFilename) - { - String sIndexFilename = FileHelper.appendPath(_sOutputFilename, "postscript.ini"); - String sBasename = FileHelper.getBasename(_sOutputFilename); - addBasenameToFile(sIndexFilename, sBasename, "", "", ""); - } public static void addBasenameToIndex(String _sOutputFilename, String _sBasename, String _sCreator, String _sType, String _sSource) { String sIndexFilename = FileHelper.appendPath(_sOutputFilename, "index.ini"); diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java index b2508b173c38..326365adb832 100644 --- a/qadevOOo/runner/graphical/IniFile.java +++ b/qadevOOo/runner/graphical/IniFile.java @@ -409,10 +409,7 @@ public class IniFile implements Enumeration<String> insertValue(_sSection, _sKey, String.valueOf(_nValue)); } - public void insertValue(String _sSection, String _sKey, long _nValue) - { - insertValue(_sSection, _sKey, String.valueOf(_nValue)); - } + /** insert a value diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java index 6d9c5c698d37..c33b09632850 100644 --- a/qadevOOo/runner/graphical/JPEGCreator.java +++ b/qadevOOo/runner/graphical/JPEGCreator.java @@ -31,17 +31,7 @@ public class JPEGCreator extends EnhancedComplexTestCase return new String[]{"PostscriptOrPDFToJPEG"}; } - /** - * test function. - */ - public void PostscriptOrPDFToJPEG() - { - GlobalLogWriter.set(log); - ParameterHelper aParam = new ParameterHelper(param); - // run through all documents found in Inputpath - foreachPSorPDFinInputPath(aParam); - } public void checkOneFile(String _sDocumentName, String _sResult, ParameterHelper _aParams) throws OfficeException diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index 2132297f893d..13db6222dbee 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -162,57 +162,7 @@ public class MSOfficePostscriptCreator implements IOffice return false; } - public void storeToFileWithMSOffice( ParameterHelper _aGTA, - String _sInputFile, - String _sOutputFile) throws OfficeException, java.io.IOException - { - String sDocumentSuffix = FileHelper.getSuffix(_sInputFile); - String sFilterName = _aGTA.getExportFilterName(); - ArrayList<String> aStartCommand = new ArrayList<String>(); - if (isWordDocument(sDocumentSuffix)) - { - aStartCommand = createWordStoreHelper(); - } - else if (isExcelDocument(sDocumentSuffix)) - { - aStartCommand = createExcelStoreHelper(); - } - else if (isPowerPointDocument(sDocumentSuffix)) - { - } - else if (sDocumentSuffix.toLowerCase().equals(".xml")) - { - // special case, if xml we prefer word, but with DEFAULT_XML_FORMAT_APP=excel it's changeable. - String sDocFormat = getXMLDocumentFormat(_sInputFile); - if (sDocFormat.equals("excel")) - { - aStartCommand = createExcelStoreHelper(); - } - else - { - aStartCommand = createWordStoreHelper(); - } - } - else - { - GlobalLogWriter.println("No Microsoft Office document format found."); - throw new WrongSuffixException("No MS office document format found."); - } - if (aStartCommand != null) - { - if (sFilterName == null) - { -// TODO: hardcoded FilterName in perl script - sFilterName = ""; // xlXMLSpreadsheet"; - } - - aStartCommand.add(_sInputFile); - aStartCommand.add(sFilterName); - aStartCommand.add(_sOutputFile); - realStartCommand(aStartCommand); - } - } /** diff --git a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java index 4408b527a1f6..126c3b78b20a 100644 --- a/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/OpenOfficePostscriptCreator.java @@ -576,74 +576,12 @@ public class OpenOfficePostscriptCreator implements IOffice } - /** - * @return true, if the reference (*.prrn file) based on given output path and given input path exist. - * If OVERWRITE_REFERENCE is set, always return false. - */ - public boolean isReferenceExists(ParameterHelper _aGTA, - String _sAbsoluteOutputPath, - String _sAbsoluteInputFile) - { - if (! FileHelper.exists(_sAbsoluteInputFile)) - { - return false; - } - String sInputFileBasename = FileHelper.getBasename(_sAbsoluteInputFile); - String sOutputPath; - if (_sAbsoluteOutputPath != null) - { - sOutputPath = _sAbsoluteOutputPath; - } - else - { - String sInputPath = FileHelper.getPath(_sAbsoluteInputFile); - sOutputPath = sInputPath; - } - - String sPrintFilename = FileHelper.getNameNoSuffix(sInputFileBasename); - - String sAbsolutePrintFilename = FileHelper.appendPath(sOutputPath, sPrintFilename + ".prn"); - if (FileHelper.exists(sAbsolutePrintFilename) && _aGTA.getOverwrite() == false) - { - GlobalLogWriter.println("Reference already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite."); - return true; - } - return false; - } // TODO: move this away! - void showType(String _sInputURL, XMultiServiceFactory _xMSF) - { - if (_sInputURL.length() == 0) - { - return; - } - if (_xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory not set."); - return; - } - XTypeDetection aTypeDetection = null; - try - { - Object oObj = _xMSF.createInstance("com.sun.star.document.TypeDetection"); - aTypeDetection = UnoRuntime.queryInterface(XTypeDetection.class, oObj); - } - catch(com.sun.star.uno.Exception e) - { - GlobalLogWriter.println("Can't get com.sun.star.document.TypeDetection."); - return; - } - if (aTypeDetection != null) - { - String sType = aTypeDetection.queryTypeByURL(_sInputURL); - GlobalLogWriter.println("Type is: " + sType); - } - } @@ -875,133 +813,7 @@ public class OpenOfficePostscriptCreator implements IOffice } - public void convertDocument(String _sInputFile, String _sOutputPath, ParameterHelper _aGTA) - { - XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory(); - if (xMSF == null) - { - GlobalLogWriter.println("MultiServiceFactory in GraphicalTestArgument not set."); - return; - } - - String sInputURL = URLHelper.getFileURLFromSystemPath(_sInputFile); - XComponent aDoc = loadFromURL( _aGTA, sInputURL); - if (aDoc == null) - { - GlobalLogWriter.println("Can't load document '"+ sInputURL + "'"); - return; - } - - if (_sOutputPath == null) - { - GlobalLogWriter.println("Outputpath not set."); - return; - } - - if (! isStoreAllowed()) - { - GlobalLogWriter.println("It's not allowed to store, check Input/Output path."); - return; - } - - XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, aDoc ); - - // store the document in an other directory - XStorable xStorable = UnoRuntime.queryInterface( XStorable.class, aDoc); - if (xStorable == null) - { - GlobalLogWriter.println("com.sun.star.frame.XStorable is null"); - return; - } - String sFilterName = _aGTA.getExportFilterName(); - - ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); - - String sExtension = ""; - - if (sFilterName != null && sFilterName.length() > 0) - { - String sInternalFilterName = getInternalFilterName(sFilterName, xMSF); - String sServiceName = getServiceNameFromFilterName(sFilterName, xMSF); - - GlobalLogWriter.println("Filter detection:"); - // check if service name from file filter is the same as from the loaded document - boolean bServiceFailed = false; - if (sServiceName == null || sInternalFilterName == null) - { - GlobalLogWriter.println("Given FilterName '" + sFilterName + "' seems to be unknown."); - bServiceFailed = true; - } - if (! xServiceInfo.supportsService(sServiceName)) - { - GlobalLogWriter.println("Service from FilterName '" + sServiceName + "' is not supported by loaded document."); - bServiceFailed = true; - } - if (bServiceFailed == true) - { - GlobalLogWriter.println("Please check '" + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + "' in the property file."); - return; - } - - if (sInternalFilterName != null && sInternalFilterName.length() > 0) - { - // get the FileExtension, by the filter name, if we don't get a file extension - // we assume the is also no right filter name. - sExtension = getFileExtension(sInternalFilterName, xMSF); - if (sExtension == null) - { - GlobalLogWriter.println("Can't found an extension for filtername, take it from the source."); - } - } - - PropertyValue Arg = new PropertyValue(); - Arg.Name = "FilterName"; - Arg.Value = sFilterName; - aPropertyList.add(Arg); - showProperty(Arg); - GlobalLogWriter.println("FilterName is set to: " + sFilterName); - } - - String sOutputURL = ""; - try - { - // create the new filename with the extension, which is ok to the file format - String sInputFileBasename = FileHelper.getBasename(_sInputFile); - String sInputFileNameNoSuffix = FileHelper.getNameNoSuffix(sInputFileBasename); - String fs = System.getProperty("file.separator"); - String sOutputFile = _sOutputPath; - if (! sOutputFile.endsWith(fs)) - { - sOutputFile += fs; - } - if (sExtension != null && sExtension.length() > 0) - { - sOutputFile += sInputFileNameNoSuffix + "." + sExtension; - } - else - { - sOutputFile += sInputFileBasename; - } - - if (FileHelper.exists(sOutputFile) && _aGTA.getOverwrite() == false) - { - GlobalLogWriter.println("File already exist, don't overwrite. Set " + PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE + "=true to force overwrite."); - return; - } - - sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputFile); - - GlobalLogWriter.println("Store document as '" + sOutputURL + "'"); - xStorable.storeAsURL(sOutputURL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList)); - GlobalLogWriter.println("Document stored."); - } - catch (com.sun.star.io.IOException e) - { - GlobalLogWriter.println("Can't store document '" + sOutputURL + "'. Message is :'" + e.getMessage() + "'"); - } - - } private OfficeProvider m_aProvider = null; private void startOffice() @@ -1041,12 +853,8 @@ public class OpenOfficePostscriptCreator implements IOffice } } - public void disallowStore() - { - } - public void allowStore() - { - } + + public boolean isStoreAllowed() { return false; diff --git a/qadevOOo/runner/graphical/PixelCounter.java b/qadevOOo/runner/graphical/PixelCounter.java index 0807b26cbdeb..b0b9e41d7e66 100644 --- a/qadevOOo/runner/graphical/PixelCounter.java +++ b/qadevOOo/runner/graphical/PixelCounter.java @@ -34,19 +34,7 @@ class CountNotWhite extends CountPixel { } - public void countold(final int pixel) - { - // final int alpha = (pixel >> 24) & 0xff; - final int red = (pixel >> 16) & 0xff; - final int green = (pixel >> 8) & 0xff; - final int blue = (pixel ) & 0xff; - if (red == 0xff && green == 0xff && blue == 0xff) - { - return; - } - ++m_nCount; - } @Override public void count(final int pixel) { @@ -79,19 +67,7 @@ class CountNotBlack extends CountPixel { } - public void countold(final int pixel) - { - // final int alpha = (pixel >> 24) & 0xff; - final int red = (pixel >> 16) & 0xff; - final int green = (pixel >> 8) & 0xff; - final int blue = (pixel ) & 0xff; - if (red == 0x00 && green == 0x00 && blue == 0x00) - { - return; - } - ++m_nCount; - } @Override public void count(final int pixel) { diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java index 3d62291baa00..f6029bc0e8a0 100644 --- a/qadevOOo/runner/helper/ConfigHelper.java +++ b/qadevOOo/runner/helper/ConfigHelper.java @@ -181,28 +181,10 @@ public class ConfigHelper } - public static Object readDirectKey(XMultiServiceFactory xSMGR , - String sConfigFile, - String sRelPath , - String sKey ) - throws com.sun.star.uno.Exception - { - ConfigHelper aConfig = new ConfigHelper(xSMGR, sConfigFile, true); - return aConfig.readRelativeKey(sRelPath, sKey); - } - public static void writeDirectKey(XMultiServiceFactory xSMGR , - String sConfigFile, - String sRelPath , - String sKey , - Object aValue ) - throws com.sun.star.uno.Exception - { - ConfigHelper aConfig = new ConfigHelper(xSMGR, sConfigFile, false); - aConfig.writeRelativeKey(sRelPath, sKey, aValue); - aConfig.flush(); - } + + /** diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java index bde788a5e687..e698d47104f3 100644 --- a/qadevOOo/runner/helper/ConfigurationRead.java +++ b/qadevOOo/runner/helper/ConfigurationRead.java @@ -71,14 +71,7 @@ public class ConfigurationRead { this(xMSF, "org.openoffice.Setup"); } - /** - * Does the node with this hierarchical name exist? - * @param name The hierarchical name of a subnode. - * @return True, if the node exists. - */ - public boolean hasByHieracrhicalName(String name) { - return root.hasByHierarchicalName(name); - } + /** @@ -91,28 +84,7 @@ public class ConfigurationRead { return names; } - /** - * Get all elements of this node - * @param name The name of the node - * @return All elements of this node (as hierarchical names). - */ - public String[] getSubNodeNames(String name) { - String[]names = null; - try { - Object next = root.getByHierarchicalName(name); - XNameAccess x = UnoRuntime.queryInterface( - XNameAccess.class, next); - names = x.getElementNames(); - for (int i=0; i< names.length; i++) { - names[i] = name + "/" + names[i]; - } - } - catch(Exception e) { - //just return null, if there are no further nodes - } - return names; - } /** * Get contents of a node by its hierarchical name. diff --git a/qadevOOo/runner/helper/FileTools.java b/qadevOOo/runner/helper/FileTools.java index 8a859183ebf6..cede7c46059d 100644 --- a/qadevOOo/runner/helper/FileTools.java +++ b/qadevOOo/runner/helper/FileTools.java @@ -92,19 +92,7 @@ public class FileTools { in.close(); out.close(); } - /** - * Deletes all files and subdirectories under dir and the directory itself. - * Returns true if all deletions were successful. - * If the deletion fails, the method the method continues to delete rest - * of the files and returns false. - * @return Returns true if all deletions were successful, else false. - * @param dir the directory to delete - */ - public static boolean deleteDir(File dir) { - // The directory is now empty so delete it - return cleanDir(dir); - } public static boolean cleanDir(File dir) { diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java index 43372d224b67..35b32999cb4a 100644 --- a/qadevOOo/runner/helper/ProcessHandler.java +++ b/qadevOOo/runner/helper/ProcessHandler.java @@ -576,18 +576,7 @@ public class ProcessHandler flushInput(); } - /** - * This method is useful when the process was executed - * asynchronously. Waits for process to exit and return - * its result. - * - * @return <code>true</code> if process correctly exited - * (exit code doesn't affect to this result). - */ - public boolean waitFor() - { - return waitFor(0); - } + /** * This method is useful when the process was executed @@ -737,20 +726,7 @@ public class ProcessHandler } } - /** - * Prints the string specified to sdtin of external - * command. '\n' is not added so if you need you - * should terminate the string with '\n'. <p> - * - * The method can also be called before the command - * starts its execution. Then the text is buffered - * and transferred to command when it will be started. - */ - public void printInputText(String str) - { - stdInBuff += str; - flushInput(); - } + /** * Returns information about was the command started or @@ -940,15 +916,5 @@ public class ProcessHandler } } - /** - * to stop the extra thread, before he will kill a running office. This will stop the thread. - */ - public void stopWatcher() - { - if (m_aWatcher != null) - { - m_aWatcher.holdOn(); - shortWait(5000); - } - } + } diff --git a/qadevOOo/runner/helper/StringHelper.java b/qadevOOo/runner/helper/StringHelper.java index 3ed630030e76..6308a0a2eacb 100644 --- a/qadevOOo/runner/helper/StringHelper.java +++ b/qadevOOo/runner/helper/StringHelper.java @@ -71,25 +71,7 @@ public class StringHelper return sNewPath; } - public static String doubleQuoteIfNeed(String _sStr) - { - if (_sStr.startsWith("\"") && _sStr.endsWith("\"")) - { - // don't quote twice - return _sStr; - } - if (_sStr.indexOf(" ") == -1) - { - // don't quote, if there is no space in name - return _sStr; - } - if (_sStr.indexOf("%") != -1) - { - return singleQuote(_sStr); - } - return doubleQuote(_sStr); - } /** * Convert a value to a string with a given length, if the len is greater the len of the value string representation diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java index c869f1a1d48b..ebf59b01e0eb 100644 --- a/qadevOOo/runner/helper/URLHelper.java +++ b/qadevOOo/runner/helper/URLHelper.java @@ -144,84 +144,11 @@ public class URLHelper - /** - * The same as getURLWithProtocolFromSystemPath() before but uses string parameter instead - * of a File types. It exist to supress converting of necessary parameters in the - * outside code. But of course getURLWithProtocolFromSystemPath(File,File,String) will be - * a little bit faster then this method ... - * - * @param sSystemPath - * represent the file in system notation - * - * @param sBasePath - * define the base path of the aSystemPath value, - * which must be replaced with the value of "sServerPath". - * - * @param sServerPath - * 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 - */ - public static String getURLWithProtocolFromSystemPath( String sSystemPath, String sBasePath, String sServerPath ) - { - return getURLWithProtocolFromSystemPath(new File(sSystemPath), new File(sBasePath), sServerPath); - } - /** - * This convert an URL (formated as a string) to a struct com.sun.star.util.URL. - * It use a special service to do that: the URLTransformer. - * Because some API calls need it and it's not allowed to set "Complete" - * part of the util struct only. The URL must be parsed. - * - * @param sURL - * URL for parsing in string notation - * - * @return [com.sun.star.util.URL] - * URL in UNO struct notation - */ - public static com.sun.star.util.URL parseURL(XURLTransformer xParser, String sURL) - { - com.sun.star.util.URL aURL = null; - if (sURL==null || sURL.equals("")) - return null; - - try - { - // Create special service for parsing of given URL. -/* com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)OfficeConnect.createRemoteInstance( - com.sun.star.util.XURLTransformer.class, - "com.sun.star.util.URLTransformer"); -*/ - // Because it's an in/out parameter we must use an array of URL objects. - com.sun.star.util.URL[] aParseURL = new com.sun.star.util.URL[1]; - aParseURL[0] = new com.sun.star.util.URL(); - aParseURL[0].Complete = sURL; - - // Parse the URL - xParser.parseStrict(aParseURL); - - aURL = aParseURL[0]; - } - catch(com.sun.star.uno.RuntimeException exRuntime) - { - // Any UNO method of this scope can throw this exception. - // Reset the return value only. - aURL = null; - } - return aURL; - } /** diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 9ee716eeefd0..1866b2646dac 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -170,47 +170,9 @@ public class Parameters implements XPropertySet { } } - public static String getString(XPropertySet props, String name) { - try { - return (String)props.getPropertyValue(name); - } catch (UnknownPropertyException e) { - return null; - } catch (WrappedTargetException e) { - return null; - } - } - public static Object get(XPropertySet props, String name) { - try { - return props.getPropertyValue(name); - } catch (UnknownPropertyException e) { - return null; - } catch (WrappedTargetException e) { - return null; - } - } - public static Map<String, Object> toMap(XPropertySet props) { - HashMap<String, Object> result = new HashMap<String, Object>(10); - XPropertySetInfo setInfo = props.getPropertySetInfo(); - Property[] properties = setInfo.getProperties(); - for (int i = 0; i < properties.length; i++) { - String name = properties[i].Name; - Object value; - try { - value = props.getPropertyValue(name); - } catch (WrappedTargetException e) { - continue; - } catch (UnknownPropertyException e) { - continue; - } - - result.put(name, value); - } - - return result; - } } diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java index 680e499cf8da..fc4a2b4fe9d3 100644 --- a/qadevOOo/runner/lib/Status.java +++ b/qadevOOo/runner/lib/Status.java @@ -86,13 +86,7 @@ public class Status extends SimpleStatus { return new Status( SKIPPED, state ); } - /** - * This is a factory method for creating a Status representing that the - * result of the activity was excluded. It always has FAILED state. - */ - public static Status excluded() { - return new Status( EXCLUDED, false ); - } + /** * Creates a Status representing an activity failed for an arbitrary reason. diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java index 6b893106c65b..5ca0b9bbead4 100644 --- a/qadevOOo/runner/util/AccessibilityTools.java +++ b/qadevOOo/runner/util/AccessibilityTools.java @@ -262,53 +262,6 @@ public class AccessibilityTools { return null; } - /** - * This methods retunrs the <CODE>XAccessibleContext</CODE> of a named Sheet-Cell like "G5".<p> - * @param xSheetAcc The <CODE>XAccessibleContext</CODE> of a Sheet - * @param cellName The name of a cell like "A5" - * @return the <CODE>XAccessiblecontext</CODE> of the named cell - */ - public static XAccessibleContext getSheetCell(XAccessibleContext xSheetAcc, String cellName){ - - int cellIndex = 0; - int column =0; - int charMem = 0; - for (int n=0; n<cellName.length(); n++){ - String cha = cellName.substring(n,n+1); - System.out.println("char: " + cha + " "); - - byte[] bytes = cha.getBytes(); - - if ((bytes[0] >= 'A') && (bytes[0] <= 'Z')){ - charMem = bytes[0]-64; - column++; - if ( column == 2 ){ - cellIndex += charMem * 26; - } - cellIndex= cellIndex+ (bytes[0]-65); - } else { - String sNumb = cellName.substring(n, cellName.length()); - int iNumb = Integer.valueOf(sNumb).intValue(); - cellIndex += (iNumb-1) * 256; - System.out.println("numb:" + (iNumb-1) * 256); - } - - } - - try { - XAccessibleContext ac = xSheetAcc.getAccessibleChild(cellIndex).getAccessibleContext(); - System.out.println(ac.getAccessibleRole() + "," + - ac.getAccessibleName() + "(" + - ac.getAccessibleDescription() + "):" + - utils.getImplName(ac)); - - return ac; - } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { - System.out.println("ERROR: could not get child at index " + cellIndex +"': " + ex.toString()); - return null; - } - } - public static void printAccessibleTree(PrintWriter log, XAccessible xacc, boolean debugIsActive) { debug = debugIsActive; if (debug) printAccessibleTree(log, xacc, ""); diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 5f22f5407dd2..7b352179929e 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -280,12 +280,7 @@ public class DBTools { */ public DataSourceInfo newDataSourceInfo() { return new DataSourceInfo() ;} - /** - * Returns new instance of <code>DataSourceInfo</code> class. - */ - public DataSourceInfo newDataSourceInfo(Object dataSource) { - return new DataSourceInfo(dataSource); - } + /** * Registers the datasource on the specified name in @@ -324,75 +319,9 @@ public class DBTools { registerDB(name, dataSource) ; } - /** - * RESERVED. Not used. - */ - public XConnection connectToTextDB(String contextName, - String dbDir, String fileExtension) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - - xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir)); - - PropertyValue extParam = new PropertyValue() ; - extParam.Name = "EXT" ; - extParam.Value = fileExtension ; - xSrcProp.setPropertyValue("Info", new PropertyValue[] {extParam}) ; - dbContext.registerObject(contextName, newSource) ; - Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; - - XCompletedConnection xSrcCon = UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ; - - XConnection con = xSrcCon.connectWithCompletion(xHandler) ; - - return con ; - } finally { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception e) {} - } - } - - /** - * Registers DBase database (directory with DBF files) in the - * global DB context, then connects to it. - * @param contextName Name under which DB will be registered. - * @param dbDir The directory with DBF tables. - * @return Connection to the DB. - */ - public XConnection connectToDBase(String contextName, - String dbDir) - throws com.sun.star.uno.Exception { - - try { - XInterface newSource = (XInterface) xMSF.createInstance - ("com.sun.star.sdb.DataSource") ; - - XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); - xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir)); - - dbContext.registerObject(contextName, newSource) ; - - XConnection con = connectToSource(newSource) ; - - return con ; - } catch(com.sun.star.uno.Exception e) { - try { - dbContext.revokeObject(contextName) ; - } catch (Exception ex) {} - - throw e ; - } - } /** * Performs connection to DataSource specified. @@ -461,23 +390,7 @@ public class DBTools { return src ; } - /** - * Connects to <code>DataSource</code> specially created for testing. - * This source always has name <code>'APITestDatabase'</code> and it - * is registered in subdirectory <code>TestDB</code> of directory - * <code>docPath</code> which is supposed to be a directory with test - * documents, but can be any other (it must have subdirectory with DBF - * tables). If such data source doesn't exists or exists with - * different URL it is recreated and reregistered. Finally connection - * performed. - * @param docPath Path to database <code>TestDB</code> directory. - * @return Connection to test database. - */ - public XConnection connectToTestDB(String docPath) - throws com.sun.star.uno.Exception { - return connectToSource(registerTestDB(docPath)) ; - } /** * Empties the table in the specified source. @@ -584,44 +497,9 @@ public class DBTools { xClose.close() ; } - /** - * Initializes test table specified of the connection specified. - * Deletes all record from table, and then inserts data from - * <code>TST_TABLE_VALUES</code> constant array. <p> - * Test table has some predefined format which includes as much - * field types as possible. For every column type constants - * {@link #TST_STRING TST_STRING}, {@link #TST_INT TST_INT}, etc. - * are declared for column index fast find. - * @param con Connection to data source where test table exists. - * @param table Test table name. - */ - public void initializeTestTable(XConnection con, String table) - throws com.sun.star.sdbc.SQLException { - - deleteAllRows(con, table) ; - for (int i = 0; i < TST_TABLE_VALUES.length; i++) { - addRowToTestTable(con, table, TST_TABLE_VALUES[i], TST_STREAM_LENGTHS[i]) ; - } - } - - /** - * Prints full info about currently registered DataSource's. - */ - public void printRegisteredDatabasesInfo(PrintWriter out) { - XEnumerationAccess dbContEA = UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ; - XEnumeration xEnum = dbContEA.createEnumeration() ; - out.println("DatabaseContext registered DataSource's :") ; - while (xEnum.hasMoreElements()) { - try { - DataSourceInfo inf = new DataSourceInfo(xEnum.nextElement()) ; - inf.printInfo(out) ; - } catch (com.sun.star.container.NoSuchElementException e) {} - catch (com.sun.star.lang.WrappedTargetException e) {} - } - } /** * Convert system pathname to SOffice URL string diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 30bfd8725d43..8e6ad3238cde 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -101,17 +101,7 @@ public class DesktopTools return xDesktop.getComponents().createEnumeration(); } - /** - * returns the current component on the desktop - * @param xMSF the XMultiServiceFactory - * @return XComponent of the current component on the desktop - */ - public static XComponent getCurrentComponent(XMultiServiceFactory xMSF) - { - XDesktop xDesktop = UnoRuntime.queryInterface( - XDesktop.class, createDesktop(xMSF)); - return xDesktop.getCurrentComponent(); - } + /** * returns the current component on the desktop @@ -460,15 +450,7 @@ public class DesktopTools } } - /** - * Due to typo deprecated - * @deprecated - */ - @Deprecated - public static void bringWindowToFromt(XModel xModel) - { - bringWindowToFront(xModel); - } + /** * This function brings a document to the front.<P> diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java index acb89d88e26c..4facd805fd34 100644 --- a/qadevOOo/runner/util/DrawTools.java +++ b/qadevOOo/runner/util/DrawTools.java @@ -130,21 +130,4 @@ public class DrawTools { return oShape; } - /** - * creates a XShape and adds it to the documents - * first drawpage - * @param oDoc the document - * @param height the height of the shape - * @param width the width of the shape - * @param x the x-position of the shape - * @param y the y-position of the shape - * @param kind the kind of the shape ('Ellipse', 'Line' or 'Rectangle') - */ - public void addShape( XComponent oDoc, int height, int width, int x, - int y, String kind ) { - - getShapes(getDrawPage(oDoc,0)).add(createShape( oDoc, height, width, x, - y, kind ) ); - } - } diff --git a/qadevOOo/runner/util/DynamicClassLoader.java b/qadevOOo/runner/util/DynamicClassLoader.java index ff70becefbba..8fdd721f1ea2 100644 --- a/qadevOOo/runner/util/DynamicClassLoader.java +++ b/qadevOOo/runner/util/DynamicClassLoader.java @@ -61,23 +61,6 @@ public class DynamicClassLoader { /** * Get an instance of a class. The constructor matching to the - * arguments is used and the arguments are given to this constructor. - * @param className The class to instantiate. - * @param ctorArgs Arguments for the constructor. - * @return The instance of the class. - */ - public Object getInstance(String className, Object[] ctorArgs) - throws IllegalArgumentException { - Class<?>[] ctorType = new Class[ctorArgs.length]; - for(int i=0; i<ctorType.length; i++) { - ctorType[i] = ctorArgs[i].getClass(); - } - return getInstance(className, ctorType, ctorArgs); - - } - - /** - * Get an instance of a class. The constructor matching to the * given calss types is used and the instance is created using the arguments * for the constructor. * @param className The class to instantiate. diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 9064487f791c..2de4698877c2 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -260,24 +260,7 @@ public class FormTools { return UnoRuntime.queryInterface(XLoadable.class, the_form); } - public static XLoadable bindForm( XTextDocument aDoc, String formName ) { - XLoadable formLoader = null; - try { - XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName); - XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); - formProps.setPropertyValue("DataSourceName","Bibliography"); - formProps.setPropertyValue("Command","biblio"); - formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form); - } - catch (Exception ex) { - System.out.println("Exception: "+ex); - ex.printStackTrace(System.err); - } - - return formLoader; - } /** * Binds the form with the name specified of <code>aDoc</code> Writer document diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 8a841397ee5c..dd46df9b6bdc 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -99,23 +99,7 @@ public class SOfficeFactory { } // finished createTextDoc - /** - * method which opens a new TextDocument - * - * @see XTextDocument - */ - public XTextDocument createTextDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - XComponent oDoc = openDoc("swriter", frameName, mediaDescriptor); - - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XTextDocument.class, oDoc); - } else { - return null; - } - } // finished createTextDoc /** * method which opens a new SpreadsheetDocument @@ -135,23 +119,7 @@ public class SOfficeFactory { } } // finished createCalcDoc - /** - * method which opens a new SpreadsheetDocument - * - * @see XSpreadsheetDocument - */ - public XSpreadsheetDocument createCalcDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - - XComponent oDoc = openDoc("scalc", frameName, mediaDescriptor); - if (oDoc != null) { - DesktopTools.bringWindowToFront(oDoc); - return UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); - } else { - return null; - } - } // finished createCalcDoc /** * method which opens a new DrawDocument @@ -162,17 +130,7 @@ public class SOfficeFactory { return openDoc("sdraw", frameName); } // finished createDrawDoc - /** - * method which opens a new ImpressDocument - */ - /** - * method which opens a new DrawDocument - */ - public XComponent createDrawDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("sdraw", frameName, mediaDescriptor); - } // finished createDrawDoc /** * method which opens a new ImpressDocument @@ -183,14 +141,7 @@ public class SOfficeFactory { return openDoc("simpress", frameName); } // finished createImpressDoc - /** - * method which opens a new ImpressDocument - */ - public XComponent createImpressDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("simpress", frameName, mediaDescriptor); - } // finished createImpressDoc /** * method which opens a new MathDocument @@ -201,14 +152,7 @@ public class SOfficeFactory { return openDoc("smath", frameName); } // finished createMathDoc - /** - * method which opens a new MathDocument - */ - public XComponent createMathDoc(String frameName, PropertyValue[] mediaDescriptor) - throws com.sun.star.uno.Exception { - return openDoc("smath", frameName, mediaDescriptor); - } // finished createMathDoc /** * method which opens a new ChartDocument @@ -261,19 +205,7 @@ public class SOfficeFactory { return oTable; } - /** - * creates a simple TextFrame - * ... to be continued - */ - public static XTextFrame createTextFrame(XTextDocument xTextDoc) - { - - FrameDsc tDsc = new FrameDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - XTextFrame oFrame = (XTextFrame) instCreate.getInstance(); - return oFrame; - } /** * creates a simple TextFrame @@ -289,15 +221,7 @@ public class SOfficeFactory { return oFrame; } - public static void insertString(XTextDocument xTextDoc, String cString) - { - XText xText = xTextDoc.getText(); - XText oText = UnoRuntime.queryInterface( - XText.class, xText); - XTextCursor oCursor = oText.createTextCursor(); - oText.insertString(oCursor, cString, false); - } public static void insertTextContent(XTextDocument xTextDoc, XTextContent xCont) @@ -335,33 +259,9 @@ public class SOfficeFactory { } /// finish createBookmark - /** - * the method createReferenceMark - */ - public static XTextContent createReferenceMark(XTextDocument xTextDoc) - { - - ReferenceMarkDsc tDsc = new ReferenceMarkDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oReferenceMark = (XTextContent) instCreate.getInstance(); - return oReferenceMark; - - } /// finish createReferenceMark - /** - * the method createFootnote - */ - public static XTextContent createFootnote(XTextDocument xTextDoc) - { - FootnoteDsc tDsc = new FootnoteDsc(); - InstCreator instCreate = new InstCreator(xTextDoc, tDsc); - - XTextContent oFootnote = (XTextContent) instCreate.getInstance(); - return oFootnote; - } /// finish createFootnote /** * the method create Index @@ -403,16 +303,7 @@ public class SOfficeFactory { return oIA; } - public static String getUniqueName(XInterface oInterface, String prefix) { - XNameAccess oNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oInterface); - if (oNameAccess == null) { - return null; - } - int i; - for (i = 0; oNameAccess.hasByName(prefix + i); i++) { - } - return prefix + i; - } + public XShape createShape(XComponent oDoc, int height, int width, int x, int y, String kind) { //possible values for kind are 'Ellipse', 'Line' and 'Rectangle' @@ -482,45 +373,7 @@ public class SOfficeFactory { return oInstance; } - public XControlShape createControlShape(XComponent oDoc, int height, int width, int x, int y, String kind) { - - Size size = new Size(); - Point position = new Point(); - XControlShape oCShape = null; - XControlModel aControl = null; - - //get MSF - XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); - try { - Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); - Object aCon = oDocMSF.createInstance("com.sun.star.form.component." + kind); - aControl = UnoRuntime.queryInterface(XControlModel.class, aCon); - oCShape = UnoRuntime.queryInterface(XControlShape.class, oInt); - size.Height = height; - size.Width = width; - position.X = x; - position.Y = y; - oCShape.setSize(size); - oCShape.setPosition(position); - - - } catch (Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't create instance " + e); - } - - try { - oCShape.setControl(aControl); - } catch (Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't get Control " + e); - } - - - return oCShape; - - } public XComponent loadDocument(String fileName) throws com.sun.star.lang.IllegalArgumentException, @@ -607,15 +460,5 @@ public class SOfficeFactory { } // finished openDoc - // query for XServiceInfo - public Object queryXServiceInfo(Object oObj) { - if (oObj != null) { - UnoRuntime.queryInterface( - XServiceInfo.class, oObj); - System.out.println("!!!! XServiceInfo n.a. !!!! "); - } else { - System.out.println("Object is empty!!!! "); - } - return null; - } // finish queryXServiceInfo + } diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 0d289f4d68da..09896ade63e0 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -32,82 +32,15 @@ import com.sun.star.datatransfer.*; public class SysUtils { - public static String getJavaPath() { - String cp = System.getProperty("java.class.path"); - String jh = System.getProperty("java.home"); - String fs = System.getProperty("file.separator"); - jh = jh + fs + "bin" + fs; - jh = jh + "java -classpath "+cp; - return jh; - } - private static ArrayList<String> files = new ArrayList<String>(); - public static Object[] traverse( String afileDirectory ) { + private static ArrayList<String> files = new ArrayList<String>(); - File fileDirectory = new File(afileDirectory); - // Testing, if the file is a directory, and if so, it throws an exception - if ( !fileDirectory.isDirectory() ) { - throw new IllegalArgumentException( - "not a directory: " + fileDirectory.getName() - ); - } - // Getting all files and directories in the current directory - File[] entries = fileDirectory.listFiles( - new FileFilter() { - public boolean accept( File pathname ) { - return true; - } - } - ); - - // Iterating for each file and directory - for ( int i = 0; i < entries.length; ++i ) { - // Testing, if the entry in the list is a directory - if ( entries[ i ].isDirectory() ) { - // Recursive call for the new directory - traverse( entries[ i ].getAbsolutePath() ); - } else { - // adding file to List - try { - // Composing the URL by replacing all backslashs - String stringUrl = "file:///" - + entries[ i ].getAbsolutePath().replace( '\\', '/' ); - files.add(stringUrl); - } - catch( Exception exception ) { - exception.printStackTrace(); - } - } - } - return files.toArray(); - } - public static XComponent getActiveComponent(XMultiServiceFactory msf) { - XComponent ac = null; - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - ac = xDesk.getCurrentComponent(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return ac; - } - public static XFrame getActiveFrame(XMultiServiceFactory msf) { - try { - Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); - return xDesk.getCurrentFrame(); - } catch (com.sun.star.uno.Exception e) { - System.out.println("Couldn't get active Component"); - } - return null; - } /** * Tries to obtain text data from cliboard if such one exists. diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index c97c6d47c008..2004bca59a8c 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -196,180 +196,20 @@ public class UITools { } } - /** - * Deactivates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to deactivated - */ - public boolean deactivateToggleButton(String buttonName){ - return clickToggleButton(buttonName, false); - } - /** - * Activates toggle button via Accessibility - * @param buttonName The name of the button in the Accessibility tree - * - * @return true if the button could be set to activated - */ - public boolean activateToggleButton(String buttonName){ - return clickToggleButton(buttonName, true); - } - /** - * returns the value of named radio button - * @param buttonName the name of the button to get the value of - * @throws java.lang.Exception if something fail - * @return Integer - */ - public Integer getRadioButtonValue(String buttonName) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.RADIO_BUTTON, buttonName); - - return (Integer) getValue(xRB); - } catch (Exception e) { - throw new Exception("Could not get value from RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * returns the named graphic - * @param GraphicName the name of the graphic - * @return XInterface - * @throws java.lang.Exception if something fail - */ - public XInterface getGraphic(String GraphicName) throws java.lang.Exception - { - return AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.GRAPHIC, - GraphicName); - } - /** - * set a named radio button the a given value - * @param buttonName the name of the button to set - * @param iValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setRadioButtonValue(String buttonName, int iValue) - throws java.lang.Exception - { - try { - XInterface xRB =AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.RADIO_BUTTON, buttonName); - if(xRB == null) - System.out.println("AccessibleObjectForRole couldn't be found for " + buttonName); - XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xRB); - if(oValue == null) - System.out.println("XAccessibleValue couldn't be queried for " + buttonName); - oValue.setCurrentValue(new Integer(iValue)); - } catch (Exception e) { - e.printStackTrace(); - - throw new Exception("Could not set value to RadioButton '" - + buttonName + "' : " + e.toString()); - } - } - /** - * select an item in nanmed listbox - * @param ListBoxName the name of the listbox - * @param nChildIndex the index of the item to set - * @throws java.lang.Exception if something fail - */ - public void selectListboxItem(String ListBoxName, int nChildIndex) - throws java.lang.Exception - { - try { - XAccessibleContext xListBox = null; - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - XAccessibleContext xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - XAccessibleSelection xListSelect = UnoRuntime.queryInterface(XAccessibleSelection.class, xList); - xListSelect.selectAccessibleChild(nChildIndex); - } catch (Exception e) { - throw new Exception("Could not select item '" +nChildIndex+ - "' in listbox '" + ListBoxName + "' : " + e.toString()); - } - } - /** - * This method returns all entries as XInterface of a list box - * @param ListBoxName the name of the listbox - * @return Object[] containing XInterface - * @throws java.lang.Exception if something fail - */ - - public Object[] getListBoxObjects(String ListBoxName) - throws java.lang.Exception - { - ArrayList<XInterface> Items = new ArrayList<XInterface>(); - try { - XAccessibleContext xListBox = null; - XAccessibleContext xList = null; - - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.COMBO_BOX, ListBoxName); - if (xListBox == null){ - xListBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.PANEL, ListBoxName); - } - - if (xListBox == null){ - // get the list of TreeListBox - xList =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.TREE, ListBoxName); - - // all other list boxes have a children of kind of LIST - } else { - XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); - // if a List is not pulled to be open all entries are not visiblle, therefore the - // boolean argument - xList =AccessibilityTools.getAccessibleObjectForRole( - xListBoxAccess, AccessibleRole.LIST, true); - } - - for (int i=0;i<xList.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xList.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - Items.add(xChildInterface); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child form list of '" - + ListBoxName + "' : " + e.toString()); - } - } - - } catch (Exception e) { - throw new Exception("Could not get list of items from '" - + ListBoxName + "' : " + e.toString()); - } - Object[]ret = new XInterface[Items.size()]; - for (int i=0;i<Items.size();i++){ - ret[i] = Items.get(i); - } - return ret; - } /** * Helper method: returns the entry manes of a List-Box @@ -429,27 +269,7 @@ public class UITools { String[]ret = new String[Items.size()]; return Items.toArray(ret); } - /** - * set to a named nureric filed a given value - * @param NumericFieldName the name of the nureic field - * @param cValue the value to set - * @throws java.lang.Exception if something fail - */ - public void setNumericFieldValue(String NumericFieldName, String cValue) - throws java.lang.Exception - { - try{ - XInterface xNumericField =AccessibilityTools.getAccessibleObjectForRole( - mXRoot, AccessibleRole.TEXT, NumericFieldName); - UnoRuntime.queryInterface( - XAccessibleEditableText.class, xNumericField); - setString(xNumericField, cValue); - } catch (Exception e) { - throw new Exception("Could not set value '" + cValue + - "' into NumericField '" + NumericFieldName + "' : " + e.toString()); - } - } /** * returns the value of a numeric field @@ -511,66 +331,10 @@ public class UITools { } - /** - * returns the numeric value of a numeric filed. This is needed ie. for - * fields include the moneytary unit. - * @param NumericFieldName the name of the numeric filed - * @return the value of the numeric filed - * @throws java.lang.Exception if something fail - */ - public Double getNumericFieldNumericValue(String NumericFieldName) - throws java.lang.Exception - { - try{ - Double retValue = null; - String sValue = getNumericFieldValue(NumericFieldName); - String sAmount = removeCharactersFromCurrencyString(sValue); - retValue = Double.valueOf(sAmount); - return retValue; - - } catch (Exception e) { - throw new Exception("Could get numeric value from NumericField '" - + NumericFieldName + "' : " + e.toString()); - } - } - /** - * returns the content of a TextBox - * @param TextFieldName the name of the textbox - * @return the value of the text box - * @throws java.lang.Exception if something fail - */ - public String getTextBoxText(String TextFieldName) - throws java.lang.Exception - { - String TextFieldText = null; - try{ - XAccessibleContext xTextField =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.SCROLL_PANE, TextFieldName); - XAccessible xTextFieldAccess = UnoRuntime.queryInterface(XAccessible.class, xTextField); - XAccessibleContext xFrame =AccessibilityTools.getAccessibleObjectForRole( - xTextFieldAccess, AccessibleRole.TEXT_FRAME); - for (int i=0;i<xFrame.getAccessibleChildCount();i++) { - try { - XAccessible xChild = xFrame.getAccessibleChild(i); - XAccessibleContext xChildCont = - xChild.getAccessibleContext(); - XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); - TextFieldText += (getString(xChildInterface)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - throw new Exception("Could not get child fom TextFrame of '" - + TextFieldName + "' : " + e.toString()); - } - } - return TextFieldText; - } catch (Exception e) { - throw new Exception("Could not get content fom Textbox '" - + TextFieldName + "' : " + e.toString()); - } - } /** * set a value to a named check box @@ -598,26 +362,7 @@ public class UITools { } } - /** - * returns the value of the named check box - * @param CheckBoxName the name of the check box - * @return the value of the check box - * @throws java.lang.Exception if something fail - */ - public Integer getCheckBoxValue(String CheckBoxName) - throws java.lang.Exception - { - try { - XInterface xCheckBox =AccessibilityTools.getAccessibleObjectForRole(mXRoot, - AccessibleRole.CHECK_BOX, CheckBoxName); - XAccessibleValue xCheckBoxValue = UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); - return (Integer) xCheckBoxValue.getCurrentValue(); - } catch (Exception e) { - throw new Exception("Could not set value to CheckBox '" - + CheckBoxName + "' : " + e.toString()); - } - } /** * returns the message of a Basic-MessageBox @@ -642,130 +387,13 @@ public class UITools { } } - /** - * fetch the window which is equal to the given <CODE>WindowName</CODE> - * @return the named window - * @throws java.lang.Exception if something fail - */ - public XWindow getTopWindow(String WindowName, boolean debug) throws java.lang.Exception - { - XInterface xToolKit = null; - try { - xToolKit = (XInterface) mMSF.createInstance("com.sun.star.awt.Toolkit") ; - } catch (com.sun.star.uno.Exception e) { - throw new Exception("Could not toolkit: " + e.toString()); - } - XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); - - int count = tk.getTopWindowCount(); - - XTopWindow retWindow = null; - - if (debug) System.out.println("getTopWindow ->"); - - for (int i=0; i < count ; i++){ - XTopWindow xTopWindow = tk.getTopWindow(i); - XAccessible xAcc = AccessibilityTools.getAccessibleObject(xTopWindow); - String accName = xAcc.getAccessibleContext().getAccessibleName(); - - if (debug){ - System.out.println("AccessibleName: " + accName); - } - - if (WindowName.equals(accName)){ - if (debug) System.out.println("-> found window with name '" + WindowName + "'"); - retWindow = xTopWindow; - } - } - if (debug) { - if (retWindow == null) System.out.println("could not found window with name '" + WindowName + "'"); - System.out.println("<- getTopWindow "); - } - return UnoRuntime.queryInterface(XWindow.class, retWindow); - } - public void clickMiddleOfAccessibleObject(short role, String name){ - - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - public void doubleClickMiddleOfAccessibleObject(short role, String name) { - XAccessibleContext xAcc =AccessibilityTools.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = UnoRuntime.queryInterface( - XAccessibleComponent.class, xAcc); - - System.out.println(xAcc.getAccessibleRole() + "," + - xAcc.getAccessibleName() + "(" + - xAcc.getAccessibleDescription() + "):" + - utils.getImplName(xAcc)); - - if (aComp != null) { - aComp.getLocationOnScreen(); - String bounds = "(" + aComp.getBounds().X + "," + - aComp.getBounds().Y + ")" + " (" + - aComp.getBounds().Width + "," + - aComp.getBounds().Height + ")"; - System.out.println("The boundary Rectangle is " + bounds); - try { - Robot rob = new Robot(); - int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2); - int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2); - System.out.println("try to double click mouse button on x/y " + x + "/" + y); - rob.mouseMove(x, y); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - utils.shortWait(100); - rob.mousePress(InputEvent.BUTTON1_MASK); - rob.mouseRelease(InputEvent.BUTTON1_MASK); - } catch (java.awt.AWTException e) { - System.out.println("couldn't press mouse button"); - } - } - } - /** - * <B>DEPRECATED</B> - * Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @deprecated Since <CODE>AccessibilityTools</CODE> handle parameter <CODE>debugIsActive</CODE> - * this function does not work anymore. - * @param log logWriter - */ - public void printAccessibleTree(PrintWriter log) - { - AccessibilityTools.printAccessibleTree(log, mXRoot); - } /** diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index f706d9c5878a..ac3c89e275d7 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -98,23 +98,9 @@ public class XMLTools { attrByName.put(attr.Name, attr) ; } - /** - * Adds an attribute with value specified. As a type of - * value 'CDATA' string specified. - * @param name The attribute name. - * @param value Attribute value. - */ - public void add(String name, String value) { - add(name, "CDATA", value) ; - } - /** - * Clears all attributes added before. - */ - public void clear() { - attrByName.clear() ; - attributes.clear() ; - } + + /*************************************** * XAttributeList methods @@ -392,12 +378,7 @@ public class XMLTools { public void addTagEnclosed(String tag, String outerTag) { tags.put(tag, outerTag) ; } - /** - * Adds a character data which must be contained in the XML data. - */ - public void addCharacters(String ch) { - chars.put(ch, "") ; - } + /** * Adds a character data which must be contained in the XML data and * must be inside the tag with name <code>outerTag</code>. @@ -647,9 +628,7 @@ public class XMLTools { tagSet.add(tag.name) ; } - public void addCharacters(String ch) { - chars.add(new Object[] {ch.trim(), null}) ; - } + public void addCharactersEnclosed(String ch, Tag outerTag) { chars.add(new Object[] {ch.trim(), outerTag}) ; @@ -760,36 +739,7 @@ public class XMLTools { } } - /** - * Creates <code>XDocumentHandler</code> implementation in form - * of <code>com.sun.star.xml.sax.Writer</code> service, which - * writes XML data into a <code>com.sun.star.io.Pipe</code> - * created. - * @return Single element array which contains the handler - * contained in <code>Any</code> structure. - */ - public static Object[] getDocumentHandler(XMultiServiceFactory xMSF) { - Object[] ret = new Object[1]; - try { - XInterface Writer = (XInterface) xMSF.createInstance( - "com.sun.star.xml.sax.Writer"); - XInterface oPipe = (XInterface) xMSF.createInstance - ( "com.sun.star.io.Pipe" ); - XOutputStream xPipeOutput = UnoRuntime. - queryInterface(XOutputStream.class, oPipe) ; - - XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); - xADS.setOutputStream(xPipeOutput); - XDocumentHandler handler = UnoRuntime.queryInterface(XDocumentHandler.class,Writer); - - Any arg = new Any(new Type(XDocumentHandler.class),handler); - - ret[0] = arg; - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - return ret; - } + public static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) { PropertyValue[] props = new PropertyValue[propNames.length] ; @@ -863,73 +813,7 @@ public class XMLTools { oIn.closeInput(); } - /** - * Exports document (the whole or a part) into the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Document to be exported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param exportType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it also depends of document type) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be exported to. - */ - public static void exportDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String exportType, String fileURL) - throws com.sun.star.uno.Exception { - XDocumentHandler xDocHandWriter = XMLTools.getFileXMLWriter(xMSF, fileURL) ; - Any arg = new Any(new Type(XDocumentHandler.class), xDocHandWriter); - XInterface oExp = (XInterface)xMSF.createInstanceWithArguments( - "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter", - new Object[] {arg}); - XExporter xExp = UnoRuntime.queryInterface - (XExporter.class, oExp) ; - xExp.setSourceDocument(xDoc) ; - - XFilter filter = UnoRuntime.queryInterface(XFilter.class, oExp) ; - filter.filter(XMLTools.createMediaDescriptor( - new String[] {"FilterName"}, - new Object[] {"Custom filter"})) ; - } - - /** - * Imports document (the whole or a part) from the file specified - * in XML format. - * @param xMSF Soffice <code>ServiceManager</code> factory. - * @param xDoc Target document to be imported. - * @param docType Type of document (for example 'Calc', 'Writer', 'Draw') - * The type must start with <b>capital</b> letter. - * @param importType The type of export specifies if the whole - * document will be exported or one of its parts (Meta info, Styles, etc.). - * The following types supported (it hardly depends of XML data in file) : - * "" (empty string) - for the whole document ; - * "Content" - only content exported ; - * "Meta" - meta document info exported ; - * "Settings" - view settings of document exported ; - * "Styles" - document styles exported ; - * @param fileURL XML file name (in form file:///<path>) to be imported from. - */ - public static void importDocument(XMultiServiceFactory xMSF, XComponent xDoc, - String docType, String importType, String fileURL) - throws com.sun.star.uno.Exception { - - XInterface oImp = (XInterface)xMSF.createInstance( - "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); - XImporter xImp = UnoRuntime.queryInterface - (XImporter.class, oImp) ; - XDocumentHandler xDocHandImp = UnoRuntime.queryInterface - (XDocumentHandler.class, oImp) ; - - xImp.setTargetDocument(xDoc) ; - parseXMLFile(xMSF, fileURL, xDocHandImp) ; - } } diff --git a/qadevOOo/runner/util/compare/DocComparator.java b/qadevOOo/runner/util/compare/DocComparator.java index 3521876f10d2..8503fda8254a 100644 --- a/qadevOOo/runner/util/compare/DocComparator.java +++ b/qadevOOo/runner/util/compare/DocComparator.java @@ -29,14 +29,12 @@ public interface DocComparator { public boolean isReferenceExistent() throws IOException; - public void createReference() throws IOException; - public boolean compare() throws IOException; - public boolean isDiffReferenceExistent() throws IOException; - public void createDiffReference() throws IOException; + + public boolean isDiffReferenceExistent() throws IOException; public boolean compareDiff() throws IOException; diff --git a/qadevOOo/runner/util/compare/GraphicalComparator.java b/qadevOOo/runner/util/compare/GraphicalComparator.java index f52e8f0bbfd7..30a39d3fdebc 100644 --- a/qadevOOo/runner/util/compare/GraphicalComparator.java +++ b/qadevOOo/runner/util/compare/GraphicalComparator.java @@ -51,24 +51,7 @@ class GraphicalComparator implements DocComparator return a; } - /** - * return a (FileFilter) function, which returns true, if the filename is a '*.prn' file - */ - FileFilter getTrueIfPRNFile_FileFilter() - { - FileFilter aFileFilter = new FileFilter() - { - public boolean accept( File pathname ) - { - if (pathname.getName().endsWith(".prn")) - { - return true; - } - return false; - } - }; - return aFileFilter; - } + /** * build a new file from _sEntry by diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java index 99b0929bfbb4..2d711a1235c9 100644 --- a/qadevOOo/runner/util/dbg.java +++ b/qadevOOo/runner/util/dbg.java @@ -83,29 +83,7 @@ public class dbg { return types; } - /** - * Returns true if a specified target implements the interface with the - * given name. Note that the comparison is not case sensitive. - * @param xTarget The implementation which should be analysed. - * @param ifcName The name of the interface that is tested. The name can - * be full qualified, such as 'com.sun.star.io.XInputStream', or only - * consist of the interface name, such as 'XText'. - * @return True, if xTarget implements the interface named ifcType - * @see com.sun.star.uno.XInterface - */ - public static boolean implementsInterface( - XInterface xTarget, String ifcName) { - Type[] types = getInterfaceTypes(xTarget); - if( null != types ) { - int nLen = types.length; - for( int i = 0; i < nLen ; i++ ) { - if(types[i].getTypeName().toLowerCase().endsWith( - ifcName.toLowerCase())) - return true; - } - } - return false; - } + /** * Prints information about an interface type. @@ -203,18 +181,7 @@ public class dbg { } } - /** - * Print the names and the values of a sequnze of <code>PropertyValue</code> - * to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValueSequenzePairs(PropertyValue[] ps){ - for( int i = 0; i < ps.length; i++){ - printProperyValuePairs(ps[i], new PrintWriter(System.out)); - } - } /** * Print the names and the values of a sequenze of <code>PropertyValue</code> @@ -229,14 +196,7 @@ public class dbg { } } - /** - * Print the name and the value of a <code>PropertyValue</code> to to standard out. - * @param ps The property which should displayed - * @see com.sun.star.beans.PropertyValue - */ - public static void printProperyValuePairs(PropertyValue ps){ - printProperyValuePairs(ps, new PrintWriter(System.out)); - } + /** * Print the name and the value of a <code>PropertyValue</code> to a print writer. diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 73664ce6989a..332a85deae47 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -215,38 +215,7 @@ public class utils { return; } - /** - * - * This method get the version for a given TestBase/platform combination - * - */ - public static String getVersion(String aFile, String aPlatform, String aTestbase) { - if ((aFile == null) || (aPlatform == null) || (aTestbase == null)) { - return "/"; - } - File the_file = new File(aFile); - try { - RandomAccessFile raf = new RandomAccessFile(the_file, "r"); - String res = ""; - while (!res.equals("[" + aTestbase.toUpperCase() + "]")) { - res = raf.readLine(); - } - res = "=/"; - while ((!res.startsWith(aPlatform)) || (res.startsWith("["))) { - res = raf.readLine(); - } - raf.close(); - if (res.startsWith("[")) { - res = "/"; - } - return res.substring(res.indexOf("=") + 1); - - } catch (Exception e) { - System.out.println("Couldn't find version"); - return "/"; - } - } /** * @@ -307,24 +276,7 @@ public class utils { return settingPath; } - public static void setOfficeSettingsValue(XMultiServiceFactory msf, String setting, String value) { - try { - Object settings = msf.createInstance("com.sun.star.comp.framework.PathSettings"); - XPropertySet pthSettings = null; - try { - pthSettings = (XPropertySet) AnyConverter.toObject( - new Type(XPropertySet.class), settings); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - System.out.println("### couldn't get Office Settings"); - } - pthSettings.setPropertyValue(setting, value); - - } catch (Exception e) { - System.out.println("Couldn't set '" + setting + "' to value '" + value + "'"); - e.printStackTrace(); - } - } /** * This method returns the temp dicrectory of the user. @@ -570,15 +522,7 @@ public class utils { return true; } - public static void doOverwriteFile( - XMultiServiceFactory xMsf, String oldF, String newF) - { - try { - overwriteFile_impl(xMsf, oldF, newF); - } catch (InteractiveAugmentedIOException e) { - throw new RuntimeException(e); - } - } + public static boolean hasPropertyByName(XPropertySet props, String aName) { Property[] list = props.getPropertySetInfo().getProperties(); @@ -687,20 +631,7 @@ public class utils { return null; } - /** returns the path to the office binary folder - * - * @param msf The XMultiSeriveFactory - * @return the path to the office binrary or an empty string on any error - */ - public static String getOfficeBinPath(XMultiServiceFactory msf) { - String sysBinDir = ""; - try { - sysBinDir = utils.getSystemURL(utils.expandMacro(msf, "$SYSBINDIR")); - } catch (java.lang.Exception e) { - } - return sysBinDir; - } /** * Get an array of all property names from the property set. With the include @@ -871,37 +802,7 @@ public class utils { } - /** - * returns the platform of the office.<br> - * Since the runner and the office could run on different platform this function delivers the - * platform the office is running. - * @param xMSF the XMultiServiceFactory - * @return unxsols, unxsoli, unxlngi, wntmsci - */ - public static String getOfficeOS(XMultiServiceFactory xMSF) { - String platform = "unknown"; - - try { - String theOS = expandMacro(xMSF, "$_OS"); - if (theOS.equals("Windows")) { - platform = "wntmsci"; - } else if (theOS.equals("Linux")) { - platform = "unxlngi"; - } else { - if (theOS.equals("Solaris")) { - String theArch = expandMacro(xMSF, "$_ARCH"); - if (theArch.equals("SPARC")) { - platform = "unxsols"; - } else if (theArch.equals("x86")) { - platform = "unxsoli"; - } - } - } - } catch (Exception ex) { - } - return platform; - } /** * dispatches given <CODE>URL</CODE> to the document <CODE>XComponent</CODE> diff --git a/reportbuilder/Jar_reportbuilder.mk b/reportbuilder/Jar_reportbuilder.mk index 4dd30307471e..325a1029f897 100644 --- a/reportbuilder/Jar_reportbuilder.mk +++ b/reportbuilder/Jar_reportbuilder.mk @@ -46,16 +46,13 @@ $(eval $(call gb_Jar_add_sourcefiles,reportbuilder,\ reportbuilder/java/org/libreoffice/report/ImageService \ reportbuilder/java/org/libreoffice/report/InputRepository \ reportbuilder/java/org/libreoffice/report/JobDefinitionException \ - reportbuilder/java/org/libreoffice/report/JobProgressIndicator \ reportbuilder/java/org/libreoffice/report/JobProperties \ reportbuilder/java/org/libreoffice/report/OfficeToken \ reportbuilder/java/org/libreoffice/report/OutputRepository \ reportbuilder/java/org/libreoffice/report/ParameterMap \ - reportbuilder/java/org/libreoffice/report/ReportAddIn \ reportbuilder/java/org/libreoffice/report/ReportEngineMetaData \ reportbuilder/java/org/libreoffice/report/ReportEngineParameterNames \ reportbuilder/java/org/libreoffice/report/ReportExecutionException \ - reportbuilder/java/org/libreoffice/report/ReportExpression \ reportbuilder/java/org/libreoffice/report/ReportExpressionMetaData \ reportbuilder/java/org/libreoffice/report/ReportJob \ reportbuilder/java/org/libreoffice/report/ReportJobDefinition \ diff --git a/reportbuilder/java/org/libreoffice/report/ImageService.java b/reportbuilder/java/org/libreoffice/report/ImageService.java index 91037841d416..e7d484bea58d 100644 --- a/reportbuilder/java/org/libreoffice/report/ImageService.java +++ b/reportbuilder/java/org/libreoffice/report/ImageService.java @@ -24,11 +24,7 @@ import java.io.InputStream; public interface ImageService { - /** - * @param image - * @return the mime-type of the image as string. - */ - String getMimeType(final InputStream image) throws ReportExecutionException; + /** * @param image @@ -36,12 +32,7 @@ public interface ImageService */ String getMimeType(final byte[] image) throws ReportExecutionException; - /** - * @param image - * @returns the dimension in 100th mm. - * @throws ReportExecutionException - **/ - Size getImageSize(final InputStream image) throws ReportExecutionException; + /** * @param image diff --git a/reportbuilder/java/org/libreoffice/report/InputRepository.java b/reportbuilder/java/org/libreoffice/report/InputRepository.java index bbaec3eaafe2..858210694bbe 100644 --- a/reportbuilder/java/org/libreoffice/report/InputRepository.java +++ b/reportbuilder/java/org/libreoffice/report/InputRepository.java @@ -64,7 +64,7 @@ public interface InputRepository */ long getVersion(final String name); - boolean exists(final String name); + boolean isReadable(final String name); diff --git a/reportbuilder/java/org/libreoffice/report/JobProgressIndicator.java b/reportbuilder/java/org/libreoffice/report/JobProgressIndicator.java deleted file mode 100644 index 2f51de5fae7a..000000000000 --- a/reportbuilder/java/org/libreoffice/report/JobProgressIndicator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -package org.libreoffice.report; - -/** - * Based on - * http://api.libreoffice.org/docs/common/ref/com/sun/star/task/XStatusIndicator.html - * - */ -public interface JobProgressIndicator -{ - - /** - * Updates the progress description. - * - * @param string the new description - */ - void setText(String string); - - /** - * Initializes the progress indicator and sets the progress description to - * the text given in the parameter <code>text</code>. The progress values - * passed to this indicator will not exceed the given <code>maxValue</code>. - * The value range of this indicator is set to 0 to <code>maxValue</code> - * Stopped indicators must ignore that call. - * - * @param string the progress description - * @param text - * @param maxValue the maximum value - * @see JobProgressIndicator#setText(String) - */ - void start(String text, int maxValue); - - /** - * Updates the value to the specified value. Invalid values must be ignored. - * Stopped indicators must ignore that call. - * - * @param value the new value that should be shown now. This must fit the - * range [0..maxValue] as defined in {@link JobProgressIndicator#start(String, int)}. - */ - void setValue(int value); - - /** - * Stop the progress. A progress indicator cannot be destructed before end() - * has been called. - */ - void end(); - - /** - * Clear progress value and description. Calling of setValue(0) and - * setText("") should do the same. Stopped indicators must ignore this call. - */ - void reset(); -} diff --git a/reportbuilder/java/org/libreoffice/report/OutputRepository.java b/reportbuilder/java/org/libreoffice/report/OutputRepository.java index ae1653225401..b7be98d4dd8a 100644 --- a/reportbuilder/java/org/libreoffice/report/OutputRepository.java +++ b/reportbuilder/java/org/libreoffice/report/OutputRepository.java @@ -55,7 +55,7 @@ public interface OutputRepository boolean existsStorage(final String name); - boolean isWritable(final String name); + void closeOutputRepository(); } diff --git a/reportbuilder/java/org/libreoffice/report/ParameterMap.java b/reportbuilder/java/org/libreoffice/report/ParameterMap.java index c1d8fae9a931..4facd66ef260 100644 --- a/reportbuilder/java/org/libreoffice/report/ParameterMap.java +++ b/reportbuilder/java/org/libreoffice/report/ParameterMap.java @@ -19,17 +19,6 @@ package org.libreoffice.report; public interface ParameterMap { - - /** - * Adds a property to this properties collection. If a property with the given name - * exist, the property will be replaced with the new value. If the value is null, the - * property will be removed. - * - * @param key the property key. - * @param value the property value. - */ - public void put(final String key, final Object value); - /** * Retrieves the value stored for a key in this properties collection. * @@ -39,21 +28,5 @@ public interface ParameterMap */ Object get(final String key); - /** - * Retrieves the value stored for a key in this properties collection, and returning the - * default value if the key was not stored in this properties collection. - * - * @param key the property key. - * @param defaultValue the default value to be returned when the key is not stored in - * this properties collection. - * @return The stored value, or the default value if the key does not exist in this - * collection. - */ - Object get(final String key, final Object defaultValue); - String[] keys(); - - void clear(); - - int size(); } diff --git a/reportbuilder/java/org/libreoffice/report/ReportAddIn.java b/reportbuilder/java/org/libreoffice/report/ReportAddIn.java deleted file mode 100644 index 60c15b80d5a1..000000000000 --- a/reportbuilder/java/org/libreoffice/report/ReportAddIn.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -package org.libreoffice.report; - -/** - * A report add-in defines a set of expressions, which can - * be used in the reporting. - * - * Each expression must provide meta-data to support GUI implementors. - * Expressions are assumed to be statefull, if they are not, they are - * free to be implemented as stateless expression. - */ -public interface ReportAddIn -{ - - int getExpressionCount(); - - ReportExpression createExpression(int expression); - - ReportExpressionMetaData getMetaData(int expression); -} diff --git a/reportbuilder/java/org/libreoffice/report/ReportEngineMetaData.java b/reportbuilder/java/org/libreoffice/report/ReportEngineMetaData.java index f38693b9bfcf..d99b2da9bc8d 100644 --- a/reportbuilder/java/org/libreoffice/report/ReportEngineMetaData.java +++ b/reportbuilder/java/org/libreoffice/report/ReportEngineMetaData.java @@ -20,28 +20,15 @@ package org.libreoffice.report; public interface ReportEngineMetaData { - /** - * Checks, whether a certain output type is available. - * Feed the mime-type of the output type in and you'll get - * a true or false back. - * - * @param mimeType - * @return true, if the output type is supported; false otherwise. - */ - boolean isOutputSupported(String mimeType); - - /** - * Lists all supported output parameters for the given mime-type. - * This listing can be used to build a generic user interface for - * configuring a certain output. - */ - String[] getOutputParameters(String mimeType); + + + Class getParameterType(String parameter); - boolean isMandatory(String parameter); - boolean isEnumeration(String parameter); - Object[] getEnumerationValues(String parameter); + + + } diff --git a/reportbuilder/java/org/libreoffice/report/ReportExpression.java b/reportbuilder/java/org/libreoffice/report/ReportExpression.java deleted file mode 100644 index d9fdeb2d4b64..000000000000 --- a/reportbuilder/java/org/libreoffice/report/ReportExpression.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -package org.libreoffice.report; - -/** - * Expressions are simple computation components. - * - * Expressions are always assumed to be immutable. They are not allowed to - * change their state and it is not guaranteed, in which order they get called. - * If the expression has been called before, the last computed value will be - * available from the datarow. - * - * This construct allows us to write expressions in the form - * "Sum := Sum + Column". - * - * Multiple calls to getValue on the same expression instance must return the - * same value (assuming that the datarow passed in is the same). - */ -public interface ReportExpression -{ - - void setParameters(Object[] parameters); - - Object getParameters(); - - Object getValue(DataRow row); -} diff --git a/reportbuilder/java/org/libreoffice/report/ReportExpressionMetaData.java b/reportbuilder/java/org/libreoffice/report/ReportExpressionMetaData.java index b4c359e5502c..3b58c7a8ce11 100644 --- a/reportbuilder/java/org/libreoffice/report/ReportExpressionMetaData.java +++ b/reportbuilder/java/org/libreoffice/report/ReportExpressionMetaData.java @@ -22,17 +22,17 @@ import java.util.Locale; public interface ReportExpressionMetaData { - int getParameterCount(); - String getParameterName(int param); - String getParameterDisplayName(int param, Locale locale); - String getParameterDescription(int param, Locale locale); - String getName(); - String getDisplayName(Locale l); - String getDescription(Locale l); + + + + + + + } diff --git a/reportbuilder/java/org/libreoffice/report/ReportJob.java b/reportbuilder/java/org/libreoffice/report/ReportJob.java index 1bbcdec436ee..450845155ff1 100644 --- a/reportbuilder/java/org/libreoffice/report/ReportJob.java +++ b/reportbuilder/java/org/libreoffice/report/ReportJob.java @@ -55,27 +55,4 @@ public interface ReportJob void execute() throws ReportExecutionException, IOException; - /** - * Interrupt the job. - */ - void interrupt(); - - /** - * Queries the jobs execution status. - * - * @return true, if the job is currently running, false otherwise. - */ - boolean isRunning(); - - /** - * Queries the jobs result status. - * - * @return true, if the job is finished (or has been interrupted), false - * if the job waits for activation. - */ - boolean isFinished(); - - void addProgressIndicator(JobProgressIndicator indicator); - - void removeProgressIndicator(JobProgressIndicator indicator); } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportAddIn.java b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportAddIn.java index bbd915c87222..fc4e689dc844 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportAddIn.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportAddIn.java @@ -17,8 +17,6 @@ */ package org.libreoffice.report.pentaho; -import org.libreoffice.report.ReportAddIn; -import org.libreoffice.report.ReportExpression; import org.libreoffice.report.ReportExpressionMetaData; import org.libreoffice.report.pentaho.expressions.SumExpression; @@ -26,14 +24,14 @@ import org.libreoffice.report.pentaho.expressions.SumExpression; * This class is a dummy implementation. Ignore it for now, we may extend this * one later. */ -public class PentahoReportAddIn implements ReportAddIn +public class PentahoReportAddIn { public PentahoReportAddIn() { } - public ReportExpression createExpression(final int expression) + public SumExpression createExpression(final int expression) { return (expression == 0) ? new SumExpression() : null; } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java index b7c480467305..0a8586b56d2f 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java @@ -21,7 +21,6 @@ import org.libreoffice.report.DataSourceFactory; import org.libreoffice.report.ImageService; import org.libreoffice.report.InputRepository; import org.libreoffice.report.JobDefinitionException; -import org.libreoffice.report.JobProgressIndicator; import org.libreoffice.report.JobProperties; import org.libreoffice.report.OutputRepository; import org.libreoffice.report.ParameterMap; @@ -77,7 +76,6 @@ public class PentahoReportJob implements ReportJob private static final Log LOGGER = LogFactory.getLog(PentahoReportJob.class); private boolean finished; - private final List<JobProgressIndicator> listeners; private final DataSourceFactory dataSourceFactory; private final OutputRepository outputRepository; private final JobProperties jobProperties; @@ -104,7 +102,6 @@ public class PentahoReportJob implements ReportJob } this.definition = definition; - this.listeners = new ArrayList<JobProgressIndicator>(); this.jobProperties = definition.getProcessingParameters().copy(); this.dataSourceFactory = (DataSourceFactory) jobProperties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); @@ -182,11 +179,6 @@ public class PentahoReportJob implements ReportJob return tempReport; } - public void addProgressIndicator(final JobProgressIndicator indicator) - { - listeners.add(indicator); - } - /** * Interrupt the job. */ @@ -206,10 +198,7 @@ public class PentahoReportJob implements ReportJob return finished; } - public void finish() - { - finished = true; - } + /** * Queries the jobs execution status. @@ -221,11 +210,6 @@ public class PentahoReportJob implements ReportJob return !finished; } - public void removeProgressIndicator(final JobProgressIndicator indicator) - { - listeners.remove(indicator); - } - private void collectGroupExpressions(final Node[] nodes, final List<Object[]> expressions, final FormulaParser parser, final Expression reportFunctions[]) { for (int i = 0; i < nodes.length; i++) diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java index b3648efa469c..b21faf5731ae 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java @@ -383,37 +383,5 @@ public class SOReportJobFactory } } - /** - * Gives a factory for creating the service. This method is called by the <code>JavaLoader</code> - * <p/> - * - * @param sImplName the name of the implementation for which a service is desired - * @return returns a <code>XSingleComponentFactory</code> for creating the component - * @see com.sun.star.comp.loader.JavaLoader - */ - public static XSingleComponentFactory __getComponentFactory(final String sImplName) - { - XSingleComponentFactory xFactory = null; - try - { - if (sImplName.equals(_SOReportJobFactory.class.getName())) - { - xFactory = Factory.createComponentFactory(_SOReportJobFactory.class, _SOReportJobFactory.getServiceNames()); - } - else if (sImplName.equals(SOFunctionManager.class.getName())) - { - xFactory = Factory.createComponentFactory(SOFunctionManager.class, SOFunctionManager.getServiceNames()); - } - else if (sImplName.equals(SOFormulaParser.class.getName())) - { - xFactory = Factory.createComponentFactory(SOFormulaParser.class, SOFormulaParser.getServiceNames()); - } - } - catch (java.lang.IncompatibleClassChangeError e2) - { - } - - return xFactory; - } } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/expressions/SumExpression.java b/reportbuilder/java/org/libreoffice/report/pentaho/expressions/SumExpression.java index d724010ef17a..9158ce13cd69 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/expressions/SumExpression.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/expressions/SumExpression.java @@ -18,9 +18,8 @@ package org.libreoffice.report.pentaho.expressions; import org.libreoffice.report.DataRow; -import org.libreoffice.report.ReportExpression; -public class SumExpression implements ReportExpression +public class SumExpression { private Object[] parameters; diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/ImageElementContext.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/ImageElementContext.java index 91cf767eab2d..6512d715852c 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/ImageElementContext.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/ImageElementContext.java @@ -69,13 +69,7 @@ public class ImageElementContext colStyles[pos] = styleName; } - public String getRowStyle(final int pos) - { - return rowStyles[pos]; - } - public String getColStyle(final int pos) - { - return colStyles[pos]; - } + + } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java index 4bb380eea236..961206a95590 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/layoutprocessor/VariablesCollection.java @@ -68,12 +68,7 @@ public class VariablesCollection return namePrefix; } - public String addVariable(final FormattedTextElement element) - { - variables.add(element); - final int size = variables.size(); - return namePrefix + size; - } + public FormattedTextElement[] getVariables() { diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java index a248ce5a4ce1..8d8d1b078767 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java @@ -22,8 +22,5 @@ import org.jfree.layouting.input.style.CSSDeclarationRule; public interface StyleMapper { - void updateStyle(final String uri, - final String attrName, - final String attrValue, - final CSSDeclarationRule targetRule); + } 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 68cf617a5179..4b80e9a685f1 100644 --- a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java +++ b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java @@ -67,61 +67,7 @@ public class DialogFactory return factory; } - public boolean showConfirmDialog(String title, String prompt) - { - final XDialog xDialog; - try - { - xDialog = createConfirmDialog(title, prompt); - } - catch (com.sun.star.uno.Exception e) - { - return false; - } - - // add an action listener to the button controls - XControlContainer controls = UnoRuntime.queryInterface(XControlContainer.class, xDialog); - - XButton okButton = UnoRuntime.queryInterface( - XButton.class, controls.getControl("Ok")); - okButton.setActionCommand("Ok"); - - XButton cancelButton = UnoRuntime.queryInterface( - XButton.class, controls.getControl("Cancel")); - cancelButton.setActionCommand("Cancel"); - - final ResultHolder resultHolder = new ResultHolder(); - com.sun.star.awt.XActionListener listener = - new com.sun.star.awt.XActionListener() - { - public void actionPerformed(com.sun.star.awt.ActionEvent e) { - if (e.ActionCommand.equals("Cancel")) - { - resultHolder.setResult(Boolean.FALSE); - xDialog.endExecute(); - } - else - { - resultHolder.setResult(Boolean.TRUE); - xDialog.endExecute(); - } - } - - public void disposing(EventObject o) { - // does nothing - } - }; - - okButton.addActionListener(listener); - cancelButton.addActionListener(listener); - - xDialog.execute(); - - Boolean result = (Boolean)resultHolder.getResult(); - - return result == null ? false : result.booleanValue(); - } public String showInputDialog(String title, String prompt) { diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java index cf860de625b4..dc40198de3d7 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java @@ -61,20 +61,7 @@ public class ParcelContainer implements XNameAccess * @return <tt>true</tt> if has parent <tt>false</tt> otherwise */ public boolean isUnoPkg() { return isPkgContainer; } - /** - * Tests if this <tt>ParcelContainer</tt> has a parent - * a parent. - * - * @return <tt>true</tt> if has parent <tt>false</tt> otherwise - */ - public boolean hasParent() - { - if ( parent == null ) - { - return false; - } - return true; - } + /** * Returns this <tt>ParcelContainer</tt>'s parent 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 dd7017b32df1..4b8e751fac81 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -57,21 +57,9 @@ public class ParcelDescriptor { private String language = null; private Map<String,String> languagedepprops = new HashMap<String,String>(3); - public static synchronized void removeParcelDescriptor(File parent) { - File path = new File(parent, PARCEL_DESCRIPTOR_NAME); - PARCEL_DESCRIPTOR_MAP.remove(path); - } - public static synchronized void renameParcelDescriptor(File oldFile, File newFile) { - File oldPath = new File(oldFile, PARCEL_DESCRIPTOR_NAME); - ParcelDescriptor pd = PARCEL_DESCRIPTOR_MAP.get(oldPath); - if(pd != null) { - PARCEL_DESCRIPTOR_MAP.remove(oldPath); - File newPath = new File(newFile, PARCEL_DESCRIPTOR_NAME); - pd.file = newPath; - PARCEL_DESCRIPTOR_MAP.put(newPath, pd); - } - } + + // returns the ParcelDescriptor in the corresponding directory // returns null if no ParcelDescriptor is found in the directory @@ -93,24 +81,7 @@ public class ParcelDescriptor { return pd; } - // returns a ParcelDescriptor for the corresponding directory - // if no ParcelDescriptor exists, one is created - public static synchronized ParcelDescriptor - createParcelDescriptor(File parent) throws IOException { - - ParcelDescriptor pd = getParcelDescriptor(parent); - - if (pd == null) { - if (parent == null || !parent.exists() || !parent.isDirectory()) { - throw new IOException("Cannot create Parcel Descriptor"); - } - File path = new File(parent, PARCEL_DESCRIPTOR_NAME); - pd = new ParcelDescriptor(path); - PARCEL_DESCRIPTOR_MAP.put(path, pd); - } - return pd; - } public ParcelDescriptor() throws IOException { ByteArrayInputStream bis = null; @@ -172,12 +143,7 @@ public class ParcelDescriptor { fos.close(); } - public void write() throws IOException { - if (file == null) - throw new FileNotFoundException("No file specified"); - write(file); - } public void write(OutputStream out) throws IOException { XMLParserFactory.getParser().write(document, out); @@ -301,10 +267,7 @@ public class ParcelDescriptor { return languagedepprops.get(name); } - public void setLanguageProperty(String name, String value) { - languagedepprops.put(name, value); - setScriptEntries(getScriptEntries()); - } + private void initLanguageProperties() { NodeList nl = document.getElementsByTagName("languagedepprops"); diff --git a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java index 69d94eb252c3..3a5989febcc3 100644 --- a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java +++ b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java @@ -46,9 +46,7 @@ public class XMLParserFactory { return parser; } - public static void setParser(XMLParser p) { - parser = p; - } + public static void setOfficeDTDURL(String url) { officedtdurl = url; diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java index 98f29c08c2b7..c41b6058056a 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java @@ -135,19 +135,7 @@ public class ScriptDescriptor } - /** - * Adds the given array of <code>Class</code> to the list of argument types - * stored in this ScriptDescriptor - * - * @param classes The feature to be added to the ArgumentTypes attribute - */ - public synchronized void addArgumentTypes( Class<?>[] classes ) - { - for ( int i = 0; i < classes.length; i++ ) - { - addArgumentType( classes[ i ] ); - } - } + /** diff --git a/scripting/java/org/openoffice/idesupport/JavaFinder.java b/scripting/java/org/openoffice/idesupport/JavaFinder.java index 7ef66c62dc9e..1594b9fd37c5 100644 --- a/scripting/java/org/openoffice/idesupport/JavaFinder.java +++ b/scripting/java/org/openoffice/idesupport/JavaFinder.java @@ -49,15 +49,7 @@ public class JavaFinder implements MethodFinder { this.classpath = classpath; } - public static JavaFinder getInstance() { - if (finder == null) { - synchronized(JavaFinder.class) { - if (finder == null) - finder = new JavaFinder(); - } - } - return finder; - } + public static JavaFinder getInstance(List<String> classpath) { return new JavaFinder(classpath); diff --git a/scripting/java/org/openoffice/idesupport/LocalOffice.java b/scripting/java/org/openoffice/idesupport/LocalOffice.java index f28e36ad3c9e..07b502c546ab 100644 --- a/scripting/java/org/openoffice/idesupport/LocalOffice.java +++ b/scripting/java/org/openoffice/idesupport/LocalOffice.java @@ -32,41 +32,7 @@ import java.util.ArrayList; */ public class LocalOffice { - /** - * Creates an instance of the local office connection. - * - * @param parent is an application specific class loader. - * @param officePath is a platform specific path string - * to the office distribution. - * @param port is a communication port. - */ - public static final LocalOffice create( - ClassLoader parent, String officePath, int port) - { - ArrayList<String> path = new ArrayList<String>(); - path.add(officePath + "/program/classes/ridl.jar"); - path.add(officePath + "/program/classes/jurt.jar"); - path.add(officePath + "/program/classes/unoil.jar"); - path.add(officePath + "/program/classes/juh.jar"); - path.add(System.getProperties().getProperty("netbeans.home") + - File.separator + "modules" + - File.separator + "ext" + - File.separator + "localoffice.jar"); - // commented out so code will compile - // ClassLoader appcl = new DefaultScriptClassLoader(parent, path); - ClassLoader appcl = path.getClass().getClassLoader(); - Class clazz = null; - LocalOffice office = null; - try { - clazz = appcl.loadClass( - "org.openoffice.idesupport.localoffice.LocalOfficeImpl"); - office = (LocalOffice)clazz.newInstance(); - office.connect(officePath, port); - } catch (java.lang.Exception exp) { - office = null; - } - return office; - } + /** * Connects to the running office. diff --git a/scripting/java/org/openoffice/idesupport/OfficeInstallation.java b/scripting/java/org/openoffice/idesupport/OfficeInstallation.java index d8b337fb3ea1..586d3a2d47ef 100644 --- a/scripting/java/org/openoffice/idesupport/OfficeInstallation.java +++ b/scripting/java/org/openoffice/idesupport/OfficeInstallation.java @@ -65,30 +65,15 @@ public class OfficeInstallation implements java.io.Serializable { return path; } - public String getPath(String name) { - if (!name.startsWith(File.separator)) - name = File.separator + name; - return path + name; - } public String getURL() { return url; } - public String getURL(String name) { - if (System.getProperty("os.name").startsWith("Windows")) - name = name.replace(File.separatorChar, '/'); - if (!name.startsWith("/")) - name = "/" + name; - return url + name; - } - public boolean hasFramework() { - return hasFW; - } public boolean supportsFramework() { return true; diff --git a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java b/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java index bd5eb48c3f20..30cf598a706a 100644 --- a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java +++ b/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java @@ -51,35 +51,11 @@ public class ParcelZipper return zipper; } - public String zipParcel(File basedir) throws IOException { - File targetfile, targetdir; - if (basedir.getName().equals(CONTENTS_DIRNAME)) - targetdir = basedir.getParentFile(); - else - targetdir = basedir; - targetfile = new File(targetdir, targetdir.getName() + "." + PARCEL_EXTENSION); - return zipParcel(basedir, targetfile, DEFAULT_FILTER); - } - public String zipParcel(File basedir, File targetfile) throws IOException { - return zipParcel(basedir, targetfile, DEFAULT_FILTER); - } - public String zipParcel(File basedir, FileFilter filter) throws IOException { - File targetfile, targetdir; - - if (basedir.getName().equals(CONTENTS_DIRNAME)) - targetdir = basedir.getParentFile(); - else - targetdir = basedir; - - targetfile = new File(targetdir, targetdir.getName() + "." + PARCEL_EXTENSION); - - return zipParcel(basedir, targetfile, filter); - } private String zipParcel(File basedir, File targetfile, FileFilter filter) throws IOException { @@ -155,18 +131,7 @@ public class ParcelZipper } } - public boolean isOverwriteNeeded(File parcel, File target) - throws IOException - { - boolean result; - - if (target.isDirectory()) - result = isDirectoryOverwriteNeeded(parcel, target); - else - result = isDocumentOverwriteNeeded(parcel, target); - return result; - } private boolean isDirectoryOverwriteNeeded(File parcel, File target) { String parcelDir = getParcelDirFromParcelZip(parcel.getName()); @@ -218,16 +183,7 @@ public class ParcelZipper return result; } - public String deployParcel(File parcel, File target) - throws IOException { - String output = null; - if (target.isDirectory()) - output = unzipToDirectory(parcel, target); - else - output = unzipToZip(parcel, target); - return output; - } private String getParcelDirFromParcelZip(String zipname) { String result = zipname.substring(0, zipname.lastIndexOf(".")); diff --git a/scripting/workben/ifc/scripting/ScriptingUtils.java b/scripting/workben/ifc/scripting/ScriptingUtils.java index 84cce3fc48c4..ce6071c78dd2 100644 --- a/scripting/workben/ifc/scripting/ScriptingUtils.java +++ b/scripting/workben/ifc/scripting/ScriptingUtils.java @@ -44,11 +44,9 @@ public class ScriptingUtils { return utils; } - public static void cleanUserDir() { - } - public static void cleanShareDir() { - } + + public Object getScriptStorage(XMultiServiceFactory xMSF, String location) { int id = getStorageId(xMSF, location); diff --git a/scripting/workben/ifc/scripting/SecurityDialogUtil.java b/scripting/workben/ifc/scripting/SecurityDialogUtil.java index 955e37b21036..fbcee55b5431 100644 --- a/scripting/workben/ifc/scripting/SecurityDialogUtil.java +++ b/scripting/workben/ifc/scripting/SecurityDialogUtil.java @@ -59,14 +59,7 @@ public String getErrorMessage() return errorMsg; } -/** - * Is there an error message available? - * @return true, if an error happened - */ -public boolean hasErrorMessage() -{ - return !errorMsg.equals(""); -} + /** * Press the named button in the currently visible dialog box. diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java index 558c0c4c21d2..5c628dbd89c4 100644 --- a/scripting/workben/installer/FileUpdater.java +++ b/scripting/workben/installer/FileUpdater.java @@ -23,71 +23,7 @@ import javax.swing.JLabel; public class FileUpdater { - public static boolean updateProtocolHandler( String installPath, JLabel statusLabel ) { - File in_file = null; - File out_file = null; - FileWriter out = null; - int count = 0; - - try { - in_file = new File( installPath+File.separator+"share"+File.separator+"registry"+File.separator+"data"+File.separator+"org"+File.separator+"openoffice"+File.separator+"Office"+File.separator+"ProtocolHandler.xcu" ); - - String[] xmlArray = new String[50]; - try { - BufferedReader reader = new BufferedReader(new FileReader(in_file)); - count = -1; - for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node> - count = count + 1; - xmlArray[count] = s; - } - reader.close(); - } - catch( IOException ioe ) { - String message = "\nError reading ProtocolHandler.xcu, please view SFrameworkInstall.log."; - System.out.println(message); - ioe.printStackTrace(); - statusLabel.setText(message); - return false; - } - - in_file.delete(); - - out_file = new File( installPath+File.separator+"share"+File.separator+"registry"+File.separator+"data"+File.separator+"org"+File.separator+"openoffice"+File.separator+"Office"+File.separator+"ProtocolHandler.xcu" ); - out_file.createNewFile(); - out = new FileWriter( out_file ); - - for(int i=0; i<count + 1; i++) { - out.write(xmlArray[i]+"\n"); - if( ( xmlArray[i].indexOf( "<node oor:name=\"HandlerSet\">" ) != -1 ) && ( xmlArray[i+1].indexOf( "ScriptProtocolHandler" ) == -1 ) ) { - out.write( " <node oor:name=\"com.sun.star.comp.ScriptProtocolHandler\" oor:op=\"replace\">\n" ); - out.write( " <prop oor:name=\"Protocols\">\n" ); - out.write( " <value>script:*</value>\n" ); - out.write( " </prop>\n" ); - out.write( " </node>\n" ); - } - } - } - catch( Exception e ) { - String message = "\nError updating ProtocolHandler.xcu, please view SFrameworkInstall.log."; - System.out.println(message); - e.printStackTrace(); - statusLabel.setText(message); - return false; - } - finally { - try { - out.close(); - System.out.println("File closed"); - } - catch(Exception e) { - System.out.println("Update ProtocolHandler Failed, please view SFrameworkInstall.log."); - System.err.println(e); - e.printStackTrace(); - } - } - return true; - }// updateProtocolHandler public static boolean updateScriptXLC( String installPath, JLabel statusLabel ) { diff --git a/scripting/workben/installer/IdeUpdater.java b/scripting/workben/installer/IdeUpdater.java index 3efe04e1f282..fe7b700d237d 100644 --- a/scripting/workben/installer/IdeUpdater.java +++ b/scripting/workben/installer/IdeUpdater.java @@ -64,52 +64,6 @@ public class IdeUpdater extends Thread { }// XmlUpdater - public boolean checkStop() - { - if (internalThread == Thread.currentThread()) - return false; - return true; - }// checkStop - - - public void checkSuspend() - { - if (threadSuspended) - { - synchronized(this) - { - while (threadSuspended) - { - try { - wait(); - } catch (InterruptedException eInt) { - - } - } - } - } - }// checkSuspend - - - public void setSuspend() - { - threadSuspended = true; - }// setSuspend - - - public void setResume() - { - threadSuspended = false; - notify(); - }// setResume - - - public void setStop() - { - internalThread = null; - }// setStop - - @Override public void run() { diff --git a/scripting/workben/installer/IdeVersion.java b/scripting/workben/installer/IdeVersion.java index 32e77552165e..6c1df1ce866c 100644 --- a/scripting/workben/installer/IdeVersion.java +++ b/scripting/workben/installer/IdeVersion.java @@ -316,9 +316,7 @@ class MyTableModelIDE extends AbstractTableModel { fireTableCellUpdated(row, col); } - String [] getSelected() { - return null; - } + public boolean isAnySelected() { Iterator iter = data.iterator(); diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java index ed9fd928e17b..af29db64c3ce 100644 --- a/scripting/workben/installer/InstUtil.java +++ b/scripting/workben/installer/InstUtil.java @@ -91,15 +91,7 @@ public class InstUtil { } - public static boolean hasJeditInstallation() { - boolean result = false; - result = checkForSupportedVersion( getJeditLocation(), versions ); - if ( !result ) - { - System.out.println("No supported version for JEdit found."); - } - return result; - } + diff --git a/scripting/workben/installer/InstallWizard.java b/scripting/workben/installer/InstallWizard.java index c9d73ba7c126..26459d4664b7 100644 --- a/scripting/workben/installer/InstallWizard.java +++ b/scripting/workben/installer/InstallWizard.java @@ -290,25 +290,13 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener System.err.println("-bindings will only install the menu & key bindings in user/config/soffice.cfg."); } - public static synchronized boolean isPatchedTypes() - { - return bPatchedTypes; - } - public static synchronized boolean isPatchedJava() - { - return bPatchedJava; - } - public static synchronized boolean isPatchedRDB() - { - return bPatchedRDB; - } - public static synchronized boolean isInstallStarted() - { - return bInstallStarted; - } + + + + public static synchronized void setPatchedTypes(boolean value) { @@ -330,25 +318,13 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener bInstallStarted = value; } - public static synchronized void setTypesPath(String path) - { - typesPath = path; - } - public static synchronized void setJavaPath(String path) - { - javaPath = path; - } - public static synchronized String getTypesPath() - { - return typesPath; - } - public static synchronized String getJavaPath() - { - return javaPath; - } + + + + private javax.swing.JPanel navigation; private javax.swing.JButton navBack; diff --git a/scripting/workben/installer/NavPanel.java b/scripting/workben/installer/NavPanel.java index af2b21f45046..d8718e1257d1 100644 --- a/scripting/workben/installer/NavPanel.java +++ b/scripting/workben/installer/NavPanel.java @@ -103,15 +103,9 @@ public class NavPanel extends JPanel implements ActionListener { navCancel.addActionListener(listener); } - public void removeNextListener(ActionListener listener) - { - navNext.removeActionListener(listener); - } - public void removeBackListener(ActionListener listener) - { - navBack.removeActionListener(listener); - } + + public void removeCancelListener(ActionListener listener) { diff --git a/scripting/workben/installer/Version.java b/scripting/workben/installer/Version.java index 40ec3c8dbef1..38da3f21befb 100644 --- a/scripting/workben/installer/Version.java +++ b/scripting/workben/installer/Version.java @@ -328,9 +328,7 @@ class MyTableModel extends AbstractTableModel { fireTableCellUpdated(row, col); } - String [] getSelected() { - return null; - } + public boolean isAnySelected() { Iterator iter = data.iterator(); diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java index 8c5763a3b05f..3424cd57d110 100644 --- a/scripting/workben/installer/XmlUpdater.java +++ b/scripting/workben/installer/XmlUpdater.java @@ -106,35 +106,8 @@ public class XmlUpdater extends Thread { }// XmlUpdater - public boolean checkStop() - { - if (internalThread == Thread.currentThread()) - return false; - return true; - }// checkStop - - - public void checkSuspend() - { - if (threadSuspended) { - synchronized(this) { - while (threadSuspended) { - try { - wait(); - } catch (InterruptedException eInt) { - - } - } - } - } - }// checkSuspend - public void setSuspend() - { - threadSuspended = true; - }// setSuspend - public void setResume() { @@ -143,12 +116,6 @@ public class XmlUpdater extends Thread { }// setResume - public void setStop() - { - internalThread = null; - }// setStop - - @Override public void run() { diff --git a/sfx2/qa/complex/sfx2/tools/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java index 59a5c1c7582a..0581a7edaddb 100644 --- a/sfx2/qa/complex/sfx2/tools/WriterHelper.java +++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java @@ -133,94 +133,10 @@ public class WriterHelper { closeDoc(xLocalDoc); xLocalDoc = null; } - public void kill() - { - XDesktop xDesktop = getDesktop(); - xDesktop.terminate(); - } - - - public XTextDocument DocByAutopilot(XMultiServiceFactory msf, - int[] indexes, boolean destroyLocal, - String bName) { - XTextDocument xTextDoc = WriterTools.createTextDoc(m_xMSF); - Object toolkit = null; - - try { - toolkit = msf.createInstance("com.sun.star.awt.Toolkit"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace( System.err ); - } - - XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, toolkit); - - shortWait(); - - Object atw = tk.getActiveTopWindow(); - - XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - - XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - - XAccessibleContext ARoot = AccessibilityTools.getAccessibleObjectForRole(xRoot, - AccessibleRole.MENU_BAR); - XAccessibleSelection sel = UnoRuntime.queryInterface(XAccessibleSelection.class, ARoot); - - for (int k = 0; k < indexes.length; k++) { - try { - sel.selectAccessibleChild(indexes[k]); - shortWait(); - ARoot = ARoot.getAccessibleChild(indexes[k]) - .getAccessibleContext(); - sel = UnoRuntime.queryInterface(XAccessibleSelection.class, ARoot); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } - } - - shortWait(); - atw = tk.getActiveTopWindow(); - xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - xRoot = AccessibilityTools.getAccessibleObject(xWindow); - XAccessibleAction action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, bName)); - - try { - action.doAccessibleAction(0); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } - - shortWait(); - - atw = tk.getActiveTopWindow(); - - xWindow = UnoRuntime.queryInterface(XWindow.class, atw); - - xRoot = AccessibilityTools.getAccessibleObject(xWindow); - - AccessibilityTools.printAccessibleTree(new PrintWriter(System.out),xRoot); - - action = UnoRuntime.queryInterface(XAccessibleAction.class, AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, "Yes")); - - try { - if (action != null) action.doAccessibleAction(0); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } - - shortWait(); - - XDesktop xDesktop = getDesktop(); - - XTextDocument returnDoc = UnoRuntime.queryInterface(XTextDocument.class, xDesktop.getCurrentComponent()); - - if (destroyLocal) { - closeDoc(xTextDoc); - } - - return returnDoc; - } /** * Sleeps for 2 sec. to allow StarOffice to react diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java index 54ca81b6e4c4..1c7d93af8627 100644 --- a/sw/qa/complex/writer/TextPortionEnumerationTest.java +++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java @@ -463,7 +463,6 @@ class Range private short m_End; private TreeNode m_Node; short getStart() { return m_Start; } - short getEnd() { return m_End ; } short getExtent() { return (short) (m_End - m_Start); } TreeNode getNode() { return m_Node; } Range(int start, int end, TreeNode node) diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java index ed78dae482da..2db73cea824e 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java +++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java @@ -372,41 +372,7 @@ public class Helper } - protected static XInputStream SaveHTMLTemp( XComponentContext xContext, String sArticle ) - { - XInputStream xResult = null; - if ( xContext != null ) - { - try - { - Object oTempFile = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.io.TempFile", xContext ); - XStream xStream = UnoRuntime.queryInterface( XStream.class, oTempFile ); - XSeekable xSeekable = UnoRuntime.queryInterface( XSeekable.class, oTempFile ); - if ( xStream != null && xSeekable != null ) - { - XOutputStream xOutputStream = xStream.getOutputStream(); - XInputStream xInputStream = xStream.getInputStream(); - if ( xOutputStream != null && xInputStream != null ) - { - String sHTML = sHTMLHeader.concat( sArticle ); - sHTML = sHTML.concat( sHTMLFooter ); - xOutputStream.writeBytes( sHTML.getBytes( "UTF-8" ) ); - // xOutputStream.closeOutput(); - xSeekable.seek( 0 ); - - xResult = xInputStream; - } - } - } - catch ( Exception ex ) - { - ex.printStackTrace(); - } - } - - return xResult; - } protected static String CreateTempFile( XComponentContext xContext ) @@ -874,22 +840,7 @@ public class Helper return null; } - protected static void SetControlPropInDialog( XDialog xDialog, String aControlName, String aPropName, Object aPropValue ) - { - if ( xDialog != null && aControlName != null && aPropName != null && aPropValue != null ) - { - try - { - XPropertySet xPropSet = GetSubControlPropSet( xDialog, aControlName ); - if ( xPropSet != null ) - xPropSet.setPropertyValue( aPropName, aPropValue ); - } - catch ( com.sun.star.uno.Exception e ) - { - e.printStackTrace(); - } - } - } + protected static String[] GetPasswordsForURLAndUser( XComponentContext xContext, String sURL, String sUserName ) { diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java index b4cb658e7734..70af8831e505 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java +++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java @@ -42,11 +42,7 @@ public class MainThreadDialogExecutor implements XCallback return GetCallback( xContext, aExecutor ); } - static public boolean Execute( XComponentContext xContext, XDialog xDialog ) - { - MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( xDialog ); - return GetCallback( xContext, aExecutor ); - } + static public boolean Execute( XComponentContext xContext, XMessageBox xMessageBox ) { diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java index b4c445edfda6..0b150125d9d8 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java @@ -111,10 +111,7 @@ public class WikiArticle return m_sTitle; } - public String GetViewURL() - { - return m_aMainURI.toString() + "index.php?title=" + m_sTitle; - } + private String getArticleWiki() throws java.io.IOException, WikiCancelException @@ -244,31 +241,7 @@ public class WikiArticle return ( m_aHostConfig != null ); } - protected void cleanHTML() - { - if ( m_sHTMLCode != null ) - { - //Welcome to regex hell ;) - - //strip comments - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<![ \\r\\n\\t]*(--([^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>",""); - //strip edit section links - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<div class=\"editsection\".*?\\</div\\>",""); - - //strip huge spaces - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<p\\>\\<br /\\>[ \r\n\t]*?\\</p\\>",""); - - //strip toc - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<table.*id=\"toc\"(.|[\r\n])*?\\</table\\>",""); - - //strip jump-to-nav - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<div id=\"jump-to-nav\".*?\\</div\\>",""); - - //strip Javascript - m_sHTMLCode = m_sHTMLCode.replaceAll("\\<script(.|[\r\n])*?\\</script\\>",""); - } - } protected boolean NotExist() diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java index 6f1f6d61f13f..9470e962a38c 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java @@ -158,39 +158,7 @@ public class WikiDialog implements XDialogEventHandler, XTopWindowListener return xPS; } - public static XDialog CreateSimpleDialog( XComponentContext xContext, String sURL, int nTitleID, String[] pControls, int[] pStringIDs ) - { - XDialog xResult = null; - - if ( xContext != null && sURL != null && sURL.length() > 0 ) - { - try - { - Object oDialogProvider = xContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.DialogProvider2", xContext ); - XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface( XDialogProvider2.class, oDialogProvider ); - - if ( xDialogProvider != null ) - xResult = xDialogProvider.createDialog( sURL ); - if ( xResult != null ) - { - SetTitle( xResult, Helper.GetLocalizedString( xContext, nTitleID ) ); - if ( pControls != null && pStringIDs != null && pControls.length == pStringIDs.length ) - { - XControlContainer xControlContainer = UnoRuntime.queryInterface( XControlContainer.class, xResult ); - for ( int nInd = 0; nInd < pControls.length; nInd++ ) - GetPropSet( xControlContainer, pControls[nInd] ).setPropertyValue( "Label", new Integer( pStringIDs[nInd] ) ); - } - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - return xResult; - } protected void InsertThrobber( int X, int Y, int Width, int Height ) { diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java index f251fc485777..1152ea6486ea 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java @@ -72,18 +72,7 @@ public final class WikiEditorImpl extends WeakBase m_aSettings = Settings.getSettings( m_xContext ); } - public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) - { - XSingleComponentFactory xFactory = null; - - if ( sImplementationName.equals( m_implementationName ) ) - xFactory = Factory.createComponentFactory( WikiEditorImpl.class, m_serviceNames ); - else if ( sImplementationName.equals( WikiOptionsEventHandlerImpl.m_sImplementationName ) ) - xFactory = Factory.createComponentFactory( WikiOptionsEventHandlerImpl.class, - WikiOptionsEventHandlerImpl.m_pServiceNames ); - return xFactory; - } // com.sun.star.lang.XServiceInfo: public String getImplementationName() @@ -193,15 +182,7 @@ public final class WikiEditorImpl extends WeakBase callStatusListener( urlstring ); } - public void callStatusListeners() - { - for (Iterator<String> iter = m_statusListeners.keySet().iterator(); iter.hasNext(); ) - { - String uristring = iter.next(); - XStatusListener listener = m_statusListeners.get(uristring); - callStatusListener( uristring ); - } - } + private void callStatusListener( String uristring ) { diff --git a/toolkit/qa/complex/toolkit/Assert.java b/toolkit/qa/complex/toolkit/Assert.java index 1077fb308813..5776f1f6c79c 100644 --- a/toolkit/qa/complex/toolkit/Assert.java +++ b/toolkit/qa/complex/toolkit/Assert.java @@ -197,29 +197,8 @@ public class Assert i_object, i_methodName, i_methodArgs, i_expectedExceptionClass ); } - /** invokes a given method on a given object, and assures a certain exception is caught - * @param i_object is the object to invoke the method on - * @param i_methodName is the name of the method to invoke - * @param i_methodArgs are the arguments to pass to the method - * @param i_argClasses are the classes to assume for the arguments of the methods - * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null, - * it means that <em>no</em> exception must be throw by invoking the method. - */ - public static void assertException( final Object i_object, final String i_methodName, final Class<?>[] i_argClasses, - 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_argClasses, i_methodArgs, i_expectedExceptionClass ); - } - public static void assertException( Object i_object, Class<?> _unoInterfaceClass, String i_methodName, Object[] i_methodArgs, - Class<?> i_expectedExceptionClass ) - { - assertException( UnoRuntime.queryInterface( _unoInterfaceClass, 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 ab774d787e2e..3f0b93671965 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -112,27 +112,11 @@ public abstract class Configuration set(new Integer(value), name, parent); } - public static void set(short value, String name, Object parent) throws Exception - { - set(new Short(value), name, parent); - } - public static void set(String value, String name, Object parent) throws Exception - { - set((Object) value, name, parent); - } - public static void set(boolean value, String name, Object parent) throws Exception - { - if (value) - { - set(Boolean.TRUE, name, parent); - } - else - { - set(Boolean.FALSE, name, parent); - } - } + + + public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException { @@ -233,20 +217,11 @@ public abstract class Configuration return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale"); } - public static Locale getUILocale(XMultiServiceFactory xMSF) - { - return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooLocale"); - } - public static String getLocaleString(XMultiServiceFactory xMSF) - { - return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale"); - } - public static String getUILocaleString(XMultiServiceFactory xMSF) - { - return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooLocale"); - } + + + /** * This method creates a new configuration node and adds it @@ -290,28 +265,11 @@ public abstract class Configuration } } - public static void commit(Object configView) throws WrappedTargetException - { - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, configView); - xUpdateControl.commitChanges(); - } - public static void updateConfiguration(XMultiServiceFactory xmsf, String path, String name, ConfigNode node, Object param) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException - { - Object view = Configuration.getConfigurationRoot(xmsf, path, true); - addConfigNode(path, name); - node.writeConfiguration(view, param); - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); - xUpdateControl.commitChanges(); - } - public static void removeNode(XMultiServiceFactory xmsf, String path, String name) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException - { - Object view = Configuration.getConfigurationRoot(xmsf, path, true); - removeNode(view, name); - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); - xUpdateControl.commitChanges(); - } + + + public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode) { @@ -377,10 +335,7 @@ public abstract class Configuration return null; } - public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname) - { - return getChildNodebyDisplayName(_xNameAccessNode, _displayname, PropertyNames.PROPERTY_NAME); - } + private static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename) { diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java index 16c39fb53286..cc3bdf3e8742 100644 --- a/wizards/com/sun/star/wizards/common/DebugHelper.java +++ b/wizards/com/sun/star/wizards/common/DebugHelper.java @@ -21,11 +21,7 @@ import com.sun.star.uno.Exception; public class DebugHelper { -//TODO - Verify these methods. Can not remove? - public static void exception(String DetailedMessage, Exception ex, int err, String additionalArgument) throws java.lang.Exception - { -// throw new UnsupportedOperationException("Not supported yet."); - } + public static void exception(int err, String additionalArgument) throws java.lang.Exception { diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index ad0e161291c9..efaff7d624c8 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -86,17 +86,9 @@ public class Desktop return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); } - public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF) - { - XComponent xComponent = getActiveComponent(_xMSF); - return UnoRuntime.queryInterface(XTextDocument.class, xComponent); - } - public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF) - { - XComponent xComponent = getActiveComponent(_xMSF); - return UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); - } + + private static XDispatch getDispatcher(XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) { @@ -297,35 +289,7 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - /** - * @deprecated use Configuration.getConfigurationRoot() with the same parameters instead - */ - public static XInterface getRegistryKeyContent(XMultiServiceFactory xMSF, String KeyName, boolean bForUpdate) - { - try - { - Object oConfigProvider; - PropertyValue[] aNodePath = new PropertyValue[1]; - oConfigProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider"); - aNodePath[0] = new PropertyValue(); - aNodePath[0].Name = "nodepath"; - aNodePath[0].Value = KeyName; - XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); - if (bForUpdate) - { - return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath); - } - else - { - return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return null; - } - } + private static String getTemplatePath(XMultiServiceFactory _xMSF) { @@ -339,17 +303,7 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - public static String getUserTemplatePath(XMultiServiceFactory _xMSF) - { - try - { - return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING); - } - catch (NoValidPathException nopathexception) - { - } - return PropertyNames.EMPTY_STRING; - } + public static String getBitmapPath(XMultiServiceFactory _xMSF) { @@ -363,77 +317,9 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - public static String getWorkPath(XMultiServiceFactory _xMSF) - { - try - { - return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - } - catch (NoValidPathException nopathexception) - { - } - return PropertyNames.EMPTY_STRING; - } - public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) - { - Object xPathSubst = null; - try - { - xPathSubst = xMSF.createInstance("com.sun.star.util.PathSubstitution"); - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(); - } - if (xPathSubst != null) - { - return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst); - } - else - { - return null; - } - } - /** - * This method searches (and hopefully finds...) a frame - * with a componentWindow. - * It does it in three phases: - * 1. Check if the given desktop argument has a componentWindow. - * If it is null, the myFrame argument is taken. - * 2. Go up the tree of frames and search a frame with a component window. - * 3. Get from the desktop all the components, and give the first one - * which has a frame. - */ - public static XFrame findAFrame(XMultiServiceFactory xMSF, XFrame myFrame, XFrame desktop) - throws NoSuchElementException, - WrappedTargetException - { - if (desktop == null) - { - desktop = myFrame; // we go up in the tree... - } - while (desktop != null && desktop.getComponentWindow() == null) - { - desktop = desktop.findFrame("_parent", FrameSearchFlag.PARENT); - } - if (desktop == null) - { - for (XEnumeration e = Desktop.getDesktop(xMSF).getComponents().createEnumeration(); e.hasMoreElements();) - { - Object comp = ((Any) e.nextElement()).getObject(); - XModel xModel = UnoRuntime.queryInterface(XModel.class, comp); - XFrame xFrame = xModel.getCurrentController().getFrame(); - if (xFrame != null && xFrame.getComponentWindow() != null) - { - return xFrame; - } - } - } - return desktop; - } } diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index febdb5612ac8..4dbad312210a 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -52,28 +52,7 @@ import com.sun.star.document.XDocumentProperties; public class FileAccess { - public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath) - { - XSimpleFileAccess xSimpleFileAccess = null; - String ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess); - // As there are several conventions about the look of Url (e.g. with " " or with "%20") you cannot make a - // simple String comparison to find out, if a path is already in "ResultPath" - String[] PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON); - int MaxIndex = PathList.length - 1; - String CompCurPath; - String CompAddPath = JavaTools.replaceSubString(sAddPath, PropertyNames.EMPTY_STRING, "/"); - String CurPath; - for (int i = 0; i <= MaxIndex; i++) - { - CurPath = JavaTools.convertfromURLNotation(PathList[i]); - CompCurPath = JavaTools.replaceSubString(CurPath, PropertyNames.EMPTY_STRING, "/"); - if (CompCurPath.equals(CompAddPath)) - { - return; - } - } - ResultPath += PropertyNames.SEMI_COLON + sAddPath; - } + private static String deleteLastSlashfromUrl(String _sPath) { @@ -395,148 +374,6 @@ public class FileAccess } } - // checks if the root of a path exists. if the parameter xWindowPeer is not null then also the directory is - // created when it does not exists and the user - public static boolean PathisValid(XMultiServiceFactory xMSF, String Path, String sMsgFilePathInvalid, boolean baskbeforeOverwrite) - { - try - { - String SubDir; - String SubDirPath = PropertyNames.EMPTY_STRING; - int SubLen; - int NewLen; - int RestLen; - boolean bexists; - boolean bSubDirexists = true; - String LowerCasePath; - String NewPath = Path; - XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - if (baskbeforeOverwrite) - { - if (xSimpleFileAccess.exists(Path)) - { - Resource oResource = new Resource(xMSF, "ImportWizard", "imp"); - String sFileexists = oResource.getResText(1053); - String NewString = JavaTools.convertfromURLNotation(Path); - sFileexists = JavaTools.replaceSubString(sFileexists, NewString, "<1>"); - sFileexists = JavaTools.replaceSubString(sFileexists, String.valueOf((char) 13), "<CR>"); - int iLeave = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sFileexists); - if (iLeave == 3) - { - return false; - } - } - } - String[] DirArray = JavaTools.ArrayoutofString(Path, "/"); - int MaxIndex = DirArray.length - 1; - if (MaxIndex > 0) - { - for (int i = MaxIndex; i >= 0; i--) - { - SubDir = DirArray[i]; - SubLen = SubDir.length(); - NewLen = NewPath.length(); - RestLen = NewLen - SubLen; - if (RestLen > 0) - { - NewPath = NewPath.substring(0, NewLen - SubLen - 1); - if (i == MaxIndex) - { - SubDirPath = NewPath; - } - bexists = xSimpleFileAccess.exists(NewPath); - if (bexists) - { - LowerCasePath = NewPath.toLowerCase(); - bexists = (!((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:")))); - } - if (bexists) - { - if (!bSubDirexists) - { - return createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath); - } - return true; - } - else - { - bSubDirexists = false; - } - } - } - } - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid); - return false; - } - catch (com.sun.star.uno.Exception exception) - { - exception.printStackTrace(System.err); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid); - return false; - } - } - - /** - * searches a directory for files which start with a certain - * prefix, and returns their URLs and document-titles. - * @param FilterName the prefix of the filename. a "-" is added to the prefix ! - * @param FolderName the folder (URL) to look for files... - * @return an array with two array members. The first one, with document titles, - * the second with the corresponding URLs. - * @deprecated please use the getFolderTitles() with ArrayList - */ - public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName) - { - String[][] LocLayoutFiles = new String[2][]; - try - { - java.util.ArrayList<String> TitleVector = null; - java.util.ArrayList<String> NameVector = null; - - XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); - XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); - - XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - - String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false); - - TitleVector = new java.util.ArrayList<String>(/*nameList.length*/); - NameVector = new java.util.ArrayList<String>(nameList.length); - - FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-"; - - String fileName = PropertyNames.EMPTY_STRING; - PropertyValue[] noArgs = { }; - for (int i = 0; i < nameList.length; i++) - { - fileName = getFilename(nameList[i]); - - if (FilterName == null || fileName.startsWith(FilterName)) - { - xDocProps.loadFromMedium(nameList[i], noArgs); - NameVector.add(nameList[i]); - TitleVector.add(xDocProps.getTitle()); - } - } - String[] LocNameList = new String[NameVector.size()]; - String[] LocTitleList = new String[TitleVector.size()]; - - NameVector.toArray(LocNameList); - TitleVector.toArray(LocTitleList); - LocLayoutFiles[1] = LocNameList; - LocLayoutFiles[0] = LocTitleList; - - JavaTools.bubblesortList(LocLayoutFiles); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - return LocLayoutFiles; - } - /** * We search in all given path for a given file */ @@ -704,12 +541,6 @@ public class FileAccess return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath()); } - public String getURL(String path) - { - File f = new File(path); - return filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath()); - } - public String getPath(String parentURL, String childURL) { return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL))); @@ -775,72 +606,12 @@ public class FileAccess return def; } - public boolean isDirectory(String filename) - { - try - { - return fileAccess.isFolder(filename); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - - return false; - } - - /** - * lists the files in a given directory - */ - public String[] listFiles(String dir, boolean includeFolders) - { - try - { - return fileAccess.getFolderContents(dir, includeFolders); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - - return new String[0]; - } - - public boolean delete(String file) - { - try - { - fileAccess.kill(file); - return true; - } - catch (CommandAbortedException e) - { - e.printStackTrace(System.err); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - - return false; - } - public static String getFilename(String path) { return getFilename(path, "/"); } - /** - * return the filename out of a system-dependent path - */ - public static String getPathFilename(String path) - { - return getFilename(path, File.separator); - } + private static String getFilename(String path, String pathSeparator) { @@ -855,37 +626,9 @@ public class FileAccess return filename.substring(0, filename.length() - (sExtension.length() + 1)); } - public boolean copy(String source, String target) - { - try - { - fileAccess.copy(source, target); - return true; - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - return false; - } - public DateTime getLastModified(String url) - { - try - { - return fileAccess.getDateTimeModified(url); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - return null; - } + /** * @return the parent dir of the given url. @@ -906,18 +649,7 @@ public class FileAccess return url.substring(0, lastPos); } - public String createNewDir(String parentDir, String name) - { - String s = getNewFile(parentDir, name, PropertyNames.EMPTY_STRING); - if (mkdir(s)) - { - return s; - } - else - { - return null; - } - } + private String getNewFile(String parentDir, String name, String extension) { @@ -939,18 +671,6 @@ public class FileAccess return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext); } - public int getSize(String url) - { - try - { - return fileAccess.getSize(url); - } - catch (Exception ex) - { - return -1; - } - } - public static String connectURLs(String urlFolder, String urlFilename) { return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") + @@ -989,33 +709,4 @@ public class FileAccess return sFileData; } - /** - * shortens a filename to a user displayable representation. - */ - public static String getShortFilename(String path, int maxLength) - { - int firstPart = 0; - - if (path.length() > maxLength) - { - if (path.startsWith("/")) - { // unix - int nextSlash = path.indexOf("/", 1) + 1; - firstPart = Math.min(nextSlash, (maxLength - 3) / 2); - } - else - { //windows - firstPart = Math.min(10, (maxLength - 3) / 2); - } - - String s1 = path.substring(0, firstPart); - String s2 = path.substring(path.length() - (maxLength - (3 + firstPart))); - - return s1 + "..." + s2; - } - else - { - return path; - } - } } diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index 9287bbccea31..79b6dcb5d74e 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -92,21 +92,7 @@ public class Helper } } - public static Object getPropertyValue(PropertyValue[] CurPropertyValue, String PropertyName) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - if (CurPropertyValue[i].Name.equals(PropertyName)) - { - return CurPropertyValue[i].Value; - } - } - } - throw new RuntimeException(); - } + public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName, java.lang.Class<?> xClass) { @@ -134,53 +120,9 @@ public class Helper } } - public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName) - { - if (CurPropertyValue != null) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - PropertyValue aValue = (PropertyValue) CurPropertyValue[i]; - if (aValue != null && aValue.Name.equals(PropertyName)) - { - return aValue.Value; - } - } - } - } - return null; - } - public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName, java.lang.Class<?> xClass) - { - try - { - if (CurPropertyValue != null) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - PropertyValue aValue = (PropertyValue) CurPropertyValue[i]; - if (aValue != null && aValue.Name.equals(PropertyName)) - { - return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), aValue.Value); - } - } - } - } - return null; - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return null; - } - } + + public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName) { @@ -382,20 +324,14 @@ public class Helper } - public String format(int formatIndex, int date) - { - return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date)); - } + public String format(int formatIndex, DateTime date) { return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date)); } - public String format(int formatIndex, long javaTimeInMillis) - { - return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(javaTimeInMillis)); - } + } public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF) diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index 0c52e9115d52..018314eaa4e8 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -34,37 +34,11 @@ public class JavaTools { } - public static String[] copyStringArray(String[] FirstArray) - { - if (FirstArray != null) - { - String[] SecondArray = new String[FirstArray.length]; - System.arraycopy(FirstArray, 0, SecondArray, 0, FirstArray.length); - return SecondArray; - } - else - { - return null; - } - } - public static Object[] initializeArray(Object[] olist, Object ovalue) - { - for (int i = 0; i < olist.length; i++) - { - olist[i] = ovalue; - } - return olist; - } - public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue) - { - for (int i = 0; i < olist.length; i++) - { - olist[i] = ovalue; - } - return olist; - } + + + public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index) { @@ -80,15 +54,7 @@ public class JavaTools return sRetArray; } - public static int[] initializeintArray(int FieldCount, int nValue) - { - int[] LocintArray = new int[FieldCount]; - for (int i = 0; i < LocintArray.length; i++) - { - LocintArray[i] = nValue; - } - return LocintArray; - } + /**converts a list of Integer values included in an Integer vector to a list of int values */ @@ -134,18 +100,7 @@ public class JavaTools } } - public static String[] multiDimListToArray(String[][] multidimlist) - { - String[] retlist = new String[] - { - }; - retlist = new String[multidimlist.length]; - for (int i = 0; i < multidimlist.length; i++) - { - retlist[i] = multidimlist[i][0]; - } - return retlist; - } + public static String getlongestArrayItem(String[] StringArray) { @@ -199,23 +154,7 @@ public class JavaTools return retvalue; } - public static int FieldInList(String[] SearchList, String SearchString, int StartIndex) - { - int FieldLen = SearchList.length; - int retvalue = -1; - if (StartIndex < FieldLen) - { - for (int i = StartIndex; i < FieldLen; i++) - { - if (SearchList[i].equals(SearchString)) - { - retvalue = i; - break; - } - } - } - return retvalue; - } + public static int FieldInTable(String[][] SearchList, String SearchString) { @@ -378,17 +317,7 @@ public class JavaTools return Hierarchy[Hierarchy.length - 1]; } - public static String getFileDescription(String sPath) - { - String sFilename = getFilenameOutOfPath(sPath); - String[] FilenameList = ArrayoutofString(sFilename, "."); - StringBuilder FileDescription = new StringBuilder(PropertyNames.EMPTY_STRING); - for (int i = 0; i < FilenameList.length - 1; i++) - { - FileDescription.append(FilenameList[i]); - } - return FileDescription.toString(); - } + public static String convertfromURLNotation(String _sURLPath) { @@ -406,20 +335,7 @@ public class JavaTools return sPath; } - public static DateTime getDateTime(long timeMillis) - { - java.util.Calendar cal = java.util.Calendar.getInstance(); - setTimeInMillis(cal, timeMillis); - DateTime dt = new DateTime(); - dt.Year = (short) cal.get(Calendar.YEAR); - dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH); - dt.Month = (short) (cal.get(Calendar.MONTH) + 1); - dt.Hours = (short) cal.get(Calendar.HOUR); - dt.Minutes = (short) cal.get(Calendar.MINUTE); - dt.Seconds = (short) cal.get(Calendar.SECOND); - dt.NanoSeconds = cal.get(Calendar.MILLISECOND)*1000000; - return dt; - } + private static long getTimeInMillis(Calendar _calendar) { @@ -434,12 +350,7 @@ public class JavaTools _calendar.setTime(dDate); } - public static long getMillis(DateTime time) - { - java.util.Calendar cal = java.util.Calendar.getInstance(); - cal.set(time.Year, time.Month, time.Day, time.Hours, time.Minutes, time.Seconds); - return getTimeInMillis(cal); - } + public static String[] removeOutdatedFields(String[] baselist, String[] _complist) { diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java index 2813b22647ea..32cc0cd80deb 100644 --- a/wizards/com/sun/star/wizards/common/NamedValueCollection.java +++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java @@ -45,20 +45,7 @@ public class NamedValueCollection m_values.put( i_name, i_value ); } - @SuppressWarnings("unchecked") - public final < T > T getOrDefault( final String i_key, final T i_default ) - { - if ( m_values.containsKey( i_key ) ) - { - final Object value = m_values.get( i_key ); - try - { - return (T)value; - } - catch ( ClassCastException e ) { } - } - return i_default; - } + public final < T extends XInterface > T queryOrDefault( final String i_key, final T i_default, Class<T> i_interfaceClass ) { @@ -70,11 +57,6 @@ public class NamedValueCollection return i_default; } - public final boolean has( final String i_key ) - { - return m_values.containsKey( i_key ); - } - public final PropertyValue[] getPropertyValues() { PropertyValue[] values = new PropertyValue[ m_values.size() ]; diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index 273af7def411..d3dd3b5df1d3 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -108,10 +108,7 @@ public class NumberFormatter } - public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue) - { - return _xNumberFormatter.convertNumberToString(_nkey, _dblValue); - } + public double convertStringToNumber(int _nkey, String _sString)throws Exception diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index f8dfbc163d3a..3e9778d48925 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -59,25 +59,7 @@ public class NumericalHelper // private c'tor, so no one can instantiate } - /** - * get the type of an object: returns all types that can possibly converted - * with this class. - * @param obj an object that is checked for conversion - * @return the type of the object - */ - public static int getType(Object obj) - { - try - { - TypeObject aTypeObject = getTypeObject(obj); - return aTypeObject.iType; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore this one; just return unknown type - } - return UNKNOWN_TYPE; - } + /** * get a byte value from the object @@ -135,68 +117,7 @@ public class NumericalHelper return retValue; } - /** - * get a char value from the object - * @return a char - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static char toChar(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - char retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case BYTE_TYPE: - retValue = (char) getByte(aTypeObject); - break; - case SHORT_TYPE: - retValue = (char) getShort(aTypeObject); - break; - case INT_TYPE: - retValue = (char) getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = (char) getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (char) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (char) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - String s = (String) aTypeObject.aValue; - if (s.length() > 0) - { - retValue = s.charAt(0); - } - else - { - retValue = (char) 0; - } - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to char: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (char) -1 : (char) 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 @@ -253,42 +174,11 @@ public class NumericalHelper return retValue; } - public static boolean isValidAndNumerical(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - return (NumericalHelper.isNumerical(aValue)); - } - } - return false; - } - public static boolean isValidAndBoolean(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - int nType = AnyConverter.getType(aValue).getTypeClass().getValue(); - return (nType == TypeClass.BOOLEAN_value); - } - } - return false; - } - public static boolean isValid(Object aValue) - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - return true; - } - } - return false; - } + + + /** @param aValue a object this can contain anything @@ -320,16 +210,7 @@ public class NumericalHelper } } - /** - @param _aValue a object this can contain anything - @return true, if the parameter aValue is type of real numbers - see also http://en.wikipedia.org/wiki/Mathematics - */ - public static boolean isRealNumber(Object _aValue) - { - return isNumerical(_aValue); - } /** @param aValue a object this can contain anything @@ -351,43 +232,9 @@ public class NumericalHelper } } - /** - * Can a given object be converted to a String array? - * @param aValue the object to test - * @return true, if the object can be converted to a String array. - */ - public static boolean isStringArray(Object aValue) - { - try - { - toStringArray(aValue); - return true; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore - } - return false; - } - /** - * Can a given object be converted to an int array? - * @param aValue the object to test - * @return true, if the object can be converted to an Integer array. - */ - public static boolean isIntegerArray(Object aValue) - { - try - { - toIntArray(aValue); - return true; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore - } - return false; - } + + /** * get an int value from the object @@ -829,198 +676,25 @@ public class NumericalHelper return retValue; } - /** - * get an int from an object - * @param _aValue a value that is constructed into an int - * @param _ndefaultValue the value that is returned, if conversion fails, or if 'aValue' is null - * @return an int value - */ - public static int toInt(Object _aValue, int _ndefaultValue) throws Exception - { - int nreturn = _ndefaultValue; - try - { - if ((_aValue != null) && (!(AnyConverter.isVoid(_aValue)))) - { - if (isInteger(_aValue)) - { - nreturn = toInt(_aValue); - } - else - { - DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, PropertyNames.EMPTY_STRING); - } - } - } - catch (com.sun.star.uno.Exception e) - { - DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING); - } - return nreturn; - } - /** - * get a long from an object - * @param aValue a value that is constructed into a long - * @param defaultValue the value that is returned, if conversion fails - * @return a long value - */ - public static long toLong(Object aValue, long defaultValue) - { - try - { - return toLong(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a float from an object - * @param aValue a value that is constructed into a float - * @param defaultValue the value that is returned, if conversion fails - * @return a long value - */ - public static float toFloat(Object aValue, float defaultValue) - { - try - { - return toFloat(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a double from an object - * @param aValue a value that is constructed into a double - * @param defaultValue the value that is returned, if conversion fails - * @return a double value - */ - public static double toDouble(Object aValue, double defaultValue) - { - try - { - return toDouble(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a string from an object - * @param aValue a value that is constructed into a string - * @param defaultValue the value that is returned, if conversion fails - * @return a string value - */ - public static String toString(Object aValue, String defaultValue) - { - try - { - return toString(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a boolean from an object - * @param aValue a value that is constructed into a boolean - * @param defaultValue the value that is returned, if conversion fails - * @return a boolean value - */ - public static boolean toBoolean(Object aValue, boolean defaultValue) - { - try - { - return toBoolean(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a int array from an object - * @param anArrayValue a value that is constructed into an int array - * @param defaultValue the value that is returned, if conversion fails - * @return an int array - */ - public static int[] toIntArray(Object anArrayValue, int[] defaultValue) - { - try - { - return toIntArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a short array from an object - * @param anArrayValue a value that is constructed into a short array - * @param defaultValue the value that is returned, if conversion fails - * @return a short array - */ - public static short[] toShortArray(Object anArrayValue, short[] defaultValue) - { - try - { - return toShortArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a string array from an object - * @param anArrayValue a value that is constructed into a string array - * @param defaultValue the value that is returned, if conversion fails - * @return a string array - */ - public static String[] toStringArray(Object anArrayValue, String[] defaultValue) - { - try - { - return toStringArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a hexadecimal representation from a number - * @param number the number to transform - * @return a String with the hex code of the number - */ - public static String getHexStringFromNumber(long number) - { - TransformNumToHex num = new TransformNumToHex(number); - return num.getResult(); - } + + + + + + + + + + /** * get the type object from the given object @@ -1337,16 +1011,9 @@ public class NumericalHelper return aShortVal; } - public static boolean representsIntegerNumber(double _dblvalue) - { - double dblsecvalue = ((int) _dblvalue); - return Double.compare(_dblvalue, dblsecvalue) == 0; - } - public static double roundDouble(Double _Dblvalue, int _ndecimals) - { - return roundDouble(_Dblvalue.doubleValue(), _ndecimals); - } + + private static double roundDouble(double _dblvalue, int _ndecimals) { diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index f319000cd9c9..660d4906f690 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -143,45 +143,7 @@ public class PropertySetHelper return nValue; } - /** - get a property and convert it to a short value - @param _sName the string name of the property - @param _nDefault if an error occur, return this value - @return the int value of the property - */ - public short getPropertyValueAsShort(String _sName, short _nDefault) - { - Object aObject = null; - short nValue = _nDefault; - if (m_xPropertySet != null) - { - try - { - aObject = m_xPropertySet.getPropertyValue(_sName); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - } - if (aObject != null) - { - try - { - nValue = NumericalHelper.toShort(aObject); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - DebugHelper.writeInfo("can't convert a object to short."); - } - } - return nValue; - } /** get a property and convert it to a double value @@ -230,46 +192,7 @@ public class PropertySetHelper return nValue; } - /** - get a property and convert it to a boolean value - @param _sName the string name of the property - @param _bDefault if an error occur, return this value - @return the boolean value of the property - */ - public boolean getPropertyValueAsBoolean(String _sName, boolean _bDefault) - { - Object aObject = null; - boolean bValue = _bDefault; - if (m_xPropertySet != null) - { - try - { - aObject = m_xPropertySet.getPropertyValue(_sName); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - DebugHelper.writeInfo(e.getMessage()); - DebugHelper.writeInfo("UnknownPropertyException caught: Name:=" + _sName); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - } - if (aObject != null) - { - try - { - bValue = NumericalHelper.toBoolean(aObject); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - DebugHelper.writeInfo("can't convert a object to boolean."); - } - } - return bValue; - } /** get a property and convert it to a string value @@ -338,15 +261,7 @@ public class PropertySetHelper return aObject; } - /** - * Debug helper, to show all properties which are available in the given object. - * @param _xObj the object of which the properties should shown - */ - public static void showProperties(Object _xObj) - { - PropertySetHelper aHelper = new PropertySetHelper(_xObj); - aHelper.showProperties(); - } + /** Debug helper, to show all properties which are available in the current object. diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index 33e3557ac263..14e3a1a88e52 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -84,18 +84,7 @@ public class Resource } } - public PropertyValue[] getStringList(int nID) - { - try - { - return (PropertyValue[])this.xStringListIndexAccess.getByIndex(nID); - } - catch (Exception exception) - { - exception.printStackTrace(); - throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found"); - } - } + public String[] getResArray(int nID, int iCount) { diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index 49674b243e5d..8ed3804f6069 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -84,20 +84,11 @@ public class SystemDialog return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILESAVE_AUTOEXTENSION); } - public static SystemDialog createOpenDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILEOPEN_SIMPLE); - } - public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", (short) 0); - } - public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", (short) 0); - } + + + private String subst(String path) { @@ -149,52 +140,14 @@ public class SystemDialog return sStorePath; } - public String callFolderDialog(String title, String description, String displayDir) - { - try - { - xFolderPicker.setDisplayDirectory(subst(displayDir)); - } - catch (com.sun.star.lang.IllegalArgumentException iae) - { - iae.printStackTrace(); - throw new IllegalArgumentException(iae.getMessage()); - } - xFolderPicker.setTitle(title); - xFolderPicker.setDescription(description); - if (execute(xFolderPicker)) - { - return xFolderPicker.getDirectory(); - } - else - { - return null; - } - } + private boolean execute(XExecutableDialog execDialog) { return execDialog.execute() == 1; } - public String[] callOpenDialog(boolean multiSelect, String displayDirectory) - { - try - { - xFilePicker.setMultiSelectionMode(multiSelect); - xFilePicker.setDisplayDirectory(subst(displayDirectory)); - if (execute(xExecutable)) - { - return xFilePicker.getFiles(); - } - } - catch (com.sun.star.lang.IllegalArgumentException exception) - { - exception.printStackTrace(); - } - return null; - } //("writer_StarOffice_XML_Writer_Template") 'StarOffice XML (Writer) private void addFilterToDialog(String sExtension, String filterName, boolean setToDefault) diff --git a/wizards/com/sun/star/wizards/common/TemplateElement.java b/wizards/com/sun/star/wizards/common/TemplateElement.java index caa40f0e2db3..07fc84f41fdd 100644 --- a/wizards/com/sun/star/wizards/common/TemplateElement.java +++ b/wizards/com/sun/star/wizards/common/TemplateElement.java @@ -20,5 +20,5 @@ package com.sun.star.wizards.common; interface TemplateElement { - void write(Object any) throws Exception; + } diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index 304f4d610c4b..a8b34dde0a94 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -312,20 +312,7 @@ public class CommandMetaData extends DBMetaData return false; } - public String[] getOrderableColumns(String[] _fieldnames) - { - ArrayList<String> aOrderableColumns = new ArrayList<String>(); - for (int i = 0; i < _fieldnames.length; i++) - { - FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); - if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) - { - aOrderableColumns.add(_fieldnames[i]); - } - } - String[] sretfieldnames = new String[aOrderableColumns.size()]; - return aOrderableColumns.toArray(sretfieldnames); - } + /** * @return Returns the command. @@ -468,23 +455,7 @@ public class CommandMetaData extends DBMetaData } } - /** - * the fieldnames passed over are not necessarily the ones that are defined in the class - */ - public boolean hasNumericalFields(String[] _DisplayFieldNames) - { - if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0) - { - for (int i = 0; i < _DisplayFieldNames.length; i++) - { - if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i]))) - { - return true; - } - } - } - return false; - } + public String getFieldTitle(String FieldName) { @@ -568,89 +539,9 @@ public class CommandMetaData extends DBMetaData return RecordFieldNames[i]; } - /**@deprecated use 'RelationController' class instead - * - */ - public String[] getReferencedTables(String _stablename, int _ncommandtype) - { - String[] sTotReferencedTables = new String[] - { - }; - try - { - if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility()) - { - java.util.ArrayList<String> TableVector = new java.util.ArrayList<String>(); - Object oTable = getTableNamesAsNameAccess().getByName(_stablename); - XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable); - xIndexKeys = xKeysSupplier.getKeys(); - for (int i = 0; i < xIndexKeys.getCount(); i++) - { - XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) - { - String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(sreftablename)) - { - TableVector.add(sreftablename); - } - } - } - if (TableVector.size() > 0) - { - sTotReferencedTables = new String[TableVector.size()]; - TableVector.toArray(sTotReferencedTables); - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return sTotReferencedTables; - } - /**@deprecated use 'RelationController' class instead - */ - public String[][] getKeyColumns(String _sreferencedtablename) - { - String[][] skeycolumnnames = null; - try - { - for (int i = 0; i < xIndexKeys.getCount(); i++) - { - XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) - { - String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(scurreftablename)) - { - if (scurreftablename.equals(_sreferencedtablename)) - { - XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet); - String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); - skeycolumnnames = new String[2][smastercolnames.length]; - skeycolumnnames[0] = smastercolnames; - skeycolumnnames[1] = new String[smastercolnames.length]; - for (int n = 0; n < smastercolnames.length; n++) - { - XPropertySet xcolPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n])); - skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); - } - return skeycolumnnames; - } - } - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - return skeycolumnnames; - } + + private void setCommandComposingAttributes() { diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index d05d0aef0daf..b788f84eb2be 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -208,31 +208,7 @@ public class DBMetaData } } - public void setCommandTypes() - { - int TableCount; - int QueryCount; - int CommandCount; - int i; - int a; - TableCount = JavaTools.getArraylength(TableNames); - QueryCount = JavaTools.getArraylength(QueryNames); - CommandCount = TableCount + QueryCount; - CommandTypes = new int[CommandCount]; - if (TableCount > 0) - { - for (i = 0; i < TableCount; i++) - { - CommandTypes[i] = com.sun.star.sdb.CommandType.TABLE; - } - a = i; - for (i = 0; i < QueryCount; i++) - { - CommandTypes[a] = com.sun.star.sdb.CommandType.QUERY; - a += 1; - } - } - } + public boolean hasTableByName(String _stablename) { @@ -516,18 +492,7 @@ public class DBMetaData return isSQL92CheckEnabled; } - public String verifyName(String _sname, int _maxlen) - { - if (_sname.length() > _maxlen) - { - return _sname.substring(0, _maxlen); - } - if (this.isSQL92CheckEnabled()) - { - return Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), _sname); - } - return _sname; - } + public XDataSource getDataSource() { @@ -797,10 +762,7 @@ public class DBMetaData } } - public boolean supportsAutoIncrementation() - { - return false; - } + public boolean supportsQueriesInFrom() { diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index a2c0b090359a..f0d55d3859bb 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -214,17 +214,7 @@ public class FieldColumn FieldTitle = _sTitle; } - public static String getCommandName(String _DisplayName) - { - String locCommandName = null; - String[] sFieldMetaData = JavaTools.ArrayoutofString(_DisplayName, "."); - if (sFieldMetaData.length >= 2) - { - String locfieldname = sFieldMetaData[sFieldMetaData.length - 1]; - locCommandName = _DisplayName.substring(0, _DisplayName.length() - locfieldname.length() - 1); - } - return locCommandName; - } + public boolean isBoolean() { diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 8987d254d88e..04852ae5c80e 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -134,24 +134,7 @@ public class QueryMetaData extends CommandMetaData oRemainingFieldColumns.toArray(FieldColumns); } - public void removeFieldColumn(String _sFieldName, String _sCommandName) - { - FieldColumn oFieldColumn = getFieldColumn(_sFieldName, _sCommandName); - int a = 0; - if (oFieldColumn != null) - { - FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1]; - for (int i = 0; i < FieldColumns.length; i++) - { - if (!FieldColumns[i].getFieldName().equals(_sFieldName) && !FieldColumns[i].getCommandName().equals(_sCommandName)) - { - LocFieldColumns[a] = FieldColumns[i]; - a++; - } - } - FieldColumns = LocFieldColumns; - } - } + public String[] getIncludedCommandNames() { @@ -194,11 +177,7 @@ public class QueryMetaData extends CommandMetaData return sIncludedCommandNames; } - public String[] getFieldNamesOfCommand(String _sCommandName) - { - CommandObject oTable = getTableByName(_sCommandName); - return oTable.getColumns().getElementNames(); - } + public void initializeFieldTitleSet() { diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 2423cc11ceba..24f1072fe305 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -122,20 +122,7 @@ public class SQLQueryComposer } } - public void appendFilterConditions() - { - try - { - for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++) - { - m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public void prependSortingCriteria() throws SQLException { diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index 77c46538902b..a430d93cbd0f 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -640,32 +640,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen } } - public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet) - { - try - { - if (!hasByName(_columnname)) - { - if (_columnname.equals(PropertyNames.EMPTY_STRING)) - { - return false; - } - else - { - ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor()); - oPropertySet.assignNewPropertySet(_columnname, _xNewColPropertySet); - ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, _columnname); - columncontainer.add(oColumnDescriptor); - return true; - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return false; - } + private XPropertySet addPrimaryKeyColumn(String _columnname) { diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index 75f4f82ad837..8811d0c98c3b 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -145,28 +145,7 @@ public class TypeInspector return _nNullable; } - public int getNullability(XPropertySet _xColPropertySet) - { - try - { - int i = getDataTypeIndex(_xColPropertySet, false); - if (i == -1) - { - return ColumnValue.NO_NULLS; - } - int nNullable = AnyConverter.toInt(_xColPropertySet.getPropertyValue("IsNullable")); - if (nNullable == ColumnValue.NULLABLE) - { - return nNullableInfos[i]; - } - return nNullable; - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return ColumnValue.NO_NULLS; - } + public boolean isColumnOrderable(XPropertySet _xColPropertySet) { diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index d896560c8775..07513eb3d38e 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -176,13 +176,7 @@ public class DatabaseControl extends Control } private static long m_nLongMax = 0; - public static long getLongMax() - { - if (m_nLongMax == 0) - { - } - return m_nLongMax; - } + private void setNumericLimits() { try diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 7c675a2c141b..2626cf5bc528 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -159,23 +159,9 @@ public class FormHandler return -1; } - public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF) - { - xMSF = _xMSF; - } - public String getModelServiceName(int _fieldtype) - { - int icontroltype = getControlType(_fieldtype); - if (icontroltype > -1) - { - return sModelServices[icontroltype]; - } - else - { - return null; - } - } + + private void initializeBasicControlValues() { @@ -252,21 +238,7 @@ public class FormHandler return xNamedForms.hasByName(_FormName); } - public void removeFormByName(String _FormName) - { - try - { - if (hasFormByName(_FormName)) - { - removeControlsofForm(_FormName); - xNamedFormContainer.removeByName(_FormName); - } - } - catch (com.sun.star.uno.Exception ex) - { - Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); - } - } + public void removeControlsofForm(String _FormName) { @@ -347,10 +319,7 @@ public class FormHandler } } - public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer) - { - return insertFormbyName(_FormName, _xNamedFormContainer); - } + public XNameContainer insertFormbyName(String _FormName) { @@ -427,30 +396,9 @@ public class FormHandler } } - public void moveShapesToNirwana() - { - try - { - for (int i = 0; i < this.xDrawPage.getCount(); i++) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos)); - } - } - catch (Exception e) - { - Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); - } - } - public void removeAllShapes() throws Exception - { - for (int i = this.xDrawPage.getCount(); i > -1; i--) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - removeShape(xShape); - } - } + + /** * By removing the shape the whole control is disposed too @@ -462,18 +410,7 @@ public class FormHandler XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape); xComponent.dispose(); } - // Destroy all Shapes in Nirwana - public void removeNirwanaShapes() throws Exception - { - for (int i = this.xDrawPage.getCount(); i > -1; i--) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - if (xShape.getPosition().Y < this.iYNirwanaPos) - { - xDrawPage.remove(xShape); - } - } - } + public XShape groupShapesTogether(XMultiServiceFactory _xMSF, XShape _xLabelShape, XShape _xControlShape) { diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index 69051833078e..3e19628a0557 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -66,25 +66,7 @@ public class OfficeDocument { } - public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL) - { - try - { - XEventsSupplier xEventssSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent); - PropertyValue[] oEventProperties = new PropertyValue[2]; - oEventProperties[0] = new PropertyValue(); - oEventProperties[0].Name = "EventType"; - oEventProperties[0].Value = EventType; // "Service", "StarBasic" - oEventProperties[1] = new PropertyValue(); - oEventProperties[1].Name = "Script"; //PropertyNames.URL; - oEventProperties[1].Value = EventURL; - xEventssSuppl.getEvents().replaceByName(EventName, oEventProperties); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent) { @@ -108,51 +90,7 @@ public class OfficeDocument } } - /** - * Create a new office document, attached to the given frame. - * @param sDocumentType e.g. swriter, scalc, ( simpress, scalc : not tested) - * @return the document Component (implements XComponent) object ( XTextDocument, or XSpreadsheedDocument ) - */ - public static Object createNewDocument(XFrame frame, String sDocumentType, boolean preview, boolean readonly) - { - PropertyValue[] loadValues = new PropertyValue[2]; - loadValues[0] = new PropertyValue(); - loadValues[0].Name = PropertyNames.READ_ONLY; - loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE; - loadValues[1] = new PropertyValue(); - loadValues[1].Name = "Preview"; - loadValues[1].Value = preview ? Boolean.TRUE : Boolean.FALSE; - - Object oDocument = null; - com.sun.star.frame.XComponentLoader xComponentLoader = null; - String sURL = "private:factory/" + sDocumentType; - - try - { - xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, frame); - /*if (frame.getName() == null || frame.getName().equals(PropertyNames.EMPTY_STRING)); - frame.setName("T" + System.currentTimeMillis());*/ - XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues); - - if (sDocumentType.equals("swriter")) - { - oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); - } - else if (sDocumentType.equals("scalc")) - { - oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); - //TODO: - // else if (sDocumentType == "simpress") - // else if (sDocumentType == "sdraw") - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - return oDocument; - } public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener) { @@ -273,43 +211,7 @@ public class OfficeDocument return oDocument; } - public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl) - { - try - { - XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent); - PropertyValue[] oStoreProperties; - if (FilterName.length() > 0) - { - oStoreProperties = new PropertyValue[2]; - oStoreProperties[0] = new PropertyValue(); - oStoreProperties[0].Name = "FilterName"; - oStoreProperties[0].Value = FilterName; - oStoreProperties[1] = new PropertyValue(); - oStoreProperties[1].Name = "InteractionHandler"; - oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); - } - else - { - oStoreProperties = new PropertyValue[0]; - } - if (bStoreToUrl) - { - xStoreable.storeToURL(StorePath, oStoreProperties); - } - else - { - xStoreable.storeAsURL(StorePath, oStoreProperties); - } - return true; - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return false; - } - } public static boolean close(XComponent xComponent) { @@ -366,59 +268,15 @@ public class OfficeDocument } } - public static PropertyValue[] getFileMediaDecriptor(XMultiServiceFactory xmsf, String url) - throws Exception - { - Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - PropertyValue[][] mediaDescr = new PropertyValue[1][1]; - mediaDescr[0][0] = new PropertyValue(); - mediaDescr[0][0].Name = PropertyNames.URL; - mediaDescr[0][0].Value = url; - String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); - if (type.equals(PropertyNames.EMPTY_STRING)) - { - return null; - } - else - { - return (PropertyValue[]) xNameAccess.getByName(type); - } - } - public static PropertyValue[] getTypeMediaDescriptor(XMultiServiceFactory xmsf, String type) - throws Exception - { - Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); - return (PropertyValue[]) xNameAccess.getByName(type); - } - /** - * returns the count of slides in a presentation, - * or the count of pages in a draw document. - * @param model a presentation or a draw document - * @return the number of slides/pages in the given document. - */ - public static int getSlideCount(Object model) - { - XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, model); - return xDrawPagesSupplier.getDrawPages().getCount(); - } - public static XDocumentProperties getDocumentProperties(Object document) - { - XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document); - return xDocumentPropertiesSupplier.getDocumentProperties(); - } - public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText) - { - return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText); - } + + /** * @return Returns the xWindowPeer. diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index 29cb69f244f9..4663a1d268c1 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -129,11 +129,4 @@ public class DataEntrySetter } - public void toggleCheckBoxes() - { - boolean bdisplayalldata = optDisplayAllData.getState(); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata)); - } } diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index 19a8044c4729..e49bbe14efc7 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -106,10 +106,7 @@ public class Finalizer } } - public void toggleFinishButton() - { - CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0); - } + public String getName() { diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index c478745fb810..3ef163cd6b6b 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -132,13 +132,7 @@ public class FormConfiguration return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState())); } - public void toggleSubFormMode() - { - boolean bdoEnable = (this.chkcreateSubForm.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); - toggleSteps(); - } + public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController) { diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index d5ddf3f7daee..2257bd7bd79d 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -661,18 +661,7 @@ public class FormControlArranger cYOffset = _aPoint.Y; } - public void adjustYPositions(int _diffY) - { - for (int i = 0; i < DBControlList.length; i++) - { - Point aPoint = DBControlList[i].getPosition(); - DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); - aPoint = LabelControlList[i].getPosition(); - LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); - } - m_controlMaxPosY = -_diffY; - cYOffset = -_diffY; - } + public void setFormSize(Size _FormSize) { diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index bcb01d7bfea9..c860d3af7841 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -200,85 +200,11 @@ public class StyleApplier } } - public void changeLayout() - { - short iPos = lstStyles.getSelectedItemPos(); - if (iPos != iOldLayoutPos) - { - iOldLayoutPos = iPos; - String sFileName = FileNames[iPos]; - int[] iStyles = getStyleColors(sFileName); - applyDBControlProperties(iStyles); - } - curFormDocument.unlockallControllers(); - } - public Short getBorderType() { return IBorderValue; } - public void changeBorderLayouts() - { - try - { - curFormDocument.xTextDocument.lockControllers(); - - if (optNoBorder.getState()) - { - IBorderValue = new Short((short) 0); - } - else if (opt3DLook.getState()) - { - IBorderValue = new Short((short) 1); - } - else - { - IBorderValue = new Short((short) 2); - } - for (int m = 0; m < curFormDocument.oControlForms.size(); m++) - { - FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m); - if (curControlForm.getArrangemode() == FormWizard.AS_GRID) - { - GridControl oGridControl = curControlForm.getGridControl(); - oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - else - { - DatabaseControl[] DBControls = curControlForm.getDatabaseControls(); - for (int n = 0; n < DBControls.length; n++) - { - if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) - { - TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; - for (int i = 0; i < 2; i++) - { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); - if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) - { - xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - } - } - else - { - if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) - { - DBControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - } - } - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - curFormDocument.unlockallControllers(); - } - private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription) { int index = JavaTools.FieldInList(_sDataList, _sHeader); diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index ff92792e64cc..727e40b0a6a1 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -149,29 +149,7 @@ public class UIControlArranger return optAlignLeft.getState() ? (short)0 : (short)2; } - public void alignLabelControls() - { - try - { - short iAlignValue = getAlignValue(); - for (int m = 0; m < curFormDocument.oControlForms.size(); m++) - { - FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m); - if (curControlForm.getArrangemode() == FormWizard.COLUMNAR_LEFT) - { - Control[] LabelControls = curControlForm.getLabelControls(); - for (int n = 0; n < LabelControls.length; n++) - { - LabelControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short(iAlignValue)); - } - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + private void enableAlignControlGroup(boolean _bEnableAlignControlGroup) { diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 844c06bb8c37..853d478cb4f9 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -117,11 +117,7 @@ public class Finalizer }); } - public void changeTitle() - { - final String TitleName = m_aTxtTitle.getText(); - m_queryWizard.enableFinishButton( TitleName.length() > 0 ); - } + /* TODO: The title textbox always has to be updated when a new Table has been selected if it is clear that the user has not made any input meanwhile diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index df934cd1eb9c..7141da9e6ffd 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -35,30 +35,7 @@ public class CallReportWizard private static boolean bWizardstartedalready; - /** Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return Returns a <code>XSingleServiceFactory</code> for creating the component. - * @see com.sun.star.comp.loader.JavaLoader - * @param stringImplementationName The implementation name of the component. - * @param xMSF The service manager, who gives access to every known service. - * @param xregistrykey Makes structural information (except regarding treestructures) of a single - * registry key accessible. - */ - public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) - { - com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null; - if (stringImplementationName.equals( - ReportWizardImplementation.class.getName())) - { - xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory( - ReportWizardImplementation.class, - ReportWizardImplementation.__serviceName, - xMSF, - xregistrykey); - } - return xsingleservicefactory; - } + /** This class implements the component. At least the interfaces XServiceInfo, * XTypeProvider, and XInitialization should be provided by the service. diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 169f66bdcd93..7f49db1a9f0b 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -250,14 +250,7 @@ public class DBColumn oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } - public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell) - { - XTextCursor xTextCursor = TextDocument.createTextCursor(xCell); - xTextCursor.gotoStart(false); - xTextCursor.gotoEnd(true); - xTextCursor.setString(PropertyNames.EMPTY_STRING); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); - } + public void formatValueCell() { diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 68356b39d271..63c15a434280 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -146,22 +146,7 @@ public class ReportFinalizer } - /* - * This function is called if one of the radio buttons is pressed - */ - public void toggleSubTemplateControls() - { - // String sStorePath = PropertyNames.EMPTY_STRING; - Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE); - boolean bDoTemplateEnable = iState.shortValue() == 1; - CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); - CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); - CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); - String sTitle = xTitleTextBox.getText(); - boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING); - CurUnoDialog.enableFinishButton(!bDoEnable); - } public void initialize(RecordParser _CurDBMetaData) { String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0]; @@ -204,12 +189,7 @@ public class ReportFinalizer } } - public void changeReportTitle() - { - final String TitleName = xTitleTextBox.getText(); - CurReportDocument.liveupdate_updateReportTitle(TitleName); - CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName)); - } + public int getReportOpenMode() { diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 73b249da895c..f052ce219dce 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -119,29 +119,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen return oNumberFormatter; } - public boolean checkReportLayoutMode(String[] GroupFieldNames) - { - try - { - XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections(); - Object oTextSection; - if (GroupFieldNames.length > 0) - { - oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1)); - } - else - { - oTextSection = xTextSections.getByName(RECORDSECTION); - } - return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); - } - catch (Exception e) - { - Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); - // In doubt we rather suggest this is LayoutMode... - return true; - } - } + public void swapContentTemplate(String ContentTemplatePath) { @@ -211,10 +189,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames())); } - public void updateReportTitle(String _sTitleName) - { - m_xDocProps.setTitle(_sTitleName); - } + private void getReportPageStyles() { @@ -335,15 +310,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } - public void replaceFieldValueInRecordSection() - { - int GroupCount = CurDBMetaData.GroupFieldNames.length; - int FieldCount = CurDBMetaData.getFieldNames().length; - for (int i = GroupCount; i < FieldCount; i++) - { - DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - } - } + private void updateTextSections(String[] SelGroupNames) { @@ -376,21 +343,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen CurDBColumn.setCellFont(); } - public void replaceFieldValueInRecordTable() - { - String TableName = TBLRECORDSECTION; - String OldTableName = CurRecordTable.xTableName.getName(); - if (OldTableName.compareTo(TableName) != 0) - { - CurRecordTable.xTableName.setName(TableName); - } - int GroupCount = CurDBMetaData.GroupFieldNames.length; - int RecordCount = CurDBMetaData.getRecordFieldNames().length; - for (int i = GroupCount; i < RecordCount; i++) - { - DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - } - } + private void insertColumnstoRecordTable() { diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index 0524e42c894c..bef28fae4032 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java @@ -843,10 +843,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } - protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight) - { - return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1); - } + private Rectangle insertHorizontalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight) { diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index da89154bf025..c320cd618082 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -230,130 +230,15 @@ public class FieldFormatter implements XItemListener CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated); } - public void addFieldName() - { - String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, PropertyNames.EMPTY_STRING); - short icount = xlstFieldNames.getItemCount(); - if (CurUnoDialog.verifyfieldcount(icount)) - { - xlstFieldNames.addItem(snewfieldname, icount); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - icount - }); - toggleButtons(); - FieldDescription curfielddescription = new FieldDescription(snewfieldname); - CurUnoDialog.fielditems.put(snewfieldname, curfielddescription); - curTableDescriptor.addColumn(curfielddescription.getPropertyValues()); - updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname)); - CurUnoDialog.setControlVisible("oColumnDescriptor", true); - CurUnoDialog.repaintDialogStep(); - } - } - public void removeFieldName() - { - String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); - short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames); - String fieldname = fieldnames[ipos]; - xlstFieldNames.removeItems(ipos, (short) 1); - CurUnoDialog.fielditems.remove(fieldname); - int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); - if ((ipos) < ilistcount) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - else - { - if (ilistcount > -1) - { - ipos = (short) ((short) ilistcount - (short) 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - } - curTableDescriptor.dropColumnbyName(fieldname); - fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); - boolean benable = ((ipos > -1) && (ipos < fieldnames.length)); - if (benable) - { - String snewfieldname = fieldnames[ipos]; - updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname)); - toggleButtons(); - } - else - { - Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); - CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable); - } - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); - CurUnoDialog.setControlVisible("oColumnDescriptor", benable); - CurUnoDialog.repaintDialogStep(); - } - public void modifyFieldName() - { - String newfieldname = txtfieldname.getText(); - String oldfieldname = xlstFieldNames.getSelectedItem(); - if (!newfieldname.equals(oldfieldname)) - { - if (curTableDescriptor.modifyColumnName(oldfieldname, newfieldname)) - { - Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column"); - Helper.setUnoPropertyValue(oColumn, PropertyNames.PROPERTY_NAME, newfieldname); - FieldDescription curfielddescription = CurUnoDialog.fielditems.get(oldfieldname); - CurUnoDialog.fielditems.remove(oldfieldname); - curfielddescription.setName(newfieldname); - CurUnoDialog.fielditems.put(newfieldname, curfielddescription); - String[] fieldnames = xlstFieldNames.getItems(); - short ipos = xlstFieldNames.getSelectedItemPos(); - fieldnames[ipos] = newfieldname; - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, fieldnames); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - } - } - public void shiftFieldNameUp() - { - short ipos = xlstFieldNames.getSelectedItemPos(); - String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); - if ((ipos - 1) > -1) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - (short) (ipos - 1) - }); - curTableDescriptor.moveColumn(ipos, ipos - 1); - } - toggleButtons(); - } - public void shiftFieldNameDown() - { - short ipos = xlstFieldNames.getSelectedItemPos(); - String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); - if ((ipos + 1) < xlstFieldNames.getItemCount()) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - (short) (ipos + 1) - }); - curTableDescriptor.moveColumn(ipos, ipos + 1); - } - toggleButtons(); - } + + + + + private String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount) { diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 946b71b9e34f..be154da43d26 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -333,30 +333,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener return bischecked; } - public void onPrimeKeySelected() - { - try - { - String selfieldname = lstSinglePrimeKey.getSelectedItem(); - boolean bdoenable = isAutoIncrementatable(selfieldname); - CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); - XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname); - boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue(); - if (bIsAutoIncremented) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 1)); - } - else - { - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 0)); - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + private void toggleAutomaticAutoValueCheckBox() { diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 458f95612844..6b60f063929f 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -152,18 +152,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X initializeCategory(BUSINESS); } - public void selectCategory() - { - if (optBusiness.getState()) - { - initializeCategory(BUSINESS); - } - else - { - initializeCategory(PRIVATE); - } - } - private void initializeCategory(int _iCategory) { try @@ -268,16 +256,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X return smytable; } - public void fillupTables() - { - } - - public void fillupFieldsListbox() - { - super.emptyFieldsListBoxes(); - } - - /* (non-Javadoc) * @see com.sun.star.awt.XItemListener#itemStateChanged(com.sun.star.awt.ItemEvent) */ diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index 7db7ea59a0d8..a604f2f29e86 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -333,29 +333,7 @@ public class TextDocument // to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the // two sequences of tablenames you can find out the tablename of the last inserted Table - // Todo: This method is unsecure because the last index is not necessarily the last section - public int getCharWidth(String ScaleString) - { - int iScale = 200; - xTextDocument.lockControllers(); - int iScaleLen = ScaleString.length(); - com.sun.star.text.XTextCursor xTextCursor = createTextCursor(xTextDocument.getText()); - xTextCursor.gotoStart(false); - com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); - xTextCursor.setString(ScaleString); - XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); - XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor(); - xTextViewCursor.gotoStart(false); - int iFirstPos = xTextViewCursor.getPosition().X; - xTextViewCursor.gotoEnd(false); - int iLastPos = xTextViewCursor.getPosition().X; - iScale = (iLastPos - iFirstPos) / iScaleLen; - xTextCursor.gotoStart(false); - xTextCursor.gotoEnd(true); - xTextCursor.setString(PropertyNames.EMPTY_STRING); - unlockallControllers(); - return iScale; - } + public void unlockallControllers() { @@ -365,102 +343,13 @@ public class TextDocument } } - public void refresh() - { - XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument); - xRefreshable.refresh(); - } - /** - * This method sets the Author of a Wizard-generated template correctly - * and adds a explanatory sentence to the template description. - * @param WizardName The name of the Wizard. - * @param TemplateDescription The old Description which is being appended with another sentence. - */ - public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription) - { - try - { - Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false); - XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD); - Object gn = xNA.getByName("givenname"); - Object sn = xNA.getByName("sn"); - String fullname = gn + PropertyNames.SPACE + sn; - - Calendar cal = new GregorianCalendar(); - int year = cal.get(Calendar.YEAR); - int month = cal.get(Calendar.MONTH); - int day = cal.get(Calendar.DAY_OF_MONTH); - DateTime currentDate = new DateTime(); - currentDate.Day = (short) day; - currentDate.Month = (short) month; - currentDate.Year = (short) year; - DateUtils du = new DateUtils(xMSF, this.xTextDocument); - int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY); - String myDate = du.format(ff, currentDate); - - XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); - XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties(); - xDocProps2.setAuthor(fullname); - xDocProps2.setModifiedBy(fullname); - String description = xDocProps2.getDescription(); - description = description + PropertyNames.SPACE + TemplateDescription; - description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>"); - description = JavaTools.replaceSubString(description, myDate, "<current_date>"); - xDocProps2.setDescription(description); - } - catch (NoSuchElementException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (WrappedTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (Exception e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - /** - * removes an arbitrary Object which supports the 'XTextContent' interface - */ - public boolean removeTextContent(Object oTextContent) - { - try - { - XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent); - xText.removeTextContent(xTextContent); - return true; - } - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - return false; - } - } - /** - * Apparently there is no other way to get the - * page count of a text document other than using a cursor and - * making it jump to the last page... - * @param model the document model. - * @return the page count of the document. - */ - public static int getPageCount(Object model) - { - XModel xModel = UnoRuntime.queryInterface(XModel.class, model); - XController xController = xModel.getCurrentController(); - XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController); - XTextViewCursor xTextVC = xTextVCS.getViewCursor(); - XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC); - xPC.jumpToLastPage(); - return xPC.getPage(); - } + + + + /* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles", "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */ diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java index d3ab23a51651..ab6d018f86bc 100644 --- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java @@ -281,35 +281,7 @@ public class TextFieldHandler } } - public void removeUserFieldByContent(String _FieldContent) - { - XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String"); - if (xDependentTextFields != null) - { - for (int i = 0; i < xDependentTextFields.length; i++) - { - xDependentTextFields[i].dispose(); - } - } - } - public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent) - { - try - { - XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("UserDataType", new Short(UserDataPart), "Short"); - if (xDependentTextFields != null) - { - for (int i = 0; i < xDependentTextFields.length; i++) - { - xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent); - } - } - refreshTextFields(); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + + } diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java index 44642f5c4f00..4c4a9ff10b48 100644 --- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java +++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java @@ -68,11 +68,7 @@ public class TextSectionHandler } } - public boolean hasTextSectionByName(String SectionName) - { - com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections(); - return xAllTextSections.hasByName(SectionName); - } + public void removeLastTextSection() { @@ -170,18 +166,7 @@ public class TextSectionHandler } } - public void breakLinkOfTextSection(Object oTextSection) - { - SectionFileLink oSectionLink = new SectionFileLink(); - oSectionLink.FileURL = PropertyNames.EMPTY_STRING; - Helper.setUnoPropertyValues(oTextSection, new String[] - { - "FileLink", "LinkRegion" - }, new Object[] - { - oSectionLink, PropertyNames.EMPTY_STRING - }); - } + public void linkSectiontoTemplate(String TemplateName, String SectionName) { diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java index c04d3b513415..cbd573ea1418 100644 --- a/wizards/com/sun/star/wizards/text/TextTableHandler.java +++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java @@ -109,24 +109,7 @@ public class TextTableHandler } } - public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor) - { - try - { - com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable"); - XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable); - if (xTextCursor == null) - { - xTextCursor = xTextDocument.getText().createTextCursor(); - xTextCursor.gotoEnd(false); - } - xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public void removeAllTextTables() { @@ -206,12 +189,7 @@ public class TextTableHandler } } - public static BreakType resetBreakTypeofTextTable(Object oTextTable) - { - BreakType BreakValue = (BreakType) com.sun.star.wizards.common.Helper.getUnoStructValue(oTextTable, "BreakType"); - Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE); - return BreakType.NONE; - } + public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable) { diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index d9e005043f8b..06e4f9bceec4 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -357,20 +357,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener return pageStart + i; } - public void intervalAdded(ListDataEvent event) - { - if (event.getIndex0() <= m_nCurrentSelection) - { - if (event.getIndex1() <= m_nCurrentSelection) - { - m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1; - } - } - if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols())) - { - refreshImages(); - } - } + /** Registers ItemListener to receive events. * @param listener The listener to register. @@ -553,27 +540,9 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener showButtons = b; } - public void nextPage() - { - if (pageStart < getListModel().getSize() - rows * cols) - { - setPageStart(pageStart + rows * cols); - } - } - public void prevPage() - { - if (pageStart == 0) - { - return; - } - int i = pageStart - rows * cols; - if (i < 0) - { - i = 0; - } - setPageStart(i); - } + + private void enableButtons() { @@ -649,16 +618,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener } - /** - * jump to the given item (display the screen - * that contains the given item). - */ - public void display(int i) - { - int is = (getCols() * getRows()); - int ps = (listModel.getSize() / is) * is; - setPageStart(ps); - } + public boolean isenabled() { diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index b738b4af2d8e..9fe81b84c2ce 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -116,10 +116,7 @@ public abstract class ControlScroller } } - protected void setScrollBarOrientationHorizontal() - { - Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, new Integer(ScrollBarOrientation.HORIZONTAL)); - } + /** * @param _ntotfieldcount The number of fields that are to be administered by the ControlScroller @@ -278,29 +275,11 @@ public abstract class ControlScroller return nscrollvalue; } - protected void setLineIncrementation(int _nlineincrement) - { - this.nlineincrement = _nlineincrement; - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", new Integer(nlineincrement)); - } - protected int getLineIncrementation() - { - return nlineincrement; - } - protected void setBlockIncrementation(int _nblockincrement) - { - this.nblockincrement = _nblockincrement; - Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] - { - PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "ScrollValueMax" - }, new Object[] - { - Boolean.valueOf(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement) - }); - } + + protected int getBlockIncrementation() { @@ -396,10 +375,7 @@ public abstract class ControlScroller } } - protected PropertyValue[] getControlGroupInfo(int _i) - { - return scrollfields.get(_i); - } + private void setControlData(String controlname, Object newvalue) { diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index 81119688b061..66b70426873f 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -124,14 +124,6 @@ public abstract class DBLimitedFieldSelection } - protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames); - short[] SelList = null; - int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName); - SelList = new short[] { (short) (index) }; - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList); - } } diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 7a7047c44038..ba3d83e261a2 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -491,11 +491,7 @@ public class FieldSelection } } - public void mergeList(String[] AllFieldNames) - { - xFieldsListBox.addItems(AllFieldNames, (short) 0); - toggleListboxButtons((short) - 1, (short) - 1); - } + public void intializeSelectedFields(String[] _SelectedFieldNames) { @@ -521,15 +517,7 @@ public class FieldSelection toggleListboxControls(Boolean.TRUE); } - public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount) - { - String[] AllFieldNames_ = new String[_AllFieldNamesTable.length]; - for (int i = 0; i < _AllFieldNamesTable.length; i++) - { - AllFieldNames_[i] = _AllFieldNamesTable[i][0]; - } - initialize(AllFieldNames_, _AppendMode, _maxfieldcount); - } + public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount) { diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 7bfcc765fc6b..9c416f02df8f 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -923,16 +923,8 @@ public class FilterComponent return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue")); } - protected Object getText() - { - return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text")); - } - protected String getDateTimeString() - { - double dblValue = ((Double) getValue()).doubleValue(); - NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter(); - return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue); - } + + } } diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java index 89a10f04f5ce..36bc2f4a5af4 100644 --- a/wizards/com/sun/star/wizards/ui/PeerConfig.java +++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java @@ -163,25 +163,9 @@ public class PeerConfig implements XWindowListener }); } - public void setAccessibleName(XControl _xControl, String _saccessname) - { - setPeerProperties(_xControl, new String[] - { - "AccessibleName" - }, new String[] - { - _saccessname - }); - } - /** - * @param oAPIControl an API control that the interface XControl can be derived from - */ - public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues) - { - XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl); - setPeerProperties(xControl, _propnames, _propvalues); - } + + public void setPeerProperties(XControl _xControl, String[] propnames, Object[] propvalues) { @@ -189,15 +173,7 @@ public class PeerConfig implements XWindowListener this.m_aPeerTasks.add(oPeerTask); } - /** - * assigns an arbitrary property to a control as soon as the peer is created - * Note: The property 'ImageUrl' should better be assigned with 'setImageurl(...)', to consider the High Contrast Mode - */ - public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue) - { - ControlTask oControlTask = new ControlTask(_ocontrolmodel, _spropname, _propvalue); - this.aControlTasks.add(oControlTask); - } + /** * Assigns an image to the property 'ImageUrl' of a dialog control. The image id must be assigned in a resource file diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index 67db72753d47..93687627c64c 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -273,26 +273,7 @@ public class SortingComponent } } - public void disableListBoxesfromIndex(int CurIndex) - { - if (CurIndex < MAXSORTCRITERIAINDEX) - { - for (int i = CurIndex + 1; i <= MAXSORTCRITERIAINDEX; i++) - { - toggleSortListBox(i, (false)); - if (i < MaxSortIndex) - { - CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[] - { - 0 - }); - } - // xSortListBox[i+1].selectItemPos((short)0, true); - } - CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1)); - MaxSortIndex = CurIndex - 1; - } - } + // The following code can be reactivated in a future version when task #100799 will be fixed private void moveupSortItems(int CurIndex, boolean bDoEnable) diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 6f184f1cea30..a0b4c13f819b 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -198,24 +198,7 @@ public class UnoDialog implements EventNames } } - public void printControlProperties(String ControlName) - { - try - { - Object xControlModel = getDlgNameAccess().getByName(ControlName); - XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); - Property[] allProps = xPSet.getPropertySetInfo().getProperties(); - for (int i = 0; i < allProps.length; i++) - { - String sName = allProps[i].Name; - System.out.println(sName); - } - } - catch (com.sun.star.uno.Exception exception) - { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException, - exception.printStackTrace(System.err); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException - } - } + public double getMAPConversionFactor(String ControlName) { @@ -269,14 +252,7 @@ public class UnoDialog implements EventNames return ipos.length > 0; } - public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex) - { - xListBox.addItem(ListItem, xListBox.getItemCount()); - if (iSelIndex != -1) - { - xListBox.selectItemPos(iSelIndex, true); - } - } + public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues) { @@ -314,41 +290,9 @@ public class UnoDialog implements EventNames return xButton; } - public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception - { - Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", sName, sProperties, sValues); - XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectCheckBox = xDlgContainer.getControl(sName); - XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox); - if (xItemListener != null) - { - xCheckBox.addItemListener(xItemListener); - } - Integer ControlKey = new Integer(iControlKey); - if (ControlList != null) - { - ControlList.put(sName, ControlKey); - } - } - public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception - { - Object oNumericFieldModel = insertControlModel("com.sun.star.awt.UnoControlNumericFieldModel", sName, sProperties, sValues); - XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectNumericField = xDlgContainer.getControl(sName); - XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField); - if (xTextListener != null) - { - xNumericField.addTextListener(xTextListener); - } - Integer ControlKey = new Integer(iControlKey); - if (ControlList != null) - { - ControlList.put(sName, ControlKey); - } - } + + public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues) { @@ -431,30 +375,7 @@ public class UnoDialog implements EventNames return xListBox; } - public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception - { - XInterface xComboBoxModel = insertControlModel("com.sun.star.awt.UnoControlComboBoxModel", sName, sProperties, sValues); - XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xControlComboBox = xDlgContainer.getControl(sName); - XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControlComboBox); - if (xItemListener != null) - { - xComboBox.addItemListener(xItemListener); - } - if (xTextListener != null) - { - XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); - xTextComponent.addTextListener(xTextListener); - } - if (xActionListener != null) - { - xComboBox.addActionListener(xActionListener); - } - Integer ControlKey = new Integer(iControlKey); - ControlList.put(sName, ControlKey); - return xComboBox; - } + public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) { @@ -572,25 +493,7 @@ public class UnoDialog implements EventNames xWindow.setFocus(); } - public static String[] combineListboxList(String sFirstEntry, String[] MainList) - { - try - { - String[] FirstList = new String[] - { - sFirstEntry - }; - String[] ResultList = new String[MainList.length + 1]; - System.arraycopy(FirstList, 0, ResultList, 0, 1); - System.arraycopy(MainList, 0, ResultList, 1, MainList.length); - return ResultList; - } - catch (java.lang.Exception jexception) - { - jexception.printStackTrace(System.err); - return null; - } - } + public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex) { @@ -670,14 +573,7 @@ public class UnoDialog implements EventNames this.xWindow.setVisible(true); } - /** - * @return 0 for cancel, 1 for ok. - */ - public short executeDialog(UnoDialog parent) - throws com.sun.star.uno.Exception - { - return executeDialog(parent.xWindow.getPosSize()); - } + /** * @return 0 for cancel, 1 for ok. @@ -708,14 +604,7 @@ public class UnoDialog implements EventNames return executeDialog(Desktop.getActiveFrame(xMSF)); } - public void setAutoMnemonic(String ControlName, boolean bValue) - { - Object oControl = xDlgContainer.getControl(ControlName); - xControl = UnoRuntime.queryInterface(XControl.class, oControl); - XWindowPeer xWindowPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); - xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue)); - } + public void modifyFontWeight(String ControlName, float FontWeight) { @@ -755,33 +644,9 @@ public class UnoDialog implements EventNames return createWindowPeer(null); } - // deletes the first entry when this is equal to "DelEntryName" - // returns true when a new item is selected - public void deletefirstListboxEntry(String ListBoxName, String DelEntryName) - { - XControl xListControl = xDlgContainer.getControl(ListBoxName); - XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl); - String FirstItem = xListBox.getItem((short) 0); - if (FirstItem.equals(DelEntryName)) - { - short SelPos = xListBox.getSelectedItemPos(); - xListBox.removeItems((short) 0, (short) 1); - if (SelPos > 0) - { - setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]); - xListBox.selectItemPos((short) (SelPos - 1), true); - } - } - } - public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue) - { - Object oControl = xDlgContainer.getControl(ControlName); - XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl); - XWindowPeer xControlPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer); - xVclWindowPeer.setProperty(PropertyName, PropertyValue); - } + + public static Object getModel(Object control) { diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index 9d0d65badc4a..2d1ecbc70c0f 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -127,10 +127,7 @@ public class UnoDialog2 extends UnoDialog return xComboBox; } - public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, String[] sPropNames, Object[] oPropValues) - { - return insertComboBox(sName, actionPerformed, textChanged, itemChanged, this, sPropNames, oPropValues); - } + public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { @@ -169,21 +166,14 @@ public class UnoDialog2 extends UnoDialog return insertRadioButton(sName, itemChanged, this, sPropNames, oPropValues); } - public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues) - { - Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues); - return UnoRuntime.queryInterface(XControl.class, oTitledBox); - } + public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class); } - public XTextComponent insertTextField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertTextField(sName, sTextChanged, this, sPropNames, oPropValues); - } + public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues) { @@ -225,70 +215,49 @@ public class UnoDialog2 extends UnoDialog return (XControl) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, XControl.class); } - public XControl insertFileControl(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertFileControl(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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); } - public XCurrencyField insertCurrencyField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertCurrencyField(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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); } - public XDateField insertDateField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertDateField(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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); } - public XNumericField insertNumericField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertNumericField(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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); } - public XTimeField insertTimeField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertTimeField(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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); } - public XPatternField insertPatternField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertPatternField(sName, sTextChanged, this, sPropNames, oPropValues); - } + 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 XTextComponent insertFormattedField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertFormattedField(sName, sTextChanged, this, sPropNames, oPropValues); - } + public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues) { @@ -296,23 +265,11 @@ public class UnoDialog2 extends UnoDialog return UnoRuntime.queryInterface(XControl.class, oLine); } - public XScrollBar insertScrollBar(String sName, String[] sPropNames, Object[] oPropValues) - { - Object oScrollBar = insertControlModel2("com.sun.star.awt.UnoControlScrollBarModel", sName, sPropNames, oPropValues); - return UnoRuntime.queryInterface(XScrollBar.class, oScrollBar); - } - public XProgressBar insertProgressBar(String sName, String[] sPropNames, Object[] oPropValues) - { - Object oProgressBar = insertControlModel2("com.sun.star.awt.UnoControlProgressBarModel", sName, sPropNames, oPropValues); - return UnoRuntime.queryInterface(XProgressBar.class, oProgressBar); - } - public XControl insertGroupBox(String sName, String[] sPropNames, Object[] oPropValues) - { - Object oGroupBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues); - return UnoRuntime.queryInterface(XControl.class, oGroupBox); - } + + + private Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues) { @@ -338,10 +295,7 @@ public class UnoDialog2 extends UnoDialog return UnoRuntime.queryInterface(type, insertControlModel2(serviceName, componentName, sPropNames, oPropValues)); } - public static Object getControlModel(Object unoControl) - { - return UnoRuntime.queryInterface(XControl.class, unoControl).getModel(); - } + public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) { diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 825eecba647d..aac598d1c532 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -144,22 +144,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL nNewStep = nOldStep; } - public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) - { - try - { - nNewStep = itemEvent.ItemId; - nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP)); - if (nNewStep != nOldStep) - { - switchToStep(); - } - } - catch (com.sun.star.lang.IllegalArgumentException exception) - { - exception.printStackTrace(System.err); - } - } + public void setRoadmapInteractive(boolean _bInteractive) { @@ -494,25 +479,9 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled) - { - for (int i = 0; i < items.length; i++) - { - insertRoadmapItem(i, enabled[i], items[i], steps[i]); - } - } - /** This method also enables and disables the "next" button, - * if the step currently dis/enabled is the one of the next steps. - */ - public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton) - { - setStepEnabled(_nStep, bEnabled); - if (getNextAvailableStep() > 0) - { - enableNextButton(bEnabled); - } - } + + public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish) { @@ -586,29 +555,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - public synchronized void gotoPreviousAvailableStep() - { - boolean bIsEnabled; - if (nNewStep > 1) - { - nOldStep = nNewStep; - nNewStep--; - while (nNewStep > 0) - { - bIsEnabled = isStepEnabled(nNewStep); - if (bIsEnabled) - { - break; - } - nNewStep--; - } - if (nNewStep == 0) // Exception??? - { - nNewStep = nOldStep; - } - switchToStep(); - } - } + //TODO discuss with rp private int getNextAvailableStep() @@ -626,37 +573,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL return -1; } - public synchronized void gotoNextAvailableStep() - { - nOldStep = nNewStep; - nNewStep = getNextAvailableStep(); - if (nNewStep > -1) - { - switchToStep(); - } - } + public abstract boolean finishWizard(); - /** - * This function will call if the finish button is pressed on the UI. - */ - public void finishWizard_1() - { - enableFinishButton(false); - boolean success = false; - try - { - success = finishWizard(); - } - finally - { - if ( !success ) - enableFinishButton( true ); - } - if ( success ) - removeTerminateListener(); - } + public int getMaximalStep() { @@ -715,10 +636,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL xDialog.endExecute(); } - public void callHelp() - { - //should be overwritten by extending class - } + private void removeTerminateListener() { @@ -741,10 +659,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL removeTerminateListener(); } - public void windowHidden() - { - cancelWizard_1(); - } + public void notifyTermination(EventObject arg0) { diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java index af444f72cc16..fbcfd5670269 100644 --- a/wizards/com/sun/star/wizards/ui/XCompletion.java +++ b/wizards/com/sun/star/wizards/ui/XCompletion.java @@ -24,7 +24,7 @@ public interface XCompletion public boolean iscompleted(int _ndialogpage); - public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue); - public boolean ismodified(int _ndialogpage); + + } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 10d7d58fe147..7e45396f4fcc 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -178,33 +178,11 @@ public abstract class DataAware { return a.equals(b); } - /** - * given a collection containing DataAware objects, - * calls updateUI() on each memebr of the collection. - * @param dataAwares a collection containing DataAware objects. - */ - public static void updateUI(Collection<DataAware> dataAwares) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().updateUI(); - } - public static void updateData(Collection<DataAware> dataAwares) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().updateData(); - } - /** - * /** - * Given a collection containing DataAware objects, - * sets the given DataObject to each DataAware object - * in the given collection - * @param dataAwares a collection of DataAware objects. - * @param dataObject new data object to set to the DataAware objects in the given collection. - * @param updateUI if true, calls updateUI() on each DataAware object. - */public static void setDataObject(Collection<DataAware> dataAwares, Object dataObject, boolean updateUI) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().setDataObject(dataObject, updateUI); - } + + + /** * Value objects read and write a value from and diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java index b7e8209ea8a3..ab9e78f7b9e5 100644 --- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java +++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java @@ -77,12 +77,5 @@ public class MethodInvocation } } - /** - * This method is a convenience method. - * It is the same as calling invoke(null); - */ - public Object invoke() throws IllegalAccessException, InvocationTargetException - { - return invoke(null); - } + } diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java index c0440ee5d74c..75608d9ffcaf 100644 --- a/wizards/com/sun/star/wizards/ui/event/Task.java +++ b/wizards/com/sun/star/wizards/ui/event/Task.java @@ -37,15 +37,9 @@ public class Task max = max_; } - public void start() - { - fireTaskStarted(); - } - public void fail() - { - fireTaskFailed(); - } + + public int getMax() { @@ -75,26 +69,16 @@ public class Task } } - public void advance(boolean success_, String nextSubtaskName) - { - advance(success_); - setSubtaskName(nextSubtaskName); - } + public int getStatus() { return successful + failed; } - public void addTaskListener(TaskListener tl) - { - listeners.add(tl); - } - public void removeTaskListener(TaskListener tl) - { - listeners.remove(tl); - } + + private void fireTaskStatusChanged() { diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index 8130fc5c8d76..310c83ec0a28 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -112,10 +112,7 @@ public class UnoDataAware extends DataAware } } - public void disableControls(Object[] controls) - { - disableObjects = controls; - } + @Override protected Object getFromUI() @@ -150,37 +147,15 @@ public class UnoDataAware extends DataAware return uda; } - public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Text", field, PropertyNames.EMPTY_STRING); - } - public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Date", field, 0); - } - public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Time", field, 0); - } - public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Value", field, new Double(0)); - } - public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field) - { - XCheckBox xcheckBox = UnoRuntime.queryInterface(XCheckBox.class, checkBox); - final UnoDataAware uda = new UnoDataAware(data, - field - ? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0)) - : new DataAware.PropertyValue(prop, data), - checkBox, PropertyNames.PROPERTY_STATE); - xcheckBox.addItemListener(itemListener(uda, listener)); - return uda; - } + + + + + static XItemListener itemListener(final DataAware da, final Listener listener) { @@ -202,35 +177,16 @@ public class UnoDataAware extends DataAware }; } - public static UnoDataAware attachLabel(Object data, String prop, Object label, boolean field) - { - return new UnoDataAware(data, - field ? DataAwareFields.getFieldValueFor(data, prop, PropertyNames.EMPTY_STRING) - : new DataAware.PropertyValue(prop, data), - label, PropertyNames.PROPERTY_LABEL); - } - public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field) - { - XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, listBox); - final UnoDataAware uda = new UnoDataAware(data, - field - ? DataAwareFields.getFieldValueFor(data, prop, new short[0]) - : new DataAware.PropertyValue(prop, data), - listBox, PropertyNames.SELECTED_ITEMS); - xListBox.addItemListener(itemListener(uda, listener)); - return uda; - } + + public static Object getModel(Object control) { return UnoRuntime.queryInterface(XControl.class, control).getModel(); } - public static void setEnabled(Object control, boolean enabled) - { - setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE); - } + private static void setEnabled(Object control, Boolean enabled) { diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java index 72771f5b56ab..65e8504fd4a5 100644 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ b/xmerge/source/bridge/java/XMergeBridge.java @@ -280,25 +280,7 @@ public class XMergeBridge { return true; } - public String replace(String origString, String origChar, String replaceChar){ - String tmp=""; - int index=origString.indexOf(origChar); - if(index !=-1){ - while (index !=-1){ - String first =origString.substring(0,index); - first=first.concat(replaceChar); - tmp=tmp.concat(first); - origString=origString.substring(index+1,origString.length()); - index=origString.indexOf(origChar); - if(index==-1) { - tmp=tmp.concat(origString); - } - } - - } - return tmp; - } private String needsMask(String origString){ if (origString.contains("&")) { diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java index c3a12fef4cbb..d95e37cdc815 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/Convert.java @@ -221,61 +221,7 @@ public class Convert implements Cloneable { } } - /** - * NEW (HJ): - * Convert the input specified in calls to the <code>addInputStream</code> - * method to the output format specified by this <code>Convert</code> - * class. - * The (de)serializer may use the URLs to resolve links and choose name(s) - * for destination document(s). - * - * @return The output data. - * - * @param sFromURL URL of the source document (may be null if unknown) - * @param sToURL URL of the destination document (may be null if unknown) - * - * @throws ConvertException If any conversion error occurs. - * @throws IOException If any I/O error occurs. - */ - public ConvertData convert(String sFromURL, String sToURL) throws - ConvertException, IOException { - - ConvertData dataOut = new ConvertData(); - - if (toOffice) { - - // From device format to Office format - - DocumentDeserializerFactory myDocDeserializerFactory = - ci.getDocDeserializerFactory(); - DocumentDeserializer deser = - myDocDeserializerFactory.createDocumentDeserializer(inputCD); - Document officeDoc = deser instanceof DocumentSerializer2 ? - ((DocumentDeserializer2) deser).deserialize(sFromURL,sToURL) : - deser.deserialize(); - - - dataOut.addDocument(officeDoc); - return dataOut; - - } else { - // From Office format to device format - - DocumentSerializerFactory myDocSerializerFactory = - ci.getDocSerializerFactory(); - - Iterator<Object> e = inputCD.getDocumentEnumeration(); - - Document doc = (Document) e.next(); - DocumentSerializer ser = myDocSerializerFactory.createDocumentSerializer(doc); - dataOut = ser instanceof DocumentSerializer2 ? - ((DocumentSerializer2) ser).serialize(sFromURL,sToURL) : - ser.serialize(); - - return dataOut; - } - } /** * Returns the appropriate "Office" <code>Document</code> @@ -296,22 +242,6 @@ public class Convert implements Cloneable { } - /** - * Returns the appropriate "Device" <code>Document</code> - * object for this plug-in. - * - * @param name The name of the <code>Document</code> to create. - * @param is The <code>InputStream</code> corresponding to the - * <code>Document</code> to create. - * - * @return The appropriate "Device" <code>Document</code> - * object for this plug-in. - * - * @throws IOException If any I/O error occurs. - */ - public Document getDeviceDocument(String name, InputStream is) - throws IOException { - return(ci.getPluginFactory().createDeviceDocument(name, is)); - } + } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java index ccd03e227327..75417be8c527 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/ConverterFactory.java @@ -34,29 +34,7 @@ import org.openoffice.xmerge.util.registry.ConverterInfoMgr; */ public class ConverterFactory { - /** - * Confirms whether or not a particular conversion can be done - * based on the Mime types of the files to be converted to and - * from. - * - * @param mimeTypeIn The mime input type. - * @param mimeTypeOut The mime output type. - * - * @return true if the conversion is possible, false otherwise. - */ - public boolean canConvert(String mimeTypeIn, String mimeTypeOut) { - - ConverterInfo foundInfo; - // findConverterInfo expects the second paramenter to be the - // destination MimeType - if (ConverterInfo.isValidOfficeType(mimeTypeOut)) - foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeIn, mimeTypeOut); - else - foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeOut, mimeTypeIn); - - return foundInfo != null; - } /** 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 37480d7cbd61..475a7d166f5d 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 @@ -337,16 +337,7 @@ public class DOMDocument } - /** - * Initializes a new DOM <code>Document</code> with the content - * containing minimum XML tags. - * - * @throws IOException If any I/O error occurs. - */ - public final void initContentDOM() throws IOException { - contentDoc = createDOM(""); - } /** * <p>Creates a new DOM <code>Document</code> containing minimum diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java index 5e34469f9a49..961fc444d54e 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PalmDB.java @@ -332,60 +332,9 @@ public final class PalmDB { } - /** - * Write out the number of Records followed by what - * will be written out by each <code>Record</code> object. - * - * @param os The <code>OutputStream</code> to write the - * object. - * - * @throws IOException If any I/O error occurs. - */ - public void write(OutputStream os) throws IOException { - - DataOutputStream out = new DataOutputStream(os); - // write out PDB name - out.write(bName); - // write out 2 bytes for number of records - out.writeShort(records.length); - // let each Record object write out its own info. - for (Record record : records) { - record.write(out); - } - } - - /** - * Read the necessary data to create a PDB from - * the <code>InputStream</code>. - * - * @param is The <code>InputStream</code> to read data - * in order to restore the object. - * - * @throws IOException If any I/O error occurs. - */ - public void read(InputStream is) throws IOException { - - DataInputStream in = new DataInputStream(is); - - // read in the PDB name. - byte[] bytes = new byte[NAME_LENGTH]; - in.readFully(bytes); - store(bytes); - - // read in number of records - int nrec = in.readUnsignedShort(); - records = new Record[nrec]; - - // read in the Record infos - for (int i = 0; i < nrec; i++) { - - records[i] = new Record(); - records[i].read(in); - } - } /** * Override equals method of <code>Object</code>. diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java index d63156248fee..a9658c96af30 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbDecoder.java @@ -55,80 +55,7 @@ import java.io.DataInputStream; public final class PdbDecoder { - /** - * <p>This method decodes a PDB file into a <code>PalmDB</code> - * object.</p> - * - * <p>First, the header data is read using the <code>PdbHeader</code> - * <code>read</code> method. Next, the RecordList section is - * read and the <code>Record</code> offsets are stored for use when - * parsing the Records. Based on these offsets, the bytes - * corresponding to each <code>Record</code> are read and each is - * stored in a <code>Record</code> object. Lastly, the data is - * used to create a <code>PalmDB</code> object.</p> - * - * @param fileName PDB file name. - * - * @throws IOException If I/O error occurs. - */ - public PalmDB parse(String fileName) throws IOException { - - RandomAccessFile file = new RandomAccessFile(fileName, "r"); - - // read the PDB header - PdbHeader header = new PdbHeader(); - header.read(file); - - Record recArray[] = new Record[header.numRecords]; - if (header.numRecords != 0) { - - // read in the record indices + offsets - - int recOffset[] = new int[header.numRecords]; - byte recAttrs[] = new byte[header.numRecords]; - - for (int i = 0; i < header.numRecords; i++) { - - recOffset[i] = file.readInt(); - // read in attributes (1 byte) + unique id (3 bytes) - // take away the unique id, store the attributes - - int attr = file.readInt(); - recAttrs[i] = (byte) (attr >>> 24); - } - - - // read the records - - int lastIndex = header.numRecords - 1; - - for (int i = 0; i < lastIndex; i++) { - - file.seek(recOffset[i]); - int len = recOffset[i+1] - recOffset[i]; - byte[] bytes = new byte[len]; - file.readFully(bytes); - recArray[i] = new Record(bytes, recAttrs[i]); - } - - // last record - file.seek(recOffset[lastIndex]); - int len = (int) file.length() - recOffset[lastIndex]; - byte[] bytes = new byte[len]; - file.readFully(bytes); - recArray[lastIndex] = new Record(bytes, recAttrs[lastIndex]); - - } - - file.close(); - - // create PalmDB and return it - PalmDB pdb = new PalmDB(header.pdbName, header.creatorID, - header.typeID, header.version, header.attribute, recArray); - - return pdb; - } /** * <p>This method decodes a PDB file into a <code>PalmDB</code> diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java index a2ddbb19574b..85147c7980e2 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/PdbUtil.java @@ -33,59 +33,8 @@ public final class PdbUtil { final static int HEADER_SIZE = 78; - /** - * <p>This method converts a 4 letter string into the Palm ID - * integer.</p> - * - * <p>It is normally used to convert the Palm creator ID string into - * the integer version of it. Also use for data types, etc.</p> - * - * @param s Four character <code>String</code>. - * - * @return Palm ID representing the <code>String</code>. - * - * @throws ArrayIndexOutOfBoundsException If <code>String</code> - * parameter contains less than four characters. - */ - public static int intID(String s) { - // grab the first char and put it in the high bits - // note that we only want 8 lower bits of it. - int temp = s.charAt(0); - int id = temp << 24; - // grab the second char and add it in. - temp = s.charAt(1) & 0x00ff; - id += temp << 16; - // grab the second char and add it in. - temp = s.charAt(2) & 0x00ff; - id += temp << 8; - - // grab the last char and add it in - id += s.charAt(3) & 0x00ff; - - return id; - } - - - /** - * This method converts an integer into a <code>String</code> - * given the Palm ID format. - * - * @param i Palm ID. - * - * @return <code>String</code> representation. - */ - public static String stringID(int i) { - - char ch[] = new char[4]; - ch[0] = (char) (i >>> 24); - ch[1] = (char) ((i >> 16) & 0x00ff); - ch[2] = (char) ((i >> 8) & 0x00ff); - ch[3] = (char) (i & 0x00ff); - - return new String(ch); - } } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java index f3909beab31d..b90a285938ce 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java @@ -338,52 +338,6 @@ public abstract class OfficeDocument } /** - * Returns the embedded object corresponding to the name provided. - * The name should be stripped of any preceding path characters, such as - * '/', '.' or '#'. - * - * @param name The name of the embedded object to retrieve. - * - * @return An <code>EmbeddedObject</code> instance representing the named - * object. - */ - public EmbeddedObject getEmbeddedObject(String name) { - if (name == null) { - return null; - } - - if (embeddedObjects == null) { - getEmbeddedObjects(); - } - - if (embeddedObjects.containsKey(name)) { - return embeddedObjects.get(name); - } - else { - return null; - } - } - - - /** - * Adds a new embedded object to the document. - * - * @param embObj An instance of <code>EmbeddedObject</code>. - */ - public void addEmbeddedObject(EmbeddedObject embObj) { - if (embObj == null) { - return; - } - - if (embeddedObjects == null) { - embeddedObjects = new HashMap<String, EmbeddedObject>(); - } - - embeddedObjects.put(embObj.getName(), embObj); - } - - - /** * Read the Office <code>Document</code> from the given * <code>InputStream</code>. * diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java index 44eb33c3bdfc..4ed8f865c9bf 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/ParaStyle.java @@ -331,31 +331,10 @@ public class ParaStyle extends Style implements Cloneable { } - /** - * Check whether an attribute is set in this <code>Style</code>. - * - * @param attrIndex The attribute index to check. - * - * @return true if the attribute at specified index is set, - * false otherwise. - */ - public boolean isAttributeSet(int attrIndex) { - return isSet[attrIndex]; - } - /** - * Get the value of an integer attribute. - * - * @param attrIndex Index of the attribute. - * - * @return Value of the attribute, 0 if not set. - */ - public int getAttribute(int attrIndex) { - if (isSet[attrIndex]) - return value[attrIndex]; - else return 0; - } + + /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java index 6e85a41706f6..1f5bcd5ce44c 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/Style.java @@ -181,19 +181,7 @@ public class Style { } - /** - * Write this <code>Style</code> object's attributes to the given - * <code>Node</code>. This may involve writing child - * <code>Node</code> objects as well. This is similar to the - * <code>writeNode</code> method, but the <code>Node</code> - * already exists, and this does <b>not</b> write the name, - * family, and parent attributes, which are assumed to already - * exist in the <code>Node</code>. - * - * @param node The <code>Node</code> to add style attributes. - */ - public void writeAttributes(Node node) { - } + /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java index c60c43b0848e..70ac5cebfd35 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java @@ -231,20 +231,7 @@ public class StyleCatalog { } - /** - * Given a <code>Style</code> <code>s</code>, return the - * <code>style</code> that is the closest match. Not currently - * implemented. - * - * @param s <code>Style</code> to match. - * - * @return The <code>Style</code> that most closely matches. - */ - public Style getBestMatch(Style s) { - // DJP: is this needed? - // DJP ToDo: implement this - return null; - } + /** @@ -290,33 +277,7 @@ public class StyleCatalog { } - /** - * Dump the <code>Style</code> table in Comma Separated Value (CSV) - * format - * - * @param para If true, dump in paragraph <code>Style</code>, - * otherwise dump in text style. - */ - public void dumpCSV(boolean para) { - if (!para) { - TextStyle.dumpHdr(); - int nStyles = styles.size(); - for (int i = 0; i < nStyles; i++) { - Style s = styles.get(i); - if (s.getClass().equals(TextStyle.class)) - ((TextStyle)s).dumpCSV(); - } - } else { - ParaStyle.dumpHdr(); - int nStyles = styles.size(); - for (int i = 0; i < nStyles; i++) { - Style s = styles.get(i); - if (s.getClass().equals(ParaStyle.class)) - ((ParaStyle)s).dumpCSV(); - } - } - } /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java index b04579bde788..c3b4857e7f5c 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java @@ -258,36 +258,10 @@ public class TextStyle extends Style implements Cloneable { } - /** - * Return true if text <code>attribute</code> is set in this - * <code>Style</code>. An attribute that is set may have a - * value of <i>on</i> or <i>off</i>. - * - * @param attribute The attribute to check ({@link #BOLD}, - * {@link #ITALIC}, etc.). - * - * @return true if text <code>attribute</code> is set in this - * <code>Style</code>, false otherwise. - */ - public boolean isSet(int attribute) { - return (!((mask & attribute) == 0)); - } - /** - * Return true if the <code>attribute</code> is set to <i>on</i> - * - * @param attribute Attribute to check ({@link #BOLD}, - * {@link #ITALIC}, etc.) - * - * @return true if <code>attribute</code> is set to <i>on</i>, - * otherwise false. - */ - public boolean getAttribute(int attribute) { - if ((mask & attribute) == 0) - return false; - return (!((values & attribute) == 0)); - } + + /** @@ -335,19 +309,7 @@ public class TextStyle extends Style implements Cloneable { } - /** - * Set the font and/or background <code>Color</code> for this - * <code>Style</code>. - * - * @param fontColor The font <code>Color</code> to set. - * @param backgroundColor The background <code>Color</code> to set. - */ - public void setColors(Color fontColor, Color backgroundColor) { - if (fontColor != null) - this.fontColor = fontColor; - if (backgroundColor != null) - this.bgColor = backgroundColor; - } + /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java index bd47df2bb70b..20f1a790dcce 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java @@ -69,14 +69,7 @@ public class BookSettings implements OfficeConstants { this.hasColumnRowHeaders = hasColumnRowHeaders; } - /** - * Get the flag indicating whether we have row/column headers. - * - * @return Flag indicating whether we have row/column headers. - */ - public boolean hasColumnRowHeaders() { - return hasColumnRowHeaders; - } + /** * Gets the <code>Vector</code> of <code>SheetSettings</code> diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java index c0925599d3ec..3bf1dc70c2ec 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java @@ -169,20 +169,7 @@ public class Format implements Cloneable { return (!((attributes & attribute) == 0)); } - /** - * Return true if text <code>attribute</code> is set in this - * <code>Style</code>.An attribute that is set may have a - * value of <i>on</i> or <i>off</i>. - * - * @param attribute The attribute to check ({@link #BOLD}, - * {@link #ITALIC}, etc.). - * - * @return true if text <code>attribute</code> is set in this - * <code>Style</code>, false otherwise. - */ - public boolean isSet(int attribute) { - return (!((mask & attribute) == 0)); - } + /** * Set the formatting category of this object, ie number, date, diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java index 23d6f794c6e1..be2b5ccc3db5 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SheetSettings.java @@ -142,18 +142,7 @@ public class SheetSettings implements OfficeConstants { return (new Point(splitTypeX, splitTypeY)); } - /** - * Sets the top row visible in the lower pane and the leftmost column - * visibile in the right pane. - * - * @param top The top row visible in the lower pane - * @param left The leftmost column visibile in the right pane - */ - public void setTopLeft(int top, int left) { - posLeft = left; - posTop = top; - } /** * Gets the leftmost column visibile in the right pane. diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java index 3cc0a35e6b39..3b79122f32f6 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SpreadsheetEncoder.java @@ -41,15 +41,7 @@ public abstract class SpreadsheetEncoder { public abstract void createWorksheet(String sheetName) throws IOException; - /** - * Set a cell's formatting options via a separately create - * <code>Format</code> object. - * - * @param row The row number of the cell to be changed - * @param column The column number of the cell to be changed - * @param fmt Object containing formatting settings for this cell. - */ - public abstract void setCellFormat(int row, int column, Format fmt); + /** @@ -73,12 +65,7 @@ public abstract class SpreadsheetEncoder { public abstract int getNumberOfSheets(); - /** - * Get the names of the sheets in the WorkBook. - * - * @param sheet The required sheet. - */ - public abstract String getSheetName(int sheet); + /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java index 7a35abb03bd8..ae4988676052 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/merger/Iterator.java @@ -37,13 +37,7 @@ public interface Iterator { public Object next(); - /** - * Move to previous element in the sequence. - * - * @return The <code>Object</code> of the previous element in the sequence. - * If there is no previous element, then return null. - */ - public Object previous(); + /** @@ -55,13 +49,7 @@ public interface Iterator { public Object start(); - /** - * Move to the end of the sequence. - * - * @return The <code>Object</code> of the last element in the sequence. - * If it is empty, then return null. - */ - public Object end(); + /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java index 03722fb309ca..cf137abc6052 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/Debug.java @@ -192,37 +192,10 @@ public final class Debug { } - /** - * Prints out information regarding platform. - */ - public static void logSystemInfo() { - if (writer != null) { - writer.println(); - writer.println("Platform Information:"); - writer.println("OS : " + System.getProperty("os.name")); - writer.println("Version : " + System.getProperty("os.version")); - writer.println("Platform : " + System.getProperty("os.arch")); - writer.println("JDK Version : " + System.getProperty("java.version")); - writer.println("JDK Vendor : " + System.getProperty("java.vendor")); - writer.println(); - } - } - /** - * Prints out timestamp. - */ - public static void logTime() { - - if (writer != null) { - - Date time = Calendar.getInstance().getTime(); - DateFormat dt = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); - writer.println(dt.format(time)); - } - } /** @@ -300,29 +273,6 @@ public final class Debug { } - /** - * Converts the given bytes to a <code>String</code> of - * Hex digits. - * - * @param bytes <code>byte</code> array. - * - * @return Hex representation in a <code>String</code>. - */ - public static String byteArrayToHexString(byte bytes[]) { - - StringBuffer buff = new StringBuffer(); - - for (int i = 0; i < bytes.length; i++) { - int ch = (bytes[i] & 0xff); - String str = Integer.toHexString(ch); - if (str.length() < 2) - buff.append('0'); - buff.append(str); - buff.append(' '); - } - - return buff.toString(); - } } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java index 3b28d2f5ce8f..854be77254b7 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/TwipsConverter.java @@ -58,17 +58,7 @@ public class TwipsConverter { return twips; } - /** - * <p>Convert from twips to cm's</p> - * - * @param value The <code>short</code> to be converted. - * - * @return float containing the converted - */ - public static float twips2inches(int value) { - return (float) value/1440; - } |