summaryrefslogtreecommitdiffstats
path: root/odk/examples/DevelopersGuide/Spreadsheet
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Spreadsheet')
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.components9
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java24
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.components8
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java63
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/Makefile20
5 files changed, 80 insertions, 44 deletions
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.components b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.components
new file mode 100644
index 000000000000..6212c72d4215
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.components
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://openoffice.org/2010/uno-components">
+ <component loader="com.sun.star.loader.Java2" uri="ExampleAddIn.uno.jar">
+ <implementation name="ExampleAddIn$_ExampleAddIn">
+ <service name="com.sun.star.sheet.AddIn"/>
+ <service name="org.openoffice.sheet.addin.ExampleAddIn"/>
+ </implementation>
+ </component>
+</components>
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
index 44f17a50c83d..d44de20e345e 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
@@ -116,7 +116,7 @@ public class 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";
+ static private final String aImplName = _ExampleAddIn.class.getName();
private static final short FUNCTION_INVALID = -1;
private static final short FUNCTION_INCREMENT = 0;
@@ -301,14 +301,18 @@ public class ExampleAddIn
return xSingleServiceFactory;
}
- 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)
- && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
- _ExampleAddIn.aImplName, _ExampleAddIn.aAddInService, 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)
+// {
+// // register for both the base AddIn and the own service
+// return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
+// _ExampleAddIn.aImplName, _ExampleAddIn.aExampleService, regKey)
+// && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
+// _ExampleAddIn.aImplName, _ExampleAddIn.aAddInService, regKey);
+// }
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.components b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.components
new file mode 100644
index 000000000000..f0881c1f5570
--- /dev/null
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.components
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://openoffice.org/2010/uno-components">
+ <component loader="com.sun.star.loader.Java2" uri="ExampleDataPilotSource.uno.jar">
+ <implementation name="ExampleDataPilotSource$_ExampleDataPilotSource">
+ <service name="com.sun.star.sheet.DataPilotSource"/>
+ </implementation>
+ </component>
+</components>
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);
+// }
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/Makefile b/odk/examples/DevelopersGuide/Spreadsheet/Makefile
index 3c1748327bac..84fdd9432dd8 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/Makefile
+++ b/odk/examples/DevelopersGuide/Spreadsheet/Makefile
@@ -59,6 +59,7 @@ COMP1_JAR=$(SAMPLE_CLASS_OUT)/$(COMP1_JAR_NAME)
COMP1_MANIFESTFILE=$(COMP1_GEN_OUT)/$(COMP1_NAME).uno.Manifest
COMP1_UNOPKG_MANIFEST=$(COMP1_GEN_OUT)/$(COMP1_NAME)/META-INF/manifest.xml
COMP1_REGISTERFLAG=$(SAMPLE_GEN_OUT)/devguide_$(COMP1_NAME)_register_component.flag
+COMP1_COMPONENTS=$(COMP1_NAME).components
# Example DataPilot component
COMP2_NAME=ExampleDataPilotSource
@@ -71,6 +72,7 @@ COMP2_JAR=$(SAMPLE_CLASS_OUT)/$(COMP2_JAR_NAME)
COMP2_MANIFESTFILE=$(COMP2_GEN_OUT)/$(COMP2_NAME).uno.Manifest
COMP2_UNOPKG_MANIFEST=$(COMP2_GEN_OUT)/$(COMP2_NAME)/META-INF/manifest.xml
COMP2_REGISTERFLAG=$(SAMPLE_GEN_OUT)/devguide_$(COMP2_NAME)_register_component.flag
+COMP2_COMPONENTS=$(COMP2_NAME).components
#REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(SAMPLE_NAME)_register_component.flag
@@ -176,8 +178,8 @@ $(COMP1_UNOPKG_MANIFEST) :
@echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
@echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
@echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP1_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
- @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
- @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP1_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP1_COMPONENTS)$(QM)"/$(CSEP)>> $@
@echo $(OSEP)/manifest:manifest$(CSEP) >> $@
$(COMP2_UNOPKG_MANIFEST) :
@@ -185,22 +187,24 @@ $(COMP2_UNOPKG_MANIFEST) :
@echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
@echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
@echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
- @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
- @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP2_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
+ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
+ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP2_COMPONENTS)$(QM)"/$(CSEP)>> $@
@echo $(OSEP)/manifest:manifest$(CSEP) >> $@
-$(COMP1_PACKAGE) : $(COMP1_RDB) $(COMP1_JAR) $(COMP1_UNOPKG_MANIFEST)
+$(COMP1_PACKAGE) : $(COMP1_RDB) $(COMP1_JAR) $(COMP1_UNOPKG_MANIFEST) $(COMP1_COMPONENTS)
echo "####" $(@)
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
-$(MKDIR) $(subst /,$(PS),$(@D))
- cd $(subst /,$(PS),$(COMP1_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(<F)
+ $(SDK_ZIP) $@ $(COMP1_COMPONENTS)
+ cd $(subst /,$(PS),$(COMP1_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) $(<F)
cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP1_JAR_NAME)
cd $(subst /,$(PS),$(COMP1_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../../bin/$(@F) META-INF/manifest.xml
-$(COMP2_PACKAGE) : $(COMP2_JAR) $(COMP2_UNOPKG_MANIFEST)
+$(COMP2_PACKAGE) : $(COMP2_JAR) $(COMP2_UNOPKG_MANIFEST) $(COMP2_COMPONENTS)
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
-$(MKDIR) $(subst /,$(PS),$(@D))
- cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
+ $(SDK_ZIP) $@ $(COMP2_COMPONENTS)
+ cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F)
cd $(subst /,$(PS),$(COMP2_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../../bin/$(@F) META-INF/manifest.xml
$(SAMPLE_GEN_OUT)/devguide_$(COMP1_NAME)_register_component.flag : $(OUT_BIN)/$(COMP1_NAME).$(UNOOXT_EXT)