diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-03-07 16:31:11 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-03-07 16:31:11 +0100 |
commit | e4d3fd6faea32f954923690a111c2466bea1d0c9 (patch) | |
tree | 22277c583c9735e236715002129b1698eb597a06 /odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java | |
parent | af67f29984bd8c83fac33e0ceca8eefdd7f652e6 (diff) | |
parent | 127c6e0da8657f19392081d7c4da2754c2b9bd09 (diff) |
CWS-TOOLING: integrate CWS jsc340ooo/DEV300_m106ooo/DEV300_m105ooo/DEV300_m104ooo/DEV300_m103ooo/DEV300_m102
Diffstat (limited to 'odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java')
-rw-r--r-- | odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java index 3bd4703a..b78e878e 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java @@ -765,7 +765,7 @@ public class ExampleDataPilotSource com.sun.star.lang.XServiceInfo { static private final String aServiceName = "com.sun.star.sheet.DataPilotSource"; - static private final String aImplName = "ExampleDataPilotSource"; + static private final String aImplName = _ExampleDataPilotSource.class.getName(); private ExampleSettings aSettings = new ExampleSettings(); private ExampleDimensions aDimensions; @@ -780,27 +780,34 @@ public class ExampleDataPilotSource { // If the first argument (Source) is a number between 2 and 10, // use it as member count, otherwise keep the default value. - if ( aArguments.length >= 1 ) + try { - String aSource = (String) aArguments[0]; - if ( aSource != null ) - { - try - { - int nValue = Integer.parseInt( aSource ); - if ( nValue >= 2 && nValue <= 10 ) - aSettings.nMemberCount = nValue; - } - catch ( NumberFormatException e ) - { - System.out.println( "Error: caught exception in " + - "ExampleDataPilotSource.initialize!\nException Message = " - + e.getMessage()); - e.printStackTrace(); - } - } + if ( aArguments.length >= 1 ) + { + String aSource = com.sun.star.uno.AnyConverter.toString(aArguments[0]); + if ( aSource != null && aSource.length() > 0) + { + int nValue = Integer.parseInt( aSource ); + if ( nValue >= 2 && nValue <= 10 ) + aSettings.nMemberCount = nValue; } } + } + catch ( NumberFormatException e ) + { + System.out.println( "Error: caught exception in " + + "ExampleDataPilotSource.initialize!\nException Message = " + + e.getMessage()); + e.printStackTrace(); + } + catch ( com.sun.star.lang.IllegalArgumentException e ) + { + System.out.println( "Error: caught exception in " + + "ExampleDataPilotSource.initialize!\nException Message = " + + e.getMessage()); + e.printStackTrace(); + } + } // XDataPilotResults @@ -970,12 +977,16 @@ public class ExampleDataPilotSource return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey regKey) - { - return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - _ExampleDataPilotSource.aImplName, - _ExampleDataPilotSource.aServiceName, regKey); - } + // This method not longer necessary since OOo 3.4 where the component registration + // was changed to passive component registration. For more details see + // http://wiki.services.openoffice.org/wiki/Passive_Component_Registration + +// public static boolean __writeRegistryServiceInfo( +// com.sun.star.registry.XRegistryKey regKey) +// { +// return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( +// _ExampleDataPilotSource.aImplName, +// _ExampleDataPilotSource.aServiceName, regKey); +// } } |