summaryrefslogtreecommitdiff
path: root/odk/examples/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/cpp')
-rw-r--r--odk/examples/cpp/DocumentLoader/DocumentLoader.cxx47
-rw-r--r--odk/examples/cpp/DocumentLoader/Makefile37
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/Makefile55
-rw-r--r--odk/examples/cpp/complextoolbarcontrols/exports.cxx65
-rw-r--r--odk/examples/cpp/counter/Makefile42
-rw-r--r--odk/examples/cpp/counter/counter.cxx54
-rw-r--r--odk/examples/cpp/counter/countermain.cxx68
-rw-r--r--odk/examples/cpp/remoteclient/Makefile65
-rw-r--r--odk/examples/cpp/remoteclient/remoteclient.cxx52
9 files changed, 235 insertions, 250 deletions
diff --git a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
index 211f2024..0ef6c115 100644
--- a/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
+++ b/odk/examples/cpp/DocumentLoader/DocumentLoader.cxx
@@ -48,6 +48,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>
@@ -71,36 +72,22 @@ using namespace com::sun::star::registry;
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
object.
@@ -131,7 +118,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr());
exit(1);
}
-
+
// gets the server component context as property of the office component factory
Reference< XPropertySet > xPropSet( xInterface, UNO_QUERY );
xPropSet->getPropertyValue( OUString::createFromAscii("DefaultContext") ) >>= xComponentContext;
@@ -139,7 +126,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
// gets the service manager from the office
Reference< XMultiComponentFactory > xMultiComponentFactoryServer(
xComponentContext->getServiceManager() );
-
+
/* Creates an instance of a component which supports the services specified
by the factory. Important: using the office component context.
*/
@@ -151,9 +138,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 91e6f49c..6cbd8bdd 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 a21590d0..8e622330 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) $(STLPORTLIB) 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) $(STLPORTLIB) $(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 76e0b1a8..c75471a6 100644
--- a/odk/examples/cpp/complextoolbarcontrols/exports.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/exports.cxx
@@ -41,17 +41,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"
{
@@ -62,27 +62,30 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
+// 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_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_ENSURE( sal_False, "### InvalidRegistryException!" ); }
-
- return sal_False;
-}
+// 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_ENSURE( sal_False, "### 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 5e7f620a..161145f7 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) $(STLPORTLIB) 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) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
@@ -138,16 +134,33 @@ else
$(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(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 db903cfa..f13ee41f 100644
--- a/odk/examples/cpp/counter/counter.cxx
+++ b/odk/examples/cpp/counter/counter.cxx
@@ -167,7 +167,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;
}
@@ -179,33 +179,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") ) ) );
+// 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] );
+// 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;
-}
+// return sal_True;
+// }
+// catch (InvalidRegistryException &)
+// {
+// // we should not ignore exceptions
+// }
+// }
+// return result;
+// }
/**
* This function is called to get service factories for an implementation.
@@ -215,7 +215,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 08a68b19..fce1715f 100644
--- a/odk/examples/cpp/counter/countermain.cxx
+++ b/odk/examples/cpp/counter/countermain.cxx
@@ -68,55 +68,37 @@ 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::createFromAscii("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::createFromAscii("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::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component
-#ifdef UNX
-#ifdef MACOSX
- OUString::createFromAscii("counter.uno.dylib"), // component location
-#else
- OUString::createFromAscii("counter.uno.so"), // component location
-#endif
-#else
- OUString::createFromAscii("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::createFromAscii("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();
+
+ } catch( Exception& e) {
+ printf("Error: caught exception:\n %s\n",
+ OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr());
+ exit(1);
}
- Reference< XComponent >::query( xContext )->dispose();
return 0;
}
diff --git a/odk/examples/cpp/remoteclient/Makefile b/odk/examples/cpp/remoteclient/Makefile
index 40d51deb..96b2ef9b 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) $(STLPORTLIB) 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) $(STLPORTLIB) $(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 be2dd90c..867c1092 100644
--- a/odk/examples/cpp/remoteclient/remoteclient.cxx
+++ b/odk/examples/cpp/remoteclient/remoteclient.cxx
@@ -227,39 +227,41 @@ 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::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) );
+// SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+// void * pServiceManager, void * pRegistryKey )
+// {
+// if (pRegistryKey)
+// {
+// try
+// {
+// Reference< XRegistryKey > xNewKey(
+// reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
+// OUString::createFromAscii( "/" 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] );
+// 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_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_False;
-}
+// return sal_True;
+// }
+// catch (InvalidRegistryException &)
+// {
+// OSL_ENSURE( sal_False, "### 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;