Blob Blame History Raw
From 8071d87b62ab87b2a825394847e9313ea8ddfcb4 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 17 Dec 2013 10:53:29 +0100
Subject: [PATCH 072/109] Keep using component_getImplementationEnvironment in
 extensions

...instead of relying on the implicit CPPU_CURRENT_LANGUAGE_BINDING_NAME
convention.  Keeping that convention an implementation detail makes it easier to
do improvements in the future.  (Theoretically, the bundled extension in mysqlc
could be considered internal code and not adapted, but just be safe.)

(cherry picked from commit fa2a7c1c95f78d20ed572091e12700fd4d852835)
Conflicts:
	desktop/test/deployment/active/active_native.cxx
	odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
	odk/examples/cpp/counter/counter.cxx

Change-Id: Iae41a6e072dabc2bf7c1481ba6cfed61680edf37
Reviewed-on: https://gerrit.libreoffice.org/7119
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
---
 desktop/test/deployment/active/active_native.cxx                  | 7 +++++++
 desktop/test/deployment/passive/passive_native.cxx                | 7 +++++++
 mysqlc/source/mysqlc_services.cxx                                 | 7 +++++++
 .../Components/Addons/ProtocolHandlerAddon_cpp/component.cxx      | 8 ++++++++
 .../DevelopersGuide/Components/CppComponent/service2_impl.cxx     | 7 +++++++
 .../DevelopersGuide/Database/DriverSkeleton/SServices.cxx         | 7 +++++++
 .../OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx | 7 +++++++
 .../OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx     | 7 +++++++
 odk/examples/DevelopersGuide/examples.html                        | 4 ++--
 odk/examples/cpp/complextoolbarcontrols/exports.cxx               | 7 +++++++
 odk/examples/cpp/counter/counter.cxx                              | 8 ++++++++
 odk/examples/cpp/custompanel/ctp_services.cxx                     | 8 ++++++++
 odk/examples/cpp/remoteclient/remoteclient.cxx                    | 8 ++++++++
 odk/settings/component.uno.def                                    | 1 +
 14 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx
index 3afc099..0e0b1e6 100644
--- a/desktop/test/deployment/active/active_native.cxx
+++ b/desktop/test/deployment/active/active_native.cxx
@@ -252,6 +252,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
         pImplName, pServiceManager, pRegistryKey, services);
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 extern "C" sal_Bool SAL_CALL component_writeInfo(
     void * pServiceManager, void * pRegistryKey)
 {
diff --git a/desktop/test/deployment/passive/passive_native.cxx b/desktop/test/deployment/passive/passive_native.cxx
index 819f6ab..22586a4 100644
--- a/desktop/test/deployment/passive/passive_native.cxx
+++ b/desktop/test/deployment/passive/passive_native.cxx
@@ -249,4 +249,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
         pImplName, pServiceManager, pRegistryKey, services);
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/mysqlc/source/mysqlc_services.cxx b/mysqlc/source/mysqlc_services.cxx
index af1cabe..0ffe9cd 100644
--- a/mysqlc/source/mysqlc_services.cxx
+++ b/mysqlc/source/mysqlc_services.cxx
@@ -22,6 +22,7 @@
 #include <cppuhelper/factory.hxx>
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
+#include <uno/lbnames.h>
 
 using namespace connectivity::mysqlc;
 using ::com::sun::star::uno::Reference;
@@ -102,6 +103,12 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
 };
 /* }}} */
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
 
 /*
  * Local variables:
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
index 20c2628..b71c694 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx
@@ -35,6 +35,7 @@
 
 #include <stdio.h>
 #include <rtl/ustring.hxx>
+#include <uno/lbnames.h>
 #include <cppuhelper/queryinterface.hxx> // helper for queryInterface() impl
 #include <cppuhelper/factory.hxx> // helper for component factory
 // generated c++ interfaces
@@ -85,4 +86,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_C
     return pRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
index ac86ea1..fa6d875 100644
--- a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
@@ -36,6 +36,7 @@
 #include <cppuhelper/implbase3.hxx> // "3" implementing three interfaces
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.hxx>
+#include <uno/lbnames.h>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
@@ -206,6 +207,12 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
         implName, xMgr, xRegistry, ::my_sc_impl::s_component_entries );
 }
 
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 }
 
 
diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx
index 9e8fa4c..4873522 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx
@@ -37,6 +37,7 @@
 #include "SDriver.hxx"
 #include <cppuhelper/factory.hxx>
 #include <osl/diagnose.h>
+#include <uno/lbnames.h>
 
 using namespace connectivity::skeleton;
 using ::rtl::OUString;
@@ -143,5 +144,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
     return pRet;
 };
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
index e6b7885..9d234e9 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
@@ -37,6 +37,7 @@
 
 #include <osl/mutex.hxx>
 #include <osl/thread.h>
+#include <uno/lbnames.h>
 #include <cppuhelper/factory.hxx>
 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
 
@@ -72,6 +73,12 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
     return pRet;
 }
 
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx
index 5cfe660..9dd347d 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx
@@ -38,6 +38,7 @@
 #include <cppuhelper/implbase2.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <uno/lbnames.h>
 
 #include <com/sun/star/lang/XComponent.hpp>
 
@@ -339,6 +340,12 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
     return pRet;
 }
 
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 } // extern "C"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/DevelopersGuide/examples.html b/odk/examples/DevelopersGuide/examples.html
index b33b16e..17db8e1 100644
--- a/odk/examples/DevelopersGuide/examples.html
+++ b/odk/examples/DevelopersGuide/examples.html
@@ -573,7 +573,7 @@ the c++ ProtocolHandler example.</td>
  href="./Components/Addons/ProtocolHandlerAddon_cpp/component.cxx"
  title="link to Components/Addons/ProtocolHandlerAddon_cpp/component.cxx">component.cxx</a></td>
                   <td class="cell80">Implements the administrative
-component functions (component_writeInfo, component_getFactory).</td>
+component functions (component_writeInfo, component_getFactory, component_getImplementationEnvironment).</td>
                 </tr>
                 <tr>
                   <td class="cell20"><a
@@ -900,7 +900,7 @@ the filter detection example.</td>
  href="./OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx"
  title="link to OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx">fdcomp.cxx</a></td>
                   <td class="cell80">Implements the administrative
-component functions (component_writeInfo, component_getFactory).</td>
+component functions (component_writeInfo, component_getFactory, component_getImplementationEnvironment).</td>
                 </tr>
                 <tr>
                   <td class="cell20"><a
diff --git a/odk/examples/cpp/complextoolbarcontrols/exports.cxx b/odk/examples/cpp/complextoolbarcontrols/exports.cxx
index 09ab4ce..35a4f39 100644
--- a/odk/examples/cpp/complextoolbarcontrols/exports.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/exports.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <cppuhelper/factory.hxx>
+#include <uno/lbnames.h>
 
 #include "MyProtocolHandler.h"
 #include "MyListener.h"
@@ -56,6 +57,12 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplNa
     return xFactory.get();
 }
 
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 } // extern C
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/cpp/counter/counter.cxx b/odk/examples/cpp/counter/counter.cxx
index 6f65f5c..0773d60 100644
--- a/odk/examples/cpp/counter/counter.cxx
+++ b/odk/examples/cpp/counter/counter.cxx
@@ -46,6 +46,7 @@
 
 #include <stdio.h>
 #include <rtl/ustring.hxx>
+#include <uno/lbnames.h>
 #include <cppuhelper/queryinterface.hxx> // helper for queryInterface() impl
 #include <cppuhelper/factory.hxx> // helper for component factory
 // generated c++ interfaces
@@ -194,4 +195,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_C
     return pRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/cpp/custompanel/ctp_services.cxx b/odk/examples/cpp/custompanel/ctp_services.cxx
index c096a7b..a8f5702 100644
--- a/odk/examples/cpp/custompanel/ctp_services.cxx
+++ b/odk/examples/cpp/custompanel/ctp_services.cxx
@@ -20,6 +20,7 @@
 #include "ctp_factory.hxx"
 
 #include <cppuhelper/implementationentry.hxx>
+#include <uno/lbnames.h>
 
 //......................................................................................................................
 namespace sd { namespace colortoolpanel
@@ -52,6 +53,13 @@ extern "C"
     {
         return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::sd::colortoolpanel::s_aServiceEntries );
     }
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/examples/cpp/remoteclient/remoteclient.cxx b/odk/examples/cpp/remoteclient/remoteclient.cxx
index c8886b0..037814b 100644
--- a/odk/examples/cpp/remoteclient/remoteclient.cxx
+++ b/odk/examples/cpp/remoteclient/remoteclient.cxx
@@ -35,6 +35,7 @@
 
 #include <stdio.h>
 #include <osl/mutex.hxx>
+#include <uno/lbnames.h>
 #include <cppuhelper/factory.hxx>
 
 #include <com/sun/star/uno/XNamingService.hpp>
@@ -245,6 +246,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
 
     return pRet;
 }
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+    char const ** ppEnvTypeName, uno_Environment **)
+{
+    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/odk/settings/component.uno.def b/odk/settings/component.uno.def
index 0c35f9a..1ca480a 100644
--- a/odk/settings/component.uno.def
+++ b/odk/settings/component.uno.def
@@ -1,2 +1,3 @@
 EXPORTS
 component_getFactory
+component_getImplementationEnvironment
-- 
1.8.4.2