diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:36 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:36 +0100 |
commit | 11cdc4ccc4ae58437ded5aef40df1276220edc2c (patch) | |
tree | 7e367cf5e21e93532d69126eadac3090e1d33a1a /odk/examples | |
parent | f03de39457c663e88592899ebda0f07c4e24aa9c (diff) | |
parent | 33e2b11638c87ffed5d91405ba76cb00cd91e1be (diff) |
Merge commit 'ooo/DEV300_m103'
Conflicts:
odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx
odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx
odk/examples/cpp/complextoolbarcontrols/exports.cxx
odk/examples/cpp/counter/countermain.cxx
odk/examples/cpp/remoteclient/remoteclient.cxx
odk/settings/settings.mk
Diffstat (limited to 'odk/examples')
83 files changed, 1120 insertions, 907 deletions
diff --git a/odk/examples/CLI/CSharp/Spreadsheet/Makefile b/odk/examples/CLI/CSharp/Spreadsheet/Makefile index cbe43167905d..bae593f34069 100644 --- a/odk/examples/CLI/CSharp/Spreadsheet/Makefile +++ b/odk/examples/CLI/CSharp/Spreadsheet/Makefile @@ -25,10 +25,7 @@ CLI_LIB_LOCATION = $(PRJ)\cli # Targets .PHONY : ALL -ALL : SpreadsheetSample \ - GeneralTableSample \ - ViewSample \ - Info +ALL : Info include $(SETTINGS)/stdtarget.mk @@ -56,7 +53,8 @@ GeneralTableSample : $(SPREADSHEET_OUT)/GeneralTableSample.exe ViewSample : $(SPREADSHEET_OUT)/ViewSample.exe .PHONY : Info -Info : +ifeq "$(OS)" "WIN" +Info : SpreadsheetSample GenerateTableSample ViewSample @echo ------------------------------------------------------------------------------- @echo Please use one of the following commands to execute the examples! @echo - @@ -64,7 +62,12 @@ Info : @echo $(MAKE) SpreadsheetSample.run @echo $(MAKE) ViewSample.run @echo ------------------------------------------------------------------------------- - +else +Info : + @echo -------------------------------------------------------------------------------- + @echo This example works only under Windows! + @echo -------------------------------------------------------------------------------- +endif %.run : $(SPREADSHEET_OUT)/%.exe @echo ------------------------------------------------------------------------------- diff --git a/odk/examples/CLI/VB.NET/WriterDemo/Makefile b/odk/examples/CLI/VB.NET/WriterDemo/Makefile index ac60d7ef4536..2fd3f993ce2c 100644 --- a/odk/examples/CLI/VB.NET/WriterDemo/Makefile +++ b/odk/examples/CLI/VB.NET/WriterDemo/Makefile @@ -42,12 +42,19 @@ $(WRITERDEMO_OUT)/%.exe: %.vb -reference:System.Windows.Forms.dll \ $^ +ifeq "$(OS)" "WIN" WriterDemo : $(WRITERDEMO_OUT)/WriterDemo.exe @echo ------------------------------------------------------------------------------- @echo Please use the following command to execute the example! @echo - @echo $(MAKE) WriterDemo.run @echo ------------------------------------------------------------------------------- +else +WriterDemo : + @echo -------------------------------------------------------------------------------- + @echo This example works only under Windows! + @echo -------------------------------------------------------------------------------- +endif %.run : $(WRITERDEMO_OUT)/%.exe @echo ------------------------------------------------------------------------------- diff --git a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.components b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.components new file mode 100644 index 000000000000..e9a7baa48056 --- /dev/null +++ b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.components @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<components xmlns="http://openoffice.org/2010/uno-components"> + <component loader="com.sun.star.loader.Java2" uri="JavaSampleChartAddIn.uno.jar"> + <implementation name="JavaSampleChartAddIn"> + <service name="com.sun.star.comp.Chart.JavaSampleChartAddIn"/> + <service name="com.sun.star.chart.Diagram"/> + <service name="com.sun.star.chart.ChartAxisYSupplier"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java index 10a137a316d5..06239b6c9851 100644 --- a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java +++ b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java @@ -459,18 +459,22 @@ public class JavaSampleChartAddIn extends WeakBase implements * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey regKey ) - { - boolean bResult = true; - - String[] aServices = getSupportedServiceNames_Static(); - int i, nLength = aServices.length; - - for( i = 0; i < nLength; ++i ) - { - bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - JavaSampleChartAddIn.class.getName(), aServices[ i ], regKey ); - } - return bResult; - } + // 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 ) +// { +// boolean bResult = true; + +// String[] aServices = getSupportedServiceNames_Static(); +// int i, nLength = aServices.length; + +// for( i = 0; i < nLength; ++i ) +// { +// bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( +// JavaSampleChartAddIn.class.getName(), aServices[ i ], regKey ); +// } +// return bResult; +// } } diff --git a/odk/examples/DevelopersGuide/Charts/Makefile b/odk/examples/DevelopersGuide/Charts/Makefile index f35f8fcbb9f7..d6727662bfbb 100644 --- a/odk/examples/DevelopersGuide/Charts/Makefile +++ b/odk/examples/DevelopersGuide/Charts/Makefile @@ -57,14 +57,15 @@ APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar APP5_NAME=SelectionChangeListener APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar -COMPONENT_NAME=JavaSampleChartAddIn -COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar -COMPONENT_JAR = $(SAMPLE_CLASS_OUT)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE = $(SAMPLE_CLASS_OUT)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(SAMPLE_CLASS_OUT)/$(COMPONENT_NAME)/META-INF/manifest.xml -COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=JavaSampleChartAddIn +COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME = $(COMP_NAME).uno.jar +COMP_JAR = $(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE = $(SAMPLE_CLASS_OUT)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(SAMPLE_CLASS_OUT)/$(COMP_NAME)/META-INF/manifest.xml +COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components COMPJAVAFILES = \ JavaSampleChartAddIn.java @@ -79,7 +80,7 @@ COMPCLASSFILES= $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(COMPJAVAFILES)) APP_CLASSFILES= $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES)) APP_CLASSNAMES= $(patsubst %.java,%.class,$(APP_JAVAFILES)) -$(COMPONENT_NAME)_CLASSFILES = $(COMPONENT_NAME).class +$(COMP_NAME)_CLASSFILES = $(COMP_NAME).class SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)) @@ -122,7 +123,7 @@ $(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(COMPCLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(COMPCLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) @@ -133,22 +134,23 @@ $(SAMPLE_CLASS_OUT)/%/manifest.xml : @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 $(SAMPLE_CLASS_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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component pacakge file -$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) -u $(<F) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) ../../../bin/$(@F) -u META-INF/manifest.xml -$(COMP_REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -195,4 +197,4 @@ AddInChart.ods.load : $(REGISTERFLAG) clean : -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.components b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.components new file mode 100644 index 000000000000..c47f26b0187d --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.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="AsyncJob.uno.jar"> + <implementation name="com.sun.star.comp.framework.java.services.AsyncJob"> + <service name="com.sun.star.task.AsyncJob"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java index 14c2659e48a7..790a52d46fb1 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java +++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.java @@ -312,7 +312,22 @@ public class AsyncJob extends WeakBase implements XServiceInfo, XAsyncJob // Because we need a parent anytime. // And showing e.g. a java dialog can make some trouble // inside office ... but we have no chance here. - javax.swing.JOptionPane.showMessageDialog(null, sMessage, sTitle, javax.swing.JOptionPane.INFORMATION_MESSAGE); + final java.lang.String sFinalTitle = sTitle; + final java.lang.String sFinalMessage = sMessage; + + // On Mac OS X, AWT/Swing must not be accessed from the AppKit thread, so call + // SwingUtilities.invokeLater always on a fresh thread to avoid that problem + // (also, the current thread must not wait for that fresh thread to terminate, + // as that would cause a deadlock if this thread is the AppKit thread): + final Runnable doRun = new Runnable() { + public void run() { + javax.swing.JOptionPane.showMessageDialog(null, sFinalMessage, sFinalTitle, javax.swing.JOptionPane.INFORMATION_MESSAGE); + } + }; + + new Thread( doRun ) { + public void run() { javax.swing.SwingUtilities.invokeLater(doRun); } + }.start(); } //___________________________________________ @@ -415,12 +430,15 @@ public class AsyncJob extends WeakBase implements XServiceInfo, XAsyncJob } //___________________________________________ - - public synchronized static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xRegKey) - { - return Factory.writeRegistryServiceInfo( - AsyncJob.IMPLEMENTATIONNAME, - AsyncJob.SERVICENAMES, - xRegKey); - } + // 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 synchronized static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xRegKey) +// { +// return Factory.writeRegistryServiceInfo( +// AsyncJob.IMPLEMENTATIONNAME, +// AsyncJob.SERVICENAMES, +// xRegKey); +// } } diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile index 8b40d9ec87ff..052cea359530 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile +++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Makefile @@ -42,16 +42,17 @@ include $(SETTINGS)/std.mk include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings -COMPONENT_NAME=AsyncJob -OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME) -OUT_COMP_MISC=$(OUT_MISC)/$(COMPONENT_NAME) -COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar -COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml -REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=AsyncJob +OUT_COMP_CLASS=$(OUT_CLASS)/$(COMP_NAME) +OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME) +COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME=$(COMP_NAME).uno.jar +COMP_JAR=$(OUT_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components JAVAFILES = AsyncJob.java @@ -76,7 +77,7 @@ $(CLASSFILES) : $(JAVAFILES) $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) . @@ -91,24 +92,24 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)Jobs.xcu$(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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu Jobs.xcu $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) Addons.xcu Jobs.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_CLASS)) && $(SDK_ZIP) ../bin/$(@F) $(<F) - $(SDK_ZIP) -u $@ Addons.xcu Jobs.xcu + $(SDK_ZIP) -u $@ Addons.xcu Jobs.xcu $(COMP_COMPONENTS) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -132,5 +133,5 @@ DevGuideJobsAddon : $(REGISTERFLAG) clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_JAR))) diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile index af679d8a4bc2..a6bc6835fdcb 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/Makefile @@ -43,14 +43,15 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=ProtocolHandlerAddon_cpp -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME) OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml -COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +#COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag @@ -70,12 +71,12 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -86,7 +87,8 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +#$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -105,16 +107,28 @@ $(OUT_COMP_GEN)/%/manifest.xml : @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@ - @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)org.openoffice.Office.addon.example$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.frame.ProtocolHandler$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + # rule for component package file -$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) - cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_NAME).components + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml @@ -144,5 +158,6 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx index 19553b282926..cb21920ea951 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx @@ -61,7 +61,7 @@ using namespace ::com::sun::star::registry; /** * Gives the environment this component belongs to. */ -extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -73,33 +73,37 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char * * @param pServiceManager the service manager * @param pRegistryKey the registry key */ -extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) -{ - sal_Bool result = sal_False; +// This method not longer necessary since OOo 3.4 where the component registration was +// was changed to passive component registration. For more details see +// http://wiki.services.openoffice.org/wiki/Passive_Component_Registration +// +// extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) +// { +// sal_Bool result = sal_False; - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLEMENTATION_NAME "/UNO/SERVICES") ) ) ); +// if (pRegistryKey) +// { +// try +// { +// Reference< XRegistryKey > xNewKey( +// reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( +// OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLEMENTATION_NAME "/UNO/SERVICES") ) ) ); - const Sequence< OUString > & rSNL = - Addon_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); +// const Sequence< OUString > & rSNL = +// Addon_getSupportedServiceNames(); +// const OUString * pArray = rSNL.getConstArray(); +// for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) +// xNewKey->createKey( pArray[nPos] ); - return sal_True; - } - catch (InvalidRegistryException &) - { - // we should not ignore exceptions - } - } - return result; -} +// return sal_True; +// } +// catch (InvalidRegistryException &) +// { +// // we should not ignore exceptions +// } +// } +// return result; +// } /** * This function is called to get service factories for an implementation. @@ -109,7 +113,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * * @param pRegistryKey the registry key for this component, need for persistent data * @return a component factory */ -extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) { void * pRet = 0; diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile index ac6a0670a05a..82a87aea4ecf 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/Makefile @@ -42,17 +42,18 @@ include $(SETTINGS)/std.mk include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings -COMPONENT_NAME=ProtocolHandlerAddon_java -OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME) -OUT_COMP_MISC=$(OUT_MISC)/$(COMPONENT_NAME) -COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar -COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml - -REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=ProtocolHandlerAddon_java +OUT_COMP_CLASS=$(OUT_CLASS)/$(COMP_NAME) +OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME) +COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME=$(COMP_NAME).uno.jar +COMP_JAR=$(OUT_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +COMP_COMPONENTS=$(COMP_NAME).components + +REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMP_NAME)_register_component.flag JAVAFILES = ProtocolHandlerAddon.java @@ -77,7 +78,7 @@ $(CLASSFILES) : $(JAVAFILES) $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) . @@ -92,25 +93,25 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu ProtocolHandler.xcu $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) Addons.xcu ProtocolHandler.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_MISC)) cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) - $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu + $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu $(COMP_COMPONENTS) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -134,5 +135,5 @@ DevGuideProtocolHandlerAddon : $(REGISTERFLAG) clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_JAR))) diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java index ad3b0efe8747..debc2ce8d8af 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java @@ -273,11 +273,15 @@ public class ProtocolHandlerAddon { * structures) of a single * registry key accessible. */ - public static boolean __writeRegistryServiceInfo( - XRegistryKey xRegistryKey ) { - return Factory.writeRegistryServiceInfo( - ProtocolHandlerAddonImpl.class.getName(), - ProtocolHandlerAddonImpl.getServiceNames(), - xRegistryKey ); - } + // 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( +// XRegistryKey xRegistryKey ) { +// return Factory.writeRegistryServiceInfo( +// ProtocolHandlerAddonImpl.class.getName(), +// ProtocolHandlerAddonImpl.getServiceNames(), +// xRegistryKey ); +// } } diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.components new file mode 100644 index 000000000000..13665ebbc3c5 --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon_java.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="ProtocolHandlerAddon_java.uno.jar"> + <implementation name="ProtocolHandlerAddon$ProtocolHandlerAddonImpl"> + <service name="com.sun.star.frame.ProtocolHandler"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/Makefile b/odk/examples/DevelopersGuide/Components/CppComponent/Makefile index 96dd4e59e9ae..84195a8ff777 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/Makefile +++ b/odk/examples/DevelopersGuide/Components/CppComponent/Makefile @@ -49,7 +49,7 @@ SAMPLE_SLO_OUT=$(OUT_SLO)/$(SAMPLE_NAME) SAMPLE_OBJ_OUT=$(OUT_OBJ)/$(SAMPLE_NAME) COMP_NAME=CppComponent -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) APP1_NAME= TestCppComponent APP1_BINARY= $(OUT_BIN)/$(APP1_NAME)$(EXE_EXT) @@ -59,7 +59,8 @@ COMP_RDB = $(SAMPLE_GEN_OUT)/$(COMP_RDB_NAME) COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(SAMPLE_GEN_OUT)/$(COMP_NAME)/META-INF/manifest.xml -COMP_MAPFILE = $(SAMPLE_GEN_OUT)/$(COMP_NAME).uno.map +#COMP_MAPFILE = $(SAMPLE_GEN_OUT)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(SAMPLE_GEN_OUT)/$(COMP_NAME).components COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_register_component.flag COMP_TYPEFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_types.flag @@ -103,12 +104,12 @@ $(SAMPLE_SLO_OUT)/%.$(OBJ_EXT) : %.cxx $(COMP_TYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -119,7 +120,8 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +#$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -136,16 +138,31 @@ $(SAMPLE_GEN_OUT)/%/manifest.xml : @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 $(SAMPLE_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=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ -$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) $(COMP_RDB) $(COMP_UNOPKG_MANIFEST) +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)my_module.my_sc_implementation.MyService1$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)my_module.MyService1$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)my_module.my_sc_implementation.MyService2$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)my_module.MyService2$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + +$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) $(COMP_RDB) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(UNOPKG_PLATFORM)) - cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_RDB_NAME) $(UNOPKG_PLATFORM)/$(<F) + cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_NAME).components + cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) $(UNOPKG_PLATFORM)/$(<F) cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml @@ -216,5 +233,6 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_SLO_OUT)) -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_OBJ_OUT)) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(COMP_NAME)*)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/*$(APP1_NAME)*)) diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx index 81401ede482b..cc0f377173fd 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx +++ b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx @@ -200,20 +200,25 @@ static struct ::cppu::ImplementationEntry s_component_entries [] = extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( sal_Char const ** ppEnvTypeName, uno_Environment ** ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) -{ - return ::cppu::component_writeInfoHelper( - xMgr, xRegistry, ::my_sc_impl::s_component_entries ); -} +// This method not longer necessary since OOo 3.4 where the component registration was +// was changed to passive component registration. For more details see +// http://wiki.services.openoffice.org/wiki/Passive_Component_Registration +// +// sal_Bool SAL_CALL component_writeInfo( +// lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) +// { +// return ::cppu::component_writeInfoHelper( +// xMgr, xRegistry, ::my_sc_impl::s_component_entries ); +// } + -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sal_Char const * implName, lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry ) { diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/JavaComponent.components b/odk/examples/DevelopersGuide/Components/JavaComponent/JavaComponent.components new file mode 100644 index 000000000000..67ac8696dbe2 --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/JavaComponent.components @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<components xmlns="http://openoffice.org/2010/uno-components"> + <component loader="com.sun.star.loader.Java2" uri="JavaComponent.uno.jar"> + <implementation name="TestComponentA"> + <service name="com.sun.star.test.SomethingA"/> + </implementation> + <implementation name="TestComponentB"> + <service name="com.sun.star.test.SomethingB"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile b/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile index 55f8cbc12425..327d4f2d3f36 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/Makefile @@ -43,21 +43,23 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings -COMPONENT_NAME=JavaComponent -OUT_COMP_CLASS = $(OUT_CLASS)/$(COMPONENT_NAME) -OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME) -COMPONENT_RDB_NAME = $(COMPONENT_NAME).uno.rdb -COMPONENT_RDB = $(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME) -COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar -COMPONENT_JAR = $(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml +COMP_NAME=JavaComponent +OUT_COMP_CLASS = $(OUT_CLASS)/$(COMP_NAME) +OUT_COMP_GEN = $(OUT_MISC)/$(COMP_NAME) +COMP_RDB_NAME = $(COMP_NAME).uno.rdb +COMP_RDB = $(OUT_COMP_GEN)/$(COMP_RDB_NAME) +COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME = $(COMP_NAME).uno.jar +COMP_JAR = $(OUT_COMP_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +COMP_COMPONENTS=$(COMP_NAME).components + APP1_NAME=TestJavaComponent APP1_JAR=$(OUT_COMP_CLASS)/$(APP1_NAME).jar -REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMPONENT_NAME)_register_component.flag +REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMP_NAME)_register_component.flag IDLFILES = XSomethingA.idl \ XSomethingB.idl \ @@ -80,9 +82,9 @@ GENURDFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/%.urd,$(IDLFILES)) COMPCLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(COMPJAVAFILES)) -$(COMPONENT_NAME)_CLASSFILES = $(patsubst %.java,%.class,$(COMPJAVAFILES)) +$(COMP_NAME)_CLASSFILES = $(patsubst %.java,%.class,$(COMPJAVAFILES)) -$(COMPONENT_NAME)_CLASSFILES += $(subst $(OUT_COMP_CLASS)/,,$(GENCLASSFILES)) +$(COMP_NAME)_CLASSFILES += $(subst $(OUT_COMP_CLASS)/,,$(GENCLASSFILES)) SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(OUT_COMP_CLASS)) @@ -109,9 +111,9 @@ $(OUT_COMP_GEN)/%.rdb : $(GENURDFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(REGMERGE) $@ /UCR $(GENURDFILES) -$(OUT_COMP_CLASS)/$(PACKAGE)/%.class : $(COMPONENT_RDB) +$(OUT_COMP_CLASS)/$(PACKAGE)/%.class : $(COMP_RDB) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMPONENT_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) + $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) $(OUT_COMP_CLASS)/%.class : %.java $(GENCLASSFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) @@ -134,11 +136,11 @@ $(OUT_COMP_CLASS)/%.mf : $(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(APP1_NAME).class $(COMPCLASSFILES) $(GENCLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - +cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(basename $(@F)).class $($(COMPONENT_NAME)_CLASSFILES) + +cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(basename $(@F)).class $($(COMP_NAME)_CLASSFILES) +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(COMPCLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(COMPCLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) @@ -151,24 +153,25 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @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 $(OUT_COMP_CLASS)/,,$(@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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component pacakge file -$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(COPY) $(subst /,$(PS),$(COMPONENT_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(COMPONENT_RDB_NAME) $(COMPONENT_JAR_NAME) + $(COPY) $(subst /,$(PS),$(COMP_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS)) + $(SDK_ZIP) $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml - $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_COMP_CLASS)/$(COMPONENT_RDB_NAME))) + $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_COMP_CLASS)/$(COMP_RDB_NAME))) -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -200,5 +203,5 @@ JavaComponentExample : $(REGISTERFLAG) $(APP1_JAR) clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java index dee8899510e4..15980bb04a64 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java @@ -57,15 +57,19 @@ public class TestServiceProvider return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey){ - boolean bregA= FactoryHelper.writeRegistryServiceInfo( - TestComponentA.class.getName(), - TestComponentA.__serviceName, regKey); - boolean bregB= FactoryHelper.writeRegistryServiceInfo( - TestComponentB.class.getName(), - TestComponentB.__serviceName, regKey); - return bregA && bregB; - } + // 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(XRegistryKey regKey){ +// boolean bregA= FactoryHelper.writeRegistryServiceInfo( +// TestComponentA.class.getName(), +// TestComponentA.__serviceName, regKey); +// boolean bregB= FactoryHelper.writeRegistryServiceInfo( +// TestComponentB.class.getName(), +// TestComponentB.__serviceName, regKey); +// return bregA && bregB; +// } } diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.components b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.components new file mode 100644 index 000000000000..94a4848c0ee1 --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.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="LicenseTest.uno.jar"> + <implementation name="LicenseTest$_LicenseTest"> + <service name="org.openoffice.LicenseTest"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java index 211638c46c58..d7b6716dcdcc 100644 --- a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java @@ -148,11 +148,15 @@ public class LicenseTest { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(_LicenseTest.class.getName(), - _LicenseTest.getServiceNames(), - 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(XRegistryKey regKey) { +// return Factory.writeRegistryServiceInfo(_LicenseTest.class.getName(), +// _LicenseTest.getServiceNames(), +// regKey); +// } /** This method is a member of the interface for initializing an object * directly after its creation. * @param object This array of arbitrary objects will be passed to the diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile b/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile index 976de2d07b40..c82f0ba7e014 100644 --- a/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/Makefile @@ -62,6 +62,7 @@ COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag COMP_LOCAL_FILES = description.xml registration/license_de.txt registration/license_en_US.txt +COMP_COMPONENTS=$(COMP_NAME).components IDLFILES = LicenseTest.idl @@ -130,15 +131,16 @@ $(COMP_GEN_OUT)/%/manifest.xml : @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 $(SAMPLE_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 $(SAMPLE_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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_LOCAL_FILES) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_LOCAL_FILES) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME) + $(SDK_ZIP) $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) $(COMP_RDB_NAME) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml $(SDK_ZIP) -u $@ $(COMP_LOCAL_FILES) diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/Makefile index 6dffc4cbad7a..7070493a8cf1 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/Makefile +++ b/odk/examples/DevelopersGuide/Components/Thumbs/Makefile @@ -59,7 +59,7 @@ $(SUBDIRS) : org/openoffice/comp/test : org/openoffice/test -ComponentsThumbsExample : $(COMPONENT_PACKAGE) +ComponentsThumbsExample : $(COMP_PACKAGE) @echo -------------------------------------------------------------------------------- @echo Please use one of the following command to execute the example! @echo - diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.components b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.components new file mode 100644 index 000000000000..11d958fe82a0 --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.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="ImageShrink.uno.jar"> + <implementation name="org.openoffice.comp.test.ImageShrink"> + <service name="org.openoffice.test.ImageShrink"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java index 7fe4307d8a80..5565d7d20780 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java @@ -93,12 +93,17 @@ public class ImageShrink extends WeakBase return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - //System.out.println(ImageShrink.class.getName()); - return FactoryHelper.writeRegistryServiceInfo( ImageShrink.class.getName(), - __serviceName, - 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(XRegistryKey regKey) { +// //System.out.println(ImageShrink.class.getName()); +// return FactoryHelper.writeRegistryServiceInfo( ImageShrink.class.getName(), +// __serviceName, +// regKey); +// } // XFilter implementation (a sub-interface of XImageShrinkFilter) public void cancel() { diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile index 2b990e22ae2e..6894e1d9bb49 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Makefile @@ -74,7 +74,7 @@ $(OUT_COMP_CLASS)/%.mf : @echo Application-Class: $(subst /,.,$(PACKAGE)).$*>> $@ # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(OUT_COMP_CLASS)/$(PACKAGE)/$(COMPONENT_NAME).class +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(OUT_COMP_CLASS)/$(PACKAGE)/$(COMP_NAME).class -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) $(PACKAGE)/$(basename $(basename $(@F))).class $(patsubst %.class,-C $(OUT_COMP_CLASS) %.class,$(GENCLASSNAMES)) @@ -87,18 +87,19 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @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 $(OUT_COMP_CLASS)/,,$(@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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(COPY) $(subst /,$(PS),$(COMPONENT_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(COMPONENT_RDB_NAME) $(COMPONENT_JAR_NAME) + $(COPY) $(subst /,$(PS),$(COMP_RDB)) $(subst /,$(PS),$(OUT_COMP_CLASS)) + $(SDK_ZIP) $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml - $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_CLASS)/$(COMPONENT_RDB_NAME))) + $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_CLASS)/$(COMP_RDB_NAME))) $(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(PACKAGE)/$(APP1_NAME).class -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) @@ -106,11 +107,11 @@ $(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(PACKAGE)/$(A +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -122,7 +123,7 @@ endif .PHONY: clean clean : - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_JAR))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(APP1_JAR))) diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile index 698670084a23..fc453a11f948 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/Makefile @@ -64,9 +64,9 @@ $(OUT_COMP_GEN)/%.rdb : $(GENURDFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(REGMERGE) $@ /UCR $(GENURDFILES) -$(OUT_COMP_CLASS)/%.class : $(COMPONENT_RDB) +$(OUT_COMP_CLASS)/%.class : $(COMP_RDB) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMPONENT_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) + $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) .PHONY: clean clean : diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk b/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk index ae6a5c94f0fa..cec8a3f4c655 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk +++ b/odk/examples/DevelopersGuide/Components/Thumbs/thumbs.mk @@ -1,16 +1,17 @@ OUT_COMP_CLASS = $(OUT_CLASS)/ComponentThumbsExample OUT_COMP_GEN = $(OUT_MISC)/ComponentThumbsExample -COMPONENT_NAME=ImageShrink -COMPONENT_RDB_NAME = $(COMPONENT_NAME).uno.rdb -COMPONENT_RDB = $(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME) -COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar -COMPONENT_JAR = $(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml -REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=ImageShrink +COMP_RDB_NAME = $(COMP_NAME).uno.rdb +COMP_RDB = $(OUT_COMP_GEN)/$(COMP_RDB_NAME) +COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME = $(COMP_NAME).uno.jar +COMP_JAR = $(OUT_COMP_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components IDL_PACKAGE=org/openoffice/test diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.components b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.components new file mode 100644 index 000000000000..56d7c8eb8f45 --- /dev/null +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.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="DialogComponent.uno.jar"> + <implementation name="DialogComponent$_DialogComponent"> + <service name="com.sun.star.test.TestDialogHandler"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java index f7ad9ad4b7c8..9d6409e26674 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java @@ -316,9 +316,13 @@ public class DialogComponent { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(_DialogComponent.class.getName(), - _DialogComponent.getServiceNames(), - 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(XRegistryKey regKey) { +// return Factory.writeRegistryServiceInfo(_DialogComponent.class.getName(), +// _DialogComponent.getServiceNames(), +// regKey); +// } } diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile b/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile index 8726029ec222..7afc11f0834c 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/Makefile @@ -61,6 +61,7 @@ COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components IDLFILES = XTestDialogHandler.idl \ TestDialogHandler.idl @@ -131,15 +132,16 @@ $(COMP_GEN_OUT)/%/manifest.xml : @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 $(SAMPLE_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 $(SAMPLE_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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME) + $(SDK_ZIP) $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) $(COMP_RDB_NAME) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/Makefile b/odk/examples/DevelopersGuide/Database/DriverSkeleton/Makefile index ccfe4b6e7dfe..7f77f1ff24d7 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/Makefile +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/Makefile @@ -43,7 +43,7 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=DatabaseSDBCDriverSkeleton -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) COMP_LIBRARY=$(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) OUT_COMP_MISC=$(OUT_MISC)/$(COMP_NAME) @@ -51,9 +51,10 @@ OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(OUT_COMP_MISC)/$(COMP_NAME)/META-INF/manifest.xml -COMP_MAPFILE = $(OUT_COMP_MISC)/$(COMP_NAME).uno.map +#COMP_MAPFILE = $(OUT_COMP_MISC)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(OUT_COMP_MISC)/$(COMP_NAME).components -REGISTERFLAG = $(OUT_COMP_MISC)/devguide_$(COMP_NAME)_register_component.flag +COMP_REGISTERFLAG = $(OUT_COMP_MISC)/devguide_$(COMP_NAME)_register_component.flag CXXFILES = SConnection.cxx \ SDatabaseMetaData.cxx \ @@ -78,12 +79,12 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) $(STL_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -94,7 +95,7 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -109,18 +110,30 @@ $(OUT_COMP_MISC)/%/manifest.xml : @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=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_MISC)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ -$(COMP_PACKAGE) : $(COMP_LIBRARY) $(COMP_UNOPKG_MANIFEST) +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)com.sun.star.comp.sdbc.SkeletonDriver$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.sdbc.Driver$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + +$(COMP_PACKAGE) : $(COMP_LIBRARY) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_MISC)/$(UNOPKG_PLATFORM)) - cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) + cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_NAME).components + cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) cd $(subst /,$(PS),$(OUT_COMP_MISC)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMP_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(MKDIR) $(subst /,$(PS),$(@D)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) @@ -134,7 +147,7 @@ else @echo -------------------------------------------------------------------------------- endif -DatabaseSDBCDriverSkeletonExample : $(REGISTERFLAG) +DatabaseSDBCDriverSkeletonExample : $(COMP_REGISTERFLAG) @echo -------------------------------------------------------------------------------- @echo The Database SDBC skeleton driver component was installed if SDK_AUTO_DEPLOYMENT = YES. @echo You can use this component inside your office installation, see the example @@ -147,4 +160,6 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_LIBRARY))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx index 5866d829e125..d9ad79fcdc77 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx @@ -33,6 +33,7 @@ * *************************************************************************/ +#include <sal/types.h> #include "SDriver.hxx" #include <cppuhelper/factory.hxx> #include <osl/diagnose.h> @@ -56,8 +57,8 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) //*************************************************************************************** // -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// The required C-Api must be provided! +// It contains of 3 special functions that have to be exported. // //--------------------------------------------------------------------------------------- @@ -118,7 +119,7 @@ struct ProviderRequest //--------------------------------------------------------------------------------------- -extern "C" void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment **ppEnv ) @@ -126,33 +127,9 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//--------------------------------------------------------------------------------------- -extern "C" sal_Bool SAL_CALL component_writeInfo( - void* pServiceManager, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - SkeletonDriver::getImplementationName_Static(), - SkeletonDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_FAIL("SKELETON::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} //--------------------------------------------------------------------------------------- -extern "C" void* SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey) diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/Makefile b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/Makefile index 87b893f1ed92..d2d4e9340892 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/Makefile @@ -60,7 +60,7 @@ include $(SETTINGS)/stdtarget.mk $(OUT_SHL_SLO)/%.$(OBJ_EXT) : %.c -$(MKDIR) $(subst /,$(PS),$(@D)) - $(CC) $(CC_FLAGS) $(CC_INCLUDES) $(SDK_JAVA_INCLUDES) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< + $(CC) $(CC_FLAGS_JNI) $(CC_INCLUDES) $(SDK_JAVA_INCLUDES) $(CC_DEFINES_JNI) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< $(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(SHL_NAME).$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/Makefile b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/Makefile index 71c50df5ea2e..7052c2f968cc 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/Makefile @@ -61,7 +61,7 @@ include $(SETTINGS)/stdtarget.mk $(OUT_SHL_SLO)/%.$(OBJ_EXT) : %.c -$(MKDIR) $(subst /,$(PS),$(@D)) - $(CC) $(CC_FLAGS) $(CC_INCLUDES) $(SDK_JAVA_INCLUDES) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< + $(CC) $(CC_FLAGS_JNI) $(CC_INCLUDES) $(SDK_JAVA_INCLUDES) $(CC_DEFINES_JNI) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< $(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(SHL_NAME).$(SHAREDLIB_EXT) : $(SLOFILES) $(SHL_NAME).def -$(MKDIR) $(subst /,$(PS),$(@D)) diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java index 24eb92a3109c..475fb4963dbc 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java @@ -723,11 +723,15 @@ public class AsciiReplaceFilter * * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey xRegistryKey ) - { - return Factory.writeRegistryServiceInfo( - _AsciiReplaceFilter.class.getName(), - _AsciiReplaceFilter.m_serviceNames, - xRegistryKey ); - } + // 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 xRegistryKey ) +// { +// return Factory.writeRegistryServiceInfo( +// _AsciiReplaceFilter.class.getName(), +// _AsciiReplaceFilter.m_serviceNames, +// xRegistryKey ); +// } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/Makefile b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/Makefile index e84e53ed3fc0..d0ce80991c11 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/Makefile @@ -55,6 +55,7 @@ COMP_JAR = $(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) COMP_MANIFESTFILE = $(SAMPLE_GEN_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(SAMPLE_GEN_OUT)/$(COMP_NAME)/META-INF/manifest.xml COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_component.flag +COMP_COMPONENTS=$(COMP_NAME).components # often the java files are structured in a hierarchy similar to the package, # for the example we know the package @@ -98,15 +99,16 @@ $(SAMPLE_GEN_OUT)/%/manifest.xml : @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.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)TypeDetection.xcu$(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 $(SAMPLE_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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_JAR) TypeDetection.xcu $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) TypeDetection.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(SDK_ZIP) $@ TypeDetection.xcu + $(SDK_ZIP) -u $@ $(COMP_COMPONENTS) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(SAMPLE_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/SampleFilter.components b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/SampleFilter.components new file mode 100644 index 000000000000..f288f7e9497d --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/SampleFilter.components @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<components xmlns="http://openoffice.org/2010/uno-components"> + <component loader="com.sun.star.loader.Java2" uri="SampleFilter.uno.jar"> + <implementation name="OfficeDev.samples.Filter.AsciiReplaceFilter$_AsciiReplaceFilter"> + <service name="com.sun.star.comp.ansifilter.AsciiReplaceFilter"/> + <service name="com.sun.star.document.ImportFilter"/> + <service name="com.sun.star.document.ExportFilter"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/Makefile b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/Makefile index c3d4898082c4..d9f70b2cf36e 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/Makefile @@ -43,7 +43,7 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=FlatXmlTypeDetection -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) OUT_COMP_INC = $(OUT_INC)/$(COMP_NAME) OUT_COMP_GEN = $(OUT_MISC)/$(COMP_NAME) OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) @@ -52,7 +52,8 @@ COMP_RDB = $(OUT_COMP_GEN)/$(COMP_RDB_NAME) COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml -COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components +#COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map REGISTERFLAG = $(OUT_MISC)/devguide_$(COMP_NAME)_register_component.flag @@ -72,12 +73,12 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -88,7 +89,7 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -105,17 +106,29 @@ $(OUT_COMP_GEN)/%/manifest.xml : @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.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)FlatXmlTypeDetection.xcu$(QM)"/$(CSEP) >> $@ - @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)devguide.officedev.samples.filter.FlatXmlDetect$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.document.ExtendedTypeDetection$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + # rule for component package file -$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) FlatXmlTypeDetection.xcu $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) FlatXmlTypeDetection.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(SDK_ZIP) $@ FlatXmlTypeDetection.xcu + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml @@ -146,5 +159,6 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx index b01d752d626c..31e13cc8577b 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx @@ -51,41 +51,15 @@ using namespace ::com::sun::star::registry; extern "C" { //================================================================================================== -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")) ); - - const Sequence< OUString > & rSNL = FilterDetect_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_FAIL( "### InvalidRegistryException!" ); - } - } - return sal_False; -} //================================================================================================== -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx index 7eb5a1225fa8..649423635a8e 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx @@ -319,38 +319,14 @@ using namespace XFlatXml; extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString(RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" )) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_FAIL( "### InvalidRegistryException!" ); - } - } - return sal_False; -} -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/Makefile b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/Makefile index a6665495563e..1a9680825e68 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/Makefile @@ -43,16 +43,17 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=FlatXmlFilter_cpp -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) OUT_COMP_INC = $(OUT_INC)/$(COMP_NAME) OUT_COMP_GEN = $(OUT_MISC)/$(COMP_NAME) OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml -COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +#COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components -REGISTERFLAG = $(OUT_MISC)/devguide_$(COMP_NAME)_register_component.flag +COMP_REGISTERFLAG = $(OUT_MISC)/devguide_$(COMP_NAME)_register_component.flag CXXFILES = FlatXml.cxx @@ -69,12 +70,12 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -85,7 +86,7 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -102,21 +103,33 @@ $(OUT_COMP_GEN)/%/manifest.xml : @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.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)FlatXmlFilter_cpp.xcu$(QM)"/$(CSEP) >> $@ - @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)devguide.officedev.samples.filter.FlatXmlCpp$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)devguide.officedev.samples.filter.FlatXmlCpp$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + # rule for component package file -$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) FlatXmlFilter_cpp.xcu $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) FlatXmlFilter_cpp.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(SDK_ZIP) $@ FlatXmlFilter_cpp.xcu + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMP_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) @@ -130,7 +143,7 @@ else @echo -------------------------------------------------------------------------------- endif -FlatXmlFilterCppExample : $(REGISTERFLAG) +FlatXmlFilterCppExample : $(COMP_REGISTERFLAG) @echo -------------------------------------------------------------------------------- @echo The C++ FlatXmlFilter component is installed if SDK_AUTO_DEPLOYMENT = YES. @echo You can use the filters "$(QM)DevGuide FlatXML ...$(QM)" inside your office installation @@ -143,6 +156,7 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_COMPONENTS))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java index cf95e1637c08..689d9b84fac6 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java @@ -264,10 +264,14 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) - { - return FactoryHelper.writeRegistryServiceInfo(__implName, - __serviceName, 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(XRegistryKey regKey) +// { +// return FactoryHelper.writeRegistryServiceInfo(__implName, +// __serviceName, regKey); +// } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXmlFilter_java.components b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXmlFilter_java.components new file mode 100644 index 000000000000..87359c3ecda6 --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXmlFilter_java.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="FlatXmlFilter_java.uno.jar"> + <implementation name="FlatXml"> + <service name="devguide.officedev.samples.filter.FlatXmlJava"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/Makefile b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/Makefile index afd060aee7be..a619e9d9c9d0 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/Makefile @@ -42,15 +42,16 @@ include $(SETTINGS)/std.mk include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings -COMPONENT_NAME=FlatXmlFilter_java -OUT_COMP_CLASS = $(OUT_CLASS)/$(COMPONENT_NAME) -COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar -COMPONENT_JAR = $(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml -REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=FlatXmlFilter_java +OUT_COMP_CLASS = $(OUT_CLASS)/$(COMP_NAME) +COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME = $(COMP_NAME).uno.jar +COMP_JAR = $(OUT_COMP_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +COMP_REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components JAVAFILES = \ FlatXml.java \ @@ -58,9 +59,9 @@ JAVAFILES = \ CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES)) -#$(COMPONENT_NAME)_CLASSFILES = FlatXml.class FlatXml$(dlr)_FlatXml.class +#$(COMP_NAME)_CLASSFILES = FlatXml.class FlatXml$(dlr)_FlatXml.class -$(COMPONENT_NAME)_CLASSFILES = *.class +$(COMP_NAME)_CLASSFILES = *.class SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(OUT_COMP_CLASS)) @@ -82,7 +83,7 @@ $(CLASSFILES) : $(JAVAFILES) $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) @@ -95,23 +96,24 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @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.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)FlatXmlFilter_java.xcu$(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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMPONENT_PACKAGE) : $(COMPONENT_JAR) FlatXmlFilter_java.xcu $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) FlatXmlFilter_java.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(SDK_ZIP) $@ FlatXmlFilter_java.xcu - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) -u $@ $(COMP_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -121,7 +123,7 @@ else @echo -------------------------------------------------------------------------------- endif -FlatXmlFilterJavaExample : $(REGISTERFLAG) +FlatXmlFilterJavaExample : $(COMP_REGISTERFLAG) @echo -------------------------------------------------------------------------------- @echo The Java FlatXmlFilter component is installed if SDK_AUTO_DEPLOYMENT = YES. @echo You can use the filters "$(QM)DevGuide FlatXML ...$(QM)" inside your office installation @@ -137,5 +139,5 @@ FlatXmlFilterJavaExample : $(REGISTERFLAG) .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/Makefile b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/Makefile index c2ac5900e862..83491a844dfb 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/Makefile +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/Makefile @@ -45,29 +45,32 @@ include $(SETTINGS)/dk.mk EXAMPLE_NAME=OfficeDevLinguisticExample OUT_COMP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME) -COMPONENT1_NAME=SampleHyphenator -COMPONENT1_PACKAGE = $(OUT_BIN)/$(COMPONENT1_NAME).$(UNOOXT_EXT) -COMPONENT1_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT1_NAME).$(UNOOXT_EXT)") -COMPONENT1_JAR_NAME = $(COMPONENT1_NAME).uno.jar -COMPONENT1_JAR = $(OUT_COMP_CLASS)/$(COMPONENT1_JAR_NAME) -COMPONENT1_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT1_NAME).uno.Manifest -COMPONENT1_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT1_NAME)/META-INF/manifest.xml - -COMPONENT2_NAME=SampleSpellChecker -COMPONENT2_PACKAGE = $(OUT_BIN)/$(COMPONENT2_NAME).$(UNOOXT_EXT) -COMPONENT2_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT2_NAME).$(UNOOXT_EXT)") -COMPONENT2_JAR_NAME = $(COMPONENT2_NAME).uno.jar -COMPONENT2_JAR = $(OUT_COMP_CLASS)/$(COMPONENT2_JAR_NAME) -COMPONENT2_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT2_NAME).uno.Manifest -COMPONENT2_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT2_NAME)/META-INF/manifest.xml - -COMPONENT3_NAME=SampleThesaurus -COMPONENT3_PACKAGE = $(OUT_BIN)/$(COMPONENT3_NAME).$(UNOOXT_EXT) -COMPONENT3_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT3_NAME).$(UNOOXT_EXT)") -COMPONENT3_JAR_NAME = $(COMPONENT3_NAME).uno.jar -COMPONENT3_JAR = $(OUT_COMP_CLASS)/$(COMPONENT3_JAR_NAME) -COMPONENT3_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT3_NAME).uno.Manifest -COMPONENT3_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT3_NAME)/META-INF/manifest.xml +COMP1_NAME=SampleHyphenator +COMP1_PACKAGE = $(OUT_BIN)/$(COMP1_NAME).$(UNOOXT_EXT) +COMP1_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP1_NAME).$(UNOOXT_EXT)") +COMP1_JAR_NAME = $(COMP1_NAME).uno.jar +COMP1_JAR = $(OUT_COMP_CLASS)/$(COMP1_JAR_NAME) +COMP1_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP1_NAME).uno.Manifest +COMP1_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP1_NAME)/META-INF/manifest.xml +COMP1_COMPONENTS=$(COMP1_NAME).components + +COMP2_NAME=SampleSpellChecker +COMP2_PACKAGE = $(OUT_BIN)/$(COMP2_NAME).$(UNOOXT_EXT) +COMP2_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP2_NAME).$(UNOOXT_EXT)") +COMP2_JAR_NAME = $(COMP2_NAME).uno.jar +COMP2_JAR = $(OUT_COMP_CLASS)/$(COMP2_JAR_NAME) +COMP2_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP2_NAME).uno.Manifest +COMP2_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP2_NAME)/META-INF/manifest.xml +COMP2_COMPONENTS=$(COMP2_NAME).components + +COMP3_NAME=SampleThesaurus +COMP3_PACKAGE = $(OUT_BIN)/$(COMP3_NAME).$(UNOOXT_EXT) +COMP3_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP3_NAME).$(UNOOXT_EXT)") +COMP3_JAR_NAME = $(COMP3_NAME).uno.jar +COMP3_JAR = $(OUT_COMP_CLASS)/$(COMP3_JAR_NAME) +COMP3_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMP3_NAME).uno.Manifest +COMP3_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP3_NAME)/META-INF/manifest.xml +COMP3_COMPONENTS=$(COMP2_NAME).components APP1_NAME=LinguisticExamples APP1_JAR=$(OUT_COMP_CLASS)/$(APP1_NAME).jar @@ -89,22 +92,22 @@ JAVAFILES = \ CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES)) -$(COMPONENT1_NAME)_CLASSFILES = XHyphenatedWord_impl.class \ +$(COMP1_NAME)_CLASSFILES = XHyphenatedWord_impl.class \ XPossibleHyphens_impl.class \ PropChgHelper.class \ PropChgHelper_Hyph.class \ OneInstanceFactory.class \ - $(COMPONENT1_NAME).class + $(COMP1_NAME).class -$(COMPONENT2_NAME)_CLASSFILES = XSpellAlternatives_impl.class \ +$(COMP2_NAME)_CLASSFILES = XSpellAlternatives_impl.class \ PropChgHelper_Spell.class \ PropChgHelper.class \ OneInstanceFactory.class \ - $(COMPONENT2_NAME).class + $(COMP2_NAME).class -$(COMPONENT3_NAME)_CLASSFILES = XMeaning_impl.class \ +$(COMP3_NAME)_CLASSFILES = XMeaning_impl.class \ OneInstanceFactory.class \ - $(COMPONENT3_NAME).class + $(COMP3_NAME).class SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(OUT_COMP_CLASS)) @@ -126,67 +129,59 @@ $(CLASSFILES) : $(JAVAFILES) # rules for the component jars and the packages doesn't work proper and we # defined explicit rules -#$(OUT_COMP_CLASS)/%.jar : $(OUT_COMP_CLASS)/%.Manifest $(CLASSFILES) -# -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -# -$(MKDIR) $(subst /,$(PS),$(@D)) -# cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) - # rule for component package manifest $(OUT_COMP_CLASS)/%/manifest.xml : -$(MKDIR) $(subst /,$(PS),$(@D)) @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 $(OUT_COMP_CLASS)/,,$(@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)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).components$(QM)"/$(CSEP) >> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ -#$(OUT_BIN)/%.uno.pkg : $(OUT_COMP_CLASS)/%.uno.jar $(OUT_COMP_CLASS)/%/META-INF/manifest.xml -# -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -# -$(MKDIR) $(subst /,$(PS),$(@D)) -# cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) -# cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml - -$(COMPONENT1_JAR) : $(COMPONENT1_MANIFESTFILE) $(CLASSFILES) +$(COMP1_JAR) : $(COMP1_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) -$(COMPONENT1_PACKAGE) : $(COMPONENT1_JAR) $(COMPONENT1_UNOPKG_MANIFEST) +$(COMP1_PACKAGE) : $(COMP1_JAR) $(COMP1_UNOPKG_MANIFEST) $(COMP1_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) $@ $(COMP1_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(COMPONENT2_JAR) : $(COMPONENT2_MANIFESTFILE) $(CLASSFILES) +$(COMP2_JAR) : $(COMP2_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) -$(COMPONENT2_PACKAGE) : $(COMPONENT2_JAR) $(COMPONENT2_UNOPKG_MANIFEST) +$(COMP2_PACKAGE) : $(COMP2_JAR) $(COMP2_UNOPKG_MANIFEST) $(COMP2_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) $@ $(COMP2_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(COMPONENT3_JAR) : $(COMPONENT3_MANIFESTFILE) $(CLASSFILES) +$(COMP3_JAR) : $(COMP3_MANIFESTFILE) $(CLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) -$(COMPONENT3_PACKAGE) : $(COMPONENT3_JAR) $(COMPONENT3_UNOPKG_MANIFEST) +$(COMP3_PACKAGE) : $(COMP3_JAR) $(COMP3_UNOPKG_MANIFEST) $(COMP3_COMPONENTS) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) $@ $(COMP3_COMPONENTS) + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMPONENT1_PACKAGE) $(COMPONENT2_PACKAGE) $(COMPONENT3_PACKAGE) +$(REGISTERFLAG) : $(COMP1_PACKAGE) $(COMP2_PACKAGE) $(COMP3_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(MKDIR) $(subst /,$(PS),$(@D)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) - $(DEPLOYTOOL) $(COMPONENT1_PACKAGE_URL) - $(DEPLOYTOOL) $(COMPONENT2_PACKAGE_URL) - $(DEPLOYTOOL) $(COMPONENT3_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP1_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP2_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP3_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -220,8 +215,8 @@ $(EXAMPLE_NAME) : $(REGISTERFLAG) $(APP1_JAR) @echo - @echo $(MAKE) $(APP1_NAME).run @echo -------- - @echo Before you can run the examples the components "$(QM)$(COMPONENT1_NAME)$(QM)", - @echo "$(QM)$(COMPONENT2_NAME)$(QM)" and "$(QM)$(COMPONENT3_NAME)$(QM)" must be deployed. + @echo Before you can run the examples the components "$(QM)$(COMP1_NAME)$(QM)", + @echo "$(QM)$(COMP2_NAME)$(QM)" and "$(QM)$(COMP3_NAME)$(QM)" must be deployed. @echo The components will be automatically deployed if SDK_AUTO_DEPLOYMENT = YES. @echo -------------------------------------------------------------------------------- @@ -231,7 +226,7 @@ $(EXAMPLE_NAME) : $(REGISTERFLAG) $(APP1_JAR) .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT1_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT2_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT3_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP1_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP2_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP3_PACKAGE_URL))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.components b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.components new file mode 100644 index 000000000000..bf083b386a31 --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.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="SampleHyphenator.uno.jar"> + <implementation name="SampleHyphenator"> + <service name="com.sun.star.linguistic2.Hyphenator"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java index adad109f9a87..8008fcd5affd 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java @@ -488,7 +488,7 @@ public class SampleHyphenator extends ComponentBase implements // __________ static things __________ - public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleHyphenator"; + public static String _aSvcImplName = SampleHyphenator.class.getName(); public static String[] getSupportedServiceNames_Static() { @@ -531,18 +531,22 @@ public class SampleHyphenator extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey xRegKey ) - { - boolean bResult = true; - String[] aServices = getSupportedServiceNames_Static(); - int i, nLength = aServices.length; - for( i = 0; i < nLength; ++i ) - { - bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - _aSvcImplName, aServices[i], xRegKey ); - } - return bResult; - } + // 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 xRegKey ) +// { +// boolean bResult = true; +// String[] aServices = getSupportedServiceNames_Static(); +// int i, nLength = aServices.length; +// for( i = 0; i < nLength; ++i ) +// { +// bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( +// _aSvcImplName, aServices[i], xRegKey ); +// } +// return bResult; +// } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.components b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.components new file mode 100644 index 000000000000..bb489918b843 --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.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="SampleSpellChecker.uno.jar"> + <implementation name="SampleSpellChecker"> + <service name="com.sun.star.linguistic2.SpellChecker"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java index 9e2cd5a81853..6d28867a3e1d 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java @@ -431,7 +431,7 @@ public class SampleSpellChecker extends ComponentBase implements // __________ static things __________ - public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleSpellChecker"; + public static String _aSvcImplName = SampleSpellChecker.class.getName(); public static String[] getSupportedServiceNames_Static() { @@ -474,18 +474,22 @@ public class SampleSpellChecker extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey xRegKey ) - { - boolean bResult = true; - String[] aServices = getSupportedServiceNames_Static(); - int i, nLength = aServices.length; - for( i = 0; i < nLength; ++i ) - { - bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - _aSvcImplName, aServices[i], xRegKey ); - } - return bResult; - } + // 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 xRegKey ) +// { +// boolean bResult = true; +// String[] aServices = getSupportedServiceNames_Static(); +// int i, nLength = aServices.length; +// for( i = 0; i < nLength; ++i ) +// { +// bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( +// _aSvcImplName, aServices[i], xRegKey ); +// } +// return bResult; +// } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.components b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.components new file mode 100644 index 000000000000..025f42451f26 --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.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="SampleThesaurus.uno.jar"> + <implementation name="SampleThesaurus"> + <service name="com.sun.star.linguistic2.Thesaurus"/> + </implementation> + </component> +</components> diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java index 7e5bbb1bf442..fd56a5683882 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java @@ -268,7 +268,7 @@ public class SampleThesaurus extends ComponentBase implements // __________ static things __________ - public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleThesaurus"; + public static String _aSvcImplName = SampleThesaurus.class.getName(); public static String[] getSupportedServiceNames_Static() { @@ -311,18 +311,22 @@ public class SampleThesaurus extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey xRegKey ) - { - boolean bResult = true; - String[] aServices = getSupportedServiceNames_Static(); - int i, nLength = aServices.length; - for( i = 0; i < nLength; ++i ) - { - bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - _aSvcImplName, aServices[i], xRegKey ); - } - return bResult; - } + // 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 xRegKey ) +// { +// boolean bResult = true; +// String[] aServices = getSupportedServiceNames_Static(); +// int i, nLength = aServices.length; +// for( i = 0; i < nLength; ++i ) +// { +// bResult = bResult && com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( +// _aSvcImplName, aServices[i], xRegKey ); +// } +// return bResult; +// } } diff --git a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/Makefile b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/Makefile index cd2200051057..23c86e57c5ed 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/Makefile +++ b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/Makefile @@ -49,17 +49,11 @@ SAMPLE_OBJ_OUT=$(OUT_OBJ)/$(SAMPLE_NAME) APP1_NAME=office_connect APP1_BINARY=$(OUT_BIN)/$(APP1_NAME)$(EXE_EXT) -APP1_RDB=$(OUT_BIN)/office_connect.rdb -APP1_ENV_FLAG = $(SAMPLE_GEN_OUT)/cpp_$(SAMPLE_NAME)_prepare_env.flag APP2_NAME=string_samples APP2_BINARY=$(OUT_BIN)/$(APP2_NAME)$(EXE_EXT) -ifeq "$(OS)" "WIN" -INI_EXTENSION=.ini -else -INI_EXTENSION=rc -endif +ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES) CXXFILES = \ office_connect.cxx \ @@ -72,14 +66,6 @@ ALL : \ include $(SETTINGS)/stdtarget.mk -$(OUT_BIN)/%$(INI_EXTENSION) : %$(INI_EXTENSION) - -$(MKDIR) $(subst /,$(PS),$(@D)) - $(COPY) $< $(subst /,$(PS),$@) - -$(OUT_BIN)/%.rdb : - -$(MKDIR) $(subst /,$(PS),$(@D)) - $(REGMERGE) $@ / $(URE_TYPES) $(OFFICE_TYPES) - $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< @@ -98,27 +84,16 @@ ifeq "$(OS)" "MACOSX" endif endif -$(OUT_BIN)/office_connect$(EXE_EXT) : $(APP1_ENV_FLAG) $(OUT_BIN)/office_connect$(INI_EXTENSION) $(SAMPLE_OBJ_OUT)/office_connect.$(OBJ_EXT) +$(OUT_BIN)/office_connect$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/office_connect.$(OBJ_EXT) $(OUT_BIN)/string_samples$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/string_samples.$(OBJ_EXT) -$(APP1_ENV_FLAG) : $(APP1_RDB) - -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) - @echo -------------------------------------------------------------------------------- - @echo Register necessary runtime components in $(APP1_RDB) - @echo -------------------------------------------------------------------------------- - $(REGCOMP) -register -r $(APP1_RDB) -c connector.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(APP1_RDB) -c remotebridge.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(APP1_RDB) -c bridgefac.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(APP1_RDB) -c uuresolver.uno.$(SHAREDLIB_EXT) - @echo bla > $@ - - ProUNOCppBindingExample : $(APP1_BINARY) $(APP2_BINARY) @echo -------------------------------------------------------------------------------- @echo Note: For the "$(QM)$(APP1_NAME)$(QM)" example you need a running office listening - @echo $(SQM) $(SQM)on port 2083. Before you run the example you have to start your office with + @echo $(SQM) $(SQM)on port 2083. The example use the defaultBootstrap_InitialComponentContext method and provides + @echo $(SQM) $(SQM)the additional office types via the UNO environment variable -env:URE_MORE_TYPES=... + @echo $(SQM) $(SQM)Before you can run this example you have to start your office in listening mode. @echo - @echo $(SQM) $(SQM)soffice "$(QM)-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager$(QM)" @echo ----- @@ -131,6 +106,9 @@ ProUNOCppBindingExample : $(APP1_BINARY) $(APP2_BINARY) %.run: $(OUT_BIN)/%$(EXE_EXT) cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) +$(API1_NAME).run: $(API1_BINARY) + cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES) + .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_INC_OUT)) diff --git a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.ini b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.ini deleted file mode 100644 index c10b97b57bd3..000000000000 --- a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.ini +++ /dev/null @@ -1,2 +0,0 @@ -UNO_TYPES=$SYSBINDIR/office_connect.rdb -UNO_SERVICES=$SYSBINDIR/office_connect.rdb
\ No newline at end of file diff --git a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connectrc b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connectrc deleted file mode 100644 index ab2c6f10b7e5..000000000000 --- a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connectrc +++ /dev/null @@ -1,2 +0,0 @@ -UNO_TYPES=$SYSBINDIR/office_connect.rdb -UNO_SERVICES=$SYSBINDIR/office_connect.rdb 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) diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx index b9aafda6c8d9..e0416f8ea8d8 100644 --- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx +++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx @@ -49,6 +49,7 @@ #include <osl/file.hxx> #include <osl/process.h> +#include <rtl/process.h> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> @@ -72,35 +73,21 @@ using ::rtl::OUStringToOString; SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { OUString sConnectionString(RTL_CONSTASCII_USTRINGPARAM("uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager")); - if (argc < 2) + + sal_Int32 nCount = (sal_Int32)rtl_getAppCommandArgCount(); + + if (nCount < 1) { - printf("using: DocumentLoader <file_url> [<uno_connection_url>]\n\n" - "example: DocumentLoader \"file:///e:/temp/test.odt\" \"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\"\n"); + printf("using: DocumentLoader -env:URE_MORE_TYPES=<office_types_rdb_url> <file_url> [<uno_connection_url>]\n\n" + "example: DocumentLoader -env:URE_MORE_TYPES=\"file:///.../basis-link/program/offapi.rdb\" \"file:///e:/temp/test.odt\" \"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager\"\n"); exit(1); } - if (argc == 3) + if (nCount == 2) { - sConnectionString = OUString::createFromAscii(argv[2]); + rtl_getAppCommandArg(1, &sConnectionString.pData); } - // Creates a simple registry service instance. - Reference< XSimpleRegistry > xSimpleRegistry( - ::cppu::createSimpleRegistry() ); - - // Connects the registry to a persistent data source represented by an URL. - xSimpleRegistry->open( OUString( RTL_CONSTASCII_USTRINGPARAM( - "DocumentLoader.rdb") ), sal_True, sal_False ); - - /* Bootstraps an initial component context with service manager upon a given - registry. This includes insertion of initial services: - - (registry) service manager, shared lib loader, - - simple registry, nested registry, - - implementation registration - - registry typedescription provider, typedescription manager (also - installs it into cppu core) - */ - Reference< XComponentContext > xComponentContext( - ::cppu::bootstrap_InitialComponentContext( xSimpleRegistry ) ); + Reference< XComponentContext > xComponentContext(::cppu::defaultBootstrap_InitialComponentContext()); /* Gets the service manager instance to be used (or null). This method has been added for convenience, because the service manager is a often used @@ -152,9 +139,11 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) /* Loads a component specified by an URL into the specified new or existing frame. */ - OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl; + OUString sAbsoluteDocUrl, sWorkingDir, sDocPathUrl, sArgDocUrl; + rtl_getAppCommandArg(0, &sArgDocUrl.pData); + osl_getProcessWorkingDir(&sWorkingDir.pData); - osl::FileBase::getFileURLFromSystemPath( OUString::createFromAscii(argv[1]), sDocPathUrl); + osl::FileBase::getFileURLFromSystemPath( sArgDocUrl, sDocPathUrl); osl::FileBase::getAbsoluteFileURL( sWorkingDir, sDocPathUrl, sAbsoluteDocUrl); Reference< XComponent > xComponent = xComponentLoader->loadComponentFromURL( diff --git a/odk/examples/cpp/DocumentLoader/Makefile b/odk/examples/cpp/DocumentLoader/Makefile index 1c6a2aec5191..02a872a46fa2 100644 --- a/odk/examples/cpp/DocumentLoader/Makefile +++ b/odk/examples/cpp/DocumentLoader/Makefile @@ -43,19 +43,17 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMPONENT_NAME=DocumentLoader -COMPONENT_RDB_NAME = $(COMPONENT_NAME).rdb -COMPONENT_RDB = $(OUT_BIN)/$(COMPONENT_RDB_NAME) OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME) OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME) OUT_COMP_OBJ=$(OUT_OBJ)/$(COMPONENT_NAME) -COMPOENNT_ENV_FLAG = $(OUT_MISC)/cpp_$(COMPONENT_NAME)_prepare_env.flag - CXXFILES = DocumentLoader.cxx OBJFILES = $(patsubst %.cxx,$(OUT_SLO_COMP)/%.$(OBJ_EXT),$(CXXFILES)) +ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES) + # Targets .PHONY: ALL ALL : \ @@ -63,12 +61,6 @@ ALL : \ include $(SETTINGS)/stdtarget.mk -# This example type library will be extended by the URE and office types -$(OUT_BIN)/%.rdb : - -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) - $(REGMERGE) $@ / $(URE_TYPES) $(OFFICE_TYPES) - $(OUT_COMP_OBJ)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< @@ -87,41 +79,30 @@ ifeq "$(OS)" "MACOSX" endif endif -$(COMPOENNT_ENV_FLAG) : $(COMPONENT_RDB) - -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) - @echo -------------------------------------------------------------------------------- - @echo Register necessary runtime components in the DocumentLoader.rdb - @echo -------------------------------------------------------------------------------- - $(REGCOMP) -register -r $(COMPONENT_RDB) -c connector.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMPONENT_RDB) -c remotebridge.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMPONENT_RDB) -c bridgefac.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMPONENT_RDB) -c uuresolver.uno.$(SHAREDLIB_EXT) - @echo bla > $@ - -CppDocumentLoaderExample : $(OUT_BIN)/DocumentLoader$(EXE_EXT) $(COMPOENNT_ENV_FLAG) +CppDocumentLoaderExample : $(OUT_BIN)/DocumentLoader$(EXE_EXT) @echo -------------------------------------------------------------------------------- @echo The example loads the "$(QM)test.odt$(QM)" document in the DocumentLoader example directory. - @echo I you want to load your own document, please use: DocumentLoader "$(QM)filename$(QM)" [connection_url] + @echo If you want to load your own document, please use: + @echo $(SQM) $(SQM)DocumentLoader -env:URE_MORE_TYPES="$(QM)<fileurl_office_types_rdb>$(QM)" "$(QM)filename$(QM)" [connection_url] @echo - @echo Use the following command to execute the example! @echo - @echo $(MAKE) DocumentLoader.run @echo - @echo NOTE: This example does not use the new UNO bootstrap mechanism, it uses still a socket - @echo $(SQM) $(SQM)connection. Before you can run this example you have to start your office in listening mode. + @echo $(SQM) $(SQM)connection. The example use the defaultBootstrap_InitialComponentContext method and provides + @echo $(SQM) $(SQM)the additional office types via the UNO environment variable -env:URE_MORE_TYPES=... + @echo $(SQM) $(SQM)Before you can run this example you have to start your office in listening mode. @echo - @echo $(SQM) $(SQM)soffice "$(QM)-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager$(QM)" @echo -------------------------------------------------------------------------------- %.run: $(OUT_BIN)/DocumentLoader$(EXE_EXT) - cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(subst \\,/,$(subst /,$(PS),"$(OO_SDK_HOME)/examples/cpp/DocumentLoader/test.odt")) + cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES) $(subst \\,/,$(subst /,$(PS),"$(OO_SDK_HOME)/examples/cpp/DocumentLoader/test.odt")) .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_OBJ)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPOENNT_ENV_FLAG))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_RDB))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/DocumentLoader*)) diff --git a/odk/examples/cpp/complextoolbarcontrols/Makefile b/odk/examples/cpp/complextoolbarcontrols/Makefile index bda675080961..06af1afa94f1 100644 --- a/odk/examples/cpp/complextoolbarcontrols/Makefile +++ b/odk/examples/cpp/complextoolbarcontrols/Makefile @@ -51,8 +51,8 @@ COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map - -REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components +COMP_REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag CXXFILES = \ @@ -79,12 +79,12 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif +#$(COMP_MAPFILE) : $(SLOFILES) +# -$(MKDIR) $(subst /,$(PS),$(@D)) +# cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) +#ifeq "$(OS)" "MACOSX" +# nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) +#endif ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) @@ -95,7 +95,8 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +#$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -114,24 +115,42 @@ $(OUT_COMP_GEN)/%/manifest.xml : @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)WriterWindowState.xcu$(QM)"/$(CSEP) >> $@ - @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:meda-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)CalcWindowState.xcu$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@ - @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ + +# @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@ +# @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ +$(COMP_COMPONENTS) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)vnd.My.impl.NewDocListener$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)vnd.My.NewDocListener$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)vnd.demo.Impl.ProtocolHandler$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)vnd.demo.ProtocolHandler$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + # rule for component package file -$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) - cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F) $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu logo_small.png logo_big.png cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMP_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @@ -144,14 +163,14 @@ else @echo -------------------------------------------------------------------------------- endif -Example : $(REGISTERFLAG) +Example : $(COMP_REGISTERFLAG) @echo -------------------------------------------------------------------------------- @echo The "$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES. @echo You can use this component inside your office installation, see the example @echo description. @echo -------------------------------------------------------------------------------- -run: $(COMP1_REGISTERFLAG) +run: $(COMP1_COMP_REGISTERFLAG) "$(OFFICE_PROGRAM_PATH)$(PS)soffice" -writer @@ -161,6 +180,6 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) diff --git a/odk/examples/cpp/complextoolbarcontrols/exports.cxx b/odk/examples/cpp/complextoolbarcontrols/exports.cxx index 2e3d54b702a2..3c1179bd3330 100644 --- a/odk/examples/cpp/complextoolbarcontrols/exports.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/exports.cxx @@ -42,17 +42,17 @@ namespace css = ::com::sun::star; -static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey , - const char* pImplementationName, - const char* pServiceName ) -{ - ::rtl::OUStringBuffer sKey(256); - sKey.append (::rtl::OUString::createFromAscii(pImplementationName)); - sKey.appendAscii("/UNO/SERVICES/"); - sKey.append (::rtl::OUString::createFromAscii(pServiceName)); - - xRegistryKey->createKey(sKey.makeStringAndClear()); -} +// static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey , +// const char* pImplementationName, +// const char* pServiceName ) +// { +// ::rtl::OUStringBuffer sKey(256); +// sKey.append (::rtl::OUString::createFromAscii(pImplementationName)); +// sKey.appendAscii("/UNO/SERVICES/"); +// sKey.append (::rtl::OUString::createFromAscii(pServiceName)); + +// xRegistryKey->createKey(sKey.makeStringAndClear()); +// } extern "C" { @@ -63,27 +63,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//================================================================================================== -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, - void* pRegistryKey ) -{ - if (!pRegistryKey) - return sal_False; - try - { - css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY); - - writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME , MYLISTENER_SERVICENAME ); - writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME ); - - return sal_True; - } - catch(const css::registry::InvalidRegistryException&) - { OSL_FAIL( "### InvalidRegistryException!" ); } - - return sal_False; -} //================================================================================================== SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName , diff --git a/odk/examples/cpp/counter/Makefile b/odk/examples/cpp/counter/Makefile index 2ede77d9af6e..e74b472256b2 100644 --- a/odk/examples/cpp/counter/Makefile +++ b/odk/examples/cpp/counter/Makefile @@ -43,15 +43,18 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=counter -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) COMP_IMPL=$(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) COMP_RDB_NAME = $(COMP_NAME).uno.rdb COMP_RDB = $(OUT_BIN)/$(COMP_RDB_NAME) -COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map OUT_COMP_INC = $(OUT_INC)/$(COMP_NAME) OUT_COMP_GEN = $(OUT_MISC)/$(COMP_NAME) OUT_COMP_OBJ = $(OUT_OBJ)/$(COMP_NAME) OUT_COMP_SLO = $(OUT_SLO)/$(COMP_NAME) +COMP_SERVICES=$(SHAREDLIB_OUT)/counterservices.rdb + +ENV_EXAMPLE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(COMP_RDB) +ENV_COMP_SERVICES=-env:URE_MORE_SERVICES=$(URLPREFIX)$(COMP_SERVICES) COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag @@ -84,12 +87,12 @@ $(OUT_BIN)/%.rdb : $(GENURDFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) $(REGMERGE) $@ /UCR $(GENURDFILES) - $(REGMERGE) $@ / $(URE_TYPES) +# $(REGMERGE) $@ / $(URE_TYPES) $(COMP_TYPEFLAG) : $(COMP_RDB) $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) - $(CPPUMAKER) -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMP_RDB) + $(CPPUMAKER) -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMP_RDB) -X $(URE_TYPES) echo flagged > $@ $(OUT_COMP_OBJ)/%.$(OBJ_EXT) : %.cxx $(COMP_TYPEFLAG) @@ -102,13 +105,6 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(COMP_TYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif - ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) @@ -118,7 +114,7 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -138,16 +134,33 @@ else $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STDC++LIB) endif +$(COMP_SERVICES) : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)com.sun.star.comp.example.cpp.Counter$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)foo.Counter$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + -CppCounterExample : $(OUT_BIN)/countermain$(EXE_EXT) $(COMP_IMPL) +CppCounterExample : $(OUT_BIN)/countermain$(EXE_EXT) $(COMP_IMPL) $(COMP_SERVICES) @echo -------------------------------------------------------------------------------- @echo Please use the following command to execute the example! @echo - @echo $(MAKE) countermain.run + @echo - + @echo NOTE: The example makes use of the URE and use the defaultBootstrap_InitialComponentContext method. + @echo $(SQM) $(SQM)The additional example IDL types are provided via the UNO environment variable -env:URE_MORE_TYPES=... + @echo $(SQM) $(SQM)and the example component is made available via -env:URE_MORE_SERVICES=... + @echo $(SQM) $(SQM)Please check the generated $(QM)$(COMP_SERVICES)$(QM) to see how you can specify your own components in such an environment + @echo $(SQM) $(SQM)and how to use the passive UNO registration. @echo -------------------------------------------------------------------------------- %.run: $(OUT_BIN)/countermain$(EXE_EXT) $(COMP_IMPL) - cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) + cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_EXAMPLE_TYPES) $(ENV_COMP_SERVICES) .PHONY: clean clean : @@ -159,3 +172,4 @@ clean : -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_RDB))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/countermain*)) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_SERVICES))) diff --git a/odk/examples/cpp/counter/counter.cxx b/odk/examples/cpp/counter/counter.cxx index e2c714de5398..0f5c80c1a036 100644 --- a/odk/examples/cpp/counter/counter.cxx +++ b/odk/examples/cpp/counter/counter.cxx @@ -168,7 +168,7 @@ Reference< XInterface > SAL_CALL MyCounterImpl_create( /** * Gives the environment this component belongs to. */ -extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } @@ -180,33 +180,33 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char * * @param pServiceManager the service manager * @param pRegistryKey the registry key */ -extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) -{ - sal_Bool result = sal_False; - - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); - - const Sequence< OUString > & rSNL = - MyCounterImpl::getSupportedServiceNames_Static(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - // we should not ignore exceptions - } - } - return result; -} +// extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) +// { +// sal_Bool result = sal_False; + +// if (pRegistryKey) +// { +// try +// { +// Reference< XRegistryKey > xNewKey( +// reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( +// OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); + +// const Sequence< OUString > & rSNL = +// MyCounterImpl::getSupportedServiceNames_Static(); +// const OUString * pArray = rSNL.getConstArray(); +// for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) +// xNewKey->createKey( pArray[nPos] ); + +// return sal_True; +// } +// catch (InvalidRegistryException &) +// { +// // we should not ignore exceptions +// } +// } +// return result; +// } /** * This function is called to get service factories for an implementation. @@ -216,7 +216,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * * @param pRegistryKey the registry key for this component, need for persistent data * @return a component factory */ -extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) { void * pRet = 0; diff --git a/odk/examples/cpp/counter/countermain.cxx b/odk/examples/cpp/counter/countermain.cxx index 2a64acec106f..e1ab0a16eb76 100644 --- a/odk/examples/cpp/counter/countermain.cxx +++ b/odk/examples/cpp/counter/countermain.cxx @@ -69,57 +69,36 @@ using namespace ::rtl; //======================================================================= SAL_IMPLEMENT_MAIN() { - Reference< XSimpleRegistry > xReg = createSimpleRegistry(); - OSL_ENSURE( xReg.is(), "### cannot get service instance of \"com.sun.star.regiystry.SimpleRegistry\"!" ); - - xReg->open(OUString(RTL_CONSTASCII_USTRINGPARAM("counter.uno.rdb")), sal_False, sal_False); - OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"counter.uno.rdb\"!" ); - - Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg); - OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" ); - - Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); - OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" ); - - // register my counter component - Reference< XImplementationRegistration > xImplReg( - xMgr->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration")), xContext), UNO_QUERY); - OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" ); - - if (xImplReg.is()) - { - xImplReg->registerImplementation( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), // loader for component -#ifdef UNX -#ifdef MACOSX - OUString(RTL_CONSTASCII_USTRINGPARAM("counter.uno.dylib")), // component location -#else - OUString(RTL_CONSTASCII_USTRINGPARAM("counter.uno.so")), // component location -#endif -#else - OUString(RTL_CONSTASCII_USTRINGPARAM("counter.uno.dll")), // component location -#endif - Reference< XSimpleRegistry >() // registry omitted, - // defaulting to service manager registry used - ); - - // get a counter instance - Reference< XInterface > xx ; - xx = xMgr->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("foo.Counter")), xContext); + try { + + Reference< XComponentContext > xContext(::cppu::defaultBootstrap_InitialComponentContext()); + OSL_ENSURE( xContext.is(), "### bootstrap failed!\n" ); + + Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager(); + OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" ); + + Reference< XInterface > xx = xMgr->createInstanceWithContext( + OUString::createFromAscii("foo.Counter"), xContext); + + OSL_ENSURE( xx.is(), "### cannot get service instance of \"foo.Counter\"!" ); + Reference< XCountable > xCount( xx, UNO_QUERY ); - OSL_ENSURE( xCount.is(), "### cannot get service instance of \"foo.Counter\"!" ); + OSL_ENSURE( xCount.is(), "### cannot query XCountable interface of service instance \"foo.Counter\"!" ); if (xCount.is()) { - xCount->setCount( 42 ); - fprintf( stdout , "%d," , xCount->getCount() ); - fprintf( stdout , "%d," , xCount->increment() ); - fprintf( stdout , "%d\n" , xCount->decrement() ); + xCount->setCount( 42 ); + fprintf( stdout , "%d," , (int)xCount->getCount() ); + fprintf( stdout , "%d," , (int)xCount->increment() ); + fprintf( stdout , "%d\n" , (int)xCount->decrement() ); } - } - Reference< XComponent >::query( xContext )->dispose(); - return 0; -} + Reference< XComponent >::query( xContext )->dispose(); + + } catch( Exception& e) { + printf("Error: caught exception:\n %s\n", + OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + exit(1); + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/odk/examples/cpp/remoteclient/Makefile b/odk/examples/cpp/remoteclient/Makefile index 8d6b2bc0d246..97b0c3f903f9 100644 --- a/odk/examples/cpp/remoteclient/Makefile +++ b/odk/examples/cpp/remoteclient/Makefile @@ -43,17 +43,18 @@ include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings COMP_NAME=remoteclientsample -COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) COMP_IMPL=$(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) COMP_RDB_NAME = $(COMP_NAME).uno.rdb COMP_RDB = $(OUT_BIN)/$(COMP_RDB_NAME) -COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +COMP_SERVICES=$(SHAREDLIB_OUT)/remoteclientsample.rdb + +ENV_COMP_SERVICES=-env:URE_MORE_SERVICES=$(URLPREFIX)$(COMP_SERVICES) OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME) OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) -COMP_ENV_FLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_prepare_env.flag COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag CXXFILES = remoteclient.cxx @@ -77,13 +78,6 @@ $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) -$(MKDIR) $(subst /,$(PS),$(@D)) $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< -$(COMP_MAPFILE) : $(SLOFILES) - -$(MKDIR) $(subst /,$(PS),$(@D)) - cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE) -ifeq "$(OS)" "MACOSX" - nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE) -endif - ifeq "$(OS)" "WIN" $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) @@ -93,7 +87,7 @@ $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib msvcrt.lib kernel32.lib $(LINK_MANIFEST) else -$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE) +$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \ $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) @@ -102,40 +96,41 @@ ifeq "$(OS)" "MACOSX" endif endif -$(COMP_ENV_FLAG) : $(COMP_RDB) $(OUT_BIN)/remoteserver.rdb +$(COMP_SERVICES) : -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) - @echo -------------------------------------------------------------------------------- - @echo Register necessary runtime components in remoteserver/remoteclientsample rdb - @echo -------------------------------------------------------------------------------- - $(REGCOMP) -register -r $(OUT_BIN)/remoteserver.rdb -c connector.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(OUT_BIN)/remoteserver.rdb -c remotebridge.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(OUT_BIN)/remoteserver.rdb -c bridgefac.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(OUT_BIN)/remoteserver.rdb -c uuresolver.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(OUT_BIN)/remoteserver.rdb -c streams.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMP_RDB) -c connector.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMP_RDB) -c remotebridge.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMP_RDB) -c bridgefac.uno.$(SHAREDLIB_EXT) - $(REGCOMP) -register -r $(COMP_RDB) -c uuresolver.uno.$(SHAREDLIB_EXT) - @echo bla > $@ - -CppClientExample : $(COMP_IMPL) $(COMP_ENV_FLAG) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)com.sun.star.comp.product.example.RemoteClientSample$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.bridge.example.RemoteClientSample$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@ + @echo $(OSEP)/components$(CSEP) >> $@ + + +#CppClientExample : $(COMP_IMPL) $(COMP_ENV_FLAG) +CppClientExample : $(COMP_IMPL) $(COMP_SERVICES) @echo -------------------------------------------------------------------------------- @echo The remoteclient C++ component can be used by using the uno binary. Use the @echo the follwong command to start the example. The run target starts a remote @echo server and connect with the client to this server. @echo - @echo $(MAKE) remoteclient.run + @echo - + @echo NOTE: The example uses the $(QM)uno$(QM) tool to prepare a working UNO environment. + @echo $(SQM) $(SQM)The example component is made available via -env:URE_MORE_SERVICES=... + @echo $(SQM) $(SQM)Please check the generated $(QM)$(COMP_SERVICES)$(QM) to see how you can specify your own components in such an environment + @echo $(SQM) $(SQM)and how to use the passive UNO registration. @echo -------------------------------------------------------------------------------- -%.run: $(COMP_IMPL) $(COMP_ENV_FLAG) +%.run: $(COMP_IMPL) @echo Start the remote server process ... @echo - ifeq "$(OS)" "WIN" - start uno -rw $(OUT_BIN)/remoteserver.rdb --singleaccept -s com.sun.star.io.Pipe \ + start uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \ -u "uno:socket,host=localhost,port=2083;urp;MyPipe" else - uno -rw $(OUT_BIN)/remoteserver.rdb --singleaccept -s com.sun.star.io.Pipe \ + uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \ -u "uno:socket,host=localhost,port=2083;urp;MyPipe" & @echo waiting on the server process ... sleep 5 @@ -145,8 +140,8 @@ endif @echo - @echo Start remote client process ... @echo - - uno -l $(COMP_IMPL) -c com.sun.star.comp.product.example.RemoteClientSample \ - -rw $(COMP_RDB) -- "uno:socket,host=localhost,port=2083;urp;MyPipe" + uno $(ENV_COMP_SERVICES) -s com.sun.star.bridge.example.RemoteClientSample \ + -- "uno:socket,host=localhost,port=2083;urp;MyPipe" @echo - .PHONY: clean @@ -154,7 +149,7 @@ clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_ENV_FLAG))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_SERVICES))) -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/remoteserver.rdb)) +# -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/remoteserver.rdb)) diff --git a/odk/examples/cpp/remoteclient/remoteclient.cxx b/odk/examples/cpp/remoteclient/remoteclient.cxx index a034d03d2cc6..b15aa94eff57 100644 --- a/odk/examples/cpp/remoteclient/remoteclient.cxx +++ b/odk/examples/cpp/remoteclient/remoteclient.cxx @@ -228,39 +228,14 @@ using namespace remotebridges_officeclient; extern "C" { //================================================================================================== -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString(RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" )) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_FAIL( "### InvalidRegistryException!" ); - } - } - return sal_False; -} //================================================================================================== -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/Makefile b/odk/examples/java/EmbedDocument/EmbeddedObject/Makefile index 6b75f4ed72ac..62fb17e5e0ac 100644..100755 --- a/odk/examples/java/EmbedDocument/EmbeddedObject/Makefile +++ b/odk/examples/java/EmbedDocument/EmbeddedObject/Makefile @@ -57,6 +57,7 @@ COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components PACKAGE = org/openoffice/examples/embedding @@ -99,18 +100,19 @@ $(COMP_GEN_OUT)/%/manifest.xml : -$(MKDIR) $(subst /,$(PS),$(@D)) @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(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)$(COMP_NAME).uno.jar$(QM)"/$(CSEP) >> $@ @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(SAMPLE_NAME).xcu$(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)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(SDK_ZIP) $@ $(COMP_JAR_NAME) $(SAMPLE_NAME).xcu - cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) $@ $(COMP_JAR_NAME) + $(SDK_ZIP) $@ $(SAMPLE_NAME).xcu + $(SDK_ZIP) $@ -u $(COMP_NAME).components + cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u $@ $(COMP_JAR_NAME) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u $@ META-INF/manifest.xml $(COMP_REGISTERFLAG) : $(COMP_PACKAGE) diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.components b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.components new file mode 100644 index 000000000000..421706f7418f --- /dev/null +++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.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="OwnEmbeddedObject.uno.jar"> + <implementation name="org.openoffice.examples.embedding.OwnEmbeddedObjectFactory"> + <service name="org.openoffice.examples.embedding.Factory69474366FD6F480683748EDD1B6E771D"/> + </implementation> + </component> +</components> diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java index fd8f2793c9c5..a146e04d3ca1 100755 --- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java +++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObjectFactory.java @@ -37,11 +37,15 @@ public final class OwnEmbeddedObjectFactory extends WeakBase return xFactory; } - public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) { - return Factory.writeRegistryServiceInfo(m_implementationName, - m_serviceNames, - xRegistryKey); - } + // 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( XRegistryKey xRegistryKey ) { +// return Factory.writeRegistryServiceInfo(m_implementationName, +// m_serviceNames, +// xRegistryKey); +// } // com.sun.star.lang.XServiceInfo: public String getImplementationName() { diff --git a/odk/examples/java/MinimalComponent/Makefile b/odk/examples/java/MinimalComponent/Makefile index 8fd4ade8fb9d..23530a89358d 100644 --- a/odk/examples/java/MinimalComponent/Makefile +++ b/odk/examples/java/MinimalComponent/Makefile @@ -61,6 +61,7 @@ COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components APP1_NAME=TestMinimalComponent APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME) @@ -152,19 +153,20 @@ $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES) $(COMP_GEN_OUT)/%/manifest.xml : -$(MKDIR) $(subst /,$(PS),$(@D)) @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-typelibrary;type=RDB$(QM)" >> $@ - @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_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 $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(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-typelibrary;type=RDB$(QM)">> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(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)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME) + $(SDK_ZIP) $@ $(COMP_NAME).components + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) $(COMP_RDB_NAME) cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml diff --git a/odk/examples/java/MinimalComponent/MinimalComponent.components b/odk/examples/java/MinimalComponent/MinimalComponent.components new file mode 100644 index 000000000000..9e413f2b64a2 --- /dev/null +++ b/odk/examples/java/MinimalComponent/MinimalComponent.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="MinimalComponent.uno.jar"> + <implementation name="MinimalComponent$_MinimalComponent"> + <service name="org.openoffice.MinimalComponent"/> + </implementation> + </component> +</components> diff --git a/odk/examples/java/MinimalComponent/MinimalComponent.java b/odk/examples/java/MinimalComponent/MinimalComponent.java index 47129efc00d2..d4811ab29f1a 100644 --- a/odk/examples/java/MinimalComponent/MinimalComponent.java +++ b/odk/examples/java/MinimalComponent/MinimalComponent.java @@ -163,9 +163,13 @@ public class MinimalComponent { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(_MinimalComponent.class.getName(), - _MinimalComponent.getServiceNames(), - 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(XRegistryKey regKey) { +// return Factory.writeRegistryServiceInfo(_MinimalComponent.class.getName(), +// _MinimalComponent.getServiceNames(), +// regKey); +// } } diff --git a/odk/examples/java/PropertySet/Makefile b/odk/examples/java/PropertySet/Makefile index 0a382d15042e..7a79f340d79c 100644 --- a/odk/examples/java/PropertySet/Makefile +++ b/odk/examples/java/PropertySet/Makefile @@ -52,6 +52,7 @@ COMP_JAR=$(COMP_CLASS_OUT)/$(COMP_JAR_NAME) COMP_JAR_MANIFEST=$(COMP_CLASS_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components COMP_JAVAFILES = PropTest.java @@ -89,15 +90,16 @@ $(COMP_GEN_OUT)/%/manifest.xml : @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 $(OUT_MISC)/,,$(@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)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(<F) + $(SDK_ZIP) $@ $(COMP_NAME).components + cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(<F) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) META-INF/manifest.xml diff --git a/odk/examples/java/PropertySet/PropTest.components b/odk/examples/java/PropertySet/PropTest.components new file mode 100644 index 000000000000..320e3511c335 --- /dev/null +++ b/odk/examples/java/PropertySet/PropTest.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="PropTest.uno.jar"> + <implementation name="PropTest"> + <service name="PropTest"/> + </implementation> + </component> +</components> diff --git a/odk/examples/java/PropertySet/PropTest.java b/odk/examples/java/PropertySet/PropTest.java index e8652c7689bb..396cb15b084a 100644 --- a/odk/examples/java/PropertySet/PropTest.java +++ b/odk/examples/java/PropertySet/PropTest.java @@ -257,9 +257,13 @@ public class PropTest extends PropertySet implements XServiceInfo return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) - { - return FactoryHelper.writeRegistryServiceInfo( PropTest.class.getName(), - PropTest.__serviceName, 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(XRegistryKey regKey) +// { +// return FactoryHelper.writeRegistryServiceInfo( PropTest.class.getName(), +// PropTest.__serviceName, regKey); +// } } diff --git a/odk/examples/java/Spreadsheet/CalcAddins.components b/odk/examples/java/Spreadsheet/CalcAddins.components new file mode 100644 index 000000000000..c16c4a3a99e7 --- /dev/null +++ b/odk/examples/java/Spreadsheet/CalcAddins.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="CalcAddins.uno.jar"> + <implementation name="CalcAddins$_CalcAddins"> + <service name="org.openoffice.sheet.addin.CalcAddins"/> + <service name="com.sun.star.sheet.AddIn"/> + </implementation> + </component> +</components> diff --git a/odk/examples/java/Spreadsheet/CalcAddins.java b/odk/examples/java/Spreadsheet/CalcAddins.java index 6a052a7e2eea..58de5d492869 100644 --- a/odk/examples/java/Spreadsheet/CalcAddins.java +++ b/odk/examples/java/Spreadsheet/CalcAddins.java @@ -295,10 +295,14 @@ public class CalcAddins { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(_CalcAddins.class.getName(), - _CalcAddins.__serviceName, regKey) - && FactoryHelper.writeRegistryServiceInfo(_CalcAddins.class.getName(), - _CalcAddins.ADDIN_SERVICE, 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(XRegistryKey regKey) { +// return FactoryHelper.writeRegistryServiceInfo(_CalcAddins.class.getName(), +// _CalcAddins.__serviceName, regKey) +// && FactoryHelper.writeRegistryServiceInfo(_CalcAddins.class.getName(), +// _CalcAddins.ADDIN_SERVICE, regKey); +// } } diff --git a/odk/examples/java/Spreadsheet/Makefile b/odk/examples/java/Spreadsheet/Makefile index 4a251ae2062b..52d73a4406ca 100644 --- a/odk/examples/java/Spreadsheet/Makefile +++ b/odk/examples/java/Spreadsheet/Makefile @@ -53,16 +53,17 @@ APP2_JAR=$(OUT_COMP_CLASS)/$(APP2_NAME).jar APP3_NAME=ChartTypeChange APP3_JAR=$(OUT_COMP_CLASS)/$(APP3_NAME).jar -COMPONENT_NAME=CalcAddins -COMPONENT_RDB_NAME=$(COMPONENT_NAME).uno.rdb -COMPONENT_RDB=$(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME) -COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT) -COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)") -COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar -COMPONENT_JAR=$(OUT_COMP_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml -REGISTERFLAG=$(OUT_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag +COMP_NAME=CalcAddins +COMP_RDB_NAME=$(COMP_NAME).uno.rdb +COMP_RDB=$(OUT_COMP_GEN)/$(COMP_RDB_NAME) +COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) +COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") +COMP_JAR_NAME=$(COMP_NAME).uno.jar +COMP_JAR=$(OUT_COMP_CLASS)/$(COMP_JAR_NAME) +COMP_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMP_NAME)/META-INF/manifest.xml +COMP_REGISTERFLAG=$(OUT_MISC)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components IDLFILES = XCalcAddins.idl @@ -80,11 +81,11 @@ GENURDFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/%.urd,$(IDLFILES)) COMPCLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(COMPJAVAFILES)) #COMPCLASSFILES += $(subst $(OUT_COMP_GEN),$(OUT_COMP_CLASS),$(GENJAVAFILES:.java=.class)) -$(COMPONENT_NAME)_CLASSFILES = $(COMPONENT_NAME).class \ - $(COMPONENT_NAME)$(QUOTE)$$_$(COMPONENT_NAME).class +$(COMP_NAME)_CLASSFILES = $(COMP_NAME).class \ + $(COMP_NAME)$(QUOTE)$$_$(COMP_NAME).class -#$(COMPONENT_NAME)_CLASSFILES += $(subst $(OUT_COMP_GEN)/,,$(GENJAVAFILES:.java=.class)) -$(COMPONENT_NAME)_CLASSFILES += $(subst $(OUT_COMP_CLASS)/,,$(GENCLASSFILES)) +#$(COMP_NAME)_CLASSFILES += $(subst $(OUT_COMP_GEN)/,,$(GENJAVAFILES:.java=.class)) +$(COMP_NAME)_CLASSFILES += $(subst $(OUT_COMP_CLASS)/,,$(GENCLASSFILES)) SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(OUT_COMP_CLASS)) @@ -110,10 +111,10 @@ $(OUT_COMP_GEN)/%.rdb : $(GENURDFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) $(REGMERGE) $@ /UCR $(GENURDFILES) -#$(OUT_COMP_GEN)/%.java : $(COMPONENT_RDB) -$(GENCLASSFILES) : $(COMPONENT_RDB) +#$(OUT_COMP_GEN)/%.java : $(COMP_RDB) +$(GENCLASSFILES) : $(COMP_RDB) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMPONENT_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) + $(JAVAMAKER) -BUCR -nD $(GENTYPELIST) -O$(OUT_COMP_CLASS) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES) $(OUT_COMP_CLASS)/%.class : %.java -$(MKDIR) $(subst /,$(PS),$(@D)) @@ -139,7 +140,7 @@ $(OUT_COMP_CLASS)/%.jar : $(OUT_COMP_CLASS)/%.mf $(OUT_COMP_CLASS)/%.class +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) # rule for component jar file -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(COMPCLASSFILES) +$(COMP_JAR) : $(COMP_MANIFESTFILE) $(COMPCLASSFILES) -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) @@ -152,24 +153,25 @@ $(OUT_COMP_CLASS)/%/manifest.xml : @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 $(OUT_COMP_CLASS)/,,$(@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 $(OUT_COMP_CLASS)/,,$(@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)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_CLASS)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(COMPONENT_RDB_NAME) $(COMPONENT_JAR_NAME) + $(SDK_ZIP) $@ -u $(COMP_NAME).components + cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml $(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_COMP_CLASS)/$(<F))) -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -183,7 +185,7 @@ $(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(APP1_NAME).c $(APP2_JAR) : $(OUT_COMP_CLASS)/$(APP2_NAME).mf $(OUT_COMP_CLASS)/$(APP2_NAME).class $(APP3_JAR) : $(OUT_COMP_CLASS)/$(APP3_NAME).mf $(OUT_COMP_CLASS)/$(APP3_NAME).class -$(EXAMPLE_NAME) : $(REGISTERFLAG) $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) +$(EXAMPLE_NAME) : $(COMP_REGISTERFLAG) $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) @echo -------------------------------------------------------------------------------- @echo Please use the following command to execute the examples! @echo - @@ -202,12 +204,12 @@ $(EXAMPLE_NAME) : $(REGISTERFLAG) $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) %.run: $(OUT_COMP_CLASS)/%.jar $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< -CalcAddins.ods.load : $(REGISTERFLAG) +CalcAddins.ods.load : $(COMP_REGISTERFLAG) "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) .PHONY: clean clean : -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_REGISTERFLAG))) diff --git a/odk/examples/java/ToDo/Makefile b/odk/examples/java/ToDo/Makefile index 476ff6620dbc..d597e969aa24 100644 --- a/odk/examples/java/ToDo/Makefile +++ b/odk/examples/java/ToDo/Makefile @@ -54,6 +54,7 @@ COMP_JAR=$(COMP_CLASS_OUT)/$(COMP_JAR_NAME) COMP_JAR_MANIFEST=$(COMP_CLASS_OUT)/$(COMP_NAME).uno.Manifest COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag +COMP_COMPONENTS=$(COMP_NAME).components IDLFILES = XToDo.idl \ ToDo.idl @@ -121,15 +122,16 @@ $(COMP_GEN_OUT)/%/manifest.xml : @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 $(OUT_MISC)/,,$(@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 $(OUT_MISC)/,,$(@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)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ # rule for component package file -$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_RDB_NAME) + $(SDK_ZIP) $@ $(COMP_NAME).components + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_RDB_NAME) cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME) cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) META-INF/manifest.xml diff --git a/odk/examples/java/ToDo/ToDo.components b/odk/examples/java/ToDo/ToDo.components new file mode 100644 index 000000000000..0b667b96a87e --- /dev/null +++ b/odk/examples/java/ToDo/ToDo.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="ToDo.uno.jar"> + <implementation name="ToDo$ToDoImpl"> + <service name="org.openoffice.ToDo"/> + </implementation> + </component> +</components> diff --git a/odk/examples/java/ToDo/ToDo.java b/odk/examples/java/ToDo/ToDo.java index 784750a2e3e5..ce17063c9a72 100644 --- a/odk/examples/java/ToDo/ToDo.java +++ b/odk/examples/java/ToDo/ToDo.java @@ -957,9 +957,13 @@ public class ToDo { * @param regKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(ToDoImpl.class.getName(), - ToDoImpl.getServiceNames(), 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(XRegistryKey regKey) { +// return Factory.writeRegistryServiceInfo(ToDoImpl.class.getName(), +// ToDoImpl.getServiceNames(), regKey); +// } } |