diff options
Diffstat (limited to 'javaunohelper/com/sun/star')
24 files changed, 610 insertions, 610 deletions
diff --git a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java index ba928eb81c1f..411779faff92 100644 --- a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java +++ b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,10 +38,10 @@ import com.sun.star.comp.juhtest.SmoketestCommandEnvironment; * by this class. */ public class JavaUNOHelperServices { - + static private final String __service_smoketestCommandEnv = "com.sun.star.deployment.test.SmoketestCommandEnvironment"; - + /** * Gives a factory for creating the service. * This method is called by the <code>JavaLoader</code> @@ -55,11 +55,11 @@ public class JavaUNOHelperServices { public static XSingleComponentFactory __getComponentFactory(String sImplName) { XSingleComponentFactory xFactory = null; - + if ( sImplName.equals( SmoketestCommandEnvironment.class.getName() ) ) xFactory = Factory.createComponentFactory(SmoketestCommandEnvironment.class, SmoketestCommandEnvironment.getServiceNames()); - + return xFactory; } @@ -75,7 +75,7 @@ public class JavaUNOHelperServices { return Factory.writeRegistryServiceInfo(SmoketestCommandEnvironment.class.getName(), SmoketestCommandEnvironment.getServiceNames(), regKey); - } + } } diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index 04bba081e37f..d954f036820d 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -68,34 +68,34 @@ import java.util.Random; // insert the service manager xSet.insert( aSingleComponentFactory ); </pre> -*/ +*/ public class Bootstrap { - + private static void insertBasicFactories( XSet xSet, XImplementationLoader xImpLoader ) throws Exception { - // insert the factory of the loader + // insert the factory of the loader xSet.insert( xImpLoader.activate( "com.sun.star.comp.loader.JavaLoader", null, null, null ) ); - - // insert the factory of the URLResolver + + // insert the factory of the URLResolver xSet.insert( xImpLoader.activate( "com.sun.star.comp.urlresolver.UrlResolver", null, null, null ) ); - + // insert the bridgefactory xSet.insert( xImpLoader.activate( "com.sun.star.comp.bridgefactory.BridgeFactory", null, null, null ) ); - + // insert the connector xSet.insert( xImpLoader.activate( "com.sun.star.comp.connections.Connector", null, null, null ) ); - + // insert the acceptor xSet.insert( xImpLoader.activate( "com.sun.star.comp.connections.Acceptor", null, null, null ) ); } - + /** Bootstraps an initial component context with service manager and basic jurt components inserted. @param context_entries the hash table contains mappings of entry names (type string) to @@ -107,22 +107,22 @@ public class Bootstrap { { XImplementationLoader xImpLoader = UnoRuntime.queryInterface( XImplementationLoader.class, new JavaLoader() ); - + // Get the factory of the ServiceManager XSingleComponentFactory smgr_fac = UnoRuntime.queryInterface( XSingleComponentFactory.class, xImpLoader.activate( "com.sun.star.comp.servicemanager.ServiceManager", null, null, null ) ); - + // Create an instance of the ServiceManager XMultiComponentFactory xSMgr = UnoRuntime.queryInterface( XMultiComponentFactory.class, smgr_fac.createInstanceWithContext( null ) ); - + // post init loader XInitialization xInit = UnoRuntime.queryInterface( XInitialization.class, xImpLoader ); Object[] args = new Object [] { xSMgr }; xInit.initialize( args ); - + // initial component context if (context_entries == null) context_entries = new Hashtable( 1 ); @@ -132,22 +132,22 @@ public class Bootstrap { new ComponentContextEntry( null, xSMgr ) ); // ... xxx todo: add standard entries XComponentContext xContext = new ComponentContext( context_entries, null ); - + // post init smgr xInit = UnoRuntime.queryInterface( XInitialization.class, xSMgr ); args = new Object [] { null, xContext }; // no registry, default context xInit.initialize( args ); - + XSet xSet = UnoRuntime.queryInterface( XSet.class, xSMgr ); // insert the service manager xSet.insert( smgr_fac ); // and basic jurt factories insertBasicFactories( xSet, xImpLoader ); - + return xContext; } - + /** * Bootstraps a servicemanager with the jurt base components registered. * <p> @@ -159,10 +159,10 @@ public class Bootstrap { return UnoRuntime.queryInterface( XMultiServiceFactory.class, createInitialComponentContext( null ).getServiceManager() ); } - - + + /** Bootstraps the initial component context from a native UNO installation. - + @see cppuhelper/defaultBootstrap_InitialComponentContext() */ static public final XComponentContext defaultBootstrap_InitialComponentContext() @@ -171,12 +171,12 @@ public class Bootstrap { return defaultBootstrap_InitialComponentContext( null, null ); } /** Bootstraps the initial component context from a native UNO installation. - + @param ini_file ini_file (may be null: uno.rc besides cppuhelper lib) @param bootstrap_parameters bootstrap parameters (maybe null) - + @see cppuhelper/defaultBootstrap_InitialComponentContext() */ static public final XComponentContext defaultBootstrap_InitialComponentContext( @@ -197,7 +197,7 @@ public class Bootstrap { pairs[ n++ ] = (String)bootstrap_parameters.get( name ); } } - + if (! m_loaded_juh) { NativeLibraryLoader.loadLibrary( Bootstrap.class.getClassLoader(), "juh" ); @@ -208,7 +208,7 @@ public class Bootstrap { cppuhelper_bootstrap( ini_file, pairs, Bootstrap.class.getClassLoader() ) ); } - + static private boolean m_loaded_juh = false; static private native Object cppuhelper_bootstrap( String ini_file, String bootstrap_parameters [], ClassLoader loader ) @@ -216,27 +216,27 @@ public class Bootstrap { /** * Bootstraps the component context from a UNO installation. - * + * * @return a bootstrapped component context. - * + * * @since UDK 3.1.0 - */ + */ public static final XComponentContext bootstrap() throws BootstrapException { - + XComponentContext xContext = null; - + try { - // create default local component context + // create default local component context XComponentContext xLocalContext = createInitialComponentContext( null ); if ( xLocalContext == null ) throw new BootstrapException( "no local component context!" ); - + // find office executable relative to this class's class loader String sOffice = System.getProperty( "os.name" ).startsWith( "Windows" ) ? - "soffice.exe" : "soffice"; + "soffice.exe" : "soffice"; File fOffice = NativeLibraryLoader.getResource( Bootstrap.class.getClassLoader(), sOffice ); if ( fOffice == null ) @@ -245,7 +245,7 @@ public class Bootstrap { // create random pipe name String sPipeName = "uno" + Long.toString( (new Random()).nextLong() & 0x7fffffffffffffffL ); - + // create call with arguments String[] cmdArray = new String[7]; cmdArray[0] = fOffice.getPath(); @@ -255,26 +255,26 @@ public class Bootstrap { cmdArray[4] = "-nocrashreport"; cmdArray[5] = "-nolockcheck"; cmdArray[6] = "-accept=pipe,name=" + sPipeName + ";urp;"; - + // start office process Process p = Runtime.getRuntime().exec( cmdArray ); pipe( p.getInputStream(), System.out, "CO> " ); pipe( p.getErrorStream(), System.err, "CE> " ); - + // initial service manager XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); if ( xLocalServiceManager == null ) throw new BootstrapException( "no initial service manager!" ); - + // create a URL resolver XUnoUrlResolver xUrlResolver = UnoUrlResolver.create( xLocalContext ); - + // connection string String sConnect = "uno:pipe,name=" + sPipeName + ";urp;StarOffice.ComponentContext"; - + // wait until office is started for (int i = 0;; ++i) { try { @@ -301,13 +301,13 @@ public class Bootstrap { } catch ( java.lang.Exception e ) { throw new BootstrapException( e ); } - + return xContext; } private static void pipe( final InputStream in, final PrintStream out, final String prefix ) { - + new Thread( "Pipe: " + prefix) { public void run() { BufferedReader r = new BufferedReader( diff --git a/javaunohelper/com/sun/star/comp/helper/BootstrapException.java b/javaunohelper/com/sun/star/comp/helper/BootstrapException.java index 4d84a4f7dd3f..3136358c257f 100644 --- a/javaunohelper/com/sun/star/comp/helper/BootstrapException.java +++ b/javaunohelper/com/sun/star/comp/helper/BootstrapException.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,16 +30,16 @@ package com.sun.star.comp.helper; /** * BootstrapException is a checked exception that wraps an exception * thrown by the original target. - * + * * @since UDK 3.1.0 */ public class BootstrapException extends java.lang.Exception { - + /** * This field holds the target exception. */ private Exception m_target = null; - + /** * Constructs a <code>BootstrapException</code> with <code>null</code> as * the target exception. @@ -56,7 +56,7 @@ public class BootstrapException extends java.lang.Exception { */ public BootstrapException( String message ) { super( message ); - } + } /** * Constructs a <code>BootstrapException</code> with the specified @@ -69,17 +69,17 @@ public class BootstrapException extends java.lang.Exception { super( message ); m_target = target; } - + /** * Constructs a <code>BootstrapException</code> with a target exception. * - * @param target the target exception + * @param target the target exception */ public BootstrapException( Exception target ) { super(); m_target = target; } - + /** * Get the thrown target exception. * @@ -87,5 +87,5 @@ public class BootstrapException extends java.lang.Exception { */ public Exception getTargetException() { return m_target; - } + } } diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java index fe3336c1dbfb..fd4800d693b8 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,7 +45,7 @@ import java.util.Vector; class Disposer implements XEventListener { private XComponent m_xComp; - + //---------------------------------------------------------------------------------------------- Disposer( XComponent xComp ) { @@ -65,19 +65,19 @@ public class ComponentContext implements XComponentContext, XComponent private static final boolean DEBUG = false; private static final String SMGR_NAME = "/singletons/com.sun.star.lang.theServiceManager"; private static final String TDMGR_NAME = "/singletons/com.sun.star.reflection.theTypeDescriptionManager"; - + private Hashtable m_table; private XComponentContext m_xDelegate; - + private XMultiComponentFactory m_xSMgr; private boolean m_bDisposeSMgr; - + private Vector m_eventListener; /** Ctor to create a component context passing a hashtable for values and a delegator reference. Entries of the passed hashtable are either direct values or ComponentContextEntry objects. - + @param table entries @param xDelegate @@ -109,7 +109,7 @@ public class ComponentContext implements XComponentContext, XComponent { m_xSMgr = m_xDelegate.getServiceManager(); } - + // listen for delegate XComponent xComp = UnoRuntime.queryInterface( XComponent.class, m_xDelegate ); @@ -118,7 +118,7 @@ public class ComponentContext implements XComponentContext, XComponent xComp.addEventListener( new Disposer( this ) ); } } - + // XComponentContext impl //______________________________________________________________________________________________ public Object getValueByName( String rName ) @@ -169,7 +169,7 @@ public class ComponentContext implements XComponentContext, XComponent if (DEBUG) System.err.println( "### exception occured on late init of singleton instance \"" + rName + "\": " + exc.getMessage() ); } - + if (xInstance != null) { synchronized (entry) @@ -218,14 +218,14 @@ public class ComponentContext implements XComponentContext, XComponent { return m_xSMgr; } - + // XComponent impl //______________________________________________________________________________________________ public void dispose() { if (DEBUG) System.err.print( "> disposing context " + this ); - + // fire events EventObject evt = new EventObject( this ); Enumeration eventListener = m_eventListener.elements(); @@ -235,7 +235,7 @@ public class ComponentContext implements XComponentContext, XComponent listener.disposing( evt ); } m_eventListener.removeAllElements(); - + XComponent tdmgr = null; // dispose values, then service manager, then typdescription manager Enumeration keys = m_table.keys(); @@ -249,7 +249,7 @@ public class ComponentContext implements XComponentContext, XComponent { o = ((ComponentContextEntry)o).m_value; } - + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, o ); if (xComp != null) { @@ -265,7 +265,7 @@ public class ComponentContext implements XComponentContext, XComponent } } m_table.clear(); - + // smgr if (m_bDisposeSMgr) { @@ -277,13 +277,13 @@ public class ComponentContext implements XComponentContext, XComponent } } m_xSMgr = null; - + // tdmgr if (tdmgr != null) { tdmgr.dispose(); } - + if (DEBUG) System.err.println( "... finished" ); } @@ -293,8 +293,8 @@ public class ComponentContext implements XComponentContext, XComponent if (xListener == null) throw new com.sun.star.uno.RuntimeException( "Listener must not be null" ); if (m_eventListener.contains( xListener )) - throw new com.sun.star.uno.RuntimeException( "Listener already registred." ); - + throw new com.sun.star.uno.RuntimeException( "Listener already registred." ); + m_eventListener.addElement( xListener ); } //______________________________________________________________________________________________ @@ -303,8 +303,8 @@ public class ComponentContext implements XComponentContext, XComponent if (xListener == null) throw new com.sun.star.uno.RuntimeException( "Listener must not be null" ); if (! m_eventListener.contains( xListener )) - throw new com.sun.star.uno.RuntimeException( "Listener is not registered." ); - - m_eventListener.removeElement( xListener ); + throw new com.sun.star.uno.RuntimeException( "Listener is not registered." ); + + m_eventListener.removeElement( xListener ); } } diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java b/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java index 52b116469f7a..48e999d5700f 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContextEntry.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,11 +45,11 @@ public class ComponentContextEntry /** set entry value */ public Object m_value; - + /** Creating a late-init singleton entry component context entry. The second parameter will be ignored and overwritten during instanciation of the singleton instance. - + @param lateInit object factory or service string @param value @@ -61,7 +61,7 @@ public class ComponentContextEntry this.m_value = value; } /** Creating a direct value component context entry. - + @param value pass null */ diff --git a/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java b/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java index 826c812fa049..c748187babd3 100644 --- a/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java +++ b/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,32 +34,32 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.RuntimeException; /** The class provides a set of methods which create instances of the - com.sun.star.lang.RegistryServiceManager service. - + com.sun.star.lang.RegistryServiceManager service. + @deprecated use class Bootstrap instead */ public class RegistryServiceFactory { static { System.loadLibrary("juh"); } - + private static native Object createRegistryServiceFactory( - String writeRegistryFile, - String readRegistryFile, + String writeRegistryFile, + String readRegistryFile, boolean readOnly, ClassLoader loader); - + /** - * This bootstraps an initial service factory working on a registry. If the first or both + * This bootstraps an initial service factory working on a registry. If the first or both * parameters contain a value then the service factory is initialized with a simple registry * or a nested registry. Otherwise the service factory must be initialized later with a valid * registry. *<BR> - * @param writeRegistryFile file name of the simple registry or the first registry file of - * the nested registry which will be opened with read/write rights. This - * file will be created if necessary. - * @param readRegistryFile file name of the second registry file of the nested registry - * which will be opened with readonly rights. + * @param writeRegistryFile file name of the simple registry or the first registry file of + * the nested registry which will be opened with read/write rights. This + * file will be created if necessary. + * @param readRegistryFile file name of the second registry file of the nested registry + * which will be opened with readonly rights. * @return a new RegistryServiceFactory. */ public static XMultiServiceFactory create(String writeRegistryFile, String readRegistryFile) @@ -69,28 +69,28 @@ public class RegistryServiceFactory { } /** - * This bootstraps an initial service factory working on a registry. If the first or both + * This bootstraps an initial service factory working on a registry. If the first or both * parameters contain a value then the service factory is initialized with a simple registry * or a nested registry. Otherwise the service factory must be initialized later with a valid * registry. *<BR> - * @param writeRegistryFile file name of the simple registry or the first registry file of - * the nested registry which will be opened with read/write rights. This - * file will be created if necessary. - * @param readRegistryFile file name of the second registry file of the nested registry - * which will be opened with readonly rights. - * @param readOnly flag which specify that the first registry file will be opened with - * readonly rights. Default is FALSE. If this flag is used the registry - * will not be created if not exist. + * @param writeRegistryFile file name of the simple registry or the first registry file of + * the nested registry which will be opened with read/write rights. This + * file will be created if necessary. + * @param readRegistryFile file name of the second registry file of the nested registry + * which will be opened with readonly rights. + * @param readOnly flag which specify that the first registry file will be opened with + * readonly rights. Default is FALSE. If this flag is used the registry + * will not be created if not exist. * * @return a new RegistryServiceFactory */ public static XMultiServiceFactory create(String writeRegistryFile, String readRegistryFile, boolean readOnly) throws com.sun.star.uno.Exception { - // Ensure that we are on a native threads vm + // Ensure that we are on a native threads vm // (binary UNO does use native threads). - String vm_info = System.getProperty("java.vm.info"); + String vm_info = System.getProperty("java.vm.info"); if(vm_info != null && vm_info.indexOf("green") != -1) throw new RuntimeException(RegistryServiceFactory.class.toString() + ".create - can't use binary UNO with green threads"); @@ -107,7 +107,7 @@ public class RegistryServiceFactory { // } else // throw new com.sun.star.uno.Exception(writeRegistryFile + " doese not exist!"); // } - + // if (readRegistryFile != null) { // java.io.File file = new java.io.File(readRegistryFile); @@ -122,18 +122,18 @@ public class RegistryServiceFactory { writeRegistryFile, readRegistryFile, readOnly, RegistryServiceFactory.class.getClassLoader() ); return UnoRuntime.queryInterface( - XMultiServiceFactory.class, obj ); + XMultiServiceFactory.class, obj ); } /** * This bootstraps an initial service factory working on a registry file. *<BR> - * @param registryFile file name of the registry to use/ create; if this is an empty - * string, the default registry is used instead + * @param registryFile file name of the registry to use/ create; if this is an empty + * string, the default registry is used instead * * @return a new RegistryServiceFactory. */ - public static XMultiServiceFactory create(String registryFile) + public static XMultiServiceFactory create(String registryFile) throws com.sun.star.uno.Exception { return create(registryFile, null, false); @@ -142,15 +142,15 @@ public class RegistryServiceFactory { /** * This bootstraps an initial service factory working on a registry file. *<BR> - * @param registryFile file name of the registry to use/ create; if this is an empty - * string, the default registry is used instead - * @param readOnly flag which specify that the registry file will be opened with - * readonly rights. Default is FALSE. If this flag is used the registry - * will not be created if not exist. - * + * @param registryFile file name of the registry to use/ create; if this is an empty + * string, the default registry is used instead + * @param readOnly flag which specify that the registry file will be opened with + * readonly rights. Default is FALSE. If this flag is used the registry + * will not be created if not exist. + * * @return a new RegistryServiceFactory. */ - public static XMultiServiceFactory create(String registryFile, boolean readOnly) + public static XMultiServiceFactory create(String registryFile, boolean readOnly) throws com.sun.star.uno.Exception { return create(registryFile, null, readOnly); diff --git a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java index e077fe6bb9bd..34d523a60516 100644 --- a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java +++ b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,34 +34,34 @@ import com.sun.star.registry.XRegistryKey; /** * @deprecated use class Bootstrap bootstrapping a native UNO installation * and use the shared library loader service. - * + * * The <code>SharedLibraryLoader</code> class provides the functionality of the <code>com.sun.star.loader.SharedLibrary</code> * service. * <p> * @see com.sun.star.loader.SharedLibrary * @see com.sun.star.comp.servicemanager.ServiceManager - * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.lang.ServiceManager */ public class SharedLibraryLoader { - /** - * The default library which contains the SharedLibraryLoader component + /** + * The default library which contains the SharedLibraryLoader component */ public static final String DEFAULT_LIBRARY = "shlibloader.uno"; - /** + /** * The default implementation name */ public static final String DEFAULT_IMPLEMENTATION = "com.sun.star.comp.stoc.DLLComponentLoader"; - + static { System.loadLibrary("juh"); } - - private static native boolean component_writeInfo( + + private static native boolean component_writeInfo( String libName, XMultiServiceFactory smgr, XRegistryKey regKey, ClassLoader loader ); - - private static native Object component_getFactory( + + private static native Object component_getFactory( String libName, String implName, XMultiServiceFactory smgr, XRegistryKey regKey, ClassLoader loader ); @@ -71,19 +71,19 @@ public class SharedLibraryLoader { * for the library and "com.sun.star.comp.stoc.DLLComponentLoader" * for the component name. * <p> - * @return the factory for the "com.sun.star.comp.stoc.DLLComponentLoader" component. - * @param smgr the ServiceManager - * @param regKey the root registry key - * @see com.sun.star.loader.SharedLibrary - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.registry.RegistryKey + * @return the factory for the "com.sun.star.comp.stoc.DLLComponentLoader" component. + * @param smgr the ServiceManager + * @param regKey the root registry key + * @see com.sun.star.loader.SharedLibrary + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.registry.RegistryKey */ public static XSingleServiceFactory getServiceFactory( - XMultiServiceFactory smgr, + XMultiServiceFactory smgr, XRegistryKey regKey ) { return UnoRuntime.queryInterface( - XSingleServiceFactory.class, + XSingleServiceFactory.class, component_getFactory( DEFAULT_LIBRARY, DEFAULT_IMPLEMENTATION, smgr, regKey, SharedLibraryLoader.class.getClassLoader() ) ); @@ -92,40 +92,40 @@ public class SharedLibraryLoader { /** * Loads and returns a specific factory for a given library and implementation name. * <p> - * @return the factory of the component - * @param libName the name of the shared library - * @param impName the implementation name of the component - * @param smgr the ServiceManager - * @param regKey the root registry key - * @see com.sun.star.loader.SharedLibrary - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.registry.RegistryKey + * @return the factory of the component + * @param libName the name of the shared library + * @param impName the implementation name of the component + * @param smgr the ServiceManager + * @param regKey the root registry key + * @see com.sun.star.loader.SharedLibrary + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.registry.RegistryKey */ public static XSingleServiceFactory getServiceFactory( String libName, String impName, - XMultiServiceFactory smgr, + XMultiServiceFactory smgr, XRegistryKey regKey ) { return UnoRuntime.queryInterface( - XSingleServiceFactory.class, + XSingleServiceFactory.class, component_getFactory( libName, impName, smgr, regKey, SharedLibraryLoader.class.getClassLoader() ) ); } - + /** * Registers the SharedLibraryLoader under a RegistryKey. * <p> - * @return true if the registration was successfull - otherwise false - * @param smgr the ServiceManager - * @param regKey the root key under that the component should be registered - * @see com.sun.star.loader.SharedLibrary - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.registry.RegistryKey + * @return true if the registration was successfull - otherwise false + * @param smgr the ServiceManager + * @param regKey the root key under that the component should be registered + * @see com.sun.star.loader.SharedLibrary + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.registry.RegistryKey */ public static boolean writeRegistryServiceInfo( - com.sun.star.lang.XMultiServiceFactory smgr, + com.sun.star.lang.XMultiServiceFactory smgr, com.sun.star.registry.XRegistryKey regKey ) { return component_writeInfo( @@ -136,20 +136,20 @@ public class SharedLibraryLoader { /** * Registers the SharedLibraryLoader under a RegistryKey. * <p> - * @return true if the registration was successfull - otherwise false - * @param libName name of the shared library - * @param smgr the ServiceManager - * @param regKey the root key under that the component should be registered - * @see com.sun.star.loader.SharedLibrary - * @see com.sun.star.lang.ServiceManager - * @see com.sun.star.registry.RegistryKey + * @return true if the registration was successfull - otherwise false + * @param libName name of the shared library + * @param smgr the ServiceManager + * @param regKey the root key under that the component should be registered + * @see com.sun.star.loader.SharedLibrary + * @see com.sun.star.lang.ServiceManager + * @see com.sun.star.registry.RegistryKey */ public static boolean writeRegistryServiceInfo( String libName, - com.sun.star.lang.XMultiServiceFactory smgr, + com.sun.star.lang.XMultiServiceFactory smgr, com.sun.star.registry.XRegistryKey regKey ) - - throws com.sun.star.registry.InvalidRegistryException, + + throws com.sun.star.registry.InvalidRegistryException, com.sun.star.uno.RuntimeException { return component_writeInfo( diff --git a/javaunohelper/com/sun/star/comp/helper/UnoInfo.java b/javaunohelper/com/sun/star/comp/helper/UnoInfo.java index d528f433ba59..896974b9e301 100644 --- a/javaunohelper/com/sun/star/comp/helper/UnoInfo.java +++ b/javaunohelper/com/sun/star/comp/helper/UnoInfo.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,7 @@ import java.net.URLClassLoader; /** * UnoInfo offers functionality to obtain the UNO jar files. - */ + */ public final class UnoInfo { /** @@ -45,7 +45,7 @@ public final class UnoInfo { * Gets the URL base. * * @return the URL base - */ + */ private static String getBase() { final String JUHJAR = "/juh.jar"; @@ -103,7 +103,7 @@ public final class UnoInfo { return getURLs( jarFileNames ); } - + /** * Gets the extra UNO types. * diff --git a/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java b/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java index 9e9d3cef59bf..a28d3a145544 100644 --- a/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java +++ b/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,15 +42,15 @@ public class SmoketestCommandEnvironment extends WeakBase static private final String __serviceName = "com.sun.star.deployment.test.SmoketestCommandEnvironment"; - + private XComponentContext m_cmpCtx; private XMultiComponentFactory m_xMCF; - + public SmoketestCommandEnvironment(XComponentContext xCompContext) { try { m_cmpCtx = xCompContext; - m_xMCF = m_cmpCtx.getServiceManager(); + m_xMCF = m_cmpCtx.getServiceManager(); } catch( Exception e ) { e.printStackTrace(); @@ -67,24 +67,24 @@ public class SmoketestCommandEnvironment extends WeakBase return getServiceNames(); } - + public boolean supportsService( String sServiceName ) { boolean bSupported = false; if (sServiceName.equals(__serviceName)) bSupported = true; return bSupported; } - + public String getImplementationName() { return SmoketestCommandEnvironment.class.getName(); } - + //XCommandEnvironment ================================================ public com.sun.star.task.XInteractionHandler getInteractionHandler() { return new InteractionImpl(); } - + public com.sun.star.ucb.XProgressHandler getProgressHandler() { return new ProgressImpl(); @@ -131,7 +131,7 @@ class InteractionImpl implements com.sun.star.task.XInteractionHandler //don't query again for ongoing extensions abort = false; } - } + } } } diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java index bcc2aa128fa5..60b4fe009397 100755 --- a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,66 +42,66 @@ import com.sun.star.io.XInputStream; import com.sun.star.io.XSeekable; import com.sun.star.lib.uno.helper.ComponentBase; -public class ByteArrayToXInputStreamAdapter +public class ByteArrayToXInputStreamAdapter extends ComponentBase implements XInputStream, XSeekable { - + byte[] m_bytes; int m_length; int m_pos; - + boolean m_open; - + /** Creates a new instance of ByteArrayXInputStram */ public ByteArrayToXInputStreamAdapter(byte[] bytes) { init(bytes); } - + public void init(byte[] bytes) { // System.err.println("ByteArrayXInputStream"); m_bytes = bytes; m_length = bytes.length; m_pos = 0; m_open = true; - } - + } + private void _check() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { if (m_bytes == null) { // System.err.println("check failed no bytes!"); throw new com.sun.star.io.NotConnectedException("no bytes"); } if(!m_open) { - // System.err.println("check failed: closed"); - throw new com.sun.star.io.IOException("input closed"); + // System.err.println("check failed: closed"); + throw new com.sun.star.io.IOException("input closed"); } } - + public int available() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { _check(); - long a = m_length - m_pos; - if (a != (int)a) - throw new com.sun.star.io.IOException("integer overflow"); + long a = m_length - m_pos; + if (a != (int)a) + throw new com.sun.star.io.IOException("integer overflow"); else { - // System.err.println("available() -> "+a); + // System.err.println("available() -> "+a); return (int)a; } } - + public void closeInput() throws com.sun.star.io.NotConnectedException, com.sun.star.io.IOException { // System.err.println("closeInput()"); - _check(); + _check(); m_open = false; } - + public int readBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { // System.err.println("readbytes(..., "+param+")"); _check(); - try { + try { int remain = (int)(m_length - m_pos); if (param > remain) param = remain; /* ARGH!!! */ - if (values[0] == null){ + if (values[0] == null){ values[0] = new byte[param]; // System.err.println("allocated new buffer of "+param+" bytes"); } @@ -111,20 +111,20 @@ public class ByteArrayToXInputStreamAdapter return param; } catch (ArrayIndexOutOfBoundsException ae) { // System.err.println("readbytes() -> ArrayIndexOutOfBounds"); - ae.printStackTrace(); + ae.printStackTrace(); throw new com.sun.star.io.BufferSizeExceededException("buffer overflow"); } catch (Exception e) { // System.err.println("readbytes() -> Exception: "+e.getMessage()); - e.printStackTrace(); + e.printStackTrace(); throw new com.sun.star.io.IOException("error accessing buffer"); } } - + public int readSomeBytes(byte[][] values, int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { // System.err.println("readSomebytes()"); return readBytes(values, param); } - + public void skipBytes(int param) throws com.sun.star.io.NotConnectedException, com.sun.star.io.BufferSizeExceededException, com.sun.star.io.IOException { // System.err.println("skipBytes("+param+")"); _check(); @@ -132,30 +132,30 @@ public class ByteArrayToXInputStreamAdapter throw new com.sun.star.io.BufferSizeExceededException("buffer overflow"); m_pos += param; } - + public long getLength() throws com.sun.star.io.IOException { // System.err.println("getLength() -> "+m_length); if (m_bytes != null) return m_length; else throw new com.sun.star.io.IOException("no bytes"); } - + public long getPosition() throws com.sun.star.io.IOException { // System.err.println("getPosition() -> "+m_pos); if (m_bytes != null) return m_pos; - else throw new com.sun.star.io.IOException("no bytes"); + else throw new com.sun.star.io.IOException("no bytes"); } - + public void seek(long param) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.io.IOException { // System.err.println("seek("+param+")"); if (m_bytes != null){ if (param < 0 || param > m_length) throw new com.sun.star.lang.IllegalArgumentException("invalid seek position"); else m_pos = (int)param; - }else throw new com.sun.star.io.IOException("no bytes"); + }else throw new com.sun.star.io.IOException("no bytes"); } - + public void finalize() throws Throwable{ // System.err.println("finalizer called for ByteArrayXInputStream!"); super.finalize(); } - + } diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java index 59ed553b3272..f143bf82f12a 100644 --- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,31 +30,31 @@ import java.io.IOException; import com.sun.star.io.XInputStream; import java.io.InputStream; -/** The <code>InputStreamToInputXStreamAdapter</code> wraps the - Java <code>InputStream</code> object into a - UNO <code>XInputStream</code> object. - This allows users to access an <code>InputStream</code> +/** The <code>InputStreamToInputXStreamAdapter</code> wraps the + Java <code>InputStream</code> object into a + UNO <code>XInputStream</code> object. + This allows users to access an <code>InputStream</code> as if it were an <code>XInputStream</code>. */ public class InputStreamToXInputStreamAdapter implements XInputStream { - /** + /** * Internal store to the InputStream */ private InputStream iIn; - + /** * Constructor. * - * @param in The <code>XInputStream</code> to be + * @param in The <code>XInputStream</code> to be * accessed as an <code>InputStream</code>. */ - public InputStreamToXInputStreamAdapter (InputStream in) + public InputStreamToXInputStreamAdapter (InputStream in) { iIn = in; } - public int available() throws + public int available() throws com.sun.star.io.IOException { @@ -69,8 +69,8 @@ public class InputStreamToXInputStreamAdapter implements XInputStream { return(bytesAvail); } - public void closeInput() throws - com.sun.star.io.IOException + public void closeInput() throws + com.sun.star.io.IOException { try { iIn.close(); @@ -79,8 +79,8 @@ public class InputStreamToXInputStreamAdapter implements XInputStream { } } - public int readBytes(byte[][] b, int len) throws - com.sun.star.io.IOException + public int readBytes(byte[][] b, int len) throws + com.sun.star.io.IOException { int count = 0; try { @@ -92,22 +92,22 @@ public class InputStreamToXInputStreamAdapter implements XInputStream { bytesRead = iIn.read(b[0], 0, len); } // Casting bytesRead to an int is okay, since the user can - // only pass in an integer length to read, so the bytesRead + // only pass in an integer length to read, so the bytesRead // must <= len. // if (bytesRead <= 0) { return(0); - } + } return ((int)bytesRead); - - + + } catch (IOException e) { throw new com.sun.star.io.IOException("reader error: "+e.toString()); } } - public int readSomeBytes(byte[][] b, int len) throws - com.sun.star.io.IOException + public int readSomeBytes(byte[][] b, int len) throws + com.sun.star.io.IOException { int count = 0; try { @@ -119,22 +119,22 @@ public class InputStreamToXInputStreamAdapter implements XInputStream { bytesRead = iIn.read(b[0], 0, len); } // Casting bytesRead to an int is okay, since the user can - // only pass in an integer length to read, so the bytesRead + // only pass in an integer length to read, so the bytesRead // must <= len. // if (bytesRead <= 0) { return(0); - } + } return ((int)bytesRead); - - + + } catch (IOException e) { throw new com.sun.star.io.IOException("reader error: "+e.toString()); } } - public void skipBytes(int n) throws - com.sun.star.io.IOException + public void skipBytes(int n) throws + com.sun.star.io.IOException { int avail; int tmpLongVal = n; @@ -154,7 +154,7 @@ public class InputStreamToXInputStreamAdapter implements XInputStream { tmpIntVal = (int)tmpLongVal; } tmpLongVal -= tmpIntVal; - + try { iIn.skip(tmpIntVal); } catch (IOException e) { diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java index 93ca681a8ce4..0f69faffa4ae 100644 --- a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,8 +32,8 @@ import com.sun.star.io.XOutputStream; import java.io.OutputStream; /** The <code>OutputStreamToXOutputStreamAdapter</code> wraps - a a UNO <code>XOutputStream</code> into a Java <code>OutputStream</code> - object in a Java. This allows users to access an <code>OutputStream</code> + a a UNO <code>XOutputStream</code> into a Java <code>OutputStream</code> + object in a Java. This allows users to access an <code>OutputStream</code> as if it were an <code>XOutputStream</code>. */ public class OutputStreamToXOutputStreamAdapter implements XOutputStream { @@ -53,8 +53,8 @@ public class OutputStreamToXOutputStreamAdapter implements XOutputStream { iOut = out; } - public void closeOutput() throws - com.sun.star.io.IOException + public void closeOutput() throws + com.sun.star.io.IOException { try { iOut.close(); @@ -63,8 +63,8 @@ public class OutputStreamToXOutputStreamAdapter implements XOutputStream { } } - public void flush() throws - com.sun.star.io.IOException + public void flush() throws + com.sun.star.io.IOException { try { iOut.flush(); @@ -73,11 +73,11 @@ public class OutputStreamToXOutputStreamAdapter implements XOutputStream { } } - public void writeBytes(byte[] b) throws - com.sun.star.io.IOException + public void writeBytes(byte[] b) throws + com.sun.star.io.IOException { - - try { + + try { iOut.write(b); } catch (IOException e) { throw new com.sun.star.io.IOException(e.toString()); diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java index 0720884f00a5..696956964de7 100644 --- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,15 +41,15 @@ import java.io.InputStream; */ public class XInputStreamToInputStreamAdapter extends InputStream { - /** + /** * Internal handle to the XInputStream */ private XInputStream xin; - + /** * Constructor. * - * @param in The <code>XInputStream</code> to be + * @param in The <code>XInputStream</code> to be * accessed as an <code>InputStream</code>. */ public XInputStreamToInputStreamAdapter (XInputStream in) { @@ -77,11 +77,11 @@ public class XInputStreamToInputStreamAdapter extends InputStream { } } - public int read () throws IOException { - byte [][] tmp = new byte [1][1]; + public int read () throws IOException { + byte [][] tmp = new byte [1][1]; try { long bytesRead = xin.readBytes(tmp, 1); - + if (bytesRead <= 0) { return (-1); } else { @@ -98,8 +98,8 @@ public class XInputStreamToInputStreamAdapter extends InputStream { } public int read (byte[] b) throws IOException { - - byte [][] tmp = new byte [1][b.length]; + + byte [][] tmp = new byte [1][b.length]; int bytesRead; try { @@ -131,7 +131,7 @@ public class XInputStreamToInputStreamAdapter extends InputStream { bytesRead = xin.readBytes(tmp,len); } // Casting bytesRead to an int is okay, since the user can - // only pass in an integer length to read, so the bytesRead + // only pass in an integer length to read, so the bytesRead // must <= len. // if (bytesRead <= 0) { @@ -141,10 +141,10 @@ public class XInputStreamToInputStreamAdapter extends InputStream { } else { System.arraycopy(tmp[0], 0, b, off, len); } - + return ((int)bytesRead); - - + + } catch (Exception e) { throw new IOException("reader error: "+e.toString()); } @@ -170,7 +170,7 @@ public class XInputStreamToInputStreamAdapter extends InputStream { tmpIntVal = (int)tmpLongVal; } tmpLongVal -= tmpIntVal; - + try { xin.skipBytes(tmpIntVal); } catch (Exception e) { diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java index 82c1aceecaeb..8812f02b0e35 100755 --- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,8 +42,8 @@ import com.sun.star.io.*; import com.sun.star.lib.uno.helper.ComponentBase; public class XOutputStreamToByteArrayAdapter - extends ComponentBase - implements XOutputStream + extends ComponentBase + implements XOutputStream { private int initialSize = 100240; // 10 kb private int size = 0; @@ -56,7 +56,7 @@ public class XOutputStreamToByteArrayAdapter public XOutputStreamToByteArrayAdapter() { this(null); } - + public XOutputStreamToByteArrayAdapter(byte[] aBuffer) { if (aBuffer != null) { externalBuffer = true; @@ -67,20 +67,20 @@ public class XOutputStreamToByteArrayAdapter size = initialSize; buffer = new byte[size]; // System.err.println("new outputbuffer with internal storage"); - } + } } - + public byte[] getBuffer() { return buffer; } - - public void closeOutput() - throws com.sun.star.io.NotConnectedException, - com.sun.star.io.BufferSizeExceededException, - com.sun.star.io.IOException + + public void closeOutput() + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { // trim buffer - if ( buffer.length > position && !externalBuffer ) + if ( buffer.length > position && !externalBuffer ) { byte[] newBuffer = new byte[position]; System.arraycopy(buffer, 0, newBuffer, 0, position); @@ -88,23 +88,23 @@ public class XOutputStreamToByteArrayAdapter } closed = true; } - - public void flush() - throws com.sun.star.io.NotConnectedException, - com.sun.star.io.BufferSizeExceededException, - com.sun.star.io.IOException + + public void flush() + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { } - - public void writeBytes(byte[] values) - throws com.sun.star.io.NotConnectedException, - com.sun.star.io.BufferSizeExceededException, - com.sun.star.io.IOException + + public void writeBytes(byte[] values) + throws com.sun.star.io.NotConnectedException, + com.sun.star.io.BufferSizeExceededException, + com.sun.star.io.IOException { // System.err.println("writeBytes("+values.length+")"); - if ( values.length > size-position ) + if ( values.length > size-position ) { - if ( externalBuffer ) + if ( externalBuffer ) throw new BufferSizeExceededException("out of buffer space, cannot grow external buffer"); byte[] newBuffer = null; while ( values.length > size-position ) @@ -115,7 +115,7 @@ public class XOutputStreamToByteArrayAdapter buffer = newBuffer; } System.arraycopy(values, 0, buffer, position, values.length); - position += values.length; + position += values.length; } - + } diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java index 7765c07f513b..e8f521b5e64e 100644 --- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,8 +74,8 @@ public class XOutputStreamToOutputStreamAdapter extends OutputStream { } public void write(byte[] b) throws IOException { - - try { + + try { xout.writeBytes(b); } catch (Exception e) { throw new IOException(e.toString()); @@ -83,13 +83,13 @@ public class XOutputStreamToOutputStreamAdapter extends OutputStream { } public void write(byte[] b, int off, int len) throws IOException { - + byte[] tmp = new byte[len]; // Copy the input array into a temp array, and write it out. // System.arraycopy(b, off, tmp, 0, len); - + try { xout.writeBytes(tmp); } catch (Exception e) { @@ -98,7 +98,7 @@ public class XOutputStreamToOutputStreamAdapter extends OutputStream { } public void write(int b) throws IOException { - + byte [] oneByte = new byte [1]; oneByte[0] = (byte) b; diff --git a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java index 41cf01d81661..2833918322f4 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,15 +42,15 @@ public class ComponentBase extends WeakBase implements XComponent protected boolean bDisposed= false; static final Type EVT_LISTENER_TYPE= new Type(XEventListener.class); - + /** Creates a new instance of CompBase */ public ComponentBase() { super(); listenerContainer= new MultiTypeInterfaceContainer(); } - - /** Override to perform extra clean-up work. Provided for subclasses. It is + + /** Override to perform extra clean-up work. Provided for subclasses. It is called during dispose() */ protected void preDisposing() @@ -61,9 +61,9 @@ public class ComponentBase extends WeakBase implements XComponent protected void postDisposing() { } - - - /** Method of XComponent. It is called by the owning client when the component is not needed + + + /** Method of XComponent. It is called by the owning client when the component is not needed * anymore. The registered listeners are notified that this method has been called. */ public void dispose() @@ -108,14 +108,14 @@ public class ComponentBase extends WeakBase implements XComponent System.out.println("OComponentHelper::dispose() - dispose called twice" ); } } - + /** Method of XComponent. */ public void removeEventListener(XEventListener xEventListener) - { + { listenerContainer.removeInterface( EVT_LISTENER_TYPE, xEventListener); } - + public void addEventListener(XEventListener listener) { boolean bDoDispose= false; @@ -130,8 +130,8 @@ public class ComponentBase extends WeakBase implements XComponent { listener.disposing( new EventObject(this)); } - } - + } + protected void finalize() throws Throwable { if ( ! bInDispose && ! bDisposed) diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java index 33d107279633..0d3759f74d6d 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ import com.sun.star.uno.UnoRuntime; /** Factory helper class supporting com.sun.star.lang.XServiceInfo and com.sun.star.lang.XSingleComponentFactory. - + @attention This factory implementation does not support lang.XSingleServiceFactory. */ @@ -46,11 +46,11 @@ public class Factory implements XSingleComponentFactory, XServiceInfo { private static final boolean DEBUG = false; - + /** Creates an object factory supporting interfaces com.sun.star.lang.XSingleComponentFactory and com.sun.star.lang.XServiceInfo - + @param impl_class implementation class @param supported_services @@ -65,7 +65,7 @@ public class Factory return new Factory( impl_class, supported_services ); } /** Writes component's implementation info to given registry key. - + @param impl_name name of implementation @param supported_services @@ -98,14 +98,14 @@ public class Factory } return false; } - + //============================================================================================== private String m_impl_name; private String [] m_supported_services; private Class m_impl_class; private java.lang.reflect.Method m_method; private java.lang.reflect.Constructor m_ctor; - + // ctor private Factory( Class impl_class, String supported_services [] ) throws com.sun.star.uno.RuntimeException @@ -115,9 +115,9 @@ public class Factory m_impl_class = impl_class; m_method = null; m_ctor = null; - + Class params [] = new Class [] { XComponentContext.class }; - + try { // seeking for "public static Object __create( XComponentContext )" @@ -133,7 +133,7 @@ public class Factory catch (Exception exc) { } - + if (null == m_method) { try @@ -147,7 +147,7 @@ public class Factory } } } - + //______________________________________________________________________________________________ private final Object instantiate( XComponentContext xContext ) throws com.sun.star.uno.Exception @@ -218,7 +218,7 @@ public class Factory xInit.initialize( arguments ); return inst; } - + // XServiceInfo impl //______________________________________________________________________________________________ public final String getImplementationName() diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java index 404c5a5e3f3a..710141a17c70 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -102,15 +102,15 @@ public class InterfaceContainer implements Cloneable * The capacity of the ArrayList is the length of this array buffer. */ Object elementData[]; - + /** * The size of the ArrayList (the number of elements it contains). * * @serial */ private int size; - - + + //private ArrayList data= new ArrayList(); /** Creates a new instance of InterfaceContainer */ public InterfaceContainer() @@ -131,7 +131,7 @@ public class InterfaceContainer implements Cloneable initialCapacity); this.elementData = new Object[initialCapacity]; } - + /** * Trims the capacity of this <tt>ArrayList</tt> instance to be the * list's current size. An application can use this operation to minimize @@ -147,7 +147,7 @@ public class InterfaceContainer implements Cloneable System.arraycopy(oldData, 0, elementData, 0, size); } } - + /** * Increases the capacity of this <tt>ArrayList</tt> instance, if * necessary, to ensure that it can hold at least the number of elements @@ -168,7 +168,7 @@ public class InterfaceContainer implements Cloneable System.arraycopy(oldData, 0, elementData, 0, size); } } - + /** * Appends the specified element to the end of this list. * @@ -186,7 +186,7 @@ public class InterfaceContainer implements Cloneable } return ret; } - + /** * Inserts the specified element at the specified position in this * list. Shifts the element currently at that position (if any) and @@ -195,7 +195,7 @@ public class InterfaceContainer implements Cloneable * @param index index at which the specified element is to be inserted. * @param element element to be inserted. * @throws IndexOutOfBoundsException if index is out of range - * <tt>(index < 0 || index > size())</tt>. + * <tt>(index < 0 || index > size())</tt>. */ synchronized public void add(int index, Object element) { @@ -204,7 +204,7 @@ public class InterfaceContainer implements Cloneable if (index > size || index < 0) throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+size); - + ensureCapacity(size+1); System.arraycopy(elementData, index, elementData, index + 1, size - index); @@ -212,8 +212,8 @@ public class InterfaceContainer implements Cloneable size++; } } - - + + /** * Appends all of the elements in the specified Collection to the end of * this list, in the order that they are returned by the @@ -225,13 +225,13 @@ public class InterfaceContainer implements Cloneable * * @param c the elements to be inserted into this list. * @throws IndexOutOfBoundsException if index out of range <tt>(index - * < 0 || index > size())</tt>. + * < 0 || index > size())</tt>. */ synchronized public boolean addAll(Collection c) { int numNew = c.size(); ensureCapacity(size + numNew); - + Iterator e = c.iterator(); for (int i=0; i<numNew; i++) { @@ -250,10 +250,10 @@ public class InterfaceContainer implements Cloneable * specified Collection's iterator. * * @param index index at which to insert first element - * from the specified collection. + * from the specified collection. * @param c elements to be inserted into this list. * @throws IndexOutOfBoundsException if index out of range <tt>(index - * < 0 || index > size())</tt>. + * < 0 || index > size())</tt>. */ synchronized public boolean addAll(int index, Collection c) { @@ -276,12 +276,12 @@ public class InterfaceContainer implements Cloneable } int numNew = curIndex; ensureCapacity(size + numNew); // Increments modCount!! - + int numMoved = size - index; if (numMoved > 0) System.arraycopy(elementData, index, elementData, index + numNew, numMoved); - + for (int i=0; i<numNew; i++) { elementData[index++]= arColl[i]; @@ -291,7 +291,7 @@ public class InterfaceContainer implements Cloneable } return ret; } - + /** * Removes all of the elements from this list. The list will * be empty after this call returns. @@ -303,7 +303,7 @@ public class InterfaceContainer implements Cloneable // Let gc do its work for (int i = 0; i < size; i++) elementData[i] = null; - + size = 0; } } @@ -316,7 +316,7 @@ public class InterfaceContainer implements Cloneable { return indexOf(elem) >= 0; } - + synchronized public boolean containsAll(Collection collection) { boolean retVal= true; @@ -341,7 +341,7 @@ public class InterfaceContainer implements Cloneable * @param index index of element to return. * @return the element at the specified position in this list. * @throws IndexOutOfBoundsException if index is out of range <tt>(index - * < 0 || index >= size())</tt>. + * < 0 || index >= size())</tt>. */ synchronized public Object get(int index) { @@ -352,7 +352,7 @@ public class InterfaceContainer implements Cloneable } return null; } - + /** * Searches for the first occurence of the given argument, testing * for equality using the <tt>equals</tt> method. @@ -375,7 +375,7 @@ public class InterfaceContainer implements Cloneable break; } } - + if (index == -1) { for (int i = 0; i < size; i++) @@ -400,7 +400,7 @@ public class InterfaceContainer implements Cloneable { return size == 0; } - + synchronized public Iterator iterator() { if (elementData != null) @@ -445,9 +445,9 @@ public class InterfaceContainer implements Cloneable } return index; } - + /** - * Returns a shallow copy of this <tt>ArrayList</tt> instance. The contained + * Returns a shallow copy of this <tt>ArrayList</tt> instance. The contained * references are copied but the objects not. * * @return a clone of this <tt>List</tt> instance. @@ -469,7 +469,7 @@ public class InterfaceContainer implements Cloneable { return listIterator(0); } - + /** The iterator keeps a copy of the list. Changes to InterfaceContainer do not * affect the data of the iterator. Conversly, changes to the iterator are effect * InterfaceContainer. @@ -491,7 +491,7 @@ public class InterfaceContainer implements Cloneable * @param index the index of the element to removed. * @return the element that was removed from the list. * @throws IndexOutOfBoundsException if index out of range <tt>(index - * < 0 || index >= size())</tt>. + * < 0 || index >= size())</tt>. */ synchronized public Object remove(int index) { @@ -500,7 +500,7 @@ public class InterfaceContainer implements Cloneable { RangeCheck(index); ret= elementData[index]; - + int numMoved = size - index - 1; if (numMoved > 0) System.arraycopy(elementData, index+1, elementData, index, @@ -509,8 +509,8 @@ public class InterfaceContainer implements Cloneable } return ret; } - - + + /** Parameter obj may */ synchronized public boolean remove(Object obj) { @@ -526,7 +526,7 @@ public class InterfaceContainer implements Cloneable } return ret; } - + synchronized public boolean removeAll(Collection collection) { boolean retVal= false; @@ -543,7 +543,7 @@ public class InterfaceContainer implements Cloneable } return retVal; } - + synchronized public boolean retainAll(Collection collection) { boolean retVal= false; @@ -595,14 +595,14 @@ public class InterfaceContainer implements Cloneable } return retVal; } - - - /** Not supported. + + + /** Not supported. * @param index index of element to replace. * @param element element to be stored at the specified position. * @return the element previously at the specified position. * @throws IndexOutOfBoundsException if index out of range - * <tt>(index < 0 || index >= size())</tt>. + * <tt>(index < 0 || index >= size())</tt>. */ synchronized public Object set(int index, Object element) { @@ -615,7 +615,7 @@ public class InterfaceContainer implements Cloneable } return ret; } - + /** * Returns the number of elements in this list. * @@ -627,14 +627,14 @@ public class InterfaceContainer implements Cloneable return size; return 0; } - + /** * Returns an array containing all of the elements in this list * in the correct order. * * @return an array containing all of the elements in this list - * in the correct order. + * in the correct order. */ synchronized public Object[] toArray() { @@ -662,8 +662,8 @@ public class InterfaceContainer implements Cloneable * <tt>null</tt> elements. * * @param a the array into which the elements of the list are to - * be stored, if it is big enough; otherwise, a new array of the - * same runtime type is allocated for this purpose. + * be stored, if it is big enough; otherwise, a new array of the + * same runtime type is allocated for this purpose. * @return an array containing the elements of the list. * @throws ArrayStoreException if the runtime type of a is not a supertype * of the runtime type of every element in this list. @@ -675,13 +675,13 @@ public class InterfaceContainer implements Cloneable a.getClass().getComponentType(), size); if (elementData != null) System.arraycopy(elementData, 0, a, 0, size); - + if (a.length > size) a[size] = null; - + return a; } - + /** * Check if the given index is in range. If not, throw an appropriate * runtime exception. @@ -692,7 +692,7 @@ public class InterfaceContainer implements Cloneable throw new IndexOutOfBoundsException( "Index: "+index+", Size: "+size); } - + public void disposeAndClear(EventObject evt) { Iterator aIt; @@ -725,8 +725,8 @@ public class InterfaceContainer implements Cloneable } } } - - + + private class Itr implements Iterator { InterfaceContainer dataIt; @@ -740,23 +740,23 @@ public class InterfaceContainer implements Cloneable * to remove. */ int lastRet = -1; - + /** The object that has been returned by most recent call to next * or previous. Reset to null if this element is deleted by a call * to remove. */ Object lastRetObj= null; - + Itr(InterfaceContainer _data) { dataIt= _data; } - + synchronized public boolean hasNext() { return cursor !=dataIt.size(); } - + public synchronized Object next() { try @@ -771,7 +771,7 @@ public class InterfaceContainer implements Cloneable throw new java.util.NoSuchElementException(); } } - + /** Removes the interface from the list, that has been last returned by a * call to next(). This is done according to the specification of the interface * method. The element is also removed from InterfaceContainer but independent @@ -785,23 +785,23 @@ public class InterfaceContainer implements Cloneable // Remove the entry from InterfaceContainer. InterfaceContainer.this.remove(lastRetObj); dataIt.remove(lastRet); - + if (lastRet < cursor) cursor--; lastRet = -1; lastRetObj= null; } } - + private class LstItr extends Itr implements ListIterator { - + LstItr(InterfaceContainer _data, int _index) { super(_data); cursor= _index; } - + /** Inserts an element to the iterators list according to the specification * of this interface method. The element is also added to InterfaceContainer * but its location within the list cannot be guaranteed. @@ -813,17 +813,17 @@ public class InterfaceContainer implements Cloneable lastRet = -1; lastRetObj= null; } - + synchronized public boolean hasPrevious() { return cursor != 0; } - + synchronized public int nextIndex() { return cursor; } - + public synchronized Object previous() { try @@ -837,20 +837,20 @@ public class InterfaceContainer implements Cloneable throw new NoSuchElementException(); } } - + synchronized public int previousIndex() { return cursor-1; } - + /** This is not possible since several iterators can modify InterfaceContainer */ public synchronized void set(Object o) { throw new UnsupportedOperationException(); } - - + + } // class LstItr } diff --git a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java index c324345a27d8..e61362b2bc3c 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,14 +34,14 @@ import java.util.Iterator; public class MultiTypeInterfaceContainer { - + private Map map= new HashMap(); - + /** Creates a new instance of MultiTypeInterfaceContainer */ public MultiTypeInterfaceContainer() { } - + /** only returns types which have at least one value in InterfaceContainer * return value can contain an element null, if someone called * addInterface (null, interf) @@ -50,12 +50,12 @@ public class MultiTypeInterfaceContainer { int size; Type[] retVal= null; - + if ( (size=map.size()) > 0) { Type [] arTypes= new Type[size]; Iterator it= map.keySet().iterator(); - + int countTypes= 0; while (it.hasNext()) { @@ -73,7 +73,7 @@ public class MultiTypeInterfaceContainer arTypes[countTypes++]= new Type(key.getClass()); } } - + if (countTypes != size) { retVal= new Type[countTypes]; @@ -86,7 +86,7 @@ public class MultiTypeInterfaceContainer retVal= new Type[0]; return retVal; } - + /** param key can be null */ synchronized public InterfaceContainer getContainer(Object key) { @@ -108,12 +108,12 @@ public class MultiTypeInterfaceContainer } return retVal; } - - + + synchronized public int addInterface(Object ckey, Object iface) { //If the key is a Type then it does not matter if the objects are different - // if they represent the same type. This is because Types overrides hashCode and + // if they represent the same type. This is because Types overrides hashCode and // equals. For example: // Type a= new Type(XInterface.class); // Type b= new Type(XInterface.class); @@ -131,8 +131,8 @@ public class MultiTypeInterfaceContainer } return cont.size(); } - - + + synchronized public int removeInterface(Object key, Object iface) { int retVal= 0; @@ -144,7 +144,7 @@ public class MultiTypeInterfaceContainer } return retVal; } - + public void disposeAndClear(EventObject evt) { Iterator it= null; @@ -155,7 +155,7 @@ public class MultiTypeInterfaceContainer while (it.hasNext() ) ((InterfaceContainer) it.next()).disposeAndClear(evt); } - + synchronized public void clear() { Iterator it= map.values().iterator(); diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java index ad2c8c7bcf88..0f18ac78154b 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,18 +54,18 @@ import com.sun.star.lang.DisposedException; /** This class is an implementation of the interfaces com.sun.star.beans.XPropertySet, - * com.sun.star.beans.XFastPropertySet and com.sun.star.beans.XMultiPropertySet. This - * class has to be inherited to be used. The values of properties are stored in member - * variables of the inheriting class. By overriding the methods + * com.sun.star.beans.XFastPropertySet and com.sun.star.beans.XMultiPropertySet. This + * class has to be inherited to be used. The values of properties are stored in member + * variables of the inheriting class. By overriding the methods * {@link #convertPropertyValue convertPropertyValue}, - * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and - * {@link #getPropertyValue(Property)} one can determine how + * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and + * {@link #getPropertyValue(Property)} one can determine how * property values are stored. - * When using the supplied implementations of this class then the member variables which + * When using the supplied implementations of this class then the member variables which * hold property values have to be declared in the class which inherits last in the inheriting * chain and they have to be public<p> - * Properties have to be registered by one of the registerProperty methods. They take among other - * arguments an Object named <em>id</em> which has to be a String that represents the name of + * Properties have to be registered by one of the registerProperty methods. They take among other + * arguments an Object named <em>id</em> which has to be a String that represents the name of * the member variable. The registering has to occur in the constructor of the inheriting class. * It is no allowed to add or change properties later on.<p> * Example: @@ -89,9 +89,9 @@ XMultiPropertySet private HashMap _handleToPropertyMap; private HashMap _propertyToIdMap; private Property[] arProperties; - + private int lastHandle= 1; - + protected XPropertySetInfo propertySetInfo; protected MultiTypeInterfaceContainer aBoundLC= new MultiTypeInterfaceContainer(); protected MultiTypeInterfaceContainer aVetoableLC= new MultiTypeInterfaceContainer(); @@ -101,14 +101,14 @@ XMultiPropertySet initMappings(); } - /** Registers a property with this helper class and associates the argument <em>id</em> with it. + /** Registers a property with this helper class and associates the argument <em>id</em> with it. * <em>id</em> is used to identify the storage of the property value. How property values are stored - * and retrieved is determined by the methods {@link #convertPropertyValue convertPropertyValue}, - * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and {@link #getPropertyValue(Property) getPropertyValue} + * and retrieved is determined by the methods {@link #convertPropertyValue convertPropertyValue}, + * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and {@link #getPropertyValue(Property) getPropertyValue} * These methods expect <em>id</em> to be a java.lang.String which represents the name of a member variable * which holds the property value. * Only properties which are registered can be accessed. Registration has to occur during - * initialization of the inheriting class (i.e. within the contructor). + * initialization of the inheriting class (i.e. within the contructor). * @param prop The property to be registered. * @param id Identifies the properties storage. * @see #getPropertyId @@ -118,9 +118,9 @@ XMultiPropertySet putProperty(prop); assignPropertyId(prop, id); } - + /** Registers a property with this helper class and associates the argument id with it. - * It does the same as {@link #registerProperty(Property, Object)}. The first four + * It does the same as {@link #registerProperty(Property, Object)}. The first four * arguments are used to construct a Property object. * Registration has to occur during * initialization of the inheriting class (i.e. within the contructor) @@ -137,7 +137,7 @@ XMultiPropertySet } /** Registers a property with this class and associates the argument id with it. - * It does the same as {@link #registerProperty(Property, Object)}. The first three + * It does the same as {@link #registerProperty(Property, Object)}. The first three * arguments are used to construct a Property object. The value for the Property.Handle * is generated and does not have to be specified here. Use this method for registering * a property if you do not care about the Property's handles. @@ -154,12 +154,12 @@ XMultiPropertySet Property p= new Property(name, lastHandle++, type, attributes); registerProperty(p, id); } - - /** Registers a property with this class. This method expects that property values + + /** Registers a property with this class. This method expects that property values * are stored in member variables as is the case if the methods convertPropertyValue, * setPropertyValueNoBroadcast and getPropertyValue(Property) are not overridden. * It is presumed that the type of the member variable - * corresponds Property.Type. For example, if the TypeClass of Property.Type is to be + * corresponds Property.Type. For example, if the TypeClass of Property.Type is to be * a TypeClass.SHORT then the member must be a short or java.lang.Short. * The handle for the property is generated.<br> * If there is no member with the specified name or if the member has an incompatible type @@ -171,7 +171,7 @@ XMultiPropertySet protected void registerProperty(String propertyName, String memberName, short attributes) { Field propField= null; - try + try { propField= getClass().getDeclaredField(memberName); } @@ -190,9 +190,9 @@ XMultiPropertySet throw new com.sun.star.uno.RuntimeException("the member has an unknown type: " + memberName); } - /** Registers a property with this class. + /** Registers a property with this class. * It is presumed that the name of property is equal to the name of the member variable - * that holds the property value. + * that holds the property value. * @param propertyName The name of the property and the member variable that holds the property's value. * @param attributes The property attributes. * @see #registerProperty(String, String, short) @@ -201,13 +201,13 @@ XMultiPropertySet { registerProperty(propertyName, propertyName, attributes); } + + - - - /** Returns the Property object for a given property name or null if that property does - * not exists (i.e. it has not been registered). Override this method + /** Returns the Property object for a given property name or null if that property does + * not exists (i.e. it has not been registered). Override this method * if you want to implement your own mapping from property names to Property objects. - * Then you also have to override {@link #initMappings}, {@link #getProperties()} and + * Then you also have to override {@link #initMappings}, {@link #getProperties()} and * {@link #putProperty(Property)}. * @param propertyName The name of the property (Property.Name) * @return The Property object with the name <em>propertyName</em>. @@ -216,10 +216,10 @@ XMultiPropertySet { return (Property) _nameToPropertyMap.get(propertyName); } - + /** Returns the Property object with a handle (Property.Handle) as specified by the argument - * <em>nHandle</em>. The method returns null if there is no such property (i.e. it has not - * been registered). Override this method if you want to implement your own mapping from handles + * <em>nHandle</em>. The method returns null if there is no such property (i.e. it has not + * been registered). Override this method if you want to implement your own mapping from handles * to Property objects. Then you also have to override {@link #initMappings}, {@link #putProperty(Property)}. * @param nHandle The handle of the property (Property.Handle). * @return The Property object with the handle <em>nHandle</em> @@ -228,10 +228,10 @@ XMultiPropertySet { return (Property) _handleToPropertyMap.get(new Integer(nHandle)); } - + /** Returns an array of all Property objects or an array of length null if there - * are no properties. Override this method if you want to implement your own mapping from names - * to Property objects. Then you also have to override {@link #initMappings}, {@link #getProperty(String)} and + * are no properties. Override this method if you want to implement your own mapping from names + * to Property objects. Then you also have to override {@link #initMappings}, {@link #getProperty(String)} and * {@link #putProperty}. * @return Array of all Property objects. */ @@ -244,12 +244,12 @@ XMultiPropertySet } return arProperties; } - - /** Stores a Property object so that it can be retrieved subsequently by + + /** Stores a Property object so that it can be retrieved subsequently by * {@link #getProperty(String)},{@link #getProperties()},{@link #getPropertyByHandle(int)}. - * Override this method if you want to implement your own mapping from handles + * Override this method if you want to implement your own mapping from handles * to Property objects and names to Property objects. Then you also need to override {@link #initMappings}, - * {@link #getProperty(String)},{@link #getProperties()},{@link #getPropertyByHandle(int)}. + * {@link #getProperty(String)},{@link #getProperties()},{@link #getPropertyByHandle(int)}. * @param prop The Property object that is to be stored. */ protected void putProperty(Property prop) @@ -258,16 +258,16 @@ XMultiPropertySet if (prop.Handle != -1) _handleToPropertyMap.put(new Integer(prop.Handle), prop); } - - /** Assigns an identifyer object to a Property object so that the identifyer + + /** Assigns an identifyer object to a Property object so that the identifyer * can be obtained by {@link #getPropertyId getPropertyId} later on. The identifyer * is used to specify a certain storage for the property's value. If you do not * override {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} or {@link #getPropertyValue(Property)} - * then the argument <em>id</em> has to be a java.lang.String that equals the name of + * then the argument <em>id</em> has to be a java.lang.String that equals the name of * the member variable that holds the Property's value. - * Override this method if you want to implement your own mapping from Property objects to ids or + * Override this method if you want to implement your own mapping from Property objects to ids or * if you need ids of a type other then java.lang.String. - * Then you also need to override {@link #initMappings initMappings} and {@link #getPropertyId getPropertyId}. + * Then you also need to override {@link #initMappings initMappings} and {@link #getPropertyId getPropertyId}. * @param prop The Property object that is being assigned an id. * @param id The object which identifies the storage used for the property's value. * @see #registerProperty(Property, Object) @@ -277,11 +277,11 @@ XMultiPropertySet if (id instanceof String && ((String) id).equals("") == false) _propertyToIdMap.put(prop, id); } - - /** Returns the identifyer object for a certain Property. The object must have been + + /** Returns the identifyer object for a certain Property. The object must have been * previously assigned to the Property object by {@link #assignPropertyId assignPropertyId}. * Override this method if you want to implement your own mapping from Property objects to ids. - * Then you also need to override {@link #initMappings initMappings} and {@link #assignPropertyId assignPropertyId}. + * Then you also need to override {@link #initMappings initMappings} and {@link #assignPropertyId assignPropertyId}. * @param prop The property for which the id is to be retrieved. * @return The id object that identifies the storage used for the property's value. * @see #registerProperty(Property, Object) @@ -293,7 +293,7 @@ XMultiPropertySet /** Initializes data structures used for mappings of property names to property object, * property handles to property objects and property objects to id objects. - * Override this method if you want to implement your own mappings. Then you also need to + * Override this method if you want to implement your own mappings. Then you also need to * override {@link #putProperty putProperty},{@link #getProperty getProperty}, {@link #getPropertyByHandle}, * {@link #assignPropertyId assignPropertyId} and {@link #getPropertyId getPropertyId}. */ @@ -311,14 +311,14 @@ XMultiPropertySet { // Create an event with this as sender EventObject aEvt= new EventObject(this); - + // inform all listeners to reelease this object aBoundLC.disposeAndClear(aEvt); aVetoableLC.disposeAndClear(aEvt); - } + } //XPropertySet ---------------------------------------------------- - synchronized public void addPropertyChangeListener(String str, XPropertyChangeListener xPropertyChangeListener) + synchronized public void addPropertyChangeListener(String str, XPropertyChangeListener xPropertyChangeListener) throws UnknownPropertyException, WrappedTargetException { // only add listeners if you are not disposed @@ -381,16 +381,16 @@ XMultiPropertySet } //XPropertySet ---------------------------------------------------- public Object getPropertyValue(String name) throws UnknownPropertyException, WrappedTargetException - { + { Object ret= null; if (bInDispose || bDisposed) throw new com.sun.star.lang.DisposedException("The component has been disposed already"); - + Property prop= getProperty(name); if (prop == null) throw new UnknownPropertyException("The property " + name + " is unknown"); - - synchronized (this) + + synchronized (this) { ret= getPropertyValue(prop); } @@ -405,10 +405,10 @@ XMultiPropertySet } return ret; } - + //XPropertySet ---------------------------------------------------- synchronized public void removePropertyChangeListener(String propName, XPropertyChangeListener listener) throws UnknownPropertyException, WrappedTargetException - { // all listeners are automaticly released in a dispose call + { // all listeners are automaticly released in a dispose call if (!bInDispose && !bDisposed) { if (propName.length() > 0) @@ -439,12 +439,12 @@ XMultiPropertySet listenerContainer.removeInterface(XVetoableChangeListener.class, listener); } } - + //XPropertySet ---------------------------------------------------- - /** Sets the value of a property. + /** Sets the value of a property. * The idl description for this interfaces, stipulates that the argument value is an Any. Since a java.lang.Object * reference has the same meaning as an Any this function accepts - * java anys (com.sun.star.uno.Any) and all other appropriate objects as arguments. The value argument can be one + * java anys (com.sun.star.uno.Any) and all other appropriate objects as arguments. The value argument can be one * of these: * <ul> * <li>java.lang.Boolean</li> @@ -461,23 +461,23 @@ XMultiPropertySet * <li><em>arrays which contain elements of the types above</em></li> * <li>com.sun.star.uno.Any containing an instance of one of the above types</li> * </ul> - * - * Properties can have the attribute com.sun.star.beans.PropertyAttribute.MAYBEVOID, which means that the value + * + * Properties can have the attribute com.sun.star.beans.PropertyAttribute.MAYBEVOID, which means that the value * (not the type) can be void. In order to assign a void value to a property one can either pass an Any which - * contains a null reference or pass null directly. In bothe cases the null reference is only accepted if + * contains a null reference or pass null directly. In bothe cases the null reference is only accepted if * the PropertyAttribute.MAYBEVOID attribute is set for the property. - * - * Properties which have the attribute MAYBEVOID set (Property.Attributes) can have a void value. The following + * + * Properties which have the attribute MAYBEVOID set (Property.Attributes) can have a void value. The following * considerations presume that the Property has that attribute set. Further, when mentioning an Any's value we - * actually refer to the object returned by Any.getObject. + * actually refer to the object returned by Any.getObject. * If the argument <em>value</em> is null, or it is an Any whose value is null (but with a valid Type) - * then the member variable used for storing the property's value is set to null. + * then the member variable used for storing the property's value is set to null. * Therefore those properties can only be stored in objects * and primitive types are not allowed (one can use the wrapper classes instead,e.g. java.lang.Byte) . * If a property's value is kept in a member variable of type Any and that reference is still null * then when setPropertyValue is called with * <em>value</em> = null then the member variable is assigned an Any with type void and a null value. - * Or if the argument is an Any with a null value then it is assigned to the member variable. + * Or if the argument is an Any with a null value then it is assigned to the member variable. * Further, if the variable already * references an Any and setPropertyValue is called with <em>value</em> = null, then the variable is assigned * a new Any with the same type as the previously referenced Any and with a null value. @@ -493,8 +493,8 @@ XMultiPropertySet setPropertyValue(prop, value); } - /** Sets the value of a property. It checks if the property's attributes (READONLY,MAYBEVOID), allow that the - * new value can be set. It also causes the notification of listeners. + /** Sets the value of a property. It checks if the property's attributes (READONLY,MAYBEVOID), allow that the + * new value can be set. It also causes the notification of listeners. * @param prop The property whose value is to be set. * @param value The new value for the property. */ @@ -503,17 +503,17 @@ XMultiPropertySet { if ((prop.Attributes & PropertyAttribute.READONLY) == PropertyAttribute.READONLY) throw new com.sun.star.beans.PropertyVetoException(); - // The value may be null only if MAYBEVOID attribute is set + // The value may be null only if MAYBEVOID attribute is set boolean bVoidValue= false; if (value instanceof Any) bVoidValue= ((Any) value).getObject() == null; else bVoidValue= value == null; - if (bVoidValue && (prop.Attributes & PropertyAttribute.MAYBEVOID) == 0) + if (bVoidValue && (prop.Attributes & PropertyAttribute.MAYBEVOID) == 0) throw new com.sun.star.lang.IllegalArgumentException("The property must have a value; the MAYBEVOID attribute is not set!"); if (bInDispose || bDisposed) throw new DisposedException("Component is already disposed"); - + //Check if the argument is allowed boolean bValueOk= false; if (value instanceof Any) @@ -522,16 +522,16 @@ XMultiPropertySet bValueOk= checkType(value); if (! bValueOk) throw new com.sun.star.lang.IllegalArgumentException("No valid UNO type"); - - + + boolean bConversionOk= false; Object[] outConvertedVal= new Object[1]; Object[] outOldValue= new Object[1]; - synchronized (this) + synchronized (this) { bConversionOk= convertPropertyValue(prop, outConvertedVal, outOldValue, value); } - + //The next step following the conversion is to set the new value of the property. Prior to this // the XVetoableChangeListener s have to be notified. if (bConversionOk) @@ -548,76 +548,76 @@ XMultiPropertySet fire( new Property[]{prop}, outConvertedVal, outOldValue, false); } } - - /** Converts a value in a way so that it is appropriate for storing as a property value, that is - * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} can process the value without any further + + /** Converts a value in a way so that it is appropriate for storing as a property value, that is + * {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} can process the value without any further * conversion. This implementation presumes that - * the values are stored in member variables of the furthest inheriting class. For example, + * the values are stored in member variables of the furthest inheriting class. For example, * class A inherits this class then members of class A * can hold property values. If there is a class B which inherits A then only members of B can hold - * property values. The variables must be public. A property must have been registered (e.g. by + * property values. The variables must be public. A property must have been registered (e.g. by * {@link #registerProperty(Property, Object)} in order for this method to work. The identifyer argument (type Object) - * used in the registerProperty methods must + * used in the registerProperty methods must * be a java.lang.String, which is, the name of the member variable that holds the property value. * If one opts to store values differently then one may override - * this method, as well as {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and + * this method, as well as {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} and * {@link #getPropertyValue(Property) getPropertyValue(Property)}. - * This method is always called as a result of a call to one of the setter methods, such as - * {@link #setPropertyValue(String,Object) XPropertySet.setPropertyValue}, + * This method is always called as a result of a call to one of the setter methods, such as + * {@link #setPropertyValue(String,Object) XPropertySet.setPropertyValue}, * {@link #setFastPropertyValue XFastPropertySet.setFastPropertyValue} - * and {@link #setPropertyValues XMultiPropertySet.setPropertyValues}. - * If this method fails, that is, it returns false or throws an exception, then no listeners are notified and the + * and {@link #setPropertyValues XMultiPropertySet.setPropertyValues}. + * If this method fails, that is, it returns false or throws an exception, then no listeners are notified and the * property value, that was intended to be changed, remains untouched.<br /> This method does not have to deal with property attributes, such as * PropertyAttribute.READONLY or PropertyAttribute.MAYBEVOID. The processing of these attributes occurs * in the calling methods.<br /> - * Only if this method returns successfully further processing, such + * Only if this method returns successfully further processing, such * as listener notification and finally the modifiction of the property's value, will occur.<br /> * - * The actual modification of a property's value is done by {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} - * which is called subsequent to convertPropertyValue. + * The actual modification of a property's value is done by {@link #setPropertyValueNoBroadcast setPropertyValueNoBroadcast} + * which is called subsequent to convertPropertyValue. *<p> * This method converts values by help of the com.sun.star.uno.AnyConverter which only does a few widening - * conversions on integer types and floating point types. For example, there is the property PropA with a Type equivalent - * to int.class and the - * value of the property is to be stored in a member variable of type int with name intProp. Then setPropertyValue is + * conversions on integer types and floating point types. For example, there is the property PropA with a Type equivalent + * to int.class and the + * value of the property is to be stored in a member variable of type int with name intProp. Then setPropertyValue is * called: * <pre> * set.setPropertyValue( "PropA", new Byte( (byte)111)); * </pre> * At some point setPropertyValue will call convertPropertyValue and pass in the Byte object. Since we allow - * that Byte values can be used with the property and know that the value is to be stored in intProp (type int) - * we convert the Byte object into an Integer object which is then returned in the out-parameter <em>newVal</em>. This + * that Byte values can be used with the property and know that the value is to be stored in intProp (type int) + * we convert the Byte object into an Integer object which is then returned in the out-parameter <em>newVal</em>. This * conversion is actually performed by the AnyConverter. Later * the setPropertyValueNoBroadcast is called with that Integer object and the int value can be easily extracted - * from the object and be assigned to the member intProp. + * from the object and be assigned to the member intProp. * <p> - * The method handles Any arguments the same as Object arguments. That is, the <em>setVal</em> argument can - * be a java.lang.Boolean or a com.sun.star.uno.Any containing a java.lang.Boolean. Likewise, a member - * containing a property value can be a com.sun.star.uno.Any or an java.lang.Object. - * Then, no conversion is necessary, since they can hold all possible values. However, if + * The method handles Any arguments the same as Object arguments. That is, the <em>setVal</em> argument can + * be a java.lang.Boolean or a com.sun.star.uno.Any containing a java.lang.Boolean. Likewise, a member + * containing a property value can be a com.sun.star.uno.Any or an java.lang.Object. + * Then, no conversion is necessary, since they can hold all possible values. However, if * the member is an Object and <em>setVal</em> is an Any then the object contained in the any is assigned to - * the member. The extra type information which exists as Type object in the Any will get lost. If this is not + * the member. The extra type information which exists as Type object in the Any will get lost. If this is not * intended then use an Any variable rather then an Object.<br /> - * If a member is an Object or Any and the argument <em>setVal</em> is an Object, other than String or array, + * If a member is an Object or Any and the argument <em>setVal</em> is an Object, other than String or array, * then it is presumed to be an UNO object and queried for XInterface. If successful, the out-param <em>newVal</em> * returns the XInterface.<br /> * If a member is an UNO interface, then <em>setVal</em> is queried for this interface and the result is returned. * If <em>setVal</em> is null then <em>newVal</em> will be null too after return. * <p> - * If a property value is stored using a primitive type the the out-parameters + * If a property value is stored using a primitive type the the out-parameters * <em>curVal</em> and <em>newVal</em> contain the respective wrapper class (e.g.java.lang.Byte, etc.). * curVal is used in calls to the XVetoableChangeListener and XPropertyChangeListener. * * @param property - in-param property for which the data is to be converted. * @param newVal - out-param which contains the converted value on return. - * @param curVal - out-param the current value of the property. It is used in calls to the + * @param curVal - out-param the current value of the property. It is used in calls to the * XVetoableChangeListener and XPropertyChangeListener. - * @param setVal - in-param. The value that is to be converted so that it matches Property and the internally used - * dataformat for that property. - * @return true - Conversion was successful. <em>newVal</em> contains a valid value for the property. false - + * @param setVal - in-param. The value that is to be converted so that it matches Property and the internally used + * dataformat for that property. + * @return true - Conversion was successful. <em>newVal</em> contains a valid value for the property. false - * conversion failed for some reason. * @throws com.sun.star.lang.IllegalArgumentException The value provided is unfit for the property. - * @throws com.sun.star.lang.WrappedTargetException - An exception occured during the conversion, that is to be made known + * @throws com.sun.star.lang.WrappedTargetException - An exception occured during the conversion, that is to be made known * to the caller. */ protected boolean convertPropertyValue(Property property, Object[] newVal, Object[]curVal, Object setVal) @@ -635,10 +635,10 @@ XMultiPropertySet // also get inherited fields, but only those which are public. Field propField= getClass().getDeclaredField(sMember); if (propField != null) - { + { curVal[0]= propField.get(this); Class memberClass= propField.getType(); - + // MAYBEVOID: if setVal == null or it is an Any and getObject returns null, then a void value is to be set // This works only if there are no primitive types. For those we use the respective wrapper classes. // In this implementation, a null reference means void value. @@ -650,7 +650,7 @@ XMultiPropertySet bVoidValue= setVal == null; if (bVoidValue && memberClass.isPrimitive()) throw new com.sun.star.lang.IllegalArgumentException("The implementation does not support the MAYBEVOID attribute for this property"); - + Object convObj= null; //The member that keeps the value of the Property is an Any. It can contain all possible //types, therefore a conversion is not necessary. @@ -661,12 +661,12 @@ XMultiPropertySet convObj= setVal; else { - // Parameter setVal is not an Any. We need to construct an Any that contains + // Parameter setVal is not an Any. We need to construct an Any that contains // the argument setVal. - // If setVal is an interface implementation then, we cannot constuct the + // If setVal is an interface implementation then, we cannot constuct the // Any with setVal.getClass(), because the Any.Type._typeClass would be TypeClass.UNKNOWN. // We try to get an XInterface of setVal and set an XInterface type. - if (setVal instanceof XInterface) + if (setVal instanceof XInterface) { XInterface xint= UnoRuntime.queryInterface(XInterface.class, setVal); if (xint != null) @@ -698,7 +698,7 @@ XMultiPropertySet } catch (java.lang.NoSuchFieldException e) { - throw new WrappedTargetException("Field does not exist", this, e); + throw new WrappedTargetException("Field does not exist", this, e); } catch (java.lang.IllegalAccessException e) { @@ -706,11 +706,11 @@ XMultiPropertySet } return ret; } - + private boolean checkType(Object obj) { - if (obj == null - || obj instanceof Boolean + if (obj == null + || obj instanceof Boolean || obj instanceof Character || obj instanceof Number || obj instanceof String @@ -721,7 +721,7 @@ XMultiPropertySet return true; return false; } - + // Param object can be an Any or other object. If obj is null then the return value is null private Object convert( Class cl, Object obj) throws com.sun.star.lang.IllegalArgumentException { @@ -782,17 +782,17 @@ XMultiPropertySet throw new com.sun.star.lang.IllegalArgumentException("Could not convert the argument"); return retVal; } - - /** Sets the value of a property. In this implementation property values are stored in member variables + + /** Sets the value of a property. In this implementation property values are stored in member variables * (see {@link #convertPropertyValue convertPropertyValue} Notification of property listeners * does not occur in this method. By overriding this method one can take full control about how property values - * are stored. But then, the {@link #convertPropertyValue convertPropertyValue} and - * {@link #getPropertyValue(Property)} must be overridden too. - * - * A Property with the MAYBEVOID attribute set, is stored as null value. Therefore the member variable must be - * an Object in order to make use of the property attribute. An exception is Any. The Any variable can be initially null, but - * once it is set the reference will not become null again. If the value is to be set to - * void then a new Any will be stored + * are stored. But then, the {@link #convertPropertyValue convertPropertyValue} and + * {@link #getPropertyValue(Property)} must be overridden too. + * + * A Property with the MAYBEVOID attribute set, is stored as null value. Therefore the member variable must be + * an Object in order to make use of the property attribute. An exception is Any. The Any variable can be initially null, but + * once it is set the reference will not become null again. If the value is to be set to + * void then a new Any will be stored * with a valid type but without a value (i.e. Any.getObject returns null). * If a property has the READONLY attribute set, and one of the setter methods, such as setPropertyValue, has been * called, then this method is not going to be called. @@ -823,14 +823,14 @@ XMultiPropertySet throw new WrappedTargetException("PropertySet.setPropertyValueNoBroadcast", this, e); } } - /** Retrieves the value of a property. This implementation presumes that the values are stored in member variables - * of the furthest inheriting class (see {@link #convertPropertyValue convertPropertyValue}) and that the - * variables are public. The property must have - * been registered, for example by {@link #registerProperty(Property, Object)}. The identifyer Object argument + /** Retrieves the value of a property. This implementation presumes that the values are stored in member variables + * of the furthest inheriting class (see {@link #convertPropertyValue convertPropertyValue}) and that the + * variables are public. The property must have + * been registered, for example by {@link #registerProperty(Property, Object)}. The identifyer Object argument * must have been a java.lang.String which was the name of the member variable holding the property value. - * When properties are to be stored differently one has to override this method as well as + * When properties are to be stored differently one has to override this method as well as * {@link #convertPropertyValue} and {@link #setPropertyValueNoBroadcast}. <br> - * If a value is stored in a variable of a primitive type then this method returns an instance of the respective + * If a value is stored in a variable of a primitive type then this method returns an instance of the respective * wrapper class (e.g. java.lang.Boolean). * @param property The property for which the value is to be retrieved. * @return The value of the property. @@ -862,17 +862,17 @@ XMultiPropertySet } return ret; } - + /** * This method fires events to XPropertyChangeListener,XVetoableChangeListener and * XPropertiesChangeListener event sinks. - * To distinguish what listeners are to be called the argument <em>bVetoable</em> is to be set to true if + * To distinguish what listeners are to be called the argument <em>bVetoable</em> is to be set to true if * a XVetoableChangeListener is meant. For XPropertyChangeListener and XPropertiesChangeListener - * it is to be set to false. - * - * @param properties Properties wich will be or have been affected. - * @param newValues the new values of the properties. - * @param oldValues the old values of the properties. + * it is to be set to false. + * + * @param properties Properties wich will be or have been affected. + * @param newValues the new values of the properties. + * @param oldValues the old values of the properties. * @param bVetoable true means fire to VetoableChangeListener, false means fire to * XPropertyChangedListener and XMultiPropertyChangedListener. */ @@ -894,7 +894,7 @@ XMultiPropertySet if ((bVetoable && (properties[i].Attributes & PropertyAttribute.CONSTRAINED) > 0) || (!bVetoable && (properties[i].Attributes & PropertyAttribute.BOUND) > 0)) { - arEvts[i]= new PropertyChangeEvent(this, properties[i].Name, false, + arEvts[i]= new PropertyChangeEvent(this, properties[i].Name, false, properties[i].Handle, oldValues[i], newValues[i]); nAffectedProps++; } @@ -923,8 +923,8 @@ XMultiPropertySet // broadcast to all listeners with "" property name if(bVetoable) lc= listenerContainer.getContainer(XVetoableChangeListener.class); - else - lc= listenerContainer.getContainer(XPropertyChangeListener.class); + else + lc= listenerContainer.getContainer(XPropertyChangeListener.class); if(lc != null) { Iterator it= lc.iterator(); @@ -942,7 +942,7 @@ XMultiPropertySet // if nAffectedProps == 0 then there are no BOUND properties if (!bVetoable && nAffectedProps > 0) { - + PropertyChangeEvent[] arReduced= new PropertyChangeEvent[nAffectedProps]; System.arraycopy(arEvts, 0, arReduced, 0, nAffectedProps); InterfaceContainer lc= listenerContainer.getContainer(XPropertiesChangeListener.class); @@ -957,10 +957,10 @@ XMultiPropertySet } } } - } + } } // XFastPropertySet-------------------------------------------------------------------------------- - public void setFastPropertyValue(int nHandle, Object aValue ) throws UnknownPropertyException, + public void setFastPropertyValue(int nHandle, Object aValue ) throws UnknownPropertyException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException, WrappedTargetException { Property prop= getPropertyByHandle(nHandle); @@ -968,9 +968,9 @@ XMultiPropertySet throw new UnknownPropertyException(" The property with handle : " + nHandle +" is unknown"); setPropertyValue(prop, aValue); } - + // XFastPropertySet -------------------------------------------------------------------------------- - public Object getFastPropertyValue(int nHandle ) throws UnknownPropertyException, + public Object getFastPropertyValue(int nHandle ) throws UnknownPropertyException, WrappedTargetException { Property prop= getPropertyByHandle(nHandle); @@ -983,8 +983,8 @@ XMultiPropertySet public void addPropertiesChangeListener(String[] propNames, XPropertiesChangeListener listener) { listenerContainer.addInterface(XPropertiesChangeListener.class, listener); - } - + } + // XMultiPropertySet ----------------------------------------------------------------------------------- public void firePropertiesChangeEvent(String[] propNames, XPropertiesChangeListener listener) { @@ -1000,21 +1000,21 @@ XMultiPropertySet if (prop != null) { Object value= null; - try + try { value= getPropertyValue(prop); - } - catch(Exception e) + } + catch(Exception e) { continue; } - arEvents[eventCount]= new PropertyChangeEvent(this, prop.Name, + arEvents[eventCount]= new PropertyChangeEvent(this, prop.Name, false, prop.Handle, value, value); eventCount++; } } } - + // fire events from unsynchronized section so as to prevent deadlocks if (eventCount > 0) { @@ -1028,19 +1028,19 @@ XMultiPropertySet listener.propertiesChange(arEvents); } } - // XMultiPropertySet ----------------------------------------------------------------------------------- - /** If a value for a property could not be retrieved then the respective element in the returned + // XMultiPropertySet ----------------------------------------------------------------------------------- + /** If a value for a property could not be retrieved then the respective element in the returned * array has the value null. */ public Object[] getPropertyValues(String[] propNames) { Object[] arValues= new Object[propNames.length]; - synchronized (this) + synchronized (this) { for (int i= 0; i < propNames.length; i++) { Object value= null; - try + try { value= getPropertyValue(propNames[i]); } @@ -1052,19 +1052,19 @@ XMultiPropertySet } return arValues; } - // XMultiPropertySet ----------------------------------------------------------------------------------- + // XMultiPropertySet ----------------------------------------------------------------------------------- public void removePropertiesChangeListener(XPropertiesChangeListener xPropertiesChangeListener) { listenerContainer.removeInterface(XPropertiesChangeListener.class, xPropertiesChangeListener); } - // XMultiPropertySet ----------------------------------------------------------------------------------- + // XMultiPropertySet ----------------------------------------------------------------------------------- /** If the array of property names containes an unknown property then it will be ignored. */ public void setPropertyValues(String[] propNames, Object[] values) throws PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException { for (int i= 0; i < propNames.length; i++) { - try + try { setPropertyValue(propNames[i], values[i]); } @@ -1072,31 +1072,31 @@ XMultiPropertySet { continue; } - + } } - + private class PropertySetInfo implements XPropertySetInfo { public com.sun.star.beans.Property[] getProperties() { return PropertySet.this.getProperties(); } - + public com.sun.star.beans.Property getPropertyByName(String name) throws UnknownPropertyException { return getProperty(name); } - + public boolean hasPropertyByName(String name) { return getProperty(name) != null; } - + } } - - - - + + + + diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java index 5bf32f6cad0d..643cd43f1463 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java index 1747956949ec..a413ab43fc3b 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,28 +32,28 @@ import java.util.Vector; /** * Object representation and parsing of Uno Urls, - * which allow to locate a named Uno object in a - * different process. An Uno Url consists of the - * specification of a connection, protocol and + * which allow to locate a named Uno object in a + * different process. An Uno Url consists of the + * specification of a connection, protocol and * rootOid delimited with a ';'. * The syntax of an Uno Url is - * + * * <code> * [uno:]connection-type,parameters;protocol-name,parameters;objectname"; * </code> - * + * * An example Uno Url will look like this: - * + * * <code> * socket,host=localhost,port=2002;urp;StarOffice.ServiceManager * </code> - * + * * For more information about Uno Url please consult * <a href="http://udk.openoffice.org/common/man/spec/uno-url.html"> * http://udk.openoffice.org/common/man/spec/uno-url.html</a> - * + * * Usage: - * + * * <code> * UnoUrl url = UnoUrl.parseUnoUrl("socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"); * </code> @@ -121,7 +121,7 @@ public class UnoUrl { /** * Returns the name of the connection of this * Uno Url. Encoded characters are not allowed. - * + * * @return The connection name as string. */ public String getConnection() { @@ -131,7 +131,7 @@ public class UnoUrl { /** * Returns the name of the protocol of this * Uno Url. Encoded characters are not allowed. - * + * * @return The protocol name as string. */ public String getProtocol() { @@ -141,7 +141,7 @@ public class UnoUrl { /** * Return the object name. Encoded character are * not allowed. - * + * * @return The object name as String. */ public String getRootOid() { @@ -152,7 +152,7 @@ public class UnoUrl { * Returns the protocol parameters as * a Hashmap with key/value pairs. Encoded * characters like '%41' are decoded. - * + * * @return a HashMap with key/value pairs for protocol parameters. */ public HashMap getProtocolParameters() { @@ -163,7 +163,7 @@ public class UnoUrl { * Returns the connection parameters as * a Hashmap with key/value pairs. Encoded * characters like '%41' are decoded. - * + * * @return a HashMap with key/value pairs for connection parameters. */ public HashMap getConnectionParameters() { @@ -174,7 +174,7 @@ public class UnoUrl { * Returns the raw specification of the protocol * parameters. Encoded characters like '%41' are * not decoded. - * + * * @return The uninterpreted protocol parameters as string. */ public String getProtocolParametersAsString() { @@ -185,7 +185,7 @@ public class UnoUrl { * Returns the raw specification of the connection * parameters. Encoded characters like '%41' are * not decoded. - * + * * @return The uninterpreted connection parameters as string. */ public String getConnectionParametersAsString() { @@ -358,7 +358,7 @@ public class UnoUrl { /** * Parses the given Uno Url and returns * an in memory object representation. - * + * * @param unoUrl The given uno URl as string. * @return Object representation of class UnoUrl. * @throws IllegalArgumentException if Url cannot be parsed. diff --git a/javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter.java b/javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter.java index 2c3cc142f1a5..bda5a081b64a 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/WeakAdapter.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,10 +33,10 @@ import java.util.List; import java.util.Collections; import java.util.LinkedList; -/** An XAdapter implementation that holds a weak reference (java.lang.ref.WeakReference) - * to an object. Clients can register listener (com.sun.star.lang.XReference) which - * are notified when the the object (the one which is kept weak) is being finalized. That - * is, that object is being destroyed because there are not any hard references +/** An XAdapter implementation that holds a weak reference (java.lang.ref.WeakReference) + * to an object. Clients can register listener (com.sun.star.lang.XReference) which + * are notified when the the object (the one which is kept weak) is being finalized. That + * is, that object is being destroyed because there are not any hard references * to it. */ public class WeakAdapter implements XAdapter @@ -46,7 +46,7 @@ public class WeakAdapter implements XAdapter private WeakReference m_weakRef; // contains XReference objects registered by addReference private List m_xreferenceList; - + /** *@param component the object that is to be held weak */ @@ -55,14 +55,14 @@ public class WeakAdapter implements XAdapter m_weakRef= new WeakReference(component); m_xreferenceList= Collections.synchronizedList( new LinkedList()); } - + /** Called by the XWeak implementation (WeakBase) when it is being finalized. * It is only being called once. - * The registererd XReference listeners are notified. On notification they are - * to unregister themselves. The notification is thread-safe. However, it is possible - * to add a listener during the notification process, which will never receive a - * notification. To prevent this, one would have to synchronize this method with - * the addReference method. But this can result in deadlocks in a multithreaded + * The registererd XReference listeners are notified. On notification they are + * to unregister themselves. The notification is thread-safe. However, it is possible + * to add a listener during the notification process, which will never receive a + * notification. To prevent this, one would have to synchronize this method with + * the addReference method. But this can result in deadlocks in a multithreaded * environment. */ void referentDying() @@ -74,7 +74,7 @@ public class WeakAdapter implements XAdapter ((XReference) references[i-1]).dispose(); } } - + /** Method of com.sun.star.uno.XAdapter. It is called to obtain a hard reference * to the object which is kept weak by this instance. * @return hard reference to the object diff --git a/javaunohelper/com/sun/star/lib/uno/helper/WeakBase.java b/javaunohelper/com/sun/star/lib/uno/helper/WeakBase.java index cce414fcc2a9..ace0713ccdd7 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/WeakBase.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/WeakBase.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,14 +42,14 @@ import java.util.Hashtable; public class WeakBase implements XWeak, XTypeProvider { private final boolean DEBUG= false; - + // Contains all WeakAdapter which have been created in this class // They have to be notified when this object dies private WeakAdapter m_adapter; - + protected static Map _mapImplementationIds= new Hashtable(); protected static Map _mapTypes= new Hashtable(); - + /** Method of XWeak. The returned XAdapter implementation can be used to keap * a weak reference to this object. * @return a com.sun.star.uno.XAdapter implementation. @@ -60,7 +60,7 @@ public class WeakBase implements XWeak, XTypeProvider m_adapter= new WeakAdapter(this); return m_adapter; } - + /** Override of Object.finalize. When there are no references to this object anymore * then the garbage collector calls this method. Thereby causing the adapter object * to be notified. The adapter, in turn, notifies all listeners (com.sun.star.uno.XReference) @@ -71,7 +71,7 @@ public class WeakBase implements XWeak, XTypeProvider m_adapter.referentDying(); super.finalize(); } - + /** Method of XTypeProvider. It returns an array of Type objects which represent * all implemented UNO interfaces of this object. * @return Type objects of all implemented interfaces. @@ -95,7 +95,7 @@ public class WeakBase implements XWeak, XTypeProvider // get the superclass the currentClass inherits from currentClass= currentClass.getSuperclass(); } while (currentClass != null); - + Type types[]= new Type[vec.size()]; for( int i= 0; i < types.length; i++) types[i]= (Type) vec.elementAt(i); @@ -104,11 +104,11 @@ public class WeakBase implements XWeak, XTypeProvider } return arTypes; } - + /** Method of XTypeProvider. It provides an identifier that represents the set of UNO * interfaces implemented by this class. All instances of this class * which run in the same Java Virtual Machine return the same array. (This only works as long - * the ClassLoader preserves the class even if no instance exist.) + * the ClassLoader preserves the class even if no instance exist.) *@return identifier as array of bytes */ public byte[] getImplementationId() |