summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2005-01-31 15:55:38 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2005-01-31 15:55:38 +0000
commit4e54bc778b08a92a7f544a7659f4d056893adb1f (patch)
treed1ba4c86c3ff2e63f4e80a6cc48f47f923fc8044
parentINTEGRATION: CWS sdksample (1.4.116); FILE MERGED (diff)
downloadcore-4e54bc778b08a92a7f544a7659f4d056893adb1f.tar.gz
core-4e54bc778b08a92a7f544a7659f4d056893adb1f.zip
INTEGRATION: CWS sdksample (1.3.124); FILE MERGED
2004/06/30 09:10:29 jsc 1.3.124.1: #i29308# use of new UNO features
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java93
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl36
2 files changed, 70 insertions, 59 deletions
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
index 1fe496f9b04a..687814fa7fb1 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ExampleAddIn.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: hr $ $Date: 2003-06-30 15:45:13 $
+ * last change: $Author: rt $ $Date: 2005-01-31 16:54:08 $
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
@@ -51,13 +51,14 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
private com.sun.star.sheet.ResultEvent getResult()
{
- com.sun.star.sheet.ResultEvent aEvent = new com.sun.star.sheet.ResultEvent();
+ com.sun.star.sheet.ResultEvent aEvent =
+ new com.sun.star.sheet.ResultEvent();
aEvent.Value = aName + " " + String.valueOf( nValue );
aEvent.Source = this;
return aEvent;
}
- public void addResultListener( com.sun.star.sheet.XResultListener aListener )
+ public void addResultListener(com.sun.star.sheet.XResultListener aListener)
{
aListeners.addElement( aListener );
@@ -65,7 +66,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
aListener.modified( getResult() );
}
- public void removeResultListener( com.sun.star.sheet.XResultListener aListener )
+ public void removeResultListener(com.sun.star.sheet.XResultListener aListener)
{
aListeners.removeElement( aListener );
}
@@ -77,7 +78,8 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
java.util.Enumeration aEnum = aListeners.elements();
while (aEnum.hasMoreElements())
- ((com.sun.star.sheet.XResultListener)aEnum.nextElement()).modified( aEvent );
+ ((com.sun.star.sheet.XResultListener)aEnum.nextElement()).modified(
+ aEvent);
}
}
@@ -112,13 +114,13 @@ class ExampleAddInThread extends Thread
public class ExampleAddIn
{
- static public class _ExampleAddIn extends com.sun.star.lib.uno.helper.WeakBase implements
- com.sun.star.sheet.addin.XExampleAddIn,
- com.sun.star.sheet.XAddIn,
- com.sun.star.lang.XServiceName,
- com.sun.star.lang.XServiceInfo
+ static public class _ExampleAddIn extends com.sun.star.lib.uno.helper.WeakBase
+ implements org.openoffice.sheet.addin.XExampleAddIn,
+ com.sun.star.sheet.XAddIn,
+ com.sun.star.lang.XServiceName,
+ com.sun.star.lang.XServiceInfo
{
- static private final String aExampleService = "com.sun.star.sheet.addin.ExampleAddIn";
+ static private final String aExampleService = "org.openoffice.sheet.addin.ExampleAddIn";
static private final String aAddInService = "com.sun.star.sheet.AddIn";
static private final String aImplName = "ExampleAddIn";
@@ -162,7 +164,7 @@ public class ExampleAddIn
private int getFunctionID( String aProgrammaticFunctionName )
{
for ( int i = 0; i < aFunctionNames.length; i++ )
- if ( aProgrammaticFunctionName.equals( aFunctionNames[ i ] ) )
+ if ( aProgrammaticFunctionName.equals(aFunctionNames[i]) )
return i;
return FUNCTION_INVALID;
}
@@ -174,20 +176,21 @@ public class ExampleAddIn
return nValue + 1;
}
- public com.sun.star.sheet.XVolatileResult getCounter( String aName )
+ public com.sun.star.sheet.XVolatileResult getCounter(String aName)
{
if ( aResults == null )
{
- // create the table of results, and start a thread to increment all counters
+ // create the table of results, and start a thread to increment
+ // all counters
aResults = new java.util.Hashtable();
ExampleAddInThread aThread = new ExampleAddInThread( aResults );
aThread.start();
}
- ExampleAddInResult aResult = (ExampleAddInResult) aResults.get( aName );
+ ExampleAddInResult aResult = (ExampleAddInResult) aResults.get(aName);
if ( aResult == null )
{
- aResult = new ExampleAddInResult( aName );
+ aResult = new ExampleAddInResult(aName);
aResults.put( aName, aResult );
}
return aResult;
@@ -195,46 +198,52 @@ public class ExampleAddIn
// XAddIn
- public String getProgrammaticFuntionName( String aDisplayName )
+ public String getProgrammaticFuntionName(String aDisplayName)
{
for ( int i = 0; i < aFunctionNames.length; i++ )
- if ( aDisplayName.equals( aDisplayFunctionNames[ i ] ) )
+ if ( aDisplayName.equals(aDisplayFunctionNames[i]) )
return aFunctionNames[i];
return "";
}
- public String getDisplayFunctionName( String aProgrammaticName )
+ public String getDisplayFunctionName(String aProgrammaticName)
{
int nFunction = getFunctionID( aProgrammaticName );
- return ( nFunction == FUNCTION_INVALID ) ? "" : aDisplayFunctionNames[nFunction];
+ return ( nFunction == FUNCTION_INVALID ) ? "" :
+ aDisplayFunctionNames[nFunction];
}
- public String getFunctionDescription( String aProgrammaticName )
+ public String getFunctionDescription(String aProgrammaticName)
{
int nFunction = getFunctionID( aProgrammaticName );
- return ( nFunction == FUNCTION_INVALID ) ? "" : aDescriptions[nFunction];
+ return ( nFunction == FUNCTION_INVALID ) ? "" :
+ aDescriptions[nFunction];
}
- public String getDisplayArgumentName( String aProgrammaticFunctionName, int nArgument )
+ public String getDisplayArgumentName(String aProgrammaticFunctionName,
+ int nArgument)
{
// both functions in this example only have a first argument
int nFunction = getFunctionID( aProgrammaticFunctionName );
- return ( nFunction == FUNCTION_INVALID || nArgument != 0) ? "" : aFirstArgumentNames[nFunction];
+ return ( nFunction == FUNCTION_INVALID || nArgument != 0) ? "" :
+ aFirstArgumentNames[nFunction];
}
- public String getArgumentDescription( String aProgrammaticFunctionName, int nArgument )
+ public String getArgumentDescription(String aProgrammaticFunctionName,
+ int nArgument )
{
// both functions in this example only have a first argument
int nFunction = getFunctionID( aProgrammaticFunctionName );
- return ( nFunction == FUNCTION_INVALID || nArgument != 0) ? "" : aFirstArgumentDescriptions[nFunction];
+ return ( nFunction == FUNCTION_INVALID || nArgument != 0) ? "" :
+ aFirstArgumentDescriptions[nFunction];
}
- public String getProgrammaticCategoryName( String aProgrammaticFunctionName )
+ public String getProgrammaticCategoryName(String aProgrammaticFunctionName)
{
return( "Add-In" );
}
- public String getDisplayCategoryName( String aProgrammaticFunctionName )
+ public String getDisplayCategoryName(String aProgrammaticFunctionName)
{
return( "Add-In" );
}
@@ -243,7 +252,8 @@ public class ExampleAddIn
public void setLocale( com.sun.star.lang.Locale aLocale )
{
- // the locale is stored and used for getLocale, but otherwise ignored in this example
+ // the locale is stored and used for getLocale, but otherwise
+ // ignored in this example
aFuncLocale = aLocale;
}
@@ -276,30 +286,35 @@ public class ExampleAddIn
public boolean supportsService( String aService )
{
- return aService.equals( aExampleService ) || aService.equals( aAddInService );
+ return (aService.equals( aExampleService ) ||
+ aService.equals( aAddInService ) );
}
}
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String implName,
- com.sun.star.lang.XMultiServiceFactory multiFactory,
- com.sun.star.registry.XRegistryKey regKey)
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(
+ String implName,
+ com.sun.star.lang.XMultiServiceFactory multiFactory,
+ com.sun.star.registry.XRegistryKey regKey)
{
com.sun.star.lang.XSingleServiceFactory xSingleServiceFactory = null;
if ( implName.equals(_ExampleAddIn.aImplName) )
- xSingleServiceFactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
- _ExampleAddIn.class, _ExampleAddIn.aExampleService, multiFactory, regKey);
+ xSingleServiceFactory =
+ com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
+ _ExampleAddIn.class, _ExampleAddIn.aExampleService,
+ multiFactory, regKey);
return xSingleServiceFactory;
}
- public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey regKey)
+ public static boolean __writeRegistryServiceInfo(
+ com.sun.star.registry.XRegistryKey regKey)
{
// register for both the base AddIn and the own service
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- _ExampleAddIn.aImplName, _ExampleAddIn.aExampleService, regKey )
+ _ExampleAddIn.aImplName, _ExampleAddIn.aExampleService, regKey)
&& com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- _ExampleAddIn.aImplName, _ExampleAddIn.aAddInService, regKey );
+ _ExampleAddIn.aImplName, _ExampleAddIn.aAddInService, regKey);
}
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl b/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl
index bc53cf274ae4..ac24364d63a0 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl
+++ b/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl
@@ -2,9 +2,9 @@
*
* $RCSfile: XExampleAddIn.idl,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: hr $ $Date: 2003-06-30 15:46:32 $
+ * last change: $Author: rt $ $Date: 2005-01-31 16:55:38 $
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
@@ -38,32 +38,28 @@
*
*************************************************************************/
-#ifndef _COM_SUN_STAR_SHEET_ADDIN_XEXAMPLEADDIN_IDL_
-#define _COM_SUN_STAR_SHEET_ADDIN_XEXAMPLEADDIN_IDL_
+#ifndef _ORG_OPENOFFICE_SHEET_ADDIN_XEXAMPLEADDIN_IDL_
+#define _ORG_OPENOFFICE_SHEET_ADDIN_XEXAMPLEADDIN_IDL_
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/sheet/XVolatileResult.idl>
-module com {
- module sun {
- module star {
- module sheet {
- module addin {
+module org {
+ module openoffice {
+ module sheet {
+ module addin {
+ /// The interface that the example addin implements
+ interface XExampleAddIn : com::sun::star::uno::XInterface
+ {
+ /// Sample function that just increments a value.
+ long getIncremented( [in] long nValue );
- /// The interface that the example addin implements
- interface XExampleAddIn : com::sun::star::uno::XInterface
- {
- /// Sample function that just increments a value.
- long getIncremented( [in] long nValue );
-
- /// Sample function that returns a volatile result.
- com::sun::star::sheet::XVolatileResult getCounter( [in] string aName );
+ /// Sample function that returns a volatile result.
+ com::sun::star::sheet::XVolatileResult getCounter( [in] string aName );
+ };
};
-
};
- };
};
- };
};
#endif