diff options
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 80f5ff15a4d2..8c827d0cc2f8 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); +// } } |