diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-06-24 12:24:49 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-06-24 14:23:25 +0100 |
commit | babdd43fcee0963f80df3ed6574e8f70543827e2 (patch) | |
tree | 58945e7d44d10c6d6474885a79cd39b215c6127a /cppuhelper | |
parent | Allows using prefix information about component (diff) | |
download | core-babdd43fcee0963f80df3ed6574e8f70543827e2.tar.gz core-babdd43fcee0963f80df3ed6574e8f70543827e2.zip |
re-work prefix handling and undo cppuhelper ABI change, add unit test
use a separate prefix enabled method instead of changing the ABI of cppuhelper
also - lookup the prefix in the dllcomponentloader in case we are called this way
also - add a unit test for the prefix change
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/inc/cppuhelper/shlib.hxx | 26 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx | 4 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/makefile.mk | 1 | ||||
-rw-r--r-- | cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component | 2 | ||||
-rw-r--r-- | cppuhelper/source/factory.cxx | 2 | ||||
-rw-r--r-- | cppuhelper/source/shlib.cxx | 11 |
6 files changed, 40 insertions, 6 deletions
diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx index 582993f857d5..ed7f74107cae 100644 --- a/cppuhelper/inc/cppuhelper/shlib.hxx +++ b/cppuhelper/inc/cppuhelper/shlib.hxx @@ -48,6 +48,30 @@ namespace cppu @param rImplName implementation to be retrieved from the library @param xMgr service manager to be provided to the component @param xKey registry key to be provided to the component + @return + factory instance (::com::sun::star::lang::XSingleComponentFactory or + ::com::sun::star::lang::XSingleComponentFactory) +*/ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > +SAL_CALL loadSharedLibComponentFactory( + ::rtl::OUString const & rLibName, ::rtl::OUString const & rPath, + ::rtl::OUString const & rImplName, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & xMgr, + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey ) + SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); + +/** Loads a shared library component and gets the factory out of it. You can give either a + fully qualified libname or single lib name. The libname need not be pre/postfixed + (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific + directory. The resulting path of the library will be checked against environment variable + CPLD_ACCESSPATH if set. An optional 'prefix' parameter is used to determine the symbol + name of the entry point in the library. + + @param rLibName name of the library + @param rPath optional path + @param rImplName implementation to be retrieved from the library + @param xMgr service manager to be provided to the component + @param xKey registry key to be provided to the component @param rPrefix optional component prefix @return factory instance (::com::sun::star::lang::XSingleComponentFactory or @@ -59,7 +83,7 @@ SAL_CALL loadSharedLibComponentFactory( ::rtl::OUString const & rImplName, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & xMgr, ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey, - ::rtl::OUString const & rPrefix = ::rtl::OUString() ) + ::rtl::OUString const & rPrefix ) SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); /** Invokes component_writeInfo() function of specified component library. You can give either diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx index 2fd0d494c99d..c93d24b39e79 100644 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx @@ -416,14 +416,14 @@ cppu::ImplementationEntry entries[] = { } -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL mixin_component_getFactory( char const * implName, void * serviceManager, void * registryKey) { return cppu::component_getFactoryHelper( implName, serviceManager, registryKey, entries); } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL mixin_component_getImplementationEnvironment( char const ** envTypeName, uno_Environment **) { *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index be4cfc380947..384e2b047883 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -66,7 +66,6 @@ DEF1NAME = $(SHL1TARGET) SHL2TARGET = $(TARGET).uno SHL2OBJS = $(SLO)/comp_propertysetmixin.obj -SHL2VERSIONMAP = $(SOLARENV)/src/component.map SHL2STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) SHL2IMPLIB = i$(SHL2TARGET) SH21RPATH = NONE diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component index a654e07581a3..1ae646e98017 100644 --- a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="mixin" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="test.cppuhelper.propertysetmixin.comp.CppSupplier"> <service name="test.cppuhelper.propertysetmixin.CppSupplier"/> diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index a87d39ad91f5..bccc91db36eb 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -856,7 +856,7 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory() if( xPrefixKey.is() && xPrefixKey->getValueType() == RegistryValueType_ASCII ) { aPrefix = xPrefixKey->getAsciiValue(); - if (aPrefix.getLength() != 0) + if( aPrefix.getLength() != 0 ) aPrefix = aPrefix + OUSTR("_"); } } diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index 1127cc3f0a4a..62d772637dfd 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -345,6 +345,17 @@ extern "C" {static void s_getFactory(va_list * pParam) *ppSSF = pSym(pImplName->getStr(), pSMgr, pKey); }} +/* For backwards compatibility */ +Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( + OUString const & rLibName, OUString const & rPath, + OUString const & rImplName, + Reference< lang::XMultiServiceFactory > const & xMgr, + Reference< registry::XRegistryKey > const & xKey ) + SAL_THROW( (loader::CannotActivateFactoryException) ) +{ + return loadSharedLibComponentFactory( rLibName, rPath, rImplName, xMgr, xKey, rtl::OUString() ); +} + Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( OUString const & rLibName, OUString const & rPath, OUString const & rImplName, |