summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/access_control.cxx149
-rw-r--r--cppuhelper/source/bootstrap.cxx664
-rwxr-xr-xcppuhelper/source/cc5_solaris_sparc.map389
-rw-r--r--cppuhelper/source/component.cxx248
-rw-r--r--cppuhelper/source/component_context.cxx899
-rw-r--r--cppuhelper/source/exc_thrower.cxx298
-rw-r--r--cppuhelper/source/factory.cxx1140
-rw-r--r--cppuhelper/source/findsofficepath.c205
-rw-r--r--cppuhelper/source/gcc3.map384
-rw-r--r--cppuhelper/source/gcc3os2.map377
-rw-r--r--cppuhelper/source/implbase.cxx471
-rw-r--r--cppuhelper/source/implbase_ex.cxx469
-rw-r--r--cppuhelper/source/implementationentry.cxx102
-rw-r--r--cppuhelper/source/interfacecontainer.cxx731
-rw-r--r--cppuhelper/source/macro_expander.cxx198
-rw-r--r--cppuhelper/source/macro_expander.hxx60
-rw-r--r--cppuhelper/source/makefile.mk192
-rw-r--r--cppuhelper/source/msvc_win32_intel.map280
-rw-r--r--cppuhelper/source/propertysetmixin.cxx1428
-rw-r--r--cppuhelper/source/propshlp.cxx1241
-rw-r--r--cppuhelper/source/servicefactory.cxx660
-rw-r--r--cppuhelper/source/shlib.cxx609
-rw-r--r--cppuhelper/source/stdidlclass.cxx259
-rw-r--r--cppuhelper/source/tdmgr.cxx762
-rw-r--r--cppuhelper/source/typeprovider.cxx326
-rw-r--r--cppuhelper/source/unorc30
-rw-r--r--cppuhelper/source/unourl.cxx298
-rw-r--r--cppuhelper/source/weak.cxx553
28 files changed, 13422 insertions, 0 deletions
diff --git a/cppuhelper/source/access_control.cxx b/cppuhelper/source/access_control.cxx
new file mode 100644
index 000000000000..f3ef9f81fc0d
--- /dev/null
+++ b/cppuhelper/source/access_control.cxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <cppuhelper/access_control.hxx>
+
+#include <com/sun/star/security/XAccessController.hpp>
+#include <com/sun/star/security/RuntimePermission.hpp>
+#include <com/sun/star/io/FilePermission.hpp>
+#include <com/sun/star/connection/SocketPermission.hpp>
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace
+{
+ inline OUString str_ac_singleton()
+ {
+ return OUSTR("/singletons/com.sun.star.security.theAccessController");
+ }
+}
+
+namespace cppu
+{
+//__________________________________________________________________________________________________
+AccessControl::AccessControl( Reference< XComponentContext > const & xContext )
+ SAL_THROW( (RuntimeException) )
+{
+ if (! (xContext->getValueByName( str_ac_singleton() ) >>= m_xController))
+ {
+ throw SecurityException(
+ OUSTR("no access controller!"), Reference< XInterface >() );
+ }
+}
+//__________________________________________________________________________________________________
+AccessControl::AccessControl(
+ Reference< security::XAccessController > const & xController )
+ SAL_THROW( (RuntimeException) )
+ : m_xController( xController )
+{
+ if (! m_xController.is())
+ {
+ throw SecurityException(
+ OUSTR("no access controller!"), Reference< XInterface >() );
+ }
+}
+//__________________________________________________________________________________________________
+AccessControl::AccessControl( AccessControl const & ac )
+ SAL_THROW( (RuntimeException) )
+ : m_xController( ac.m_xController )
+{
+ if (! m_xController.is())
+ {
+ throw SecurityException(
+ OUSTR("no access controller!"), Reference< XInterface >() );
+ }
+}
+
+#ifdef SAL_W32
+#pragma pack(push, 8)
+#endif
+ // binary comp. to all Permission structs
+ struct __permission
+ {
+ rtl_uString * m_str1;
+ rtl_uString * m_str2;
+ };
+#ifdef SAL_W32
+#pragma pack(pop)
+#endif
+
+//--------------------------------------------------------------------------------------------------
+inline void __checkPermission(
+ Reference< security::XAccessController > const & xController,
+ Type const & type, rtl_uString * str1, rtl_uString * str2 )
+ SAL_THROW( (RuntimeException) )
+{
+ __permission perm;
+ perm.m_str1 = str1;
+ perm.m_str2 = str2;
+
+ uno_Any a;
+ a.pType = type.getTypeLibType();
+ a.pData = &perm;
+
+ xController->checkPermission( * static_cast< Any * >( &a ) );
+}
+//__________________________________________________________________________________________________
+void AccessControl::checkRuntimePermission(
+ OUString const & name )
+ SAL_THROW( (RuntimeException) )
+{
+ __checkPermission(
+ m_xController,
+ ::getCppuType( (security::RuntimePermission *)0 ), name.pData, 0 );
+}
+//__________________________________________________________________________________________________
+void AccessControl::checkFilePermission(
+ OUString const & url,
+ OUString const & actions )
+ SAL_THROW( (RuntimeException) )
+{
+ __checkPermission(
+ m_xController,
+ ::getCppuType( (io::FilePermission *)0 ), url.pData, actions.pData );
+}
+//__________________________________________________________________________________________________
+void AccessControl::checkSocketPermission(
+ OUString const & host,
+ OUString const & actions )
+ SAL_THROW( (RuntimeException) )
+{
+ __checkPermission(
+ m_xController,
+ ::getCppuType( (connection::SocketPermission *)0 ), host.pData, actions.pData );
+}
+
+}
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
new file mode 100644
index 000000000000..5575c118420e
--- /dev/null
+++ b/cppuhelper/source/bootstrap.cxx
@@ -0,0 +1,664 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <string.h>
+#include <vector>
+
+#include "rtl/process.h"
+#include "rtl/bootstrap.hxx"
+#include "rtl/random.h"
+#include "rtl/string.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/uri.hxx"
+#if OSL_DEBUG_LEVEL > 0
+#include "rtl/strbuf.hxx"
+#endif
+#include "osl/diagnose.h"
+#include "osl/file.hxx"
+#include "osl/module.hxx"
+#include "osl/security.hxx"
+#include "osl/thread.hxx"
+
+#include "cppuhelper/shlib.hxx"
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/component_context.hxx"
+#include "cppuhelper/access_control.hxx"
+#include "cppuhelper/findsofficepath.h"
+
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/container/XSet.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/bridge/UnoUrlResolver.hpp"
+#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
+
+#include "macro_expander.hxx"
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+#define ARLEN(x) sizeof (x) / sizeof *(x)
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+
+OUString const & get_this_libpath()
+{
+ static OUString s_path;
+ if (0 == s_path.getLength())
+ {
+ OUString path;
+ Module::getUrlFromAddress( reinterpret_cast<oslGenericFunction>(get_this_libpath), path );
+ path = path.copy( 0, path.lastIndexOf( '/' ) );
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if (0 == s_path.getLength())
+ s_path = path;
+ }
+ return s_path;
+}
+
+Bootstrap const & get_unorc() SAL_THROW( () )
+{
+ static rtlBootstrapHandle s_bstrap = 0;
+ if (! s_bstrap)
+ {
+ OUString iniName(
+ get_this_libpath() + OUSTR("/" SAL_CONFIGFILE("uno")) );
+ rtlBootstrapHandle bstrap = rtl_bootstrap_args_open( iniName.pData );
+
+ ClearableMutexGuard guard( Mutex::getGlobalMutex() );
+ if (s_bstrap)
+ {
+ guard.clear();
+ rtl_bootstrap_args_close( bstrap );
+ }
+ else
+ {
+ s_bstrap = bstrap;
+ }
+ }
+ return *(Bootstrap const *)&s_bstrap;
+}
+
+
+void addFactories(
+ char const * const * ppNames /* lib, implname, ..., 0 */,
+ OUString const & bootstrapPath,
+ Reference< lang::XMultiComponentFactory > const & xMgr,
+ Reference< registry::XRegistryKey > const & xKey )
+ SAL_THROW( (Exception) )
+{
+ Reference< container::XSet > xSet( xMgr, UNO_QUERY );
+ OSL_ASSERT( xSet.is() );
+ Reference< lang::XMultiServiceFactory > xSF( xMgr, UNO_QUERY );
+
+ while (*ppNames)
+ {
+ OUString lib( OUString::createFromAscii( *ppNames++ ) );
+ OUString implName( OUString::createFromAscii( *ppNames++ ) );
+
+ Any aFac( makeAny( loadSharedLibComponentFactory(
+ lib, bootstrapPath, implName, xSF, xKey ) ) );
+ xSet->insert( aFac );
+#if OSL_DEBUG_LEVEL > 1
+ if (xSet->has( aFac ))
+ {
+ Reference< lang::XServiceInfo > xInfo;
+ if (aFac >>= xInfo)
+ {
+ ::fprintf(
+ stderr, "> implementation %s supports: ", ppNames[ -1 ] );
+ Sequence< OUString > supported(
+ xInfo->getSupportedServiceNames() );
+ for ( sal_Int32 nPos = supported.getLength(); nPos--; )
+ {
+ OString str( OUStringToOString(
+ supported[ nPos ], RTL_TEXTENCODING_ASCII_US ) );
+ ::fprintf( stderr, nPos ? "%s, " : "%s\n", str.getStr() );
+ }
+ }
+ else
+ {
+ ::fprintf(
+ stderr,
+ "> implementation %s provides NO lang::XServiceInfo!!!\n",
+ ppNames[ -1 ] );
+ }
+ }
+#endif
+#if OSL_DEBUG_LEVEL > 0
+ if (! xSet->has( aFac ))
+ {
+ OStringBuffer buf( 64 );
+ buf.append( "### failed inserting shared lib \"" );
+ buf.append( ppNames[ -2 ] );
+ buf.append( "\"!!!" );
+ OString str( buf.makeStringAndClear() );
+ OSL_ENSURE( 0, str.getStr() );
+ }
+#endif
+ }
+}
+
+// private forward decl
+Reference< lang::XMultiComponentFactory > bootstrapInitialSF(
+ OUString const & rBootstrapPath )
+ SAL_THROW( (Exception) );
+
+Reference< XComponentContext > bootstrapInitialContext(
+ Reference< lang::XMultiComponentFactory > const & xSF,
+ Reference< registry::XSimpleRegistry > const & types_xRegistry,
+ Reference< registry::XSimpleRegistry > const & services_xRegistry,
+ OUString const & rBootstrapPath, Bootstrap const & bootstrap )
+ SAL_THROW( (Exception) );
+
+Reference< XComponentContext > SAL_CALL createInitialCfgComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ Reference< XComponentContext > const & xDelegate )
+ SAL_THROW( () );
+
+Reference< registry::XSimpleRegistry > SAL_CALL createRegistryWrapper(
+ const Reference< XComponentContext >& xContext );
+
+namespace {
+
+template< class T >
+inline beans::PropertyValue createPropertyValue(
+ OUString const & name, T const & value )
+ SAL_THROW( () )
+{
+ return beans::PropertyValue(
+ name, -1, makeAny( value ), beans::PropertyState_DIRECT_VALUE );
+}
+
+OUString findBoostrapArgument(
+ const Bootstrap & bootstrap,
+ const OUString & arg_name,
+ sal_Bool * pFallenBack )
+ SAL_THROW(())
+{
+ OUString result;
+
+ OUString prefixed_arg_name = OUSTR("UNO_");
+ prefixed_arg_name += arg_name.toAsciiUpperCase();
+
+ // environment not set -> try relative to executable
+ if(!bootstrap.getFrom(prefixed_arg_name, result))
+ {
+ if(pFallenBack)
+ *pFallenBack = sal_True;
+
+ OUString fileName;
+ bootstrap.getIniName(fileName);
+
+ // cut the rc extension
+ OUStringBuffer result_buf( 64 );
+ result_buf.append(
+ fileName.copy(
+ 0, fileName.getLength() - strlen(SAL_CONFIGFILE(""))) );
+ result_buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("_") );
+ result_buf.append( arg_name.toAsciiLowerCase() );
+ result_buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(".rdb") );
+ result = result_buf.makeStringAndClear();
+
+#if OSL_DEBUG_LEVEL > 1
+ OString result_dbg =
+ OUStringToOString(result, RTL_TEXTENCODING_ASCII_US);
+ OString arg_name_dbg =
+ OUStringToOString(arg_name, RTL_TEXTENCODING_ASCII_US);
+ OSL_TRACE(
+ "cppuhelper::findBoostrapArgument - "
+ "setting %s relative to executable: %s\n",
+ arg_name_dbg.getStr(),
+ result_dbg.getStr() );
+#endif
+ }
+ else
+ {
+ if(pFallenBack)
+ *pFallenBack = sal_False;
+
+#if OSL_DEBUG_LEVEL > 1
+ OString prefixed_arg_name_dbg = OUStringToOString(
+ prefixed_arg_name, RTL_TEXTENCODING_ASCII_US );
+ OString result_dbg = OUStringToOString(
+ result, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE(
+ "cppuhelper::findBoostrapArgument - found %s in env: %s",
+ prefixed_arg_name_dbg.getStr(),
+ result_dbg.getStr() );
+#endif
+ }
+
+ return result;
+}
+
+Reference< registry::XSimpleRegistry > nestRegistries(
+ const OUString baseDir,
+ const Reference< lang::XSingleServiceFactory > & xSimRegFac,
+ const Reference< lang::XSingleServiceFactory > & xNesRegFac,
+ OUString csl_rdbs,
+ const OUString & write_rdb,
+ sal_Bool forceWrite_rdb,
+ sal_Bool bFallenBack )
+ SAL_THROW((Exception))
+{
+ sal_Int32 index;
+ Reference< registry::XSimpleRegistry > lastRegistry;
+
+ if(write_rdb.getLength()) // is there a write registry given?
+ {
+ lastRegistry.set(xSimRegFac->createInstance(), UNO_QUERY);
+
+ try
+ {
+ lastRegistry->open(write_rdb, sal_False, forceWrite_rdb);
+ }
+ catch (registry::InvalidRegistryException & invalidRegistryException)
+ {
+ (void) invalidRegistryException;
+#if OSL_DEBUG_LEVEL > 1
+ OString rdb_name_tmp = OUStringToOString(
+ write_rdb, RTL_TEXTENCODING_ASCII_US);
+ OString message_dbg = OUStringToOString(
+ invalidRegistryException.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_TRACE(
+ "warning: couldn't open %s cause of %s",
+ rdb_name_tmp.getStr(), message_dbg.getStr() );
+#endif
+ }
+
+ if(!lastRegistry->isValid())
+ lastRegistry.clear();
+ }
+
+ do
+ {
+ index = csl_rdbs.indexOf((sal_Unicode)' ');
+ OUString rdb_name = (index == -1) ? csl_rdbs : csl_rdbs.copy(0, index);
+ csl_rdbs = (index == -1) ? OUString() : csl_rdbs.copy(index + 1);
+
+ if (! rdb_name.getLength())
+ continue;
+
+ bool optional = ('?' == rdb_name[ 0 ]);
+ if (optional)
+ rdb_name = rdb_name.copy( 1 );
+
+ try
+ {
+ Reference<registry::XSimpleRegistry> simpleRegistry(
+ xSimRegFac->createInstance(), UNO_QUERY_THROW );
+
+ osl::FileBase::getAbsoluteFileURL(baseDir, rdb_name, rdb_name);
+ simpleRegistry->open(rdb_name, sal_True, sal_False);
+
+ if(lastRegistry.is())
+ {
+ Reference< registry::XSimpleRegistry > nestedRegistry(
+ xNesRegFac->createInstance(), UNO_QUERY );
+ Reference< lang::XInitialization > nestedRegistry_xInit(
+ nestedRegistry, UNO_QUERY );
+
+ Sequence<Any> aArgs(2);
+ aArgs[0] <<= lastRegistry;
+ aArgs[1] <<= simpleRegistry;
+
+ nestedRegistry_xInit->initialize(aArgs);
+
+ lastRegistry = nestedRegistry;
+ }
+ else
+ lastRegistry = simpleRegistry;
+ }
+ catch(registry::InvalidRegistryException & invalidRegistryException)
+ {
+ if (! optional)
+ {
+ // if a registry was explicitly given, the exception shall fly
+ if( ! bFallenBack )
+ throw;
+ }
+
+ (void) invalidRegistryException;
+#if OSL_DEBUG_LEVEL > 1
+ OString rdb_name_tmp = OUStringToOString(
+ rdb_name, RTL_TEXTENCODING_ASCII_US );
+ OString message_dbg = OUStringToOString(
+ invalidRegistryException.Message, RTL_TEXTENCODING_ASCII_US );
+ OSL_TRACE(
+ "warning: couldn't open %s cause of %s",
+ rdb_name_tmp.getStr(), message_dbg.getStr() );
+#endif
+ }
+ }
+ while(index != -1 && csl_rdbs.getLength()); // are there more rdbs in list?
+
+ return lastRegistry;
+}
+
+Reference< XComponentContext >
+SAL_CALL defaultBootstrap_InitialComponentContext(
+ Bootstrap const & bootstrap )
+ SAL_THROW( (Exception) )
+{
+ OUString bootstrapPath( get_this_libpath() );
+ OUString iniDir;
+
+ osl_getProcessWorkingDir(&iniDir.pData);
+
+ Reference<lang::XMultiComponentFactory> smgr_XMultiComponentFactory(
+ bootstrapInitialSF(bootstrapPath) );
+ Reference<lang::XMultiServiceFactory> smgr_XMultiServiceFactory(
+ smgr_XMultiComponentFactory, UNO_QUERY );
+
+ Reference<registry::XRegistryKey> xEmptyKey;
+ Reference<lang::XSingleServiceFactory> xSimRegFac(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION), bootstrapPath,
+ OUSTR("com.sun.star.comp.stoc.SimpleRegistry"),
+ smgr_XMultiServiceFactory,
+ xEmptyKey),
+ UNO_QUERY);
+
+ Reference<lang::XSingleServiceFactory> xNesRegFac(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION), bootstrapPath,
+ OUSTR("com.sun.star.comp.stoc.NestedRegistry"),
+ smgr_XMultiServiceFactory,
+ xEmptyKey),
+ UNO_QUERY);
+
+ sal_Bool bFallenback_types;
+ OUString cls_uno_types =
+ findBoostrapArgument( bootstrap, OUSTR("TYPES"), &bFallenback_types );
+
+ Reference<registry::XSimpleRegistry> types_xRegistry =
+ nestRegistries(
+ iniDir, xSimRegFac, xNesRegFac, cls_uno_types,
+ OUString(), sal_False, bFallenback_types );
+
+ // ==== bootstrap from services registry ====
+
+ sal_Bool bFallenback_services;
+ OUString cls_uno_services = findBoostrapArgument(
+ bootstrap, OUSTR("SERVICES"), &bFallenback_services );
+
+ sal_Bool fallenBackWriteRegistry;
+ OUString write_rdb = findBoostrapArgument(
+ bootstrap, OUSTR("WRITERDB"), &fallenBackWriteRegistry );
+ if (fallenBackWriteRegistry)
+ {
+ // no standard write rdb anymore
+ write_rdb = OUString();
+ }
+
+ Reference<registry::XSimpleRegistry> services_xRegistry = nestRegistries(
+ iniDir, xSimRegFac, xNesRegFac, cls_uno_services, write_rdb,
+ !fallenBackWriteRegistry, bFallenback_services );
+
+ Reference< XComponentContext > xContext(
+ bootstrapInitialContext(
+ smgr_XMultiComponentFactory, types_xRegistry, services_xRegistry,
+ bootstrapPath, bootstrap ) );
+
+ // initialize sf
+ Reference< lang::XInitialization > xInit(
+ smgr_XMultiComponentFactory, UNO_QUERY );
+ OSL_ASSERT( xInit.is() );
+ Sequence< Any > aSFInit( 1 );
+ aSFInit[ 0 ] <<= services_xRegistry;
+ xInit->initialize( aSFInit );
+
+ return xContext;
+}
+
+}
+
+Reference< XComponentContext >
+SAL_CALL defaultBootstrap_InitialComponentContext(
+ OUString const & iniFile )
+ SAL_THROW( (Exception) )
+{
+ Bootstrap bootstrap( iniFile );
+ if (bootstrap.getHandle() == 0)
+ throw io::IOException(OUSTR("Cannot open for reading: ") + iniFile, 0);
+ return defaultBootstrap_InitialComponentContext( bootstrap );
+}
+
+Reference< XComponentContext >
+SAL_CALL defaultBootstrap_InitialComponentContext()
+ SAL_THROW( (Exception) )
+{
+ return defaultBootstrap_InitialComponentContext( get_unorc() );
+}
+
+BootstrapException::BootstrapException()
+{
+}
+
+BootstrapException::BootstrapException( const ::rtl::OUString & rMessage )
+ :m_aMessage( rMessage )
+{
+}
+
+BootstrapException::BootstrapException( const BootstrapException & e )
+{
+ m_aMessage = e.m_aMessage;
+}
+
+BootstrapException::~BootstrapException()
+{
+}
+
+BootstrapException & BootstrapException::operator=( const BootstrapException & e )
+{
+ m_aMessage = e.m_aMessage;
+ return *this;
+}
+
+const ::rtl::OUString & BootstrapException::getMessage() const
+{
+ return m_aMessage;
+}
+
+Reference< XComponentContext > SAL_CALL bootstrap()
+{
+ Reference< XComponentContext > xRemoteContext;
+
+ try
+ {
+ char const * p1 = cppuhelper_detail_findSofficePath();
+ if (p1 == NULL) {
+ throw BootstrapException(
+ OUSTR("no soffice installation found!"));
+ }
+ rtl::OUString p2;
+ if (!rtl_convertStringToUString(
+ &p2.pData, p1, strlen(p1), osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw BootstrapException(
+ OUSTR("bad characters in soffice installation path!"));
+ }
+ OUString path;
+ if (osl::FileBase::getFileURLFromSystemPath(p2, path) !=
+ osl::FileBase::E_None)
+ {
+ throw BootstrapException(
+ OUSTR("cannot convert soffice installation path to URL!"));
+ }
+ if (path.getLength() > 0 && path[path.getLength() - 1] != '/') {
+ path += OUSTR("/");
+ }
+
+ OUString uri;
+ if (!Bootstrap::get(OUSTR("URE_BOOTSTRAP"), uri)) {
+ Bootstrap::set(
+ OUSTR("URE_BOOTSTRAP"),
+ Bootstrap::encode(path + OUSTR(SAL_CONFIGFILE("fundamental"))));
+ }
+
+ // create default local component context
+ Reference< XComponentContext > xLocalContext(
+ defaultBootstrap_InitialComponentContext() );
+ if ( !xLocalContext.is() )
+ throw BootstrapException( OUSTR( "no local component context!" ) );
+
+ // create a random pipe name
+ rtlRandomPool hPool = rtl_random_createPool();
+ if ( hPool == 0 )
+ throw BootstrapException( OUSTR( "cannot create random pool!" ) );
+ sal_uInt8 bytes[ 16 ];
+ if ( rtl_random_getBytes( hPool, bytes, ARLEN( bytes ) )
+ != rtl_Random_E_None )
+ throw BootstrapException( OUSTR( "random pool error!" ) );
+ rtl_random_destroyPool( hPool );
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "uno" ) );
+ for ( sal_uInt32 i = 0; i < ARLEN( bytes ); ++i )
+ buf.append( static_cast< sal_Int32 >( bytes[ i ] ) );
+ OUString sPipeName( buf.makeStringAndClear() );
+
+ // accept string
+ OSL_ASSERT( buf.getLength() == 0 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "-accept=pipe,name=" ) );
+ buf.append( sPipeName );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ";urp;" ) );
+
+ // arguments
+ OUString args [] = {
+ OUSTR( "-nologo" ),
+ OUSTR( "-nodefault" ),
+ OUSTR( "-norestore" ),
+ OUSTR( "-nocrashreport" ),
+ OUSTR( "-nolockcheck" ),
+ buf.makeStringAndClear()
+ };
+ rtl_uString * ar_args [] = {
+ args[ 0 ].pData,
+ args[ 1 ].pData,
+ args[ 2 ].pData,
+ args[ 3 ].pData,
+ args[ 4 ].pData,
+ args[ 5 ].pData
+ };
+ ::osl::Security sec;
+
+ // start office process
+ oslProcess hProcess = 0;
+ oslProcessError rc = osl_executeProcess(
+ (path + OUSTR("soffice")).pData, ar_args, ARLEN( ar_args ),
+ osl_Process_DETACHED,
+ sec.getHandle(),
+ 0, // => current working dir
+ 0, 0, // => no env vars
+ &hProcess );
+ switch ( rc )
+ {
+ case osl_Process_E_None:
+ osl_freeProcessHandle( hProcess );
+ break;
+ case osl_Process_E_NotFound:
+ throw BootstrapException( OUSTR( "image not found!" ) );
+ case osl_Process_E_TimedOut:
+ throw BootstrapException( OUSTR( "timout occured!" ) );
+ case osl_Process_E_NoPermission:
+ throw BootstrapException( OUSTR( "permission denied!" ) );
+ case osl_Process_E_Unknown:
+ throw BootstrapException( OUSTR( "unknown error!" ) );
+ case osl_Process_E_InvalidError:
+ default:
+ throw BootstrapException( OUSTR( "unmapped error!" ) );
+ }
+
+ // create a URL resolver
+ Reference< bridge::XUnoUrlResolver > xUrlResolver(
+ bridge::UnoUrlResolver::create( xLocalContext ) );
+
+ // connection string
+ OSL_ASSERT( buf.getLength() == 0 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "uno:pipe,name=" ) );
+ buf.append( sPipeName );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
+ ";urp;StarOffice.ComponentContext" ) );
+ OUString sConnectString( buf.makeStringAndClear() );
+
+ // wait until office is started
+ for ( ; ; )
+ {
+ try
+ {
+ // try to connect to office
+ xRemoteContext.set(
+ xUrlResolver->resolve( sConnectString ), UNO_QUERY_THROW );
+ break;
+ }
+ catch ( connection::NoConnectException & )
+ {
+ // wait 500 ms, then try to connect again
+ TimeValue tv = { 0 /* secs */, 500000000 /* nanosecs */ };
+ ::osl::Thread::wait( tv );
+ }
+ }
+ }
+ catch ( Exception & e )
+ {
+ throw BootstrapException(
+ OUSTR( "unexpected UNO exception caught: " ) + e.Message );
+ }
+
+ return xRemoteContext;
+}
+
+OUString bootstrap_expandUri(OUString const & uri) {
+ static char const PREFIX[] = "vnd.sun.star.expand:";
+ return uri.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(PREFIX))
+ ? cppuhelper::detail::expandMacros(
+ rtl::Uri::decode(
+ uri.copy(RTL_CONSTASCII_LENGTH(PREFIX)),
+ rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8))
+ : uri;
+}
+
+} // namespace cppu
diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map
new file mode 100755
index 000000000000..d43ea690e11a
--- /dev/null
+++ b/cppuhelper/source/cc5_solaris_sparc.map
@@ -0,0 +1,389 @@
+UDK_3_0_0 {
+ global:
+GetVersionInfo;
+_DYNAMIC;
+_GLOBAL_OFFSET_TABLE_;
+_PROCEDURE_LINKAGE_TABLE_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2G6Mrk4_r4_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2T5B6M_v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2T6M_v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2t5B6Mrk4_v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2t5B6Mrkn0DJReference4n0DKXInterface____v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2t6Mrk4_v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelper2t6Mrkn0DJReference4n0DKXInterface____v_;
+__1cDcomDsunEstarDunoTWeakReferenceHelperDget6kM_n0DJReference4n0DKXInterface____;
+__1cEcppuJClassDataFquery6MrknDcomDsunEstarDunoEType_pn0EElangNXTypeProvider__n0FDAny__;
+__1cEcppuJClassDataIgetTypes6M_nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppuJClassDataPwriteTypeOffset6MrknDcomDsunEstarDunoEType_l_v_; #S-ILP32
+__1cEcppuJClassDataPwriteTypeOffset6MrknDcomDsunEstarDunoEType_i_v_; #S-LP64
+__1cEcppuJClassDataQinitTypeProvider6M_v_;
+__1cEcppuJClassDataTgetImplementationId6M_nDcomDsunEstarDunoISequence4CW___;
+__1cEcppuLOWeakObject2T5B6M_v_;
+__1cEcppuLOWeakObject2T6M_v_;
+__1cEcppuLOWeakObjectG__vtbl_;
+__1cEcppuLOWeakObjectHacquire6M_v_;
+__1cEcppuLOWeakObjectHrelease6M_v_;
+__1cEcppuLOWeakObjectMqueryAdapter6M_nDcomDsunEstarDunoJReference4n0FIXAdapter____;
+__1cEcppuLOWeakObjectOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuNClassDataBase2T5B6M_v_;
+__1cEcppuNClassDataBase2T6M_v_;
+__1cEcppuNClassDataBase2t5B6M_v_;
+__1cEcppuNClassDataBase2t5B6Ml_v_; #S-ILP32
+__1cEcppuNClassDataBase2t5B6Mi_v_; #S-LP64
+__1cEcppuNClassDataBase2t6M_v_;
+__1cEcppuNClassDataBase2t6Ml_v_; #S-ILP32
+__1cEcppuNClassDataBase2t6Mi_v_; #S-LP64
+__1cEcppuOOWeakAggObject2T5B6M_v_;
+__1cEcppuOOWeakAggObject2T6M_v_;
+__1cEcppuOOWeakAggObjectG__vtbl_;
+__1cEcppuOOWeakAggObjectHacquire6M_v_;
+__1cEcppuOOWeakAggObjectHrelease6M_v_;
+__1cEcppuOOWeakAggObjectMsetDelegator6MrknDcomDsunEstarDunoJReference4n0FKXInterface____v_;
+__1cEcppuOOWeakAggObjectOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuOOWeakAggObjectQqueryAggregation6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuOthrowException6FrknDcomDsunEstarDunoDAny__v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_88888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_8888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_88888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_8888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_88888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_8888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_88rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_8rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t5B6MrknDcomDsunEstarDunoEType_rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_88888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_8888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_888888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_88888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_8888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_888888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_88888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_8888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_888rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_88rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_8rkn0FISequence4n0G____v_;
+__1cEcppuPOTypeCollection2t6MrknDcomDsunEstarDunoEType_rkn0FISequence4n0G____v_;
+__1cEcppuQOComponentHelper2T5B6M_v_;
+__1cEcppuQOComponentHelper2T6M_v_;
+__1cEcppuQOComponentHelper2t5B6MrnDoslFMutex__v_;
+__1cEcppuQOComponentHelper2t6MrnDoslFMutex__v_;
+__1cEcppuQOComponentHelperG__vtbl_;
+__1cEcppuQOComponentHelperHacquire6M_v_;
+__1cEcppuQOComponentHelperHdispose6M_v_;
+__1cEcppuQOComponentHelperHrelease6M_v_;
+__1cEcppuQOComponentHelperIgetTypes6M_nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppuQOComponentHelperJdisposing6M_v_;
+__1cEcppuQOComponentHelperOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuQOComponentHelperQaddEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppuQOComponentHelperQqueryAggregation6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuQOComponentHelperTremoveEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppuROImplementationId2T5B6M_v_;
+__1cEcppuROImplementationId2T6M_v_;
+__1cEcppuROImplementationIdTgetImplementationId6kM_nDcomDsunEstarDunoISequence4CW___;
+__1cEcppuSOPropertySetHelper2T5B6M_v_;
+__1cEcppuSOPropertySetHelper2T6M_v_;
+__1cEcppuSOPropertySetHelper2t5B6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType____v_;
+__1cEcppuSOPropertySetHelper2t6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType____v_;
+__1cEcppuSOPropertySetHelperEfire6MplpknDcomDsunEstarDunoDAny_9AlC_v_; #S-ILP32
+__1cEcppuSOPropertySetHelperEfire6MpipknDcomDsunEstarDunoDAny_9AiC_v_; #S-LP64
+__1cEcppuSOPropertySetHelperG__vtbl_;
+__1cEcppuSOPropertySetHelperJdisposing6M_v_;
+__1cEcppuSOPropertySetHelperOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppuSOPropertySetHelperQgetPropertyValue6MrknDrtlIOUString__nDcomDsunEstarDunoDAny__;
+__1cEcppuSOPropertySetHelperQsetPropertyValue6MrknDrtlIOUString_rknDcomDsunEstarDunoDAny__v_;
+__1cEcppuSOPropertySetHelperRgetPropertyValues6MrknDcomDsunEstarDunoISequence4nDrtlIOUString____n0FISequence4n0FDAny____;
+__1cEcppuSOPropertySetHelperRsetPropertyValues6MrknDcomDsunEstarDunoISequence4nDrtlIOUString___rkn0FISequence4n0FDAny____v_;
+__1cEcppuSOPropertySetHelperUgetFastPropertyValue6Ml_nDcomDsunEstarDunoDAny__; #S-ILP32
+__1cEcppuSOPropertySetHelperUgetFastPropertyValue6Mi_nDcomDsunEstarDunoDAny__; #S-LP64
+__1cEcppuSOPropertySetHelperUsetFastPropertyValue6MlrknDcomDsunEstarDunoDAny__v_; #S-ILP32
+__1cEcppuSOPropertySetHelperUsetFastPropertyValue6MirknDcomDsunEstarDunoDAny__v_; #S-LP64
+__1cEcppuSOPropertySetHelperVcreatePropertySetInfo6Frn0AUIPropertyArrayHelper__nDcomDsunEstarDunoJReference4n0FFbeansQXPropertySetInfo____;
+__1cEcppuSOPropertySetHelperVsetFastPropertyValues6MlplpknDcomDsunEstarDunoDAny_l_v_; #S-ILP32
+__1cEcppuSOPropertySetHelperVsetFastPropertyValues6MipipknDcomDsunEstarDunoDAny_i_v_; #S-LP64
+__1cEcppuSOPropertySetHelperZaddPropertyChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXPropertyChangeListener____v_;
+__1cEcppuSOPropertySetHelperZaddVetoableChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXVetoableChangeListener____v_;
+__1cEcppuSOPropertySetHelperZfirePropertiesChangeEvent6MrknDcomDsunEstarDunoISequence4nDrtlIOUString___rkn0FJReference4n0EFbeansZXPropertiesChangeListener____v_;
+__1cEcppuSOPropertySetHelperbBaddPropertiesChangeListener6MrknDcomDsunEstarDunoISequence4nDrtlIOUString___rkn0FJReference4n0EFbeansZXPropertiesChangeListener____v_;
+__1cEcppuSOPropertySetHelperbCremovePropertyChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXPropertyChangeListener____v_;
+__1cEcppuSOPropertySetHelperbCremoveVetoableChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXVetoableChangeListener____v_;
+__1cEcppuSOPropertySetHelperbEremovePropertiesChangeListener6MrknDcomDsunEstarDunoJReference4n0EFbeansZXPropertiesChangeListener____v_;
+__1cEcppuScreateFactoryProxy6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rkn0EJReference4n0FVXSingleServiceFactory____9A_;
+__1cEcppuTcreateSingleFactory6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rknDrtlIOUString_pF8_n0EJReference4n0EKXInterface___rkn0EISequence4n0J___pnQ_rtl_ModuleCount__n0EJReference4n0FVXSingleServiceFactory____;
+__1cEcppuUIPropertyArrayHelper2T5B6M_v_;
+__1cEcppuUIPropertyArrayHelper2T6M_v_;
+__1cEcppuUIPropertyArrayHelperG__vtbl_;
+__1cEcppuUOPropertyArrayHelper2t5B6MpnDcomDsunEstarFbeansIProperty_lC_v_; #S-ILP32
+__1cEcppuUOPropertyArrayHelper2t5B6MpnDcomDsunEstarFbeansIProperty_iC_v_; #S-LP64
+__1cEcppuUOPropertyArrayHelper2t5B6MrknDcomDsunEstarDunoISequence4n0EFbeansIProperty___C_v_;
+__1cEcppuUOPropertyArrayHelper2t6MpnDcomDsunEstarFbeansIProperty_lC_v_; #S-ILP32
+__1cEcppuUOPropertyArrayHelper2t6MpnDcomDsunEstarFbeansIProperty_iC_v_; #S-LP64
+__1cEcppuUOPropertyArrayHelper2t6MrknDcomDsunEstarDunoISequence4n0EFbeansIProperty___C_v_;
+__1cEcppuUOPropertyArrayHelperEinit6MC_v_;
+__1cEcppuUOPropertyArrayHelperG__vtbl_;
+__1cEcppuUOPropertyArrayHelperIgetCount6kM_l_; #S-ILP32
+__1cEcppuUOPropertyArrayHelperIgetCount6kM_i_; #S-LP64
+__1cEcppuUOPropertyArrayHelperLfillHandles6MplrknDcomDsunEstarDunoISequence4nDrtlIOUString____l_; #S-ILP32
+__1cEcppuUOPropertyArrayHelperLfillHandles6MpirknDcomDsunEstarDunoISequence4nDrtlIOUString____i_; #S-LP64
+__1cEcppuUOPropertyArrayHelperNgetProperties6M_nDcomDsunEstarDunoISequence4n0EFbeansIProperty____;
+__1cEcppuUOPropertyArrayHelperPgetHandleByName6MrknDrtlIOUString__l_; #S-ILP32
+__1cEcppuUOPropertyArrayHelperPgetHandleByName6MrknDrtlIOUString__i_; #S-LP64
+__1cEcppuUOPropertyArrayHelperRgetPropertyByName6MrknDrtlIOUString__nDcomDsunEstarFbeansIProperty__;
+__1cEcppuUOPropertyArrayHelperRhasPropertyByName6MrknDrtlIOUString__C_;
+__1cEcppuUOPropertyArrayHelperbBfillPropertyMembersByHandle6MpnDrtlIOUString_phl_C_; #S-ILP32
+__1cEcppuUOPropertyArrayHelperbBfillPropertyMembersByHandle6MpnDrtlIOUString_phi_C_; #S-LP64
+__1cEcppuUcreateNestedRegistry6FrknDrtlIOUString__nDcomDsunEstarDunoJReference4n0FIregistryPXSimpleRegistry____;
+__1cEcppuUcreateSimpleRegistry6FrknDrtlIOUString__nDcomDsunEstarDunoJReference4n0FIregistryPXSimpleRegistry____;
+__1cEcppuWcreateComponentContext6Fpkn0ARContextEntry_Init_lrknDcomDsunEstarDunoJReference4n0FRXComponentContext____8_; #S-ILP32
+__1cEcppuWcreateComponentContext6Fpkn0ARContextEntry_Init_irknDcomDsunEstarDunoJReference4n0FRXComponentContext____8_; #S-LP64
+__1cEcppuWgetImplHelperInitMutex6F_rnDoslFMutex__;
+__1cEcppuYOInterfaceIteratorHelper2T5B6M_v_;
+__1cEcppuYOInterfaceIteratorHelper2T6M_v_;
+__1cEcppuYOInterfaceIteratorHelper2t5B6Mrn0AZOInterfaceContainerHelper__v_;
+__1cEcppuYOInterfaceIteratorHelper2t6Mrn0AZOInterfaceContainerHelper__v_;
+__1cEcppuYOInterfaceIteratorHelperEnext6M_pnDcomDsunEstarDunoKXInterface__;
+__1cEcppuYOInterfaceIteratorHelperGremove6M_v_;
+__1cEcppuYcreateOneInstanceFactory6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rknDrtlIOUString_pF8_n0EJReference4n0EKXInterface___rkn0EISequence4n0J___pnQ_rtl_ModuleCount__n0EJReference4n0FVXSingleServiceFactory____;
+__1cEcppuZOInterfaceContainerHelper2T5B6M_v_;
+__1cEcppuZOInterfaceContainerHelper2T6M_v_;
+__1cEcppuZOInterfaceContainerHelper2t5B6MrnDoslFMutex__v_;
+__1cEcppuZOInterfaceContainerHelper2t6MrnDoslFMutex__v_;
+__1cEcppuZOInterfaceContainerHelperFclear6M_v_;
+__1cEcppuZOInterfaceContainerHelperJgetLength6kM_l_; #S-ILP32
+__1cEcppuZOInterfaceContainerHelperJgetLength6kM_i_; #S-LP64
+__1cEcppuZOInterfaceContainerHelperLgetElements6kM_nDcomDsunEstarDunoISequence4n0FJReference4n0FKXInterface______;
+__1cEcppuZOInterfaceContainerHelperMaddInterface6MrknDcomDsunEstarDunoJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppuZOInterfaceContainerHelperMaddInterface6MrknDcomDsunEstarDunoJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppuZOInterfaceContainerHelperPdisposeAndClear6MrknDcomDsunEstarElangLEventObject__v_;
+__1cEcppuZOInterfaceContainerHelperPremoveInterface6MrknDcomDsunEstarDunoJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppuZOInterfaceContainerHelperPremoveInterface6MrknDcomDsunEstarDunoJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppuZOInterfaceContainerHelperRcopyAndResetInUse6M_v_;
+__1cEcppubBWeakComponentImplHelperBase2T5B6M_v_;
+__1cEcppubBWeakComponentImplHelperBase2T6M_v_;
+__1cEcppubBWeakComponentImplHelperBase2t5B6MrnDoslFMutex__v_;
+__1cEcppubBWeakComponentImplHelperBase2t6MrnDoslFMutex__v_;
+__1cEcppubBWeakComponentImplHelperBaseG__vtbl_;
+__1cEcppubBWeakComponentImplHelperBaseHacquire6M_v_;
+__1cEcppubBWeakComponentImplHelperBaseHdispose6M_v_;
+__1cEcppubBWeakComponentImplHelperBaseHrelease6M_v_;
+__1cEcppubBWeakComponentImplHelperBaseJdisposing6M_v_;
+__1cEcppubBWeakComponentImplHelperBaseOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppubBWeakComponentImplHelperBaseQaddEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppubBWeakComponentImplHelperBaseTremoveEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppubBcreateSingleRegistryFactory6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rknDrtlIOUString_rkn0EJReference4n0DIregistryMXRegistryKey____n0EJReference4n0FVXSingleServiceFactory____;
+__1cEcppubBwriteSharedLibComponentInfo6FrknDrtlIOUString_4rknDcomDsunEstarDunoJReference4n0FElangUXMultiServiceFactory___rkn0GJReference4n0FIregistryMXRegistryKey____v_;
+__1cEcppubCcreateRegistryServiceFactory6FrknDrtlIOUString_4C4_nDcomDsunEstarDunoJReference4n0FElangUXMultiServiceFactory____;
+__1cEcppubCcreateSingleComponentFactory6FpFrknDcomDsunEstarDunoJReference4n0ERXComponentContext____n0EJReference4n0EKXInterface___rknDrtlIOUString_rkn0EISequence4n0K___pnQ_rtl_ModuleCount__n0EJReference4n0DElangXXSingleComponentFactory____;
+__1cEcppubDinstallTypeDescriptionManager6FrknDcomDsunEstarDunoJReference4n0DJcontainerXXHierarchicalNameAccess____C_;
+__1cEcppubDloadSharedLibComponentFactory6FrknDrtlIOUString_44rknDcomDsunEstarDunoJReference4n0FElangUXMultiServiceFactory___rkn0GJReference4n0FIregistryMXRegistryKey____n0GJReference4n0GKXInterface____;
+__1cEcppubEWeakAggComponentImplHelperBase2T5B6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBase2T6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBase2t5B6MrnDoslFMutex__v_;
+__1cEcppubEWeakAggComponentImplHelperBase2t6MrnDoslFMutex__v_;
+__1cEcppubEWeakAggComponentImplHelperBaseG__vtbl_;
+__1cEcppubEWeakAggComponentImplHelperBaseHacquire6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBaseHdispose6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBaseHrelease6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBaseJdisposing6M_v_;
+__1cEcppubEWeakAggComponentImplHelperBaseOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppubEWeakAggComponentImplHelperBaseQaddEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppubEWeakAggComponentImplHelperBaseQqueryAggregation6MrknDcomDsunEstarDunoEType__n0FDAny__;
+__1cEcppubEWeakAggComponentImplHelperBaseTremoveEventListener6MrknDcomDsunEstarDunoJReference4n0EElangOXEventListener____v_;
+__1cEcppubE__RTTI__1CpnEcppuLOWeakObject__;
+__1cEcppubF__RTTI__1CpknEcppuLOWeakObject__;
+__1cEcppubFcreateStandardClassWithSequence6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rknDrtlIOUString_rkn0EJReference4n0DKreflectionJXIdlClass___rkn0EISequence4n0J____pn0L__;
+__1cEcppubGcreateOneInstanceRegistryFactory6FrknDcomDsunEstarDunoJReference4n0DElangUXMultiServiceFactory___rknDrtlIOUString_rkn0EJReference4n0DIregistryMXRegistryKey____n0EJReference4n0FVXSingleServiceFactory____;
+__1cEcppubH__RTTI__1CpnEcppuOOWeakAggObject__;
+__1cEcppubHbootstrap_InitialComponentContext6FrknDcomDsunEstarDunoJReference4n0DIregistryPXSimpleRegistry___rknDrtlIOUString__n0EJReference4n0ERXComponentContext____;
+__1cEcppubIOMultiTypeInterfaceContainerHelper2T5B6M_v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelper2T6M_v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelper2t5B6MrnDoslFMutex__v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelper2t6MrnDoslFMutex__v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelperFclear6M_v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelperMaddInterface6MrknDcomDsunEstarDunoEType_rkn0FJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppubIOMultiTypeInterfaceContainerHelperMaddInterface6MrknDcomDsunEstarDunoEType_rkn0FJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppubIOMultiTypeInterfaceContainerHelperMgetContainer6kMrknDcomDsunEstarDunoEType__pn0AZOInterfaceContainerHelper__;
+__1cEcppubIOMultiTypeInterfaceContainerHelperPdisposeAndClear6MrknDcomDsunEstarElangLEventObject__v_;
+__1cEcppubIOMultiTypeInterfaceContainerHelperPremoveInterface6MrknDcomDsunEstarDunoEType_rkn0FJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppubIOMultiTypeInterfaceContainerHelperPremoveInterface6MrknDcomDsunEstarDunoEType_rkn0FJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppubIOMultiTypeInterfaceContainerHelperRgetContainedTypes6kM_nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppubI__RTTI__1CpknEcppuOOWeakAggObject__;
+__1cEcppubJ__RTTI__1CpnEcppuQdDOComponentHelper__;
+__1cEcppubK__RTTI__1CpknEcppuQdDOComponentHelper__;
+__1cEcppubL__RTTI__1CpnEcppuSOPropertySetHelper__;
+__1cEcppubM__RTTI__1CpknEcppuSOPropertySetHelper__;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt322T5B6M_v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt322T6M_v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt322t5B6MrnDoslFMutex__v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt322t6MrnDoslFMutex__v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32Fclear6M_v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32MaddInterface6MrklrknDcomDsunEstarDunoJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32MaddInterface6MrkirknDcomDsunEstarDunoJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32MgetContainer6kMrkl_pn0AZOInterfaceContainerHelper__; #S-ILP32
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32MgetContainer6kMrki_pn0AZOInterfaceContainerHelper__; #S-LP64
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32PdisposeAndClear6MrknDcomDsunEstarElangLEventObject__v_;
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32PremoveInterface6MrklrknDcomDsunEstarDunoJReference4n0FKXInterface____l_; #S-ILP32
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32PremoveInterface6MrkirknDcomDsunEstarDunoJReference4n0FKXInterface____i_; #S-LP64
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32RgetContainedTypes6kM_nDcomDsunEstarDunoISequence4Cl___; #S-ILP32
+__1cEcppubNOMultiTypeInterfaceContainerHelperInt32RgetContainedTypes6kM_nDcomDsunEstarDunoISequence4Ci___; #S-LP64
+__1cEcppubN__RTTI__1CpnEcppuUIPropertyArrayHelper__;
+__1cEcppubN__RTTI__1CpnEcppuUOPropertyArrayHelper__;
+__1cEcppubO__RTTI__1CpknEcppuUIPropertyArrayHelper__;
+__1cEcppubO__RTTI__1CpknEcppuUOPropertyArrayHelper__;
+__1cEcppubOdefaultBootstrap_InitialComponentContext6F_nDcomDsunEstarDunoJReference4n0ERXComponentContext____;
+__1cEcppubV__RTTI__1CpnEcppubBWeakComponentImplHelperBase__;
+__1cEcppubW__RTTI__1CpknEcppubBWeakComponentImplHelperBase__;
+__1cEcppubY__RTTI__1CpnEcppubEWeakAggComponentImplHelperBase__;
+__1cEcppubZ__RTTI__1CpknEcppubEWeakAggComponentImplHelperBase__;
+_edata;
+_end;
+_etext;
+_fini;
+_init;
+__1cDcomDsunEstarDunobM__RTTI__1nDcomDsunEstarDunoJException__;
+__1cDcomDsunEstarDunobT__RTTI__1nDcomDsunEstarDunoQdDRuntimeException__;
+__1cDcomDsunEstarElangcA__RTTI__1nDcomDsunEstarElangWWrappedTargetException__;
+__1cDcomDsunEstarElangcC__RTTI__1nDcomDsunEstarElangYIllegalArgumentException__;
+__1cDcomDsunEstarFbeanscA__RTTI__1nDcomDsunEstarFbeansVPropertyVetoException__;
+__1cDcomDsunEstarFbeanscD__RTTI__1nDcomDsunEstarFbeansYUnknownPropertyException__;
+__1cDcomDsunEstarGloadercL__RTTI__1nDcomDsunEstarGloaderbECannotActivateFactoryException__;
+__1cDcomDsunEstarIregistrycG__RTTI__1nDcomDsunEstarIregistryYInvalidRegistryException__;
+__1cDcomDsunEstarIregistrycU__RTTI__1nDcomDsunEstarIregistrybLCannotRegisterImplementationException__;
+__1cEcppuZcomponent_writeInfoHelper6Fpv1pkn0ATImplementationEntry__C_;
+__1cEcppubAcomponent_getFactoryHelper6Fpkcpv3pkn0ATImplementationEntry__3_;
+__1cEcppuQImplHelper_query6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pv_n0EDAny__;
+__1cEcppuUWeakImplHelper_query6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pvpn0ALOWeakObject__n0EDAny__;
+__1cEcppubAWeakAggImplHelper_queryAgg6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pvpn0AOOWeakAggObject__n0EDAny__;
+__1cEcppubCImplHelper_queryNoXInterface6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pv_n0EDAny__;
+__1cEcppubDWeakComponentImplHelper_query6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pvpn0AbBWeakComponentImplHelperBase__n0EDAny__;
+__1cEcppubJWeakAggComponentImplHelper_queryAgg6FrknDcomDsunEstarDunoEType_pn0AKclass_data_pvpn0AbEWeakAggComponentImplHelperBase__n0EDAny__;
+__1cEcppuTImplHelper_getTypes6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppuWImplInhHelper_getTypes6Fpn0AKclass_data_rknDcomDsunEstarDunoISequence4n0FEType____7_;
+__1cEcppuXWeakImplHelper_getTypes6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppubAWeakAggImplHelper_getTypes6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppubGWeakComponentImplHelper_getTypes6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppubJWeakAggComponentImplHelper_getTypes6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4n0FEType____;
+__1cEcppubEImplHelper_getImplementationId6Fpn0AKclass_data__nDcomDsunEstarDunoISequence4CW___;
+__1cEcppubOdefaultBootstrap_InitialComponentContext6FrknDrtlIOUString__nDcomDsunEstarDunoJReference4n0GRXComponentContext____;
+
+__1cEcppuNAccessControl2t5B6MrknDcomDsunEstarDunoJReference4n0EIsecurityRXAccessController____v_;
+__1cEcppuNAccessControl2t5B6MrknDcomDsunEstarDunoJReference4n0FRXComponentContext____v_;
+__1cEcppuNAccessControl2t5B6Mrk1_v_;
+__1cEcppuNAccessControl2t6Mrk1_v_;
+__1cEcppuNAccessControl2t6MrknDcomDsunEstarDunoJReference4n0EIsecurityRXAccessController____v_;
+__1cEcppuNAccessControl2t6MrknDcomDsunEstarDunoJReference4n0FRXComponentContext____v_;
+__1cEcppuNAccessControlTcheckFilePermission6MrknDrtlIOUString_5_v_;
+__1cEcppuNAccessControlVcheckSocketPermission6MrknDrtlIOUString_5_v_;
+__1cEcppuNAccessControlWcheckRuntimePermission6MrknDrtlIOUString__v_;
+
+__1cEcppuQUnoUrlDescriptor2t5B6MrknDrtlIOUString__v_;
+__1cEcppuQUnoUrlDescriptor2t6MrknDrtlIOUString__v_;
+__1cEcppuQUnoUrlDescriptor2t5B6Mrk1_v_;
+__1cEcppuQUnoUrlDescriptor2t6Mrk1_v_;
+__1cEcppuQUnoUrlDescriptor2T5B6M_v_;
+__1cEcppuQUnoUrlDescriptor2T6M_v_;
+__1cEcppuGUnoUrl2t5B6MrknDrtlIOUString__v_;
+__1cEcppuGUnoUrl2t6MrknDrtlIOUString__v_;
+__1cEcppuGUnoUrl2t5B6Mrk1_v_;
+__1cEcppuGUnoUrl2t6Mrk1_v_;
+__1cEcppuGUnoUrl2T5B6M_v_;
+__1cEcppuGUnoUrl2T6M_v_;
+__1cEcppuQUnoUrlDescriptor2G6Mrk1_r1_;
+__1cEcppuQUnoUrlDescriptorNgetDescriptor6kM_rknDrtlIOUString__;
+__1cEcppuQUnoUrlDescriptorHgetName6kM_rknDrtlIOUString__;
+__1cEcppuQUnoUrlDescriptorMhasParameter6kMrknDrtlIOUString__b_;
+__1cEcppuQUnoUrlDescriptorMgetParameter6kMrknDrtlIOUString__3_;
+__1cEcppuGUnoUrl2G6Mrk1_r1_;
+__1cEcppuGUnoUrlNgetConnection6kM_rkn0AQUnoUrlDescriptor__;
+__1cEcppuGUnoUrlLgetProtocol6kM_rkn0AQUnoUrlDescriptor__;
+__1cEcppuGUnoUrlNgetObjectName6kM_rknDrtlIOUString__;
+
+ local:
+ *;
+};
+
+UDK_3.1 {
+ global:
+ __1cEcppuSgetCaughtException6F_nDcomDsunEstarDunoDAny__;
+
+ __1cEcppuSOPropertySetHelper2t6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___b_v_;
+ __1cEcppuSOPropertySetHelper2t5B6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___b_v_;
+
+ __1cEcppuJbootstrap6F_nDcomDsunEstarDunoJReference4n0ERXComponentContext____;
+ __1cEcppuSBootstrapException2t6M_v_;
+ __1cEcppuSBootstrapException2t5B6M_v_;
+ __1cEcppuSBootstrapException2t6MrknDrtlIOUString__v_;
+ __1cEcppuSBootstrapException2t5B6MrknDrtlIOUString__v_;
+ __1cEcppuSBootstrapException2t6Mrk1_v_;
+ __1cEcppuSBootstrapException2t5B6Mrk1_v_;
+ __1cEcppuSBootstrapException2T6M_v_;
+ __1cEcppuSBootstrapException2T5B6M_v_;
+ __1cEcppuSBootstrapException2G6Mrk1_r1_;
+ __1cEcppuSBootstrapExceptionKgetMessage6kM_rknDrtlIOUString__;
+ __1cEcppubJ__RTTI__1nEcppuSBootstrapException__;
+ __1cEcppubL__RTTI__1CpnEcppuSBootstrapException__;
+ __1cEcppubM__RTTI__1CpknEcppuSBootstrapException__;
+} UDK_3_0_0;
+
+UDK_3.2 {
+ global:
+ __1cEcppubL__RTTI__1nEcppuUPropertySetMixinImpl__;
+ __1cEcppubN__RTTI__1CpnEcppuUPropertySetMixinImpl__;
+ __1cEcppubO__RTTI__1CpknEcppuUPropertySetMixinImpl__;
+ __1cEcppuUPropertySetMixinImpl2t5B6MrknDcomDsunEstarDunoJReference4n0FRXComponentContext___n0BKImplements_rkn0FISequence4nDrtlIOUString___rkn0FEType__v_;
+ __1cEcppuUPropertySetMixinImpl2T5B6M_v_;
+ __1cEcppuUPropertySetMixinImpl2t6MrknDcomDsunEstarDunoJReference4n0FRXComponentContext___n0BKImplements_rkn0FISequence4nDrtlIOUString___rkn0FEType__v_;
+ __1cEcppuUPropertySetMixinImpl2T6M_v_;
+ __1cEcppuUPropertySetMixinImplbCremovePropertyChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXPropertyChangeListener____v_;
+ __1cEcppuUPropertySetMixinImplbCremoveVetoableChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXVetoableChangeListener____v_;
+ __1cEcppuUPropertySetMixinImplHdispose6M_v_;
+ __1cEcppuUPropertySetMixinImplKprepareSet6MrknDrtlIOUString_rknDcomDsunEstarDunoDAny_9Dpn0BOBoundListeners__v_;
+ __1cEcppuUPropertySetMixinImplOBoundListeners2T5B6M_v_;
+ __1cEcppuUPropertySetMixinImplOBoundListeners2t5B6M_v_;
+ __1cEcppuUPropertySetMixinImplOBoundListeners2T6M_v_;
+ __1cEcppuUPropertySetMixinImplOBoundListeners2t6M_v_;
+ __1cEcppuUPropertySetMixinImplOBoundListenersGnotify6kM_v_;
+ __1cEcppuUPropertySetMixinImplOqueryInterface6MrknDcomDsunEstarDunoEType__n0FDAny__;
+ __1cEcppuUPropertySetMixinImplQgetPropertyValue6MrknDrtlIOUString__nDcomDsunEstarDunoDAny__;
+ __1cEcppuUPropertySetMixinImplQsetPropertyValue6MrknDrtlIOUString_rknDcomDsunEstarDunoDAny__v_;
+ __1cEcppuUPropertySetMixinImplRgetPropertyValues6M_nDcomDsunEstarDunoISequence4n0EFbeansNPropertyValue____;
+ __1cEcppuUPropertySetMixinImplRsetPropertyValues6MrknDcomDsunEstarDunoISequence4n0EFbeansNPropertyValue____v_;
+ __1cEcppuUPropertySetMixinImplSgetPropertySetInfo6M_nDcomDsunEstarDunoJReference4n0EFbeansQXPropertySetInfo____;
+ __1cEcppuUPropertySetMixinImplUgetFastPropertyValue6Ml_nDcomDsunEstarDunoDAny__; #S-ILP32
+ __1cEcppuUPropertySetMixinImplUgetFastPropertyValue6Mi_nDcomDsunEstarDunoDAny__; #S-LP64
+ __1cEcppuUPropertySetMixinImplUsetFastPropertyValue6MlrknDcomDsunEstarDunoDAny__v_; #S-ILP32
+ __1cEcppuUPropertySetMixinImplUsetFastPropertyValue6MirknDcomDsunEstarDunoDAny__v_; #S-LP64
+ __1cEcppuUPropertySetMixinImplZaddPropertyChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXPropertyChangeListener____v_;
+ __1cEcppuUPropertySetMixinImplZaddVetoableChangeListener6MrknDrtlIOUString_rknDcomDsunEstarDunoJReference4n0GFbeansXXVetoableChangeListener____v_;
+} UDK_3.1;
+
+UDK_3.3 { # OOo 2.0.4
+ global:
+ __1cEcppubC__RTTI__1nEcppuLOWeakObject__;
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.3
+ global:
+ __1cEcppuSOPropertySetHelperIgetTypes6M_nDcomDsunEstarDunoISequence4n0FEType____;
+} UDK_3.3;
+
+UDK_3.5 { # OOo 2.4
+ global:
+ __1cEcppuTbootstrap_expandUri6FrknDrtlIOUString__2_; # rtl::OUString cppu::bootstrap_expandUri(rtl::OUString const &)
+} UDK_3.4;
+
+UDK_3.6 { # OOo 3.0
+ global:
+ __1cEcppuSOPropertySetHelper2t5B6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___pn0AWIEventNotificationHook_b_v_;
+ __1cEcppuSOPropertySetHelper2t6Mrn0ATOBroadcastHelperVar4n0AbIOMultiTypeInterfaceContainerHelper_nDcomDsunEstarDunoEType___pn0AWIEventNotificationHook_b_v_;
+} UDK_3.5;
+
+UDK_3.7 { # OOo 3.3
+ global:
+ __1cEcppuLOWeakObjectbAdisposeWeakConnectionPoint6M_v_;
+ __1cDcomDsunEstarDunoTWeakReferenceHelper2G6Mrkn0DJReference4n0DKXInterface____r4_;
+ __1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_;
+ __1cEcppubHcreateOneInstanceComponentFactory6FpFrknDcomDsunEstarDunoJReference4n0ERXComponentContext____n0EJReference4n0EKXInterface___rknDrtlIOUString_rkn0EISequence4n0K___pnQ_rtl_ModuleCount__n0EJReference4n0DElangXXSingleComponentFactory____;
+} UDK_3.6;
diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx
new file mode 100644
index 000000000000..b152a8f13f49
--- /dev/null
+++ b/cppuhelper/source/component.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <rtl/string.hxx>
+#include <osl/diagnose.h>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+using namespace osl;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+namespace cppu
+{
+
+// ----------------------------------------------------
+// class OComponentHelper
+// ----------------------------------------------------
+
+OComponentHelper::OComponentHelper( Mutex & rMutex ) SAL_THROW( () )
+ : rBHelper( rMutex )
+{
+}
+OComponentHelper::~OComponentHelper() SAL_THROW( (RuntimeException) )
+{
+}
+
+Any OComponentHelper::queryInterface( Type const & rType ) throw (RuntimeException)
+{
+ return OWeakAggObject::queryInterface( rType );
+}
+Any OComponentHelper::queryAggregation( Type const & rType ) throw (RuntimeException)
+{
+ if (rType == ::getCppuType( (Reference< lang::XComponent > const *)0 ))
+ {
+ void * p = static_cast< lang::XComponent * >( this );
+ return Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (Reference< lang::XTypeProvider > const *)0 ))
+ {
+ void * p = static_cast< lang::XTypeProvider * >( this );
+ return Any( &p, rType );
+ }
+ return OWeakAggObject::queryAggregation( rType );
+}
+void OComponentHelper::acquire() throw ()
+{
+ OWeakAggObject::acquire();
+}
+
+void OComponentHelper::release() throw()
+{
+ Reference<XInterface > x( xDelegator );
+ if (! x.is())
+ {
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ if (! rBHelper.bDisposed)
+ {
+ // *before* again incrementing our ref count, ensure that our weak connection point
+ // will not create references to us anymore (via XAdapter::queryAdapted)
+ disposeWeakConnectionPoint();
+
+ Reference<XInterface > xHoldAlive( *this );
+ // First dispose
+ try
+ {
+ dispose();
+ }
+ catch (::com::sun::star::uno::RuntimeException & exc)
+ {
+ // release should not throw exceptions
+#if OSL_DEBUG_LEVEL > 0
+ OString msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( 0, msg.getStr() );
+#else
+ (void) exc; // avoid warning about unused variable
+#endif
+ }
+
+ // only the alive ref holds the object
+ OSL_ASSERT( m_refCount == 1 );
+ // destroy the object if xHoldAlive decrement the refcount to 0
+ return;
+ }
+ }
+ // restore the reference count
+ osl_incrementInterlockedCount( &m_refCount );
+ }
+ OWeakAggObject::release();
+}
+
+Sequence< Type > OComponentHelper::getTypes() throw (RuntimeException)
+{
+ static OTypeCollection * s_pTypes = 0;
+ if (! s_pTypes)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! s_pTypes)
+ {
+ static OTypeCollection s_aTypes(
+ ::getCppuType( (const Reference< lang::XComponent > *)0 ),
+ ::getCppuType( (const Reference< lang::XTypeProvider > *)0 ),
+ ::getCppuType( (const Reference< XAggregation > *)0 ),
+ ::getCppuType( (const Reference< XWeak > *)0 ) );
+ s_pTypes = &s_aTypes;
+ }
+ }
+ return s_pTypes->getTypes();
+}
+
+// XComponent
+void OComponentHelper::disposing()
+{
+}
+
+// XComponent
+void OComponentHelper::dispose()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ // An frequently programming error is to release the last
+ // reference to this object in the disposing message.
+ // Make it rubust, hold a self Reference.
+ Reference<XComponent > xSelf( this );
+
+ // Guard dispose against multible threading
+ // Remark: It is an error to call dispose more than once
+ sal_Bool bDoDispose = sal_False;
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ if( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ // only one call go into this section
+ rBHelper.bInDispose = sal_True;
+ bDoDispose = sal_True;
+ }
+ }
+
+ // Do not hold the mutex because we are broadcasting
+ if( bDoDispose )
+ {
+ // Create an event with this as sender
+ try
+ {
+ try
+ {
+ Reference<XInterface > xSource(
+ Reference<XInterface >::query( (XComponent *)this ) );
+ EventObject aEvt;
+ aEvt.Source = xSource;
+ // inform all listeners to release this object
+ // The listener container are automaticly cleared
+ rBHelper.aLC.disposeAndClear( aEvt );
+ // notify subclasses to do their dispose
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ // bDispose and bInDisposing must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw;
+ }
+ MutexGuard aGuard( rBHelper.rMutex );
+ // bDispose and bInDisposing must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ }
+ catch (RuntimeException &)
+ {
+ throw;
+ }
+ catch (Exception & exc)
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
+ exc.Message, Reference< XInterface >() );
+ }
+ }
+ else
+ {
+ // in a multithreaded environment, it can't be avoided,
+ // that dispose is called twice.
+ // However this condition is traced, because it MAY indicate an error.
+ OSL_TRACE( "OComponentHelper::dispose() - dispose called twice" );
+ }
+}
+
+// XComponent
+void OComponentHelper::addEventListener(
+ const Reference<XEventListener > & rxListener )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ Reference< XInterface > x( (XComponent *)this, UNO_QUERY );
+ rxListener->disposing( EventObject( x ) );
+ }
+ else
+ {
+ rBHelper.addListener( ::getCppuType( &rxListener ) , rxListener );
+ }
+}
+
+// XComponent
+void OComponentHelper::removeEventListener(
+ const Reference<XEventListener > & rxListener )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ rBHelper.removeListener( ::getCppuType( &rxListener ) , rxListener );
+}
+
+}
+
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
new file mode 100644
index 000000000000..05b4f30205ef
--- /dev/null
+++ b/cppuhelper/source/component_context.cxx
@@ -0,0 +1,899 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#ifdef DIAG
+#define CONTEXT_DIAG
+#endif
+
+#if OSL_DEBUG_LEVEL > 0
+#include <stdio.h>
+#endif
+
+#include <vector>
+#include <hash_map>
+#ifdef CONTEXT_DIAG
+#include <map>
+#endif
+
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <uno/mapping.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/component_context.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+#include <hash_map>
+#include <memory>
+
+#define SMGR_SINGLETON "/singletons/com.sun.star.lang.theServiceManager"
+#define TDMGR_SINGLETON "/singletons/com.sun.star.reflection.theTypeDescriptionManager"
+#define AC_SINGLETON "/singletons/com.sun.star.security.theAccessController"
+#define AC_POLICY "/singletons/com.sun.star.security.thePolicy"
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace ::osl;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+namespace cppu
+{
+
+#ifdef CONTEXT_DIAG
+//--------------------------------------------------------------------------------------------------
+static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * pTypeRef )
+{
+ OSL_ASSERT( pVal );
+ if (pTypeRef->eTypeClass == typelib_TypeClass_VOID)
+ return OUSTR("void");
+
+ OUStringBuffer buf( 64 );
+ buf.append( (sal_Unicode)'(' );
+ buf.append( pTypeRef->pTypeName );
+ buf.append( (sal_Unicode)')' );
+
+ switch (pTypeRef->eTypeClass)
+ {
+ case typelib_TypeClass_INTERFACE:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( (sal_Int64)*(void **)pVal, 16 );
+ break;
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ {
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") );
+ typelib_TypeDescription * pTypeDescr = 0;
+ ::typelib_typedescriptionreference_getDescription( &pTypeDescr, pTypeRef );
+ OSL_ASSERT( pTypeDescr );
+ if (! pTypeDescr->bComplete)
+ ::typelib_typedescription_complete( &pTypeDescr );
+
+ typelib_CompoundTypeDescription * pCompType = (typelib_CompoundTypeDescription *)pTypeDescr;
+ sal_Int32 nDescr = pCompType->nMembers;
+
+ if (pCompType->pBaseTypeDescription)
+ {
+ buf.append( val2str( pVal, ((typelib_TypeDescription *)pCompType->pBaseTypeDescription)->pWeakRef ) );
+ if (nDescr)
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
+ }
+
+ typelib_TypeDescriptionReference ** ppTypeRefs = pCompType->ppTypeRefs;
+ sal_Int32 * pMemberOffsets = pCompType->pMemberOffsets;
+ rtl_uString ** ppMemberNames = pCompType->ppMemberNames;
+
+ for ( sal_Int32 nPos = 0; nPos < nDescr; ++nPos )
+ {
+ buf.append( ppMemberNames[ nPos ] );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" = ") );
+ typelib_TypeDescription * pMemberType = 0;
+ TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[ nPos ] );
+ buf.append( val2str( (char *)pVal + pMemberOffsets[ nPos ], pMemberType->pWeakRef ) );
+ TYPELIB_DANGER_RELEASE( pMemberType );
+ if (nPos < (nDescr -1))
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
+ }
+
+ ::typelib_typedescription_release( pTypeDescr );
+
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") );
+ break;
+ }
+ case typelib_TypeClass_SEQUENCE:
+ {
+ typelib_TypeDescription * pTypeDescr = 0;
+ TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
+
+ uno_Sequence * pSequence = *(uno_Sequence **)pVal;
+ typelib_TypeDescription * pElementTypeDescr = 0;
+ TYPELIB_DANGER_GET( &pElementTypeDescr, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType );
+
+ sal_Int32 nElementSize = pElementTypeDescr->nSize;
+ sal_Int32 nElements = pSequence->nElements;
+
+ if (nElements)
+ {
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") );
+ char * pElements = pSequence->elements;
+ for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos )
+ {
+ buf.append( val2str( pElements + (nElementSize * nPos), pElementTypeDescr->pWeakRef ) );
+ if (nPos < (nElements -1))
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
+ }
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") );
+ }
+ else
+ {
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{}") );
+ }
+ TYPELIB_DANGER_RELEASE( pElementTypeDescr );
+ TYPELIB_DANGER_RELEASE( pTypeDescr );
+ break;
+ }
+ case typelib_TypeClass_ANY:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") );
+ buf.append( val2str( ((uno_Any *)pVal)->pData,
+ ((uno_Any *)pVal)->pType ) );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") );
+ break;
+ case typelib_TypeClass_TYPE:
+ buf.append( (*(typelib_TypeDescriptionReference **)pVal)->pTypeName );
+ break;
+ case typelib_TypeClass_STRING:
+ buf.append( (sal_Unicode)'\"' );
+ buf.append( *(rtl_uString **)pVal );
+ buf.append( (sal_Unicode)'\"' );
+ break;
+ case typelib_TypeClass_ENUM:
+ {
+ typelib_TypeDescription * pTypeDescr = 0;
+ ::typelib_typedescriptionreference_getDescription( &pTypeDescr, pTypeRef );
+ OSL_ASSERT( pTypeDescr );
+ if (! pTypeDescr->bComplete)
+ ::typelib_typedescription_complete( &pTypeDescr );
+
+ sal_Int32 * pValues = ((typelib_EnumTypeDescription *)pTypeDescr)->pEnumValues;
+ sal_Int32 nPos = ((typelib_EnumTypeDescription *)pTypeDescr)->nEnumValues;
+ while (nPos--)
+ {
+ if (pValues[ nPos ] == *(sal_Int32 *)pVal)
+ break;
+ }
+ if (nPos >= 0)
+ buf.append( ((typelib_EnumTypeDescription *)pTypeDescr)->ppEnumNames[ nPos ] );
+ else
+ buf.append( (sal_Unicode)'?' );
+
+ ::typelib_typedescription_release( pTypeDescr );
+ break;
+ }
+ case typelib_TypeClass_BOOLEAN:
+ if (*(sal_Bool *)pVal)
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("true") );
+ else
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("false") );
+ break;
+ case typelib_TypeClass_CHAR:
+ buf.append( (sal_Unicode)'\'' );
+ buf.append( *(sal_Unicode *)pVal );
+ buf.append( (sal_Unicode)'\'' );
+ break;
+ case typelib_TypeClass_FLOAT:
+ buf.append( *(float *)pVal );
+ break;
+ case typelib_TypeClass_DOUBLE:
+ buf.append( *(double *)pVal );
+ break;
+ case typelib_TypeClass_BYTE:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( (sal_Int32)*(sal_Int8 *)pVal, 16 );
+ break;
+ case typelib_TypeClass_SHORT:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( (sal_Int32)*(sal_Int16 *)pVal, 16 );
+ break;
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( (sal_Int32)*(sal_uInt16 *)pVal, 16 );
+ break;
+ case typelib_TypeClass_LONG:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( *(sal_Int32 *)pVal, 16 );
+ break;
+ case typelib_TypeClass_UNSIGNED_LONG:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( (sal_Int64)*(sal_uInt32 *)pVal, 16 );
+ break;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+#if defined(GCC) && defined(SPARC)
+ {
+ sal_Int64 aVal;
+ *(sal_Int32 *)&aVal = *(sal_Int32 *)pVal;
+ *((sal_Int32 *)&aVal +1)= *((sal_Int32 *)pVal +1);
+ buf.append( aVal, 16 );
+ }
+#else
+ buf.append( *(sal_Int64 *)pVal, 16 );
+#endif
+ break;
+ default:
+ buf.append( (sal_Unicode)'?' );
+ }
+
+ return buf.makeStringAndClear();
+}
+//--------------------------------------------------------------------------------------------------
+static void dumpEntry( OUString const & key, Any const & value )
+{
+ OUString val( val2str( value.getValue(), value.getValueTypeRef() ) );
+ OString key_str( OUStringToOString( key, RTL_TEXTENCODING_ASCII_US ) );
+ OString val_str( OUStringToOString( val, RTL_TEXTENCODING_ASCII_US ) );
+ ::fprintf( stderr, "| %s = %s\n", key_str.getStr(), val_str.getStr() );
+}
+#endif
+//--------------------------------------------------------------------------------------------------
+static inline void try_dispose( Reference< XInterface > const & xInstance )
+ SAL_THROW( (RuntimeException) )
+{
+ Reference< lang::XComponent > xComp( xInstance, UNO_QUERY );
+ if (xComp.is())
+ {
+ xComp->dispose();
+ }
+}
+//--------------------------------------------------------------------------------------------------
+static inline void try_dispose( Reference< lang::XComponent > const & xComp )
+ SAL_THROW( (RuntimeException) )
+{
+ if (xComp.is())
+ {
+ xComp->dispose();
+ }
+}
+
+//==================================================================================================
+
+class DisposingForwarder
+ : public WeakImplHelper1< lang::XEventListener >
+{
+ Reference< lang::XComponent > m_xTarget;
+
+ inline DisposingForwarder( Reference< lang::XComponent > const & xTarget )
+ SAL_THROW( () )
+ : m_xTarget( xTarget )
+ { OSL_ASSERT( m_xTarget.is() ); }
+public:
+ // listens at source for disposing, then disposes target
+ static inline void listen(
+ Reference< lang::XComponent > const & xSource,
+ Reference< lang::XComponent > const & xTarget )
+ SAL_THROW( (RuntimeException) );
+
+ virtual void SAL_CALL disposing( lang::EventObject const & rSource )
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+inline void DisposingForwarder::listen(
+ Reference< lang::XComponent > const & xSource,
+ Reference< lang::XComponent > const & xTarget )
+ SAL_THROW( (RuntimeException) )
+{
+ if (xSource.is())
+ {
+ xSource->addEventListener( new DisposingForwarder( xTarget ) );
+ }
+}
+//__________________________________________________________________________________________________
+void DisposingForwarder::disposing( lang::EventObject const & )
+ throw (RuntimeException)
+{
+ m_xTarget->dispose();
+ m_xTarget.clear();
+}
+
+//==================================================================================================
+struct MutexHolder
+{
+protected:
+ Mutex m_mutex;
+};
+//==================================================================================================
+
+class ComponentContext
+ : private MutexHolder
+ , public WeakComponentImplHelper2< XComponentContext,
+ container::XNameContainer >
+{
+protected:
+ Reference< XComponentContext > m_xDelegate;
+
+ struct ContextEntry
+ {
+ Any value;
+ bool lateInit;
+
+ inline ContextEntry( Any const & value_, bool lateInit_ )
+ : value( value_ )
+ , lateInit( lateInit_ )
+ {}
+ };
+ typedef ::std::hash_map< OUString, ContextEntry * , OUStringHash > t_map;
+ t_map m_map;
+
+ Reference< lang::XMultiComponentFactory > m_xSMgr;
+
+protected:
+ Any lookupMap( OUString const & rName )
+ SAL_THROW( (RuntimeException) );
+
+ virtual void SAL_CALL disposing();
+public:
+ ComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ Reference< XComponentContext > const & xDelegate );
+ virtual ~ComponentContext()
+ SAL_THROW( () );
+
+ // XComponentContext
+ virtual Any SAL_CALL getValueByName( OUString const & rName )
+ throw (RuntimeException);
+ virtual Reference<lang::XMultiComponentFactory> SAL_CALL getServiceManager()
+ throw (RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName(
+ OUString const & name, Any const & element )
+ throw (lang::IllegalArgumentException, container::ElementExistException,
+ lang::WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removeByName( OUString const & name )
+ throw (container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException);
+ // XNameReplace
+ virtual void SAL_CALL replaceByName(
+ OUString const & name, Any const & element )
+ throw (lang::IllegalArgumentException,container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException);
+ // XNameAccess
+ virtual Any SAL_CALL getByName( OUString const & name )
+ throw (container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException);
+ virtual Sequence<OUString> SAL_CALL getElementNames()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( OUString const & name )
+ throw (RuntimeException);
+ // XElementAccess
+ virtual Type SAL_CALL getElementType() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
+};
+
+// XNameContainer
+//______________________________________________________________________________
+void ComponentContext::insertByName(
+ OUString const & name, Any const & element )
+ throw (lang::IllegalArgumentException, container::ElementExistException,
+ lang::WrappedTargetException, RuntimeException)
+{
+ t_map::mapped_type entry(
+ new ContextEntry(
+ element,
+ /* lateInit_: */
+ name.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("/singletons/") ) &&
+ !element.hasValue() ) );
+ MutexGuard guard( m_mutex );
+ ::std::pair<t_map::iterator, bool> insertion( m_map.insert(
+ t_map::value_type( name, entry ) ) );
+ if (! insertion.second)
+ throw container::ElementExistException(
+ OUSTR("element already exists: ") + name,
+ static_cast<OWeakObject *>(this) );
+}
+
+//______________________________________________________________________________
+void ComponentContext::removeByName( OUString const & name )
+ throw (container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException)
+{
+ MutexGuard guard( m_mutex );
+ t_map::iterator iFind( m_map.find( name ) );
+ if (iFind == m_map.end())
+ throw container::NoSuchElementException(
+ OUSTR("no such element: ") + name,
+ static_cast<OWeakObject *>(this) );
+
+ delete iFind->second;
+ m_map.erase(iFind);
+}
+
+// XNameReplace
+//______________________________________________________________________________
+void ComponentContext::replaceByName(
+ OUString const & name, Any const & element )
+ throw (lang::IllegalArgumentException,container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException)
+{
+ MutexGuard guard( m_mutex );
+ t_map::const_iterator const iFind( m_map.find( name ) );
+ if (iFind == m_map.end())
+ throw container::NoSuchElementException(
+ OUSTR("no such element: ") + name,
+ static_cast<OWeakObject *>(this) );
+ if (name.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("/singletons/") ) &&
+ !element.hasValue())
+ {
+ iFind->second->value.clear();
+ iFind->second->lateInit = true;
+ }
+ else
+ {
+ iFind->second->value = element;
+ iFind->second->lateInit = false;
+ }
+}
+
+// XNameAccess
+//______________________________________________________________________________
+Any ComponentContext::getByName( OUString const & name )
+ throw (container::NoSuchElementException,
+ lang::WrappedTargetException, RuntimeException)
+{
+ return getValueByName( name );
+}
+
+//______________________________________________________________________________
+Sequence<OUString> ComponentContext::getElementNames()
+ throw (RuntimeException)
+{
+ MutexGuard guard( m_mutex );
+ Sequence<OUString> ret( m_map.size() );
+ OUString * pret = ret.getArray();
+ sal_Int32 pos = 0;
+ t_map::const_iterator iPos( m_map.begin() );
+ t_map::const_iterator const iEnd( m_map.end() );
+ for ( ; iPos != iEnd; ++iPos )
+ pret[pos++] = iPos->first;
+ return ret;
+}
+
+//______________________________________________________________________________
+sal_Bool ComponentContext::hasByName( OUString const & name )
+ throw (RuntimeException)
+{
+ MutexGuard guard( m_mutex );
+ return m_map.find( name ) != m_map.end();
+}
+
+// XElementAccess
+//______________________________________________________________________________
+Type ComponentContext::getElementType() throw (RuntimeException)
+{
+ return ::getVoidCppuType();
+}
+
+//______________________________________________________________________________
+sal_Bool ComponentContext::hasElements() throw (RuntimeException)
+{
+ MutexGuard guard( m_mutex );
+ return ! m_map.empty();
+}
+
+//__________________________________________________________________________________________________
+Any ComponentContext::lookupMap( OUString const & rName )
+ SAL_THROW( (RuntimeException) )
+{
+#ifdef CONTEXT_DIAG
+ if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dump_maps") ))
+ {
+ ::fprintf( stderr, ">>> dumping out ComponentContext %p m_map:\n", this );
+ typedef ::std::map< OUString, ContextEntry * > t_sorted; // sorted map
+ t_sorted sorted;
+ for ( t_map::const_iterator iPos( m_map.begin() ); iPos != m_map.end(); ++iPos )
+ {
+ sorted[ iPos->first ] = iPos->second;
+ }
+ {
+ for ( t_sorted::const_iterator iPos( sorted.begin() ); iPos != sorted.end(); ++iPos )
+ {
+ dumpEntry( iPos->first, iPos->second->value );
+ }
+ }
+ return Any();
+ }
+#endif
+
+ ResettableMutexGuard guard( m_mutex );
+ t_map::const_iterator iFind( m_map.find( rName ) );
+ if (iFind == m_map.end())
+ return Any();
+
+ t_map::mapped_type pEntry = iFind->second;
+ if (! pEntry->lateInit)
+ return pEntry->value;
+
+ // late init singleton entry
+ Reference< XInterface > xInstance;
+ guard.clear();
+
+ try
+ {
+ Any usesService( getValueByName( rName + OUSTR("/service") ) );
+ Any args_( getValueByName( rName + OUSTR("/arguments") ) );
+ Sequence<Any> args;
+ if (args_.hasValue() && !(args_ >>= args))
+ {
+ args.realloc( 1 );
+ args[ 0 ] = args_;
+ }
+
+ Reference< lang::XSingleComponentFactory > xFac;
+ if (usesService >>= xFac) // try via factory
+ {
+ xInstance = args.getLength()
+ ? xFac->createInstanceWithArgumentsAndContext( args, this )
+ : xFac->createInstanceWithContext( this );
+ }
+ else
+ {
+ Reference< lang::XSingleServiceFactory > xFac2;
+ if (usesService >>= xFac2)
+ {
+ // try via old XSingleServiceFactory
+#if OSL_DEBUG_LEVEL > 0
+ ::fprintf(
+ stderr,
+ "### omitting context for service instanciation!\n" );
+#endif
+ xInstance = args.getLength()
+ ? xFac2->createInstanceWithArguments( args )
+ : xFac2->createInstance();
+ }
+ else if (m_xSMgr.is()) // optionally service name
+ {
+ OUString serviceName;
+ if ((usesService >>= serviceName) &&
+ serviceName.getLength())
+ {
+ xInstance = args.getLength()
+ ? m_xSMgr->createInstanceWithArgumentsAndContext(
+ serviceName, args, this )
+ : m_xSMgr->createInstanceWithContext(
+ serviceName, this );
+ }
+ }
+ }
+ }
+ catch (RuntimeException &)
+ {
+ throw;
+ }
+ catch (Exception & exc) // rethrow as WrappedTargetRuntimeException
+ {
+ Any caught( getCaughtException() );
+ OUStringBuffer buf;
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
+ "exception occured raising singleton \"") );
+ buf.append( rName );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\": ") );
+ buf.append( exc.Message );
+ throw lang::WrappedTargetRuntimeException(
+ buf.makeStringAndClear(), static_cast<OWeakObject *>(this),caught );
+ }
+
+ if (! xInstance.is())
+ {
+ throw RuntimeException(
+ OUSTR("no service object raising singleton ") + rName,
+ static_cast<OWeakObject *>(this) );
+ }
+
+ Any ret;
+ guard.reset();
+ iFind = m_map.find( rName );
+ if (iFind != m_map.end())
+ {
+ pEntry = iFind->second;
+ if (pEntry->lateInit)
+ {
+ pEntry->value <<= xInstance;
+ pEntry->lateInit = false;
+ return pEntry->value;
+ }
+ else
+ ret = pEntry->value;
+ }
+ guard.clear();
+ try_dispose( xInstance );
+ return ret;
+}
+
+//__________________________________________________________________________________________________
+Any ComponentContext::getValueByName( OUString const & rName )
+ throw (RuntimeException)
+{
+ // to determine the root context:
+ if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("_root") ))
+ {
+ if (m_xDelegate.is())
+ return m_xDelegate->getValueByName( rName );
+ else
+ return makeAny( Reference<XComponentContext>(this) );
+ }
+
+ Any ret( lookupMap( rName ) );
+ if (!ret.hasValue() && m_xDelegate.is())
+ {
+ return m_xDelegate->getValueByName( rName );
+ }
+ return ret;
+}
+//__________________________________________________________________________________________________
+Reference< lang::XMultiComponentFactory > ComponentContext::getServiceManager()
+ throw (RuntimeException)
+{
+ return m_xSMgr;
+}
+//__________________________________________________________________________________________________
+ComponentContext::~ComponentContext()
+ SAL_THROW( () )
+{
+#ifdef CONTEXT_DIAG
+ ::fprintf( stderr, "> destructed context %p\n", this );
+#endif
+ t_map::const_iterator iPos( m_map.begin() );
+ t_map::const_iterator const iEnd( m_map.end() );
+ for ( ; iPos != iEnd; ++iPos )
+ delete iPos->second;
+ m_map.clear();
+}
+//__________________________________________________________________________________________________
+void ComponentContext::disposing()
+{
+#ifdef CONTEXT_DIAG
+ ::fprintf( stderr, "> disposing context %p\n", this );
+#endif
+
+ Reference< lang::XComponent > xTDMgr, xAC, xPolicy; // to be disposed separately
+
+ // dispose all context objects
+ t_map::const_iterator iPos( m_map.begin() );
+ t_map::const_iterator const iEnd( m_map.end() );
+ for ( ; iPos != iEnd; ++iPos )
+ {
+ t_map::mapped_type pEntry = iPos->second;
+
+ // service manager disposed separately
+ if (!m_xSMgr.is() ||
+ !iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
+ {
+ if (pEntry->lateInit)
+ {
+ // late init
+ MutexGuard guard( m_mutex );
+ if (pEntry->lateInit)
+ {
+ pEntry->value.clear(); // release factory
+ pEntry->lateInit = false;
+ continue;
+ }
+ }
+
+ Reference< lang::XComponent > xComp;
+ pEntry->value >>= xComp;
+ if (xComp.is())
+ {
+ if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(TDMGR_SINGLETON) ))
+ {
+ xTDMgr = xComp;
+ }
+ else if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(AC_SINGLETON) ))
+ {
+ xAC = xComp;
+ }
+ else if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(AC_POLICY) ))
+ {
+ xPolicy = xComp;
+ }
+ else // dispose immediately
+ {
+ xComp->dispose();
+ }
+ }
+ }
+ }
+
+ // dispose service manager
+ try_dispose( m_xSMgr );
+ m_xSMgr.clear();
+ // dispose ac
+ try_dispose( xAC );
+ // dispose policy
+ try_dispose( xPolicy );
+ // dispose tdmgr; revokes callback from cppu runtime
+ try_dispose( xTDMgr );
+
+ iPos = m_map.begin();
+ for ( ; iPos != iEnd; ++iPos )
+ delete iPos->second;
+ m_map.clear();
+}
+//__________________________________________________________________________________________________
+ComponentContext::ComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ Reference< XComponentContext > const & xDelegate )
+ : WeakComponentImplHelper2< XComponentContext, container::XNameContainer >(
+ m_mutex ),
+ m_xDelegate( xDelegate )
+{
+ for ( sal_Int32 nPos = 0; nPos < nEntries; ++nPos )
+ {
+ ContextEntry_Init const & rEntry = pEntries[ nPos ];
+
+ if (rEntry.name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
+ {
+ rEntry.value >>= m_xSMgr;
+ }
+
+ if (rEntry.bLateInitService)
+ {
+ // singleton entry
+ m_map[ rEntry.name ] = new ContextEntry( Any(), true );
+ // /service
+ m_map[ rEntry.name + OUSTR("/service") ] = new ContextEntry( rEntry.value, false );
+ // /initial-arguments are provided as optional context entry
+ }
+ else
+ {
+ // only value, no late init factory nor string
+ m_map[ rEntry.name ] = new ContextEntry( rEntry.value, false );
+ }
+ }
+
+ if (!m_xSMgr.is() && m_xDelegate.is())
+ {
+ // wrap delegate's smgr XPropertySet into new smgr
+ Reference< lang::XMultiComponentFactory > xMgr( m_xDelegate->getServiceManager() );
+ if (xMgr.is())
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ // create new smgr based on delegate's one
+ m_xSMgr.set(
+ xMgr->createInstanceWithContext(
+ OUSTR("com.sun.star.comp.stoc.OServiceManagerWrapper"), xDelegate ),
+ UNO_QUERY );
+ // patch DefaultContext property of new one
+ Reference< beans::XPropertySet > xProps( m_xSMgr, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ if (xProps.is())
+ {
+ Reference< XComponentContext > xThis( this );
+ xProps->setPropertyValue( OUSTR("DefaultContext"), makeAny( xThis ) );
+ }
+ }
+ catch (...)
+ {
+ osl_decrementInterlockedCount( &m_refCount );
+ throw;
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ OSL_ASSERT( m_xSMgr.is() );
+ }
+ }
+}
+
+
+//##################################################################################################
+extern "C" { static void s_createComponentContext_v(va_list * pParam)
+{
+ ContextEntry_Init const * pEntries = va_arg(*pParam, ContextEntry_Init const *);
+ sal_Int32 nEntries = va_arg(*pParam, sal_Int32);
+ XComponentContext * pDelegatee = va_arg(*pParam, XComponentContext *);
+ void ** ppContext = va_arg(*pParam, void **);
+ uno::Mapping * pTarget2curr = va_arg(*pParam, uno::Mapping *);
+
+ Reference<XComponentContext> xDelegate(pDelegatee, SAL_NO_ACQUIRE);
+ Reference<XComponentContext> xContext;
+
+ if (nEntries > 0)
+ {
+ try
+ {
+ ComponentContext * p = new ComponentContext( pEntries, nEntries, xDelegate );
+ xContext.set(p);
+ // listen delegate for disposing, to dispose this (wrapping) context first.
+ DisposingForwarder::listen( Reference< lang::XComponent >::query( xDelegate ), p );
+ }
+ catch (Exception & exc)
+ {
+ (void) exc; // avoid warning about unused variable
+ OSL_ENSURE( 0, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ xContext.clear();
+ }
+ }
+ else
+ {
+ xContext = xDelegate;
+ }
+
+ delete[] pEntries;
+
+ *ppContext = pTarget2curr->mapInterface(xContext.get(), ::getCppuType(&xContext));
+}}
+
+Reference< XComponentContext > SAL_CALL createComponentContext(
+ ContextEntry_Init const * pEntries, sal_Int32 nEntries,
+ Reference< XComponentContext > const & xDelegate )
+ SAL_THROW( () )
+{
+ uno::Environment curr_env(Environment::getCurrent());
+ uno::Environment source_env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))));
+
+ uno::Mapping curr2source(curr_env, source_env);
+ uno::Mapping source2curr(source_env, curr_env);
+
+ ContextEntry_Init * mapped_entries = new ContextEntry_Init[nEntries];
+ for (sal_Int32 nPos = 0; nPos < nEntries; ++ nPos)
+ {
+ mapped_entries[nPos].bLateInitService = pEntries[nPos].bLateInitService;
+ mapped_entries[nPos].name = pEntries[nPos].name;
+
+ uno_type_any_constructAndConvert(&mapped_entries[nPos].value,
+ const_cast<void *>(pEntries[nPos].value.getValue()),
+ pEntries[nPos].value.getValueTypeRef(),
+ curr2source.get());
+ }
+
+ void * mapped_delegate = curr2source.mapInterface(xDelegate.get(), ::getCppuType(&xDelegate));
+ XComponentContext * pXComponentContext = NULL;
+ source_env.invoke(s_createComponentContext_v, mapped_entries, nEntries, mapped_delegate, &pXComponentContext, &source2curr);
+
+ return Reference<XComponentContext>(pXComponentContext, SAL_NO_ACQUIRE);
+}
+
+}
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
new file mode 100644
index 000000000000..c23873bda831
--- /dev/null
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include "osl/diagnose.h"
+#include "osl/doublecheckedlocking.h"
+#include "osl/mutex.hxx"
+#include "uno/dispatcher.hxx"
+#include "uno/mapping.hxx"
+#include "cppuhelper/detail/XExceptionThrower.hpp"
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+#include "cppuhelper/exc_hlp.hxx"
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace
+{
+
+using cppuhelper::detail::XExceptionThrower;
+
+//==============================================================================
+struct ExceptionThrower : public uno_Interface, XExceptionThrower
+{
+ inline ExceptionThrower();
+
+public:
+ static ExceptionThrower * get();
+ static inline Type const & getCppuType()
+ {
+ return ::getCppuType(
+ reinterpret_cast< Reference< XExceptionThrower > const * >(0) );
+ }
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( Type const & type )
+ throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XExceptionThrower
+ virtual void SAL_CALL throwException( Any const & exc ) throw (Exception);
+ virtual void SAL_CALL rethrowException() throw (Exception);
+};
+
+extern "C"
+{
+
+//------------------------------------------------------------------------------
+static void SAL_CALL ExceptionThrower_acquire_release_nop( uno_Interface * )
+{
+}
+
+//------------------------------------------------------------------------------
+static void SAL_CALL ExceptionThrower_dispatch(
+ uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType,
+ void * pReturn, void * pArgs [], uno_Any ** ppException )
+{
+ OSL_ASSERT( pMemberType->eTypeClass == typelib_TypeClass_INTERFACE_METHOD );
+
+ switch (reinterpret_cast< typelib_InterfaceMemberTypeDescription * >(
+ const_cast< typelib_TypeDescription * >( pMemberType ) )->
+ nPosition)
+ {
+ case 0: // queryInterace()
+ {
+ Type const & rType_demanded =
+ *reinterpret_cast< Type const * >( pArgs[ 0 ] );
+ if (rType_demanded.equals(
+ ::getCppuType( reinterpret_cast<
+ Reference< XInterface > const * >(0) ) ) ||
+ rType_demanded.equals( ExceptionThrower::getCppuType() ))
+ {
+ typelib_TypeDescription * pTD = 0;
+ TYPELIB_DANGER_GET( &pTD, rType_demanded.getTypeLibType() );
+ uno_any_construct(
+ reinterpret_cast< uno_Any * >( pReturn ), &pUnoI, pTD, 0 );
+ TYPELIB_DANGER_RELEASE( pTD );
+ }
+ else
+ {
+ uno_any_construct(
+ reinterpret_cast< uno_Any * >( pReturn ), 0, 0, 0 );
+ }
+ *ppException = 0;
+ break;
+ }
+ case 1: // acquire()
+ case 2: // release()
+ *ppException = 0;
+ break;
+ case 3: // throwException()
+ {
+ uno_Any * pAny = reinterpret_cast< uno_Any * >( pArgs[ 0 ] );
+ OSL_ASSERT( pAny->pType->eTypeClass == typelib_TypeClass_EXCEPTION );
+ uno_type_any_construct( *ppException, pAny->pData, pAny->pType, 0 );
+ break;
+ }
+ default:
+ {
+ OSL_ASSERT( 0 );
+ RuntimeException exc(
+ OUSTR("not implemented!"), Reference< XInterface >() );
+ uno_type_any_construct(
+ *ppException, &exc, ::getCppuType( &exc ).getTypeLibType(), 0 );
+ break;
+ }
+ }
+}
+
+} // extern "C"
+
+//______________________________________________________________________________
+Any ExceptionThrower::queryInterface( Type const & type )
+ throw (RuntimeException)
+{
+ if (type.equals( ::getCppuType( reinterpret_cast<
+ Reference< XInterface > const * >(0) ) ) ||
+ type.equals( ExceptionThrower::getCppuType() ))
+ {
+ XExceptionThrower * that = static_cast< XExceptionThrower * >( this );
+ return Any( &that, type );
+ }
+ return Any();
+}
+
+//______________________________________________________________________________
+void ExceptionThrower::acquire() throw ()
+{
+}
+//______________________________________________________________________________
+void ExceptionThrower::release() throw ()
+{
+}
+
+//______________________________________________________________________________
+void ExceptionThrower::throwException( Any const & exc ) throw (Exception)
+{
+ OSL_ENSURE( 0, "unexpected!" );
+ throwException( exc );
+}
+
+//______________________________________________________________________________
+void ExceptionThrower::rethrowException() throw (Exception)
+{
+ throw;
+}
+
+//______________________________________________________________________________
+inline ExceptionThrower::ExceptionThrower()
+{
+ uno_Interface::acquire = ExceptionThrower_acquire_release_nop;
+ uno_Interface::release = ExceptionThrower_acquire_release_nop;
+ uno_Interface::pDispatcher = ExceptionThrower_dispatch;
+}
+
+//______________________________________________________________________________
+ExceptionThrower * ExceptionThrower::get()
+{
+ ExceptionThrower * s_pThrower = 0;
+ if (s_pThrower == 0)
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ static ExceptionThrower s_thrower;
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ s_pThrower = &s_thrower;
+ }
+ else
+ {
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
+ }
+ return s_pThrower;
+}
+
+} // anonymous namespace
+
+
+namespace cppu
+{
+
+//==============================================================================
+void SAL_CALL throwException( Any const & exc ) SAL_THROW( (Exception) )
+{
+ if (exc.getValueTypeClass() != TypeClass_EXCEPTION)
+ {
+ throw RuntimeException(
+ OUSTR("no UNO exception given "
+ "(must be derived from com::sun::star::uno::Exception)!"),
+ Reference< XInterface >() );
+ }
+
+ Mapping uno2cpp(Environment(OUSTR(UNO_LB_UNO)), Environment::getCurrent());
+ if (! uno2cpp.is())
+ {
+ throw RuntimeException(
+ OUSTR("cannot get binary UNO to C++ mapping!"),
+ Reference< XInterface >() );
+ }
+
+ Reference< XExceptionThrower > xThrower;
+ uno2cpp.mapInterface(
+ reinterpret_cast< void ** >( &xThrower ),
+ static_cast< uno_Interface * >( ExceptionThrower::get() ),
+ ExceptionThrower::getCppuType() );
+ OSL_ASSERT( xThrower.is() );
+ xThrower->throwException( exc );
+}
+
+//==============================================================================
+Any SAL_CALL getCaughtException()
+{
+ Mapping cpp2uno(Environment::getCurrent(), Environment(OUSTR(UNO_LB_UNO)));
+ if (! cpp2uno.is())
+ {
+ throw RuntimeException(
+ OUSTR("cannot get C++ to binary UNO mapping!"),
+ Reference< XInterface >() );
+ }
+ Mapping uno2cpp(Environment(OUSTR(UNO_LB_UNO)), Environment::getCurrent());
+ if (! uno2cpp.is())
+ {
+ throw RuntimeException(
+ OUSTR("cannot get binary UNO to C++ mapping!"),
+ Reference< XInterface >() );
+ }
+
+ typelib_TypeDescription * pTD = 0;
+ TYPELIB_DANGER_GET(
+ &pTD, ExceptionThrower::getCppuType().getTypeLibType() );
+
+ UnoInterfaceReference unoI;
+ cpp2uno.mapInterface(
+ reinterpret_cast< void ** >( &unoI.m_pUnoI ),
+ static_cast< XExceptionThrower * >( ExceptionThrower::get() ), pTD );
+ OSL_ASSERT( unoI.is() );
+
+ typelib_TypeDescription * pMemberTD = 0;
+ TYPELIB_DANGER_GET(
+ &pMemberTD,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >( pTD )->
+ ppMembers[ 1 ] /* rethrowException() */ );
+
+ uno_Any exc_mem;
+ uno_Any * exc = &exc_mem;
+ unoI.dispatch( pMemberTD, 0, 0, &exc );
+
+ TYPELIB_DANGER_RELEASE( pMemberTD );
+ TYPELIB_DANGER_RELEASE( pTD );
+
+ if (exc == 0)
+ {
+ throw RuntimeException(
+ OUSTR("rethrowing C++ exception failed!"),
+ Reference< XInterface >() );
+ }
+
+ Any ret;
+ uno_any_destruct( &ret, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
+ uno_type_any_constructAndConvert(
+ &ret, exc->pData, exc->pType, uno2cpp.get() );
+ uno_any_destruct( exc, 0 );
+ return ret;
+}
+
+}
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
new file mode 100644
index 000000000000..96faf2272231
--- /dev/null
+++ b/cppuhelper/source/factory.cxx
@@ -0,0 +1,1140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/factory.hxx>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX
+#include <cppuhelper/implbase3.hxx>
+#endif
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/unload.h>
+
+#include "cppuhelper/propshlp.hxx"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XUnloadingPreference.hpp>
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+
+#include <memory>
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace osl;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::loader;
+using namespace com::sun::star::registry;
+
+namespace cppu
+{
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class OSingleFactoryHelper
+ : public XServiceInfo
+ , public XSingleServiceFactory
+ , public lang::XSingleComponentFactory
+ , public XUnloadingPreference
+{
+public:
+ OSingleFactoryHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ ComponentInstantiation pCreateFunction_,
+ ComponentFactoryFunc fptr,
+ const Sequence< OUString > * pServiceNames_ )
+ SAL_THROW( () )
+ : xSMgr( rServiceManager )
+ , pCreateFunction( pCreateFunction_ )
+ , m_fptr( fptr )
+ , aImplementationName( rImplementationName_ )
+ {
+ if( pServiceNames_ )
+ aServiceNames = *pServiceNames_;
+ }
+
+ // old function, only for backward compatibility
+ OSingleFactoryHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_ )
+ SAL_THROW( () )
+ : xSMgr( rServiceManager )
+ , pCreateFunction( NULL )
+ , m_fptr( 0 )
+ , aImplementationName( rImplementationName_ )
+ {}
+
+ virtual ~OSingleFactoryHelper();
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XSingleServiceFactory
+ Reference<XInterface > SAL_CALL createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual Reference<XInterface > SAL_CALL createInstanceWithArguments(const Sequence<Any>& Arguments)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XSingleComponentFactory
+ virtual Reference< XInterface > SAL_CALL createInstanceWithContext(
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException);
+ virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw(::com::sun::star::uno::RuntimeException);
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ /**
+ * Create an instance specified by the factory. The one instance logic is implemented
+ * in the createInstance and createInstanceWithArguments methods.
+ * @return the newly created instance. Do not return a previous (one instance) instance.
+ */
+ virtual Reference<XInterface > createInstanceEveryTime(
+ Reference< XComponentContext > const & xContext )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ Reference<XMultiServiceFactory > xSMgr;
+ ComponentInstantiation pCreateFunction;
+ ComponentFactoryFunc m_fptr;
+ Sequence< OUString > aServiceNames;
+ OUString aImplementationName;
+};
+OSingleFactoryHelper::~OSingleFactoryHelper()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+Any OSingleFactoryHelper::queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType,
+ static_cast< XSingleComponentFactory * >( this ),
+ static_cast< XSingleServiceFactory * >( this ),
+ static_cast< XServiceInfo * >( this ) ,
+ static_cast< XUnloadingPreference * >( this ));
+}
+
+// OSingleFactoryHelper
+Reference<XInterface > OSingleFactoryHelper::createInstanceEveryTime(
+ Reference< XComponentContext > const & xContext )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if (m_fptr)
+ {
+ return (*m_fptr)( xContext );
+ }
+ else if( pCreateFunction )
+ {
+ if (xContext.is())
+ {
+ Reference< lang::XMultiServiceFactory > xContextMgr(
+ xContext->getServiceManager(), UNO_QUERY );
+ if (xContextMgr.is())
+ return (*pCreateFunction)( xContextMgr );
+ }
+ return (*pCreateFunction)( xSMgr );
+ }
+ else
+ {
+ return Reference< XInterface >();
+ }
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OSingleFactoryHelper::createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return createInstanceWithContext( Reference< XComponentContext >() );
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OSingleFactoryHelper::createInstanceWithArguments(
+ const Sequence<Any>& Arguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return createInstanceWithArgumentsAndContext(
+ Arguments, Reference< XComponentContext >() );
+}
+
+// XSingleComponentFactory
+//__________________________________________________________________________________________________
+Reference< XInterface > OSingleFactoryHelper::createInstanceWithContext(
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException)
+{
+ return createInstanceEveryTime( xContext );
+}
+//__________________________________________________________________________________________________
+Reference< XInterface > OSingleFactoryHelper::createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException)
+{
+ Reference< XInterface > xRet( createInstanceWithContext( xContext ) );
+
+ Reference< lang::XInitialization > xInit( xRet, UNO_QUERY );
+ // always call initialize, even if there are no arguments.
+ // #i63511# / 2006-03-27 / frank.schoenheit@sun.com
+ if (xInit.is())
+ {
+ xInit->initialize( rArguments );
+ }
+ else
+ {
+ if ( rArguments.getLength() )
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("cannot pass arguments to component => no XInitialization implemented!") ),
+ Reference< XInterface >(), 0 );
+ }
+
+ return xRet;
+}
+
+// XServiceInfo
+OUString OSingleFactoryHelper::getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return aImplementationName;
+}
+
+// XServiceInfo
+sal_Bool OSingleFactoryHelper::supportsService(
+ const OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Sequence< OUString > seqServices = getSupportedServiceNames();
+ const OUString * pServices = seqServices.getConstArray();
+ for( sal_Int32 i = 0; i < seqServices.getLength(); i++ )
+ if( pServices[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+// XServiceInfo
+Sequence< OUString > OSingleFactoryHelper::getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return aServiceNames;
+}
+
+
+//----------------------------------------------------------------------
+//----------------------------------------------------------------------
+//----------------------------------------------------------------------
+struct OFactoryComponentHelper_Mutex
+{
+ Mutex aMutex;
+};
+
+class OFactoryComponentHelper
+ : public OFactoryComponentHelper_Mutex
+ , public OComponentHelper
+ , public OSingleFactoryHelper
+{
+public:
+ OFactoryComponentHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ ComponentInstantiation pCreateFunction_,
+ ComponentFactoryFunc fptr,
+ const Sequence< OUString > * pServiceNames_,
+ sal_Bool bOneInstance_ = sal_False )
+ SAL_THROW( () )
+ : OComponentHelper( aMutex )
+ , OSingleFactoryHelper( rServiceManager, rImplementationName_, pCreateFunction_, fptr, pServiceNames_ )
+ , bOneInstance( bOneInstance_ )
+ , pModuleCount(0)
+ {
+ }
+
+ // Used by the createXXXFactory functions. The argument pModCount is used to prevent the unloading of the module
+ // which contains pCreateFunction_
+ OFactoryComponentHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ ComponentInstantiation pCreateFunction_,
+ ComponentFactoryFunc fptr,
+ const Sequence< OUString > * pServiceNames_,
+ rtl_ModuleCount * pModCount,
+ sal_Bool bOneInstance_ = sal_False )
+ SAL_THROW( () )
+ : OComponentHelper( aMutex )
+ , OSingleFactoryHelper( rServiceManager, rImplementationName_, pCreateFunction_, fptr, pServiceNames_ )
+ , bOneInstance( bOneInstance_ )
+ , pModuleCount(pModCount)
+ {
+ if(pModuleCount)
+ pModuleCount->acquire( pModuleCount);
+ }
+
+ // old function, only for backward compatibility
+ OFactoryComponentHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ sal_Bool bOneInstance_ = sal_False )
+ SAL_THROW( () )
+ : OComponentHelper( aMutex )
+ , OSingleFactoryHelper( rServiceManager, rImplementationName_ )
+ , bOneInstance( bOneInstance_ )
+ , pModuleCount(0)
+ {
+ }
+
+ ~OFactoryComponentHelper()
+ {
+ if(pModuleCount)
+ pModuleCount->release( pModuleCount);
+ }
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw()
+ { OComponentHelper::acquire(); }
+ void SAL_CALL release() throw()
+ { OComponentHelper::release(); }
+
+ // XSingleServiceFactory
+ Reference<XInterface > SAL_CALL createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ Reference<XInterface > SAL_CALL createInstanceWithArguments( const Sequence<Any>& Arguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XSingleComponentFactory
+ virtual Reference< XInterface > SAL_CALL createInstanceWithContext(
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException);
+ virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException);
+
+ // XTypeProvider
+ virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XAggregation
+ Any SAL_CALL queryAggregation( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnloadingPreference
+ virtual sal_Bool SAL_CALL releaseOnNotification()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ Reference<XInterface > xTheInstance;
+ sal_Bool bOneInstance;
+ rtl_ModuleCount * pModuleCount;
+protected:
+ // needed for implementing XUnloadingPreference in inheriting classes
+ sal_Bool isOneInstance() {return bOneInstance;}
+ sal_Bool isInstance() {return xTheInstance.is();}
+};
+
+
+Any SAL_CALL OFactoryComponentHelper::queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rType == ::getCppuType( (Reference<XUnloadingPreference>*)0))
+ {
+ return makeAny(
+ Reference< XUnloadingPreference >(
+ static_cast< XUnloadingPreference * >(this) ) );
+ }
+ return OComponentHelper::queryInterface( rType );
+}
+
+// XAggregation
+Any OFactoryComponentHelper::queryAggregation( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Any aRet( OComponentHelper::queryAggregation( rType ) );
+ return (aRet.hasValue() ? aRet : OSingleFactoryHelper::queryInterface( rType ));
+}
+
+// XTypeProvider
+Sequence< Type > OFactoryComponentHelper::getTypes()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Type ar[ 4 ];
+ ar[ 0 ] = ::getCppuType( (const Reference< XSingleServiceFactory > *)0 );
+ ar[ 1 ] = ::getCppuType( (const Reference< XServiceInfo > *)0 );
+ ar[ 2 ] = ::getCppuType( (const Reference< XUnloadingPreference > *)0 );
+
+ if (m_fptr)
+ ar[ 3 ] = ::getCppuType( (const Reference< XSingleComponentFactory > *)0 );
+
+ return Sequence< Type >( ar, m_fptr ? 4 : 3 );
+}
+
+Sequence< sal_Int8 > OFactoryComponentHelper::getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ static OImplementationId * pId = 0;
+ if (! pId)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OFactoryComponentHelper::createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( bOneInstance )
+ {
+ if( !xTheInstance.is() )
+ {
+ MutexGuard aGuard( aMutex );
+ if( !xTheInstance.is() )
+ xTheInstance = OSingleFactoryHelper::createInstance();
+ }
+ return xTheInstance;
+ }
+ return OSingleFactoryHelper::createInstance();
+}
+
+Reference<XInterface > OFactoryComponentHelper::createInstanceWithArguments(
+ const Sequence<Any>& Arguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( bOneInstance )
+ {
+ if( !xTheInstance.is() )
+ {
+ MutexGuard aGuard( aMutex );
+// OSL_ENSURE( !xTheInstance.is(), "### arguments will be ignored!" );
+ if( !xTheInstance.is() )
+ xTheInstance = OSingleFactoryHelper::createInstanceWithArguments( Arguments );
+ }
+ return xTheInstance;
+ }
+ return OSingleFactoryHelper::createInstanceWithArguments( Arguments );
+}
+
+// XSingleComponentFactory
+//__________________________________________________________________________________________________
+Reference< XInterface > OFactoryComponentHelper::createInstanceWithContext(
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException)
+{
+ if( bOneInstance )
+ {
+ if( !xTheInstance.is() )
+ {
+ MutexGuard aGuard( aMutex );
+// OSL_ENSURE( !xTheInstance.is(), "### context will be ignored!" );
+ if( !xTheInstance.is() )
+ xTheInstance = OSingleFactoryHelper::createInstanceWithContext( xContext );
+ }
+ return xTheInstance;
+ }
+ return OSingleFactoryHelper::createInstanceWithContext( xContext );
+}
+//__________________________________________________________________________________________________
+Reference< XInterface > OFactoryComponentHelper::createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException)
+{
+ if( bOneInstance )
+ {
+ if( !xTheInstance.is() )
+ {
+ MutexGuard aGuard( aMutex );
+// OSL_ENSURE( !xTheInstance.is(), "### context and arguments will be ignored!" );
+ if( !xTheInstance.is() )
+ xTheInstance = OSingleFactoryHelper::createInstanceWithArgumentsAndContext( rArguments, xContext );
+ }
+ return xTheInstance;
+ }
+ return OSingleFactoryHelper::createInstanceWithArgumentsAndContext( rArguments, xContext );
+}
+
+
+// OComponentHelper
+void OFactoryComponentHelper::dispose()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ OComponentHelper::dispose();
+
+ Reference<XInterface > x;
+ {
+ // do not delete in the guard section
+ MutexGuard aGuard( aMutex );
+ x = xTheInstance;
+ xTheInstance = Reference<XInterface >();
+ }
+ // if it is a component call dispose at the component
+ Reference<XComponent > xComp( x, UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+}
+
+// XUnloadingPreference
+// This class is used for single factories, component factories and
+// one-instance factories. Depending on the usage this function has
+// to return different values.
+// one-instance factory: sal_False
+// single factory: sal_True
+// component factory: sal_True
+sal_Bool SAL_CALL OFactoryComponentHelper::releaseOnNotification() throw(::com::sun::star::uno::RuntimeException)
+{
+ if( bOneInstance)
+ return sal_False;
+ return sal_True;
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class ORegistryFactoryHelper : public OFactoryComponentHelper,
+ public OPropertySetHelper
+
+{
+public:
+ ORegistryFactoryHelper(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ const Reference<XRegistryKey > & xImplementationKey_,
+ sal_Bool bOneInstance_ = sal_False ) SAL_THROW( () )
+ : OFactoryComponentHelper(
+ rServiceManager, rImplementationName_, 0, 0, 0, bOneInstance_ ),
+ OPropertySetHelper( OComponentHelper::rBHelper ),
+ xImplementationKey( xImplementationKey_ )
+ {}
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( Type const & type )
+ throw (RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ // XTypeProvider
+ virtual Sequence< Type > SAL_CALL getTypes()
+ throw (RuntimeException);
+ // XPropertySet
+ virtual Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw (RuntimeException);
+
+ // OPropertySetHelper
+ virtual IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ Any & rConvertedValue, Any & rOldValue,
+ sal_Int32 nHandle, Any const & rValue )
+ throw (lang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, Any const & rValue )
+ throw (Exception);
+ using OPropertySetHelper::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue(
+ Any & rValue, sal_Int32 nHandle ) const;
+
+ // OSingleFactoryHelper
+ Reference<XInterface > createInstanceEveryTime(
+ Reference< XComponentContext > const & xContext )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XSingleServiceFactory
+ Reference<XInterface > SAL_CALL createInstanceWithArguments(const Sequence<Any>& Arguments)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XSingleComponentFactory
+ Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException);
+
+ // XServiceInfo
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException);
+ // XUnloadingPreference
+ sal_Bool SAL_CALL releaseOnNotification()
+ throw( RuntimeException);
+
+
+private:
+ Reference< XInterface > createModuleFactory()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ /** The registry key of the implementation section */
+ Reference<XRegistryKey > xImplementationKey;
+ /** The factory created with the loader. */
+ Reference<XSingleComponentFactory > xModuleFactory;
+ Reference<XSingleServiceFactory > xModuleFactoryDepr;
+ Reference< beans::XPropertySetInfo > m_xInfo;
+ ::std::auto_ptr< IPropertyArrayHelper > m_property_array_helper;
+protected:
+ using OPropertySetHelper::getTypes;
+};
+
+// XInterface
+//______________________________________________________________________________
+Any SAL_CALL ORegistryFactoryHelper::queryInterface(
+ Type const & type ) throw (RuntimeException)
+{
+ Any ret( OFactoryComponentHelper::queryInterface( type ) );
+ if (ret.hasValue())
+ return ret;
+ else
+ return OPropertySetHelper::queryInterface( type );
+}
+
+//______________________________________________________________________________
+void ORegistryFactoryHelper::acquire() throw ()
+{
+ OFactoryComponentHelper::acquire();
+}
+
+//______________________________________________________________________________
+void ORegistryFactoryHelper::release() throw ()
+{
+ OFactoryComponentHelper::release();
+}
+
+// XTypeProvider
+//______________________________________________________________________________
+Sequence< Type > ORegistryFactoryHelper::getTypes() throw (RuntimeException)
+{
+ Sequence< Type > types( OFactoryComponentHelper::getTypes() );
+ sal_Int32 pos = types.getLength();
+ types.realloc( pos + 3 );
+ Type * p = types.getArray();
+ p[ pos++ ] = ::getCppuType(
+ reinterpret_cast< Reference< beans::XMultiPropertySet > const * >(0) );
+ p[ pos++ ] = ::getCppuType(
+ reinterpret_cast< Reference< beans::XFastPropertySet > const * >(0) );
+ p[ pos++ ] = ::getCppuType(
+ reinterpret_cast< Reference< beans::XPropertySet > const * >(0) );
+ return types;
+}
+
+// XPropertySet
+//______________________________________________________________________________
+Reference< beans::XPropertySetInfo >
+ORegistryFactoryHelper::getPropertySetInfo() throw (RuntimeException)
+{
+ ::osl::MutexGuard guard( aMutex );
+ if (! m_xInfo.is())
+ m_xInfo = createPropertySetInfo( getInfoHelper() );
+ return m_xInfo;
+}
+
+// OPropertySetHelper
+//______________________________________________________________________________
+IPropertyArrayHelper & ORegistryFactoryHelper::getInfoHelper()
+{
+ ::osl::MutexGuard guard( aMutex );
+ if (m_property_array_helper.get() == 0)
+ {
+ beans::Property prop(
+ OUSTR("ImplementationKey") /* name */,
+ 0 /* handle */,
+ ::getCppuType( &xImplementationKey ),
+ beans::PropertyAttribute::READONLY |
+ beans::PropertyAttribute::OPTIONAL );
+ m_property_array_helper.reset(
+ new ::cppu::OPropertyArrayHelper( &prop, 1 ) );
+ }
+ return *m_property_array_helper.get();
+}
+
+//______________________________________________________________________________
+sal_Bool ORegistryFactoryHelper::convertFastPropertyValue(
+ Any &, Any &, sal_Int32, Any const & )
+ throw (lang::IllegalArgumentException)
+{
+ OSL_ENSURE( 0, "unexpected!" );
+ return false;
+}
+
+//______________________________________________________________________________
+void ORegistryFactoryHelper::setFastPropertyValue_NoBroadcast(
+ sal_Int32, Any const & )
+ throw (Exception)
+{
+ throw beans::PropertyVetoException(
+ OUSTR("unexpected: only readonly properties!"),
+ static_cast< OWeakObject * >(this) );
+}
+
+//______________________________________________________________________________
+void ORegistryFactoryHelper::getFastPropertyValue(
+ Any & rValue, sal_Int32 nHandle ) const
+{
+ if (nHandle == 0)
+ {
+ rValue <<= xImplementationKey;
+ }
+ else
+ {
+ rValue.clear();
+ throw beans::UnknownPropertyException(
+ OUSTR("unknown property!"), static_cast< OWeakObject * >(
+ const_cast< ORegistryFactoryHelper * >(this) ) );
+ }
+}
+
+Reference<XInterface > ORegistryFactoryHelper::createInstanceEveryTime(
+ Reference< XComponentContext > const & xContext )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ Reference< XInterface > x( createModuleFactory() );
+ if (x.is())
+ {
+ MutexGuard aGuard( aMutex );
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ xModuleFactory.set( x, UNO_QUERY );
+ xModuleFactoryDepr.set( x, UNO_QUERY );
+ }
+ }
+ }
+ if( xModuleFactory.is() )
+ {
+ return xModuleFactory->createInstanceWithContext( xContext );
+ }
+ else if( xModuleFactoryDepr.is() )
+ {
+ return xModuleFactoryDepr->createInstance();
+ }
+
+ return Reference<XInterface >();
+}
+
+Reference<XInterface > SAL_CALL ORegistryFactoryHelper::createInstanceWithArguments(
+ const Sequence<Any>& Arguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ Reference< XInterface > x( createModuleFactory() );
+ if (x.is())
+ {
+ MutexGuard aGuard( aMutex );
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ xModuleFactory.set( x, UNO_QUERY );
+ xModuleFactoryDepr.set( x, UNO_QUERY );
+ }
+ }
+ }
+ if( xModuleFactoryDepr.is() )
+ {
+ return xModuleFactoryDepr->createInstanceWithArguments( Arguments );
+ }
+ else if( xModuleFactory.is() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "### no context ORegistryFactoryHelper::createInstanceWithArgumentsAndContext()!\n" );
+#endif
+ return xModuleFactory->createInstanceWithArgumentsAndContext( Arguments, Reference< XComponentContext >() );
+ }
+
+ return Reference<XInterface >();
+}
+
+Reference< XInterface > ORegistryFactoryHelper::createInstanceWithArgumentsAndContext(
+ Sequence< Any > const & rArguments,
+ Reference< XComponentContext > const & xContext )
+ throw (Exception, RuntimeException)
+{
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ Reference< XInterface > x( createModuleFactory() );
+ if (x.is())
+ {
+ MutexGuard aGuard( aMutex );
+ if( !xModuleFactory.is() && !xModuleFactoryDepr.is() )
+ {
+ xModuleFactory.set( x, UNO_QUERY );
+ xModuleFactoryDepr.set( x, UNO_QUERY );
+ }
+ }
+ }
+ if( xModuleFactory.is() )
+ {
+ return xModuleFactory->createInstanceWithArgumentsAndContext( rArguments, xContext );
+ }
+ else if( xModuleFactoryDepr.is() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ if (xContext.is())
+ {
+ OSL_TRACE( "### ignoring context calling ORegistryFactoryHelper::createInstanceWithArgumentsAndContext()!\n" );
+ }
+#endif
+ return xModuleFactoryDepr->createInstanceWithArguments( rArguments );
+ }
+
+ return Reference<XInterface >();
+}
+
+
+// OSingleFactoryHelper
+Reference< XInterface > ORegistryFactoryHelper::createModuleFactory()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ OUString aActivatorUrl;
+ OUString aActivatorName;
+ OUString aLocation;
+
+ Reference<XRegistryKey > xActivatorKey = xImplementationKey->openKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/ACTIVATOR") ) );
+ if( xActivatorKey.is() && xActivatorKey->getValueType() == RegistryValueType_ASCII )
+ {
+ aActivatorUrl = xActivatorKey->getAsciiValue();
+
+ OUString tmpActivator(aActivatorUrl.getStr());
+ sal_Int32 nIndex = 0;
+ aActivatorName = tmpActivator.getToken(0, ':', nIndex );
+
+ Reference<XRegistryKey > xLocationKey = xImplementationKey->openKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/LOCATION") ) );
+ if( xLocationKey.is() && xLocationKey->getValueType() == RegistryValueType_ASCII )
+ aLocation = xLocationKey->getAsciiValue();
+ }
+ else
+ {
+ // old style"url"
+ // the location of the program code of the implementation
+ Reference<XRegistryKey > xLocationKey = xImplementationKey->openKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/URL") ) );
+ // is the the key of the right type ?
+ if( xLocationKey.is() && xLocationKey->getValueType() == RegistryValueType_ASCII )
+ {
+ // one implementation found -> try to activate
+ aLocation = xLocationKey->getAsciiValue();
+
+ // search protocol delemitter
+ sal_Int32 nPos = aLocation.indexOf(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("://") ) );
+ if( nPos != -1 )
+ {
+ aActivatorName = aLocation.copy( 0, nPos );
+ if( aActivatorName.compareToAscii( "java" ) == 0 )
+ aActivatorName = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.Java") );
+ else if( aActivatorName.compareToAscii( "module" ) == 0 )
+ aActivatorName = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary") );
+ aLocation = aLocation.copy( nPos + 3 );
+ }
+ }
+ }
+
+ Reference< XInterface > xFactory;
+ if( aActivatorName.getLength() != 0 )
+ {
+ Reference<XInterface > x = xSMgr->createInstance( aActivatorName );
+ Reference<XImplementationLoader > xLoader( x, UNO_QUERY );
+ Reference<XInterface > xMF;
+ if (xLoader.is())
+ {
+ xFactory = xLoader->activate( aImplementationName, aActivatorUrl, aLocation, xImplementationKey );
+ }
+ }
+ return xFactory;
+}
+
+// XServiceInfo
+Sequence< OUString > ORegistryFactoryHelper::getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( aMutex );
+ if( aServiceNames.getLength() == 0 )
+ {
+ // not yet loaded
+ try
+ {
+ Reference<XRegistryKey > xKey = xImplementationKey->openKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("UNO/SERVICES") ) );
+
+ if (xKey.is())
+ {
+ // length of prefix. +1 for the '/' at the end
+ sal_Int32 nPrefixLen = xKey->getKeyName().getLength() + 1;
+
+ // Full qualified names like "IMPLEMENTATIONS/TEST/UNO/SERVICES/com.sun.star..."
+ Sequence<OUString> seqKeys = xKey->getKeyNames();
+ OUString* pKeys = seqKeys.getArray();
+ for( sal_Int32 i = 0; i < seqKeys.getLength(); i++ )
+ pKeys[i] = pKeys[i].copy(nPrefixLen);
+
+ aServiceNames = seqKeys;
+ }
+ }
+ catch (InvalidRegistryException &)
+ {
+ }
+ }
+ return aServiceNames;
+}
+
+sal_Bool SAL_CALL ORegistryFactoryHelper::releaseOnNotification() throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool retVal= sal_True;
+ if( isOneInstance() && isInstance())
+ {
+ retVal= sal_False;
+ }
+ else if( ! isOneInstance())
+ {
+ // try to delegate
+ if( xModuleFactory.is())
+ {
+ Reference<XUnloadingPreference> xunloading( xModuleFactory, UNO_QUERY);
+ if( xunloading.is())
+ retVal= xunloading->releaseOnNotification();
+ }
+ else if( xModuleFactoryDepr.is())
+ {
+ Reference<XUnloadingPreference> xunloading( xModuleFactoryDepr, UNO_QUERY);
+ if( xunloading.is())
+ retVal= xunloading->releaseOnNotification();
+ }
+ }
+ return retVal;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class OFactoryProxyHelper : public WeakImplHelper3< XServiceInfo, XSingleServiceFactory,
+ XUnloadingPreference >
+{
+ Reference<XSingleServiceFactory > xFactory;
+
+public:
+
+ OFactoryProxyHelper(
+ const Reference<XMultiServiceFactory > & /*rServiceManager*/,
+ const Reference<XSingleServiceFactory > & rFactory )
+ SAL_THROW( () )
+ : xFactory( rFactory )
+ {}
+
+ // XSingleServiceFactory
+ Reference<XInterface > SAL_CALL createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ Reference<XInterface > SAL_CALL createInstanceWithArguments(const Sequence<Any>& Arguments)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw(::com::sun::star::uno::RuntimeException);
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException);
+ //XUnloadingPreference
+ sal_Bool SAL_CALL releaseOnNotification()
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+// XSingleServiceFactory
+Reference<XInterface > OFactoryProxyHelper::createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return xFactory->createInstance();
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OFactoryProxyHelper::createInstanceWithArguments
+(
+ const Sequence<Any>& Arguments
+)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return xFactory->createInstanceWithArguments( Arguments );
+}
+
+// XServiceInfo
+OUString OFactoryProxyHelper::getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference<XServiceInfo > xInfo( xFactory, UNO_QUERY );
+ if( xInfo.is() )
+ return xInfo->getImplementationName();
+ return OUString();
+}
+
+// XServiceInfo
+sal_Bool OFactoryProxyHelper::supportsService(const OUString& ServiceName)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference<XServiceInfo > xInfo( xFactory, UNO_QUERY );
+ if( xInfo.is() )
+ return xInfo->supportsService( ServiceName );
+ return sal_False;
+}
+
+// XServiceInfo
+Sequence< OUString > OFactoryProxyHelper::getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference<XServiceInfo > xInfo( xFactory, UNO_QUERY );
+ if( xInfo.is() )
+ return xInfo->getSupportedServiceNames();
+ return Sequence< OUString >();
+}
+
+sal_Bool SAL_CALL OFactoryProxyHelper::releaseOnNotification() throw(::com::sun::star::uno::RuntimeException)
+{
+
+ Reference<XUnloadingPreference> pref( xFactory, UNO_QUERY);
+ if( pref.is())
+ return pref->releaseOnNotification();
+ return sal_True;
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createSingleFactory(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames,
+ rtl_ModuleCount *pModCount )
+ SAL_THROW( () )
+{
+ return new OFactoryComponentHelper(
+ rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, pModCount, sal_False );
+}
+
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createFactoryProxy(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const Reference<XSingleServiceFactory > & rFactory )
+ SAL_THROW( () )
+{
+ return new OFactoryProxyHelper(
+ rServiceManager, rFactory );
+}
+
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createOneInstanceFactory(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames,
+ rtl_ModuleCount *pModCount )
+ SAL_THROW( () )
+{
+ return new OFactoryComponentHelper(
+ rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, pModCount, sal_True );
+// return new OFactoryUnloadableComponentHelper(
+// rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, pModCount, sal_True );
+}
+
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createSingleRegistryFactory(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ const Reference<XRegistryKey > & rImplementationKey )
+ SAL_THROW( () )
+{
+ return new ORegistryFactoryHelper(
+ rServiceManager, rImplementationName, rImplementationKey, sal_False );
+}
+
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createOneInstanceRegistryFactory(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ const Reference<XRegistryKey > & rImplementationKey )
+ SAL_THROW( () )
+{
+ return new ORegistryFactoryHelper(
+ rServiceManager, rImplementationName, rImplementationKey, sal_True );
+}
+
+//##################################################################################################
+Reference< lang::XSingleComponentFactory > SAL_CALL createSingleComponentFactory(
+ ComponentFactoryFunc fptr,
+ OUString const & rImplementationName,
+ Sequence< OUString > const & rServiceNames,
+ rtl_ModuleCount * pModCount)
+ SAL_THROW( () )
+{
+ return new OFactoryComponentHelper(
+ Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, pModCount, sal_False );
+}
+
+Reference< lang::XSingleComponentFactory > SAL_CALL createOneInstanceComponentFactory(
+ ComponentFactoryFunc fptr,
+ OUString const & rImplementationName,
+ Sequence< OUString > const & rServiceNames,
+ rtl_ModuleCount * pModCount)
+ SAL_THROW( () )
+{
+ return new OFactoryComponentHelper(
+ Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, pModCount, sal_True );
+}
+
+}
+
+
diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c
new file mode 100644
index 000000000000..e325f077711b
--- /dev/null
+++ b/cppuhelper/source/findsofficepath.c
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_cppuhelper.hxx"
+#include "sal/config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#if defined WNT
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+/*
+ * Gets the installation path from the Windows Registry for the specified
+ * registry key.
+ *
+ * @param hroot open handle to predefined root registry key
+ * @param subKeyName name of the subkey to open
+ *
+ * @return the installation path or NULL, if no installation was found or
+ * if an error occured
+ */
+static char* getPathFromRegistryKey( HKEY hroot, const char* subKeyName )
+{
+ HKEY hkey;
+ DWORD type;
+ char* data = NULL;
+ DWORD size;
+
+ /* open the specified registry key */
+ if ( RegOpenKeyEx( hroot, subKeyName, 0, KEY_READ, &hkey ) != ERROR_SUCCESS )
+ {
+ return NULL;
+ }
+
+ /* find the type and size of the default value */
+ if ( RegQueryValueEx( hkey, NULL, NULL, &type, NULL, &size) != ERROR_SUCCESS )
+ {
+ RegCloseKey( hkey );
+ return NULL;
+ }
+
+ /* get memory to hold the default value */
+ data = (char*) malloc( size );
+
+ /* read the default value */
+ if ( RegQueryValueEx( hkey, NULL, NULL, &type, (LPBYTE) data, &size ) != ERROR_SUCCESS )
+ {
+ RegCloseKey( hkey );
+ return NULL;
+ }
+
+ /* release registry key handle */
+ RegCloseKey( hkey );
+
+ return data;
+}
+
+/*
+ * Gets the installation path from the Windows Registry.
+ *
+ * @return the installation path or NULL, if no installation was found or
+ * if an error occured
+ */
+static char* platformSpecific()
+{
+ const char* SUBKEYNAME = "Software\\OpenOffice.org\\UNO\\InstallPath";
+
+ char* path = NULL;
+
+ /* read the key's default value from HKEY_CURRENT_USER */
+ path = getPathFromRegistryKey( HKEY_CURRENT_USER, SUBKEYNAME );
+
+ if ( path == NULL )
+ {
+ /* read the key's default value from HKEY_LOCAL_MACHINE */
+ path = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, SUBKEYNAME );
+ }
+
+ return path;
+}
+
+#else
+
+#include <unistd.h>
+#include <limits.h>
+
+/*
+ * Gets the installation path from the PATH environment variable.
+ *
+ * <p>An installation is found, if the executable 'soffice' or a symbolic link
+ * is in one of the directories listed in the PATH environment variable.</p>
+ *
+ * @return the installation path or NULL, if no installation was found or
+ * if an error occured
+ */
+static char* platformSpecific()
+{
+ const int SEPARATOR = '/';
+ const char* PATHSEPARATOR = ":";
+ const char* PATHVARNAME = "PATH";
+ const char* APPENDIX = "/soffice";
+
+ char* path = NULL;
+ char* env = NULL;
+ char* str = NULL;
+ char* dir = NULL;
+ char* file = NULL;
+ char* resolved = NULL;
+ char* sep = NULL;
+
+ char buffer[PATH_MAX];
+ int pos;
+
+ /* get the value of the PATH environment variable */
+ env = getenv( PATHVARNAME );
+ str = (char*) malloc( strlen( env ) + 1 );
+ strcpy( str, env );
+
+ /* get the tokens separated by ':' */
+ dir = strtok( str, PATHSEPARATOR );
+
+ while ( dir )
+ {
+ /* construct soffice file path */
+ file = (char*) malloc( strlen( dir ) + strlen( APPENDIX ) + 1 );
+ strcpy( file, dir );
+ strcat( file, APPENDIX );
+
+ /* check existence of soffice file */
+ if ( !access( file, F_OK ) )
+ {
+ /* resolve symbolic link */
+ resolved = realpath( file, buffer );
+
+ if ( resolved != NULL )
+ {
+ /* get path to program directory */
+ sep = strrchr( resolved, SEPARATOR );
+
+ if ( sep != NULL )
+ {
+ pos = sep - resolved;
+ path = (char*) malloc( pos + 1 );
+ strncpy( path, resolved, pos );
+ path[ pos ] = '\0';
+ free( file );
+ break;
+ }
+ }
+ }
+
+ dir = strtok( NULL, PATHSEPARATOR );
+ free( file );
+ }
+
+ free( str );
+
+ return path;
+}
+
+#endif
+
+char const* cppuhelper_detail_findSofficePath()
+{
+ const char* UNOPATHVARNAME = "UNO_PATH";
+
+ char* path = NULL;
+
+ /* get the installation path from the UNO_PATH environment variable */
+ path = getenv( UNOPATHVARNAME );
+
+ if ( path == NULL || strlen( path ) == 0 )
+ {
+ path = platformSpecific();
+ }
+
+ return path;
+}
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
new file mode 100644
index 000000000000..59ab83e34e82
--- /dev/null
+++ b/cppuhelper/source/gcc3.map
@@ -0,0 +1,384 @@
+UDK_3_0_0 {
+ global:
+GetVersionInfo;
+_ZN3com3sun4star3uno19WeakReferenceHelperC1ERKNS2_9ReferenceINS2_10XInterfaceEEE;
+_ZN3com3sun4star3uno19WeakReferenceHelperC1ERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperC2ERKNS2_9ReferenceINS2_10XInterfaceEEE;
+_ZN3com3sun4star3uno19WeakReferenceHelperC2ERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperaSERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperD1Ev;
+_ZN3com3sun4star3uno19WeakReferenceHelperD2Ev;
+_ZN4cppu11OWeakObject12queryAdapterEv;
+_ZN4cppu11OWeakObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu11OWeakObject7acquireEv;
+_ZN4cppu11OWeakObject7releaseEv;
+_ZN4cppu11OWeakObjectD0Ev;
+_ZN4cppu11OWeakObjectD1Ev;
+_ZN4cppu11OWeakObjectD2Ev;
+_ZN4cppu13ClassDataBaseC1E?;
+_ZN4cppu13ClassDataBaseC1Ev;
+_ZN4cppu13ClassDataBaseC2E?;
+_ZN4cppu13ClassDataBaseC2Ev;
+_ZN4cppu13ClassDataBaseD1Ev;
+_ZN4cppu13ClassDataBaseD2Ev;
+_ZN4cppu14OWeakAggObject12setDelegatorERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu14OWeakAggObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu14OWeakAggObject16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu14OWeakAggObject7acquireEv;
+_ZN4cppu14OWeakAggObject7releaseEv;
+_ZN4cppu14OWeakAggObjectD0Ev;
+_ZN4cppu14OWeakAggObjectD1Ev;
+_ZN4cppu14OWeakAggObjectD2Ev;
+_ZN4cppu14throwExceptionERKN3com3sun4star3uno3AnyE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeERKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeERKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu16ImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPv;
+_ZN4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu16OComponentHelper16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu16OComponentHelper16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu16OComponentHelper19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu16OComponentHelper7acquireEv;
+_ZN4cppu16OComponentHelper7disposeEv;
+_ZN4cppu16OComponentHelper7releaseEv;
+_ZN4cppu16OComponentHelper8getTypesEv;
+_ZN4cppu16OComponentHelper9disposingEv;
+_ZN4cppu16OComponentHelperC1ERN3osl5MutexE;
+_ZN4cppu16OComponentHelperC2ERN3osl5MutexE;
+_ZN4cppu16OComponentHelperD0Ev;
+_ZN4cppu16OComponentHelperD1Ev;
+_ZN4cppu16OComponentHelperD2Ev;
+_ZN4cppu17OImplementationIdD1Ev;
+_ZN4cppu17OImplementationIdD2Ev;
+_ZN4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu18OPropertySetHelper16getPropertyValueERKN3rtl8OUStringE;
+_ZN4cppu18OPropertySetHelper16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+_ZN4cppu18OPropertySetHelper17getPropertyValuesERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEE;
+_ZN4cppu18OPropertySetHelper17setPropertyValuesERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS5_INS4_3AnyEEE;
+_ZN4cppu18OPropertySetHelper20getFastPropertyValueE?;
+_ZN4cppu18OPropertySetHelper20setFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+_ZN4cppu18OPropertySetHelper21createPropertySetInfoERNS_20IPropertyArrayHelperE;
+_ZN4cppu18OPropertySetHelper21setFastPropertyValuesE?P?PKN3com3sun4star3uno3AnyE?;
+_ZN4cppu18OPropertySetHelper25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper25firePropertiesChangeEventERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS4_9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper27addPropertiesChangeListenerERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS4_9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper30removePropertiesChangeListenerERKN3com3sun4star3uno9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper4fireEP?PKN3com3sun4star3uno3AnyES8_?h;
+_ZN4cppu18OPropertySetHelper9disposingEv;
+_ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEE;
+_ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEE;
+_ZN4cppu18OPropertySetHelperD1Ev;
+_ZN4cppu18OPropertySetHelperD2Ev;
+_ZN4cppu18bootstrapInitialSFERKN3rtl8OUStringE;
+_ZN4cppu18createFactoryProxyERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKNS4_INS5_21XSingleServiceFactoryEEE;
+_ZN4cppu19ImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu19createSingleFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringEPFNS4_INS3_10XInterfaceEEES9_ERKNS3_8SequenceISB_EEP16_rtl_ModuleCount;
+_ZN4cppu20IPropertyArrayHelperD0Ev;
+_ZN4cppu20IPropertyArrayHelperD1Ev;
+_ZN4cppu20IPropertyArrayHelperD2Ev;
+_ZN4cppu20OPropertyArrayHelper11fillHandlesEP?RKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEE;
+_ZN4cppu20OPropertyArrayHelper13getPropertiesEv;
+_ZN4cppu20OPropertyArrayHelper15getHandleByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper17getPropertyByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper17hasPropertyByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper27fillPropertyMembersByHandleEPN3rtl8OUStringEPs?;
+_ZN4cppu20OPropertyArrayHelper4initEh;
+_ZN4cppu20OPropertyArrayHelperC1EPN3com3sun4star5beans8PropertyE?h;
+_ZN4cppu20OPropertyArrayHelperC1ERKN3com3sun4star3uno8SequenceINS3_5beans8PropertyEEEh;
+_ZN4cppu20OPropertyArrayHelperC2EPN3com3sun4star5beans8PropertyE?h;
+_ZN4cppu20OPropertyArrayHelperC2ERKN3com3sun4star3uno8SequenceINS3_5beans8PropertyEEEh;
+_ZN4cppu20WeakImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_11OWeakObjectE;
+_ZN4cppu20createNestedRegistryERKN3rtl8OUStringE;
+_ZN4cppu20createSimpleRegistryERKN3rtl8OUStringE;
+_ZN4cppu22ImplInhHelper_getTypesEPNS_10class_dataERKN3com3sun4star3uno8SequenceINS5_4TypeEEE;
+_ZN4cppu22createComponentContextEPKNS_17ContextEntry_InitE?RKN3com3sun4star3uno9ReferenceINS6_17XComponentContextEEE;
+_ZN4cppu22getImplHelperInitMutexEv;
+_ZN4cppu23WeakImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu24OInterfaceIteratorHelper4nextEv;
+_ZN4cppu24OInterfaceIteratorHelper6removeEv;
+_ZN4cppu24OInterfaceIteratorHelperC1ERNS_25OInterfaceContainerHelperE;
+_ZN4cppu24OInterfaceIteratorHelperC2ERNS_25OInterfaceContainerHelperE;
+_ZN4cppu24OInterfaceIteratorHelperD1Ev;
+_ZN4cppu24OInterfaceIteratorHelperD2Ev;
+_ZN4cppu24createOneInstanceFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringEPFNS4_INS3_10XInterfaceEEES9_ERKNS3_8SequenceISB_EEP16_rtl_ModuleCount;
+_ZN4cppu25OInterfaceContainerHelper12addInterfaceERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu25OInterfaceContainerHelper15disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu25OInterfaceContainerHelper15removeInterfaceERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu25OInterfaceContainerHelper17copyAndResetInUseEv;
+_ZN4cppu25OInterfaceContainerHelper5clearEv;
+_ZN4cppu25OInterfaceContainerHelperC1ERN3osl5MutexE;
+_ZN4cppu25OInterfaceContainerHelperC2ERN3osl5MutexE;
+_ZN4cppu25OInterfaceContainerHelperD1Ev;
+_ZN4cppu25OInterfaceContainerHelperD2Ev;
+_ZN4cppu25component_writeInfoHelperEPvS0_PKNS_19ImplementationEntryE;
+_ZN4cppu26WeakAggImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu26WeakAggImplHelper_queryAggERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_14OWeakAggObjectE;
+_ZN4cppu26component_getFactoryHelperEPKcPvS2_PKNS_19ImplementationEntryE;
+_ZN4cppu27WeakComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu27WeakComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu27WeakComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu27WeakComponentImplHelperBase7acquireEv;
+_ZN4cppu27WeakComponentImplHelperBase7disposeEv;
+_ZN4cppu27WeakComponentImplHelperBase7releaseEv;
+_ZN4cppu27WeakComponentImplHelperBase9disposingEv;
+_ZN4cppu27WeakComponentImplHelperBaseC1ERN3osl5MutexE;
+_ZN4cppu27WeakComponentImplHelperBaseC2ERN3osl5MutexE;
+_ZN4cppu27WeakComponentImplHelperBaseD0Ev;
+_ZN4cppu27WeakComponentImplHelperBaseD1Ev;
+_ZN4cppu27WeakComponentImplHelperBaseD2Ev;
+_ZN4cppu27createSingleRegistryFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_8registry12XRegistryKeyEEE;
+_ZN4cppu27writeSharedLibComponentInfoERKN3rtl8OUStringES3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE;
+_ZN4cppu28ImplHelper_queryNoXInterfaceERKN3com3sun4star3uno4TypeEPNS_10class_dataEPv;
+_ZN4cppu28createRegistryServiceFactoryERKN3rtl8OUStringES3_hS3_;
+_ZN4cppu28createSingleComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
+_ZN4cppu29WeakComponentImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_27WeakComponentImplHelperBaseE;
+_ZN4cppu29installTypeDescriptionManagerERKN3com3sun4star3uno9ReferenceINS2_9container23XHierarchicalNameAccessEEE;
+_ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE;
+_ZN4cppu30ImplHelper_getImplementationIdEPNS_10class_dataE;
+_ZN4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu30WeakAggComponentImplHelperBase16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu30WeakAggComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZN4cppu30WeakAggComponentImplHelperBase7disposeEv;
+_ZN4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZN4cppu30WeakAggComponentImplHelperBase9disposingEv;
+_ZN4cppu30WeakAggComponentImplHelperBaseC1ERN3osl5MutexE;
+_ZN4cppu30WeakAggComponentImplHelperBaseC2ERN3osl5MutexE;
+_ZN4cppu30WeakAggComponentImplHelperBaseD0Ev;
+_ZN4cppu30WeakAggComponentImplHelperBaseD1Ev;
+_ZN4cppu30WeakAggComponentImplHelperBaseD2Ev;
+_ZN4cppu31createStandardClassWithSequenceERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_10reflection9XIdlClassEEERKNS3_8SequenceISB_EE;
+_ZN4cppu32WeakComponentImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu32createOneInstanceRegistryFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_8registry12XRegistryKeyEEE;
+_ZN4cppu33bootstrap_InitialComponentContextERKN3com3sun4star3uno9ReferenceINS2_8registry15XSimpleRegistryEEERKN3rtl8OUStringE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper12addInterfaceERKN3com3sun4star3uno4TypeERKNS4_9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper15disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper15removeInterfaceERKN3com3sun4star3uno4TypeERKNS4_9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper5clearEv;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperC1ERN3osl5MutexE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperC2ERN3osl5MutexE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperD1Ev;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperD2Ev;
+_ZN4cppu35WeakAggComponentImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu35WeakAggComponentImplHelper_queryAggERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_30WeakAggComponentImplHelperBaseE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3212addInterfaceERK?RKN3com3sun4star3uno9ReferenceINS6_10XInterfaceEEE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3215disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3215removeInterfaceERK?RKN3com3sun4star3uno9ReferenceINS6_10XInterfaceEEE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt325clearEv;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32C1ERN3osl5MutexE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32C2ERN3osl5MutexE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32D1Ev;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32D2Ev;
+_ZN4cppu40defaultBootstrap_InitialComponentContextERKN3rtl8OUStringE;
+_ZN4cppu40defaultBootstrap_InitialComponentContextEv;
+_ZN4cppu9ClassData15writeTypeOffsetERKN3com3sun4star3uno4TypeE?;
+_ZN4cppu9ClassData16initTypeProviderEv;
+_ZN4cppu9ClassData19getImplementationIdEv;
+_ZN4cppu9ClassData5queryERKN3com3sun4star3uno4TypeEPNS3_4lang13XTypeProviderE;
+_ZN4cppu9ClassData8getTypesEv;
+_ZNK3com3sun4star3uno19WeakReferenceHelper3getEv;
+_ZNK4cppu17OImplementationId19getImplementationIdEv;
+_ZNK4cppu20OPropertyArrayHelper8getCountEv;
+_ZNK4cppu25OInterfaceContainerHelper11getElementsEv;
+_ZNK4cppu25OInterfaceContainerHelper9getLengthEv;
+_ZNK4cppu34OMultiTypeInterfaceContainerHelper12getContainerERKN3com3sun4star3uno4TypeE;
+_ZNK4cppu34OMultiTypeInterfaceContainerHelper17getContainedTypesEv;
+_ZNK4cppu39OMultiTypeInterfaceContainerHelperInt3212getContainerERK?;
+_ZNK4cppu39OMultiTypeInterfaceContainerHelperInt3217getContainedTypesEv;
+_ZTVN4cppu11OWeakObjectE;
+_ZTVN4cppu14OWeakAggObjectE;
+_ZTVN4cppu16OComponentHelperE;
+_ZTVN4cppu18OPropertySetHelperE;
+_ZTVN4cppu20IPropertyArrayHelperE;
+_ZTVN4cppu20OPropertyArrayHelperE;
+_ZTVN4cppu27WeakComponentImplHelperBaseE;
+_ZTVN4cppu30WeakAggComponentImplHelperBaseE;
+_ZN4cppu20OPropertyArrayHelperD0Ev;
+_ZN4cppu20OPropertyArrayHelperD1Ev;
+_ZThn*_N4cppu14OWeakAggObject12setDelegatorERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZThn*_N4cppu14OWeakAggObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu14OWeakAggObject16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu14OWeakAggObject7acquireEv;
+_ZThn*_N4cppu14OWeakAggObject7releaseEv;
+_ZThn*_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu16OComponentHelper16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu16OComponentHelper7acquireEv;
+_ZThn*_N4cppu16OComponentHelper7releaseEv;
+_ZThn*_N4cppu27WeakComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu27WeakComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu27WeakComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu27WeakComponentImplHelperBase7acquireEv;
+_ZThn*_N4cppu27WeakComponentImplHelperBase7disposeEv;
+_ZThn*_N4cppu27WeakComponentImplHelperBase7releaseEv;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZThn*_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu16OComponentHelper7acquireEv;
+_ZThn*_N4cppu16OComponentHelper7releaseEv;
+_ZThn*_N4cppu16OComponentHelper8getTypesEv;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase7disposeEv;
+_ZThn*_N4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZThn*_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu16OComponentHelper16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu16OComponentHelper19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn*_N4cppu16OComponentHelper7acquireEv;
+_ZThn*_N4cppu16OComponentHelper7disposeEv;
+_ZThn*_N4cppu16OComponentHelper7releaseEv;
+_ZThn*_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu18OPropertySetHelper20getFastPropertyValueE?;
+_ZThn*_N4cppu18OPropertySetHelper20setFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+_ZThn*_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn*_N4cppu18OPropertySetHelper16getPropertyValueERKN3rtl8OUStringE;
+_ZThn*_N4cppu18OPropertySetHelper16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+_ZThn*_N4cppu18OPropertySetHelper25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZThn*_N4cppu18OPropertySetHelper25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZThn*_N4cppu18OPropertySetHelper28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZThn*_N4cppu18OPropertySetHelper28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+
+_ZN4cppu13AccessControl19checkFilePermissionERKN3rtl8OUStringES4_;
+_ZN4cppu13AccessControl21checkSocketPermissionERKN3rtl8OUStringES4_;
+_ZN4cppu13AccessControl22checkRuntimePermissionERKN3rtl8OUStringE;
+_ZN4cppu13AccessControlC1ERKN3com3sun4star3uno9ReferenceINS3_8security17XAccessControllerEEE;
+_ZN4cppu13AccessControlC2ERKN3com3sun4star3uno9ReferenceINS3_8security17XAccessControllerEEE;
+_ZN4cppu13AccessControlC1ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE;
+_ZN4cppu13AccessControlC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE;
+_ZN4cppu13AccessControlC1ERKS0_;
+_ZN4cppu13AccessControlC2ERKS0_;
+
+_ZN4cppu16UnoUrlDescriptorC1ERKN3rtl8OUStringE;
+_ZN4cppu16UnoUrlDescriptorC1ERKS0_;
+_ZN4cppu16UnoUrlDescriptorC2ERKN3rtl8OUStringE;
+_ZN4cppu16UnoUrlDescriptorC2ERKS0_;
+_ZN4cppu16UnoUrlDescriptorD1Ev;
+_ZN4cppu16UnoUrlDescriptorD2Ev;
+_ZN4cppu16UnoUrlDescriptoraSERKS0_;
+_ZN4cppu6UnoUrlC1ERKN3rtl8OUStringE;
+_ZN4cppu6UnoUrlC1ERKS0_;
+_ZN4cppu6UnoUrlC2ERKN3rtl8OUStringE;
+_ZN4cppu6UnoUrlC2ERKS0_;
+_ZN4cppu6UnoUrlD1Ev;
+_ZN4cppu6UnoUrlD2Ev;
+_ZN4cppu6UnoUrlaSERKS0_;
+_ZNK4cppu16UnoUrlDescriptor12getParameterERKN3rtl8OUStringE;
+_ZNK4cppu16UnoUrlDescriptor12hasParameterERKN3rtl8OUStringE;
+_ZNK4cppu16UnoUrlDescriptor13getDescriptorEv;
+_ZNK4cppu16UnoUrlDescriptor7getNameEv;
+_ZNK4cppu6UnoUrl11getProtocolEv;
+_ZNK4cppu6UnoUrl13getConnectionEv;
+_ZNK4cppu6UnoUrl13getObjectNameEv;
+
+ local:
+ *;
+};
+
+UDK_3.1 {
+ global:
+ _ZN4cppu18getCaughtExceptionEv;
+
+ _ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEb;
+ _ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEb;
+
+ _ZN4cppu9bootstrapEv;
+ _ZN4cppu18BootstrapExceptionC1Ev;
+ _ZN4cppu18BootstrapExceptionC2Ev;
+ _ZN4cppu18BootstrapExceptionC1ERKN3rtl8OUStringE;
+ _ZN4cppu18BootstrapExceptionC2ERKN3rtl8OUStringE;
+ _ZN4cppu18BootstrapExceptionC1ERKS0_;
+ _ZN4cppu18BootstrapExceptionC2ERKS0_;
+ _ZN4cppu18BootstrapExceptionD0Ev;
+ _ZN4cppu18BootstrapExceptionD1Ev;
+ _ZN4cppu18BootstrapExceptionD2Ev;
+ _ZN4cppu18BootstrapExceptionaSERKS0_;
+ _ZNK4cppu18BootstrapException10getMessageEv;
+ # _ZTIN4cppu18BootstrapExceptionE;
+ # _ZTSN4cppu18BootstrapExceptionE;
+} UDK_3_0_0;
+
+UDK_3.2 {
+ global:
+ _ZN4cppu20PropertySetMixinImpl10prepareSetERKN3rtl8OUStringERKN3com3sun4star3uno3AnyESB_PNS0_14BoundListenersE;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersC1Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersC2Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersD1Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersD2Ev;
+ _ZN4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZN4cppu20PropertySetMixinImpl16getPropertyValueERKN3rtl8OUStringE;
+ _ZN4cppu20PropertySetMixinImpl16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+ _ZN4cppu20PropertySetMixinImpl17getPropertyValuesEv;
+ _ZN4cppu20PropertySetMixinImpl17setPropertyValuesERKN3com3sun4star3uno8SequenceINS3_5beans13PropertyValueEEE;
+ _ZN4cppu20PropertySetMixinImpl18getPropertySetInfoEv;
+ _ZN4cppu20PropertySetMixinImpl20getFastPropertyValueE?;
+ _ZN4cppu20PropertySetMixinImpl20setFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+ _ZN4cppu20PropertySetMixinImpl25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl7disposeEv;
+ _ZN4cppu20PropertySetMixinImplC1ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEENS0_10ImplementsERKNS4_8SequenceIN3rtl8OUStringEEERKNS4_4TypeE;
+ _ZN4cppu20PropertySetMixinImplC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEENS0_10ImplementsERKNS4_8SequenceIN3rtl8OUStringEEERKNS4_4TypeE;
+ _ZN4cppu20PropertySetMixinImplD1Ev;
+ _ZN4cppu20PropertySetMixinImplD2Ev;
+ _ZNK4cppu20PropertySetMixinImpl14BoundListeners6notifyEv;
+ _ZThn*_N4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZThn*_N4cppu20PropertySetMixinImpl20getFastPropertyValueE?;
+ _ZThn*_N4cppu20PropertySetMixinImpl20setFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+ _ZThn*_N4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZThn*_N4cppu20PropertySetMixinImpl17getPropertyValuesEv;
+ _ZThn*_N4cppu20PropertySetMixinImpl17setPropertyValuesERKN3com3sun4star3uno8SequenceINS3_5beans13PropertyValueEEE;
+} UDK_3.1;
+
+UDK_3.3 { # OOo 2.3
+ global:
+ _ZN4cppu18OPropertySetHelper8getTypesEv;
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.4
+ global:
+ _ZN4cppu19bootstrap_expandUriERKN3rtl8OUStringE; # rtl::OUString cppu::bootstrap_expandUri(rtl::OUString const &)
+} UDK_3.3;
+
+UDK_3.5 { # OOo 3.0
+ global:
+ _ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
+ _ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
+} UDK_3.4;
+
+UDK_3.6 { # OOo 3.3
+ global:
+ _ZN4cppu11OWeakObject26disposeWeakConnectionPointEv;
+ _ZN3com3sun4star3uno19WeakReferenceHelperaSERKNS2_9ReferenceINS2_10XInterfaceEEE;
+ _ZN3com3sun4star3uno19WeakReferenceHelper5clearEv;
+ _ZN4cppu33createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
+} UDK_3.5;
+
diff --git a/cppuhelper/source/gcc3os2.map b/cppuhelper/source/gcc3os2.map
new file mode 100644
index 000000000000..681a076cee79
--- /dev/null
+++ b/cppuhelper/source/gcc3os2.map
@@ -0,0 +1,377 @@
+UDK_3_0_0 {
+ global:
+GetVersionInfo;
+_ZN3com3sun4star3uno19WeakReferenceHelperC1ERKNS2_9ReferenceINS2_10XInterfaceEEE;
+_ZN3com3sun4star3uno19WeakReferenceHelperC1ERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperC2ERKNS2_9ReferenceINS2_10XInterfaceEEE;
+_ZN3com3sun4star3uno19WeakReferenceHelperC2ERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperaSERKS3_;
+_ZN3com3sun4star3uno19WeakReferenceHelperD1Ev;
+_ZN3com3sun4star3uno19WeakReferenceHelperD2Ev;
+_ZN4cppu11OWeakObject12queryAdapterEv;
+_ZN4cppu11OWeakObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu11OWeakObject7acquireEv;
+_ZN4cppu11OWeakObject7releaseEv;
+_ZN4cppu11OWeakObjectD0Ev;
+_ZN4cppu11OWeakObjectD1Ev;
+_ZN4cppu11OWeakObjectD2Ev;
+_ZN4cppu13ClassDataBaseC1El;
+_ZN4cppu13ClassDataBaseC1Ev;
+_ZN4cppu13ClassDataBaseC2El;
+_ZN4cppu13ClassDataBaseC2Ev;
+_ZN4cppu13ClassDataBaseD1Ev;
+_ZN4cppu13ClassDataBaseD2Ev;
+_ZN4cppu14OWeakAggObject12setDelegatorERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu14OWeakAggObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu14OWeakAggObject16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu14OWeakAggObject7acquireEv;
+_ZN4cppu14OWeakAggObject7releaseEv;
+_ZN4cppu14OWeakAggObjectD0Ev;
+_ZN4cppu14OWeakAggObjectD1Ev;
+_ZN4cppu14OWeakAggObjectD2Ev;
+_ZN4cppu14throwExceptionERKN3com3sun4star3uno3AnyE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeERKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC1ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeERKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu15OTypeCollectionC2ERKN3com3sun4star3uno4TypeES7_S7_S7_S7_S7_S7_S7_S7_S7_S7_S7_RKNS4_8SequenceIS5_EE;
+_ZN4cppu16ImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPv;
+_ZN4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu16OComponentHelper16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu16OComponentHelper16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu16OComponentHelper19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu16OComponentHelper7acquireEv;
+_ZN4cppu16OComponentHelper7disposeEv;
+_ZN4cppu16OComponentHelper7releaseEv;
+_ZN4cppu16OComponentHelper8getTypesEv;
+_ZN4cppu16OComponentHelper9disposingEv;
+_ZN4cppu16OComponentHelperC1ERN3osl5MutexE;
+_ZN4cppu16OComponentHelperC2ERN3osl5MutexE;
+_ZN4cppu16OComponentHelperD0Ev;
+_ZN4cppu16OComponentHelperD1Ev;
+_ZN4cppu16OComponentHelperD2Ev;
+_ZN4cppu17OImplementationIdD1Ev;
+_ZN4cppu17OImplementationIdD2Ev;
+_ZN4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu18OPropertySetHelper16getPropertyValueERKN3rtl8OUStringE;
+_ZN4cppu18OPropertySetHelper16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+_ZN4cppu18OPropertySetHelper17getPropertyValuesERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEE;
+_ZN4cppu18OPropertySetHelper17setPropertyValuesERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS5_INS4_3AnyEEE;
+_ZN4cppu18OPropertySetHelper20getFastPropertyValueEl;
+_ZN4cppu18OPropertySetHelper20setFastPropertyValueElRKN3com3sun4star3uno3AnyE;
+_ZN4cppu18OPropertySetHelper21createPropertySetInfoERNS_20IPropertyArrayHelperE;
+_ZN4cppu18OPropertySetHelper21setFastPropertyValuesElPlPKN3com3sun4star3uno3AnyEl;
+_ZN4cppu18OPropertySetHelper25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper25firePropertiesChangeEventERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS4_9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper27addPropertiesChangeListenerERKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEERKNS4_9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper30removePropertiesChangeListenerERKN3com3sun4star3uno9ReferenceINS3_5beans25XPropertiesChangeListenerEEE;
+_ZN4cppu18OPropertySetHelper4fireEPlPKN3com3sun4star3uno3AnyES8_lh;
+_ZN4cppu18OPropertySetHelper9disposingEv;
+_ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEE;
+_ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEE;
+_ZN4cppu18OPropertySetHelperD1Ev;
+_ZN4cppu18OPropertySetHelperD2Ev;
+_ZN4cppu18bootstrapInitialSFERKN3rtl8OUStringE;
+_ZN4cppu18createFactoryProxyERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKNS4_INS5_21XSingleServiceFactoryEEE;
+_ZN4cppu19ImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu19createSingleFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringEPFNS4_INS3_10XInterfaceEEES9_ERKNS3_8SequenceISB_EEP16_rtl_ModuleCount;
+_ZN4cppu20IPropertyArrayHelperD0Ev;
+_ZN4cppu20IPropertyArrayHelperD1Ev;
+_ZN4cppu20IPropertyArrayHelperD2Ev;
+_ZN4cppu20OPropertyArrayHelper11fillHandlesEPlRKN3com3sun4star3uno8SequenceIN3rtl8OUStringEEE;
+_ZN4cppu20OPropertyArrayHelper13getPropertiesEv;
+_ZN4cppu20OPropertyArrayHelper15getHandleByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper17getPropertyByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper17hasPropertyByNameERKN3rtl8OUStringE;
+_ZN4cppu20OPropertyArrayHelper27fillPropertyMembersByHandleEPN3rtl8OUStringEPsl;
+_ZN4cppu20OPropertyArrayHelper4initEh;
+_ZN4cppu20OPropertyArrayHelperC1EPN3com3sun4star5beans8PropertyElh;
+_ZN4cppu20OPropertyArrayHelperC1ERKN3com3sun4star3uno8SequenceINS3_5beans8PropertyEEEh;
+_ZN4cppu20OPropertyArrayHelperC2EPN3com3sun4star5beans8PropertyElh;
+_ZN4cppu20OPropertyArrayHelperC2ERKN3com3sun4star3uno8SequenceINS3_5beans8PropertyEEEh;
+_ZN4cppu20WeakImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_11OWeakObjectE;
+_ZN4cppu20createNestedRegistryERKN3rtl8OUStringE;
+_ZN4cppu20createSimpleRegistryERKN3rtl8OUStringE;
+_ZN4cppu22ImplInhHelper_getTypesEPNS_10class_dataERKN3com3sun4star3uno8SequenceINS5_4TypeEEE;
+_ZN4cppu22createComponentContextEPKNS_17ContextEntry_InitElRKN3com3sun4star3uno9ReferenceINS6_17XComponentContextEEE;
+_ZN4cppu22getImplHelperInitMutexEv;
+_ZN4cppu23WeakImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu24OInterfaceIteratorHelper4nextEv;
+_ZN4cppu24OInterfaceIteratorHelper6removeEv;
+_ZN4cppu24OInterfaceIteratorHelperC1ERNS_25OInterfaceContainerHelperE;
+_ZN4cppu24OInterfaceIteratorHelperC2ERNS_25OInterfaceContainerHelperE;
+_ZN4cppu24OInterfaceIteratorHelperD1Ev;
+_ZN4cppu24OInterfaceIteratorHelperD2Ev;
+_ZN4cppu24createOneInstanceFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringEPFNS4_INS3_10XInterfaceEEES9_ERKNS3_8SequenceISB_EEP16_rtl_ModuleCount;
+_ZN4cppu25OInterfaceContainerHelper12addInterfaceERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu25OInterfaceContainerHelper15disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu25OInterfaceContainerHelper15removeInterfaceERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu25OInterfaceContainerHelper17copyAndResetInUseEv;
+_ZN4cppu25OInterfaceContainerHelper5clearEv;
+_ZN4cppu25OInterfaceContainerHelperC1ERN3osl5MutexE;
+_ZN4cppu25OInterfaceContainerHelperC2ERN3osl5MutexE;
+_ZN4cppu25OInterfaceContainerHelperD1Ev;
+_ZN4cppu25OInterfaceContainerHelperD2Ev;
+_ZN4cppu25component_writeInfoHelperEPvS0_PKNS_19ImplementationEntryE;
+_ZN4cppu26WeakAggImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu26WeakAggImplHelper_queryAggERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_14OWeakAggObjectE;
+_ZN4cppu26component_getFactoryHelperEPKcPvS2_PKNS_19ImplementationEntryE;
+_ZN4cppu27WeakComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu27WeakComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu27WeakComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu27WeakComponentImplHelperBase7acquireEv;
+_ZN4cppu27WeakComponentImplHelperBase7disposeEv;
+_ZN4cppu27WeakComponentImplHelperBase7releaseEv;
+_ZN4cppu27WeakComponentImplHelperBase9disposingEv;
+_ZN4cppu27WeakComponentImplHelperBaseC1ERN3osl5MutexE;
+_ZN4cppu27WeakComponentImplHelperBaseC2ERN3osl5MutexE;
+_ZN4cppu27WeakComponentImplHelperBaseD0Ev;
+_ZN4cppu27WeakComponentImplHelperBaseD1Ev;
+_ZN4cppu27WeakComponentImplHelperBaseD2Ev;
+_ZN4cppu27createSingleRegistryFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_8registry12XRegistryKeyEEE;
+_ZN4cppu27writeSharedLibComponentInfoERKN3rtl8OUStringES3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE;
+_ZN4cppu28ImplHelper_queryNoXInterfaceERKN3com3sun4star3uno4TypeEPNS_10class_dataEPv;
+_ZN4cppu28createRegistryServiceFactoryERKN3rtl8OUStringES3_hS3_;
+_ZN4cppu28createSingleComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
+_ZN4cppu29WeakComponentImplHelper_queryERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_27WeakComponentImplHelperBaseE;
+_ZN4cppu29installTypeDescriptionManagerERKN3com3sun4star3uno9ReferenceINS2_9container23XHierarchicalNameAccessEEE;
+_ZN4cppu29loadSharedLibComponentFactoryERKN3rtl8OUStringES3_S3_RKN3com3sun4star3uno9ReferenceINS6_4lang20XMultiServiceFactoryEEERKNS8_INS6_8registry12XRegistryKeyEEE;
+_ZN4cppu30ImplHelper_getImplementationIdEPNS_10class_dataE;
+_ZN4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZN4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu30WeakAggComponentImplHelperBase16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZN4cppu30WeakAggComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZN4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZN4cppu30WeakAggComponentImplHelperBase7disposeEv;
+_ZN4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZN4cppu30WeakAggComponentImplHelperBase9disposingEv;
+_ZN4cppu30WeakAggComponentImplHelperBaseC1ERN3osl5MutexE;
+_ZN4cppu30WeakAggComponentImplHelperBaseC2ERN3osl5MutexE;
+_ZN4cppu30WeakAggComponentImplHelperBaseD0Ev;
+_ZN4cppu30WeakAggComponentImplHelperBaseD1Ev;
+_ZN4cppu30WeakAggComponentImplHelperBaseD2Ev;
+_ZN4cppu31createStandardClassWithSequenceERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_10reflection9XIdlClassEEERKNS3_8SequenceISB_EE;
+_ZN4cppu32WeakComponentImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu32createOneInstanceRegistryFactoryERKN3com3sun4star3uno9ReferenceINS2_4lang20XMultiServiceFactoryEEERKN3rtl8OUStringERKNS4_INS2_8registry12XRegistryKeyEEE;
+_ZN4cppu33bootstrap_InitialComponentContextERKN3com3sun4star3uno9ReferenceINS2_8registry15XSimpleRegistryEEERKN3rtl8OUStringE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper12addInterfaceERKN3com3sun4star3uno4TypeERKNS4_9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper15disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper15removeInterfaceERKN3com3sun4star3uno4TypeERKNS4_9ReferenceINS4_10XInterfaceEEE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelper5clearEv;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperC1ERN3osl5MutexE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperC2ERN3osl5MutexE;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperD1Ev;
+_ZN4cppu34OMultiTypeInterfaceContainerHelperD2Ev;
+_ZN4cppu35WeakAggComponentImplHelper_getTypesEPNS_10class_dataE;
+_ZN4cppu35WeakAggComponentImplHelper_queryAggERKN3com3sun4star3uno4TypeEPNS_10class_dataEPvPNS_30WeakAggComponentImplHelperBaseE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3212addInterfaceERKlRKN3com3sun4star3uno9ReferenceINS6_10XInterfaceEEE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3215disposeAndClearERKN3com3sun4star4lang11EventObjectE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt3215removeInterfaceERKlRKN3com3sun4star3uno9ReferenceINS6_10XInterfaceEEE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt325clearEv;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32C1ERN3osl5MutexE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32C2ERN3osl5MutexE;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32D1Ev;
+_ZN4cppu39OMultiTypeInterfaceContainerHelperInt32D2Ev;
+_ZN4cppu40defaultBootstrap_InitialComponentContextERKN3rtl8OUStringE;
+_ZN4cppu40defaultBootstrap_InitialComponentContextEv;
+_ZN4cppu9ClassData15writeTypeOffsetERKN3com3sun4star3uno4TypeEl;
+_ZN4cppu9ClassData16initTypeProviderEv;
+_ZN4cppu9ClassData19getImplementationIdEv;
+_ZN4cppu9ClassData5queryERKN3com3sun4star3uno4TypeEPNS3_4lang13XTypeProviderE;
+_ZN4cppu9ClassData8getTypesEv;
+_ZNK3com3sun4star3uno19WeakReferenceHelper3getEv;
+_ZNK4cppu17OImplementationId19getImplementationIdEv;
+_ZNK4cppu20OPropertyArrayHelper8getCountEv;
+_ZNK4cppu25OInterfaceContainerHelper11getElementsEv;
+_ZNK4cppu25OInterfaceContainerHelper9getLengthEv;
+_ZNK4cppu34OMultiTypeInterfaceContainerHelper12getContainerERKN3com3sun4star3uno4TypeE;
+_ZNK4cppu34OMultiTypeInterfaceContainerHelper17getContainedTypesEv;
+_ZNK4cppu39OMultiTypeInterfaceContainerHelperInt3212getContainerERKl;
+_ZNK4cppu39OMultiTypeInterfaceContainerHelperInt3217getContainedTypesEv;
+_ZTVN4cppu11OWeakObjectE;
+_ZTVN4cppu14OWeakAggObjectE;
+_ZTVN4cppu16OComponentHelperE;
+_ZTVN4cppu18OPropertySetHelperE;
+_ZTVN4cppu20IPropertyArrayHelperE;
+_ZTVN4cppu20OPropertyArrayHelperE;
+_ZTVN4cppu27WeakComponentImplHelperBaseE;
+_ZTVN4cppu30WeakAggComponentImplHelperBaseE;
+component_getDescriptionFunc;
+_ZN4cppu20OPropertyArrayHelperD0Ev;
+_ZN4cppu20OPropertyArrayHelperD1Ev;
+_ZThn16_N4cppu14OWeakAggObject12setDelegatorERKN3com3sun4star3uno9ReferenceINS4_10XInterfaceEEE;
+_ZThn16_N4cppu14OWeakAggObject14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu14OWeakAggObject16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu14OWeakAggObject7acquireEv;
+_ZThn16_N4cppu14OWeakAggObject7releaseEv;
+_ZThn16_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu16OComponentHelper16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu16OComponentHelper7acquireEv;
+_ZThn16_N4cppu16OComponentHelper7releaseEv;
+_ZThn16_N4cppu27WeakComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu27WeakComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn16_N4cppu27WeakComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn16_N4cppu27WeakComponentImplHelperBase7acquireEv;
+_ZThn16_N4cppu27WeakComponentImplHelperBase7disposeEv;
+_ZThn16_N4cppu27WeakComponentImplHelperBase7releaseEv;
+_ZThn16_N4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu30WeakAggComponentImplHelperBase16queryAggregationERKN3com3sun4star3uno4TypeE;
+_ZThn16_N4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZThn16_N4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZThn24_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn24_N4cppu16OComponentHelper7acquireEv;
+_ZThn24_N4cppu16OComponentHelper7releaseEv;
+_ZThn24_N4cppu16OComponentHelper8getTypesEv;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase7acquireEv;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase7disposeEv;
+_ZThn24_N4cppu30WeakAggComponentImplHelperBase7releaseEv;
+_ZThn28_N4cppu16OComponentHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn28_N4cppu16OComponentHelper16addEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn28_N4cppu16OComponentHelper19removeEventListenerERKN3com3sun4star3uno9ReferenceINS3_4lang14XEventListenerEEE;
+_ZThn28_N4cppu16OComponentHelper7acquireEv;
+_ZThn28_N4cppu16OComponentHelper7disposeEv;
+_ZThn28_N4cppu16OComponentHelper7releaseEv;
+_ZThn4_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn4_N4cppu18OPropertySetHelper20getFastPropertyValueEl;
+_ZThn4_N4cppu18OPropertySetHelper20setFastPropertyValueElRKN3com3sun4star3uno3AnyE;
+_ZThn8_N4cppu18OPropertySetHelper14queryInterfaceERKN3com3sun4star3uno4TypeE;
+_ZThn8_N4cppu18OPropertySetHelper16getPropertyValueERKN3rtl8OUStringE;
+_ZThn8_N4cppu18OPropertySetHelper16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+_ZThn8_N4cppu18OPropertySetHelper25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZThn8_N4cppu18OPropertySetHelper25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+_ZThn8_N4cppu18OPropertySetHelper28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+_ZThn8_N4cppu18OPropertySetHelper28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+
+_ZN4cppu13AccessControl19checkFilePermissionERKN3rtl8OUStringES4_;
+_ZN4cppu13AccessControl21checkSocketPermissionERKN3rtl8OUStringES4_;
+_ZN4cppu13AccessControl22checkRuntimePermissionERKN3rtl8OUStringE;
+_ZN4cppu13AccessControlC1ERKN3com3sun4star3uno9ReferenceINS3_8security17XAccessControllerEEE;
+_ZN4cppu13AccessControlC2ERKN3com3sun4star3uno9ReferenceINS3_8security17XAccessControllerEEE;
+_ZN4cppu13AccessControlC1ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE;
+_ZN4cppu13AccessControlC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE;
+_ZN4cppu13AccessControlC1ERKS0_;
+_ZN4cppu13AccessControlC2ERKS0_;
+
+_ZN4cppu16UnoUrlDescriptorC1ERKN3rtl8OUStringE;
+_ZN4cppu16UnoUrlDescriptorC1ERKS0_;
+_ZN4cppu16UnoUrlDescriptorC2ERKN3rtl8OUStringE;
+_ZN4cppu16UnoUrlDescriptorC2ERKS0_;
+_ZN4cppu16UnoUrlDescriptorD1Ev;
+_ZN4cppu16UnoUrlDescriptorD2Ev;
+_ZN4cppu16UnoUrlDescriptoraSERKS0_;
+_ZN4cppu6UnoUrlC1ERKN3rtl8OUStringE;
+_ZN4cppu6UnoUrlC1ERKS0_;
+_ZN4cppu6UnoUrlC2ERKN3rtl8OUStringE;
+_ZN4cppu6UnoUrlC2ERKS0_;
+_ZN4cppu6UnoUrlD1Ev;
+_ZN4cppu6UnoUrlD2Ev;
+_ZN4cppu6UnoUrlaSERKS0_;
+_ZNK4cppu16UnoUrlDescriptor12getParameterERKN3rtl8OUStringE;
+_ZNK4cppu16UnoUrlDescriptor12hasParameterERKN3rtl8OUStringE;
+_ZNK4cppu16UnoUrlDescriptor13getDescriptorEv;
+_ZNK4cppu16UnoUrlDescriptor7getNameEv;
+_ZNK4cppu6UnoUrl11getProtocolEv;
+_ZNK4cppu6UnoUrl13getConnectionEv;
+_ZNK4cppu6UnoUrl13getObjectNameEv;
+
+ local:
+ *;
+};
+
+UDK_3.1 {
+ global:
+ _ZN4cppu18getCaughtExceptionEv;
+
+ _ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEb;
+ _ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEb;
+
+ _ZN4cppu9bootstrapEv;
+ _ZN4cppu18BootstrapExceptionC1Ev;
+ _ZN4cppu18BootstrapExceptionC2Ev;
+ _ZN4cppu18BootstrapExceptionC1ERKN3rtl8OUStringE;
+ _ZN4cppu18BootstrapExceptionC2ERKN3rtl8OUStringE;
+ _ZN4cppu18BootstrapExceptionC1ERKS0_;
+ _ZN4cppu18BootstrapExceptionC2ERKS0_;
+ _ZN4cppu18BootstrapExceptionD0Ev;
+ _ZN4cppu18BootstrapExceptionD1Ev;
+ _ZN4cppu18BootstrapExceptionD2Ev;
+ _ZN4cppu18BootstrapExceptionaSERKS0_;
+ _ZNK4cppu18BootstrapException10getMessageEv;
+ # _ZTIN4cppu18BootstrapExceptionE;
+ # _ZTSN4cppu18BootstrapExceptionE;
+} UDK_3_0_0;
+
+UDK_3.2 {
+ global:
+ _ZN4cppu20PropertySetMixinImpl10prepareSetERKN3rtl8OUStringERKN3com3sun4star3uno3AnyESB_PNS0_14BoundListenersE;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersC1Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersC2Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersD1Ev;
+ _ZN4cppu20PropertySetMixinImpl14BoundListenersD2Ev;
+ _ZN4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZN4cppu20PropertySetMixinImpl16getPropertyValueERKN3rtl8OUStringE;
+ _ZN4cppu20PropertySetMixinImpl16setPropertyValueERKN3rtl8OUStringERKN3com3sun4star3uno3AnyE;
+ _ZN4cppu20PropertySetMixinImpl17getPropertyValuesEv;
+ _ZN4cppu20PropertySetMixinImpl17setPropertyValuesERKN3com3sun4star3uno8SequenceINS3_5beans13PropertyValueEEE;
+ _ZN4cppu20PropertySetMixinImpl18getPropertySetInfoEv;
+ _ZN4cppu20PropertySetMixinImpl20getFastPropertyValueEl;
+ _ZN4cppu20PropertySetMixinImpl20setFastPropertyValueElRKN3com3sun4star3uno3AnyE;
+ _ZN4cppu20PropertySetMixinImpl25addPropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl25addVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl28removePropertyChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XPropertyChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl28removeVetoableChangeListenerERKN3rtl8OUStringERKN3com3sun4star3uno9ReferenceINS7_5beans23XVetoableChangeListenerEEE;
+ _ZN4cppu20PropertySetMixinImpl7disposeEv;
+ _ZN4cppu20PropertySetMixinImplC1ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEENS0_10ImplementsERKNS4_8SequenceIN3rtl8OUStringEEERKNS4_4TypeE;
+ _ZN4cppu20PropertySetMixinImplC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEENS0_10ImplementsERKNS4_8SequenceIN3rtl8OUStringEEERKNS4_4TypeE;
+ _ZN4cppu20PropertySetMixinImplD1Ev;
+ _ZN4cppu20PropertySetMixinImplD2Ev;
+ _ZNK4cppu20PropertySetMixinImpl14BoundListeners6notifyEv;
+ _ZThn4_N4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZThn4_N4cppu20PropertySetMixinImpl20getFastPropertyValueEl;
+ _ZThn4_N4cppu20PropertySetMixinImpl20setFastPropertyValueElRKN3com3sun4star3uno3AnyE;
+ _ZThn8_N4cppu20PropertySetMixinImpl14queryInterfaceERKN3com3sun4star3uno4TypeE;
+ _ZThn8_N4cppu20PropertySetMixinImpl17getPropertyValuesEv;
+ _ZThn8_N4cppu20PropertySetMixinImpl17setPropertyValuesERKN3com3sun4star3uno8SequenceINS3_5beans13PropertyValueEEE;
+} UDK_3.1;
+
+UDK_3.3 { # OOo 2.3
+ global:
+ _ZN4cppu18OPropertySetHelper8getTypesEv;
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.4
+ global:
+ _ZN4cppu19bootstrap_expandUriERKN3rtl8OUStringE; # rtl::OUString cppu::bootstrap_expandUri(rtl::OUString const &)
+} UDK_3.3;
+
+UDK_3.5 { # OOo 3.0
+ global:
+ _ZN4cppu18OPropertySetHelperC1ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
+ _ZN4cppu18OPropertySetHelperC2ERNS_19OBroadcastHelperVarINS_34OMultiTypeInterfaceContainerHelperEN3com3sun4star3uno4TypeEEEPNS_22IEventNotificationHookEb;
+ _ZN4cppu28createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
+} UDK_3.4;
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
new file mode 100644
index 000000000000..0c25a082cb27
--- /dev/null
+++ b/cppuhelper/source/implbase.cxx
@@ -0,0 +1,471 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/compbase.hxx>
+#include <osl/diagnose.h>
+#include <rtl/uuid.h>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+using namespace ::osl;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+//==================================================================================================
+Mutex & SAL_CALL getImplHelperInitMutex(void) SAL_THROW( () )
+{
+ static Mutex * s_pMutex = 0;
+ if (! s_pMutex)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! s_pMutex)
+ {
+ static Mutex s_aMutex;
+ s_pMutex = & s_aMutex;
+ }
+ }
+ return * s_pMutex;
+}
+
+// ClassDataBase
+//__________________________________________________________________________________________________
+ClassDataBase::ClassDataBase() SAL_THROW( () )
+ : bOffsetsInit( sal_False )
+ , nType2Offset( 0 )
+ , nClassCode( 0 )
+ , pTypes( 0 )
+ , pId( 0 )
+{
+}
+//__________________________________________________________________________________________________
+ClassDataBase::ClassDataBase( sal_Int32 nClassCode_ ) SAL_THROW( () )
+ : bOffsetsInit( sal_False )
+ , nType2Offset( 0 )
+ , nClassCode( nClassCode_ )
+ , pTypes( 0 )
+ , pId( 0 )
+{
+}
+//__________________________________________________________________________________________________
+ClassDataBase::~ClassDataBase() SAL_THROW( () )
+{
+ delete pTypes;
+ delete pId;
+
+ for ( sal_Int32 nPos = nType2Offset; nPos--; )
+ {
+ typelib_typedescription_release(
+ (typelib_TypeDescription *)((ClassData *)this)->arType2Offset[nPos].pTD );
+ }
+}
+
+// ClassData
+//__________________________________________________________________________________________________
+void ClassData::writeTypeOffset( const Type & rType, sal_Int32 nOffset ) SAL_THROW( () )
+{
+ arType2Offset[nType2Offset].nOffset = nOffset;
+
+ arType2Offset[nType2Offset].pTD = 0;
+ typelib_typedescriptionreference_getDescription(
+ (typelib_TypeDescription **)&arType2Offset[nType2Offset].pTD, rType.getTypeLibType() );
+
+ if (arType2Offset[nType2Offset].pTD)
+ ++nType2Offset;
+#if OSL_DEBUG_LEVEL > 1
+ else
+ {
+ OString msg( "### cannot get type description for " );
+ msg += OUStringToOString( rType.getTypeName(), RTL_TEXTENCODING_ASCII_US );
+ OSL_ENSURE( sal_False, msg.getStr() );
+ }
+#endif
+}
+//__________________________________________________________________________________________________
+void ClassData::initTypeProvider() SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pTypes)
+ {
+ // create id
+ pId = new Sequence< sal_Int8 >( 16 );
+ rtl_createUuid( (sal_uInt8 *)pId->getArray(), 0, sal_True );
+
+ // collect types
+ Sequence< Type > * types = new Sequence< Type >(
+ nType2Offset + 1 + (nClassCode == 4 ? 2 : nClassCode) );
+ Type * pTypeAr = types->getArray();
+
+ // given types
+ sal_Int32 nPos = nType2Offset;
+ while (nPos--)
+ pTypeAr[nPos] = ((typelib_TypeDescription *)arType2Offset[nPos].pTD)->pWeakRef;
+
+ // XTypeProvider
+ pTypeAr[nType2Offset] = ::getCppuType( (const Reference< lang::XTypeProvider > *)0 );
+
+ // class code extra types: [[XComponent,] XWeak[, XAggregation]]
+ switch (nClassCode)
+ {
+ case 4:
+ pTypeAr[nType2Offset +2] = ::getCppuType( (const Reference< lang::XComponent > *)0 );
+ pTypeAr[nType2Offset +1] = ::getCppuType( (const Reference< XWeak > *)0 );
+ break;
+ case 3:
+ pTypeAr[nType2Offset +3] = ::getCppuType( (const Reference< lang::XComponent > *)0 );
+ case 2:
+ pTypeAr[nType2Offset +2] = ::getCppuType( (const Reference< XAggregation > *)0 );
+ case 1:
+ pTypeAr[nType2Offset +1] = ::getCppuType( (const Reference< XWeak > *)0 );
+ }
+
+ pTypes = types;
+ }
+}
+//__________________________________________________________________________________________________
+Sequence< Type > ClassData::getTypes() SAL_THROW( () )
+{
+ if (! pTypes)
+ initTypeProvider();
+ return *pTypes;
+}
+//__________________________________________________________________________________________________
+Sequence< sal_Int8 > ClassData::getImplementationId() SAL_THROW( () )
+{
+ if (! pTypes)
+ initTypeProvider();
+ return *pId;
+}
+
+//--------------------------------------------------------------------------------------------------
+static inline sal_Bool td_equals(
+ typelib_TypeDescription * pTD, typelib_TypeDescriptionReference * pType )
+ SAL_THROW( () )
+{
+ return (pTD->pWeakRef == pType ||
+ (pTD->pTypeName->length == pType->pTypeName->length &&
+ rtl_ustr_compare( pTD->pTypeName->buffer, pType->pTypeName->buffer ) == 0));
+}
+//__________________________________________________________________________________________________
+Any ClassData::query( const Type & rType, lang::XTypeProvider * pBase ) SAL_THROW( () )
+{
+ if (rType == ::getCppuType( (const Reference< XInterface > *)0 ))
+ return Any( &pBase, ::getCppuType( (const Reference< XInterface > *)0 ) );
+ for ( sal_Int32 nPos = 0; nPos < nType2Offset; ++nPos )
+ {
+ const Type_Offset & rTO = arType2Offset[nPos];
+ typelib_InterfaceTypeDescription * pTD = rTO.pTD;
+ while (pTD)
+ {
+ if (td_equals( (typelib_TypeDescription *)pTD,
+ *(typelib_TypeDescriptionReference **)&rType ))
+ {
+ void * pInterface = (char *)pBase + rTO.nOffset;
+ return Any( &pInterface, (typelib_TypeDescription *)pTD );
+ }
+ pTD = pTD->pBaseTypeDescription;
+ }
+ }
+ if (rType == ::getCppuType( (const Reference< lang::XTypeProvider > *)0 ))
+ return Any( &pBase, ::getCppuType( (const Reference< lang::XTypeProvider > *)0 ) );
+
+ return Any();
+}
+
+//##################################################################################################
+//##################################################################################################
+//##################################################################################################
+
+// WeakComponentImplHelperBase
+//__________________________________________________________________________________________________
+WeakComponentImplHelperBase::WeakComponentImplHelperBase( Mutex & rMutex )
+ SAL_THROW( () )
+ : rBHelper( rMutex )
+{
+}
+//__________________________________________________________________________________________________
+WeakComponentImplHelperBase::~WeakComponentImplHelperBase()
+ SAL_THROW( () )
+{
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::disposing()
+{
+}
+//__________________________________________________________________________________________________
+Any WeakComponentImplHelperBase::queryInterface( Type const & rType )
+ throw (RuntimeException)
+{
+ if (rType == ::getCppuType( (Reference< lang::XComponent > const *)0 ))
+ {
+ void * p = static_cast< lang::XComponent * >( this );
+ return Any( &p, rType );
+ }
+ return OWeakObject::queryInterface( rType );
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::acquire()
+ throw ()
+{
+ OWeakObject::acquire();
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::release()
+ throw ()
+{
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // ensure no other references are created, via the weak connection point, from now on
+ disposeWeakConnectionPoint();
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if (! rBHelper.bDisposed) {
+ try {
+ dispose();
+ }
+ catch (RuntimeException const& exc) { // don't break throw ()
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ OSL_ASSERT( rBHelper.bDisposed );
+ }
+ OWeakObject::release();
+ }
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::dispose()
+ throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (!rBHelper.bDisposed && !rBHelper.bInDispose)
+ {
+ rBHelper.bInDispose = sal_True;
+ aGuard.clear();
+ try
+ {
+ // side effect: keeping a reference to this
+ lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ try
+ {
+ rBHelper.aLC.disposeAndClear( aEvt );
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard2( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw;
+ }
+ MutexGuard aGuard2( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ }
+ catch (RuntimeException &)
+ {
+ throw;
+ }
+ catch (Exception & exc)
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
+ exc.Message, Reference< XInterface >() );
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::addEventListener(
+ Reference< lang::XEventListener > const & xListener )
+ throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ xListener->disposing( aEvt );
+ }
+ else
+ {
+ rBHelper.addListener( ::getCppuType( &xListener ), xListener );
+ }
+}
+//__________________________________________________________________________________________________
+void WeakComponentImplHelperBase::removeEventListener(
+ Reference< lang::XEventListener > const & xListener )
+ throw (RuntimeException)
+{
+ rBHelper.removeListener( ::getCppuType( &xListener ), xListener );
+}
+
+// WeakAggComponentImplHelperBase
+//__________________________________________________________________________________________________
+WeakAggComponentImplHelperBase::WeakAggComponentImplHelperBase( Mutex & rMutex )
+ SAL_THROW( () )
+ : rBHelper( rMutex )
+{
+}
+//__________________________________________________________________________________________________
+WeakAggComponentImplHelperBase::~WeakAggComponentImplHelperBase()
+ SAL_THROW( () )
+{
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::disposing()
+{
+}
+//__________________________________________________________________________________________________
+Any WeakAggComponentImplHelperBase::queryInterface( Type const & rType )
+ throw (RuntimeException)
+{
+ return OWeakAggObject::queryInterface( rType );
+}
+//__________________________________________________________________________________________________
+Any WeakAggComponentImplHelperBase::queryAggregation( Type const & rType )
+ throw (RuntimeException)
+{
+ if (rType == ::getCppuType( (Reference< lang::XComponent > const *)0 ))
+ {
+ void * p = static_cast< lang::XComponent * >( this );
+ return Any( &p, rType );
+ }
+ return OWeakAggObject::queryAggregation( rType );
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::acquire()
+ throw ()
+{
+ OWeakAggObject::acquire();
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::release()
+ throw ()
+{
+ Reference<XInterface> const xDelegator_(xDelegator);
+ if (xDelegator_.is()) {
+ OWeakAggObject::release();
+ }
+ else if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // ensure no other references are created, via the weak connection point, from now on
+ disposeWeakConnectionPoint();
+ // restore reference count:
+ osl_incrementInterlockedCount( &m_refCount );
+ if (! rBHelper.bDisposed) {
+ try {
+ dispose();
+ }
+ catch (RuntimeException const& exc) { // don't break throw ()
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ OSL_ASSERT( rBHelper.bDisposed );
+ }
+ OWeakAggObject::release();
+ }
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::dispose()
+ throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (!rBHelper.bDisposed && !rBHelper.bInDispose)
+ {
+ rBHelper.bInDispose = sal_True;
+ aGuard.clear();
+ try
+ {
+ // side effect: keeping a reference to this
+ lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ try
+ {
+ rBHelper.aLC.disposeAndClear( aEvt );
+ disposing();
+ }
+ catch (...)
+ {
+ MutexGuard aGuard2( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw;
+ }
+ MutexGuard aGuard2( rBHelper.rMutex );
+ // bDisposed and bInDispose must be set in this order:
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ }
+ catch (RuntimeException &)
+ {
+ throw;
+ }
+ catch (Exception & exc)
+ {
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected UNO exception caught: ") ) +
+ exc.Message, Reference< XInterface >() );
+ }
+ }
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::addEventListener(
+ Reference< lang::XEventListener > const & xListener )
+ throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ lang::EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ xListener->disposing( aEvt );
+ }
+ else
+ {
+ rBHelper.addListener( ::getCppuType( &xListener ), xListener );
+ }
+}
+//__________________________________________________________________________________________________
+void WeakAggComponentImplHelperBase::removeEventListener(
+ Reference< lang::XEventListener > const & xListener )
+ throw (RuntimeException)
+{
+ rBHelper.removeListener( ::getCppuType( &xListener ), xListener );
+}
+
+}
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
new file mode 100644
index 000000000000..6d89bca96d6e
--- /dev/null
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -0,0 +1,469 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <sal/alloca.h>
+
+#include <string.h>
+#include <osl/diagnose.h>
+#include <rtl/byteseq.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/uuid.h>
+#include <cppuhelper/compbase_ex.hxx>
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+
+/** Shared mutex for implementation helper initialization.
+ Not for public use.
+*/
+::osl::Mutex & SAL_CALL getImplHelperInitMutex(void) SAL_THROW( () );
+
+//--------------------------------------------------------------------------------------------------
+static inline void checkInterface( Type const & rType )
+ SAL_THROW( (RuntimeException) )
+{
+ if (TypeClass_INTERFACE != rType.getTypeClass())
+ {
+ OUStringBuffer buf( 64 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("querying for interface \"") );
+ buf.append( rType.getTypeName() );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\": no interface type!") );
+ OUString msg( buf.makeStringAndClear() );
+#if OSL_DEBUG_LEVEL > 0
+ OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( 0, str.getStr() );
+#endif
+ throw RuntimeException( msg, Reference< XInterface >() );
+ }
+}
+//--------------------------------------------------------------------------------------------------
+static inline bool isXInterface( rtl_uString * pStr ) SAL_THROW( () )
+{
+ return (((OUString const *)&pStr)->equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XInterface") ) != sal_False);
+}
+//--------------------------------------------------------------------------------------------------
+static inline void * makeInterface( sal_IntPtr nOffset, void * that ) SAL_THROW( () )
+{
+ return (((char *)that) + nOffset);
+}
+//--------------------------------------------------------------------------------------------------
+static inline bool __td_equals(
+ typelib_TypeDescriptionReference const * pTDR1,
+ typelib_TypeDescriptionReference const * pTDR2 )
+ SAL_THROW( () )
+{
+ return ((pTDR1 == pTDR2) ||
+ ((OUString const *)&pTDR1->pTypeName)->equals( *(OUString const *)&pTDR2->pTypeName ) != sal_False);
+}
+//--------------------------------------------------------------------------------------------------
+static inline type_entry * __getTypeEntries( class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ type_entry * pEntries = cd->m_typeEntries;
+ if (! cd->m_storedTypeRefs) // not inited?
+ {
+ MutexGuard guard( getImplHelperInitMutex() );
+ if (! cd->m_storedTypeRefs) // not inited?
+ {
+ // get all types
+ for ( sal_Int32 n = cd->m_nTypes; n--; )
+ {
+ type_entry * pEntry = &pEntries[ n ];
+ Type const & rType = (*pEntry->m_type.getCppuType)( 0 );
+ OSL_ENSURE( rType.getTypeClass() == TypeClass_INTERFACE, "### wrong helper init: expected interface!" );
+ OSL_ENSURE( ! isXInterface( rType.getTypeLibType()->pTypeName ), "### want to implement XInterface: template argument is XInterface?!?!?!" );
+ if (rType.getTypeClass() != TypeClass_INTERFACE)
+ {
+ OUStringBuffer buf( 48 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("type \"") );
+ buf.append( rType.getTypeName() );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" is no interface type!") );
+ OUString msg( buf.makeStringAndClear() );
+#if OSL_DEBUG_LEVEL > 0
+ OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( 0, str.getStr() );
+#endif
+ throw RuntimeException( msg, Reference< XInterface >() );
+ }
+ // ref is statically held by getCppuType()
+ pEntry->m_type.typeRef = rType.getTypeLibType();
+ }
+ cd->m_storedTypeRefs = sal_True;
+ }
+ }
+ return pEntries;
+}
+//--------------------------------------------------------------------------------------------------
+static inline void __fillTypes( Type * types, class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ type_entry * pEntries = __getTypeEntries( cd );
+ for ( sal_Int32 n = cd->m_nTypes; n--; )
+ {
+ types[ n ] = pEntries[ n ].m_type.typeRef;
+ }
+}
+//--------------------------------------------------------------------------------------------------
+namespace {
+
+bool recursivelyFindType(
+ typelib_TypeDescriptionReference const * demandedType,
+ typelib_InterfaceTypeDescription const * type, sal_IntPtr * offset)
+{
+ // This code assumes that the vtables of a multiple-inheritance class (the
+ // offset amount by which to adjust the this pointer) follow one another in
+ // the object layout, and that they contain slots for the inherited classes
+ // in a specifc order. In theory, that need not hold for any given
+ // platform; in practice, it seems to work well on all supported platforms:
+ next:
+ for (sal_Int32 i = 0; i < type->nBaseTypes; ++i) {
+ if (i > 0) {
+ *offset += sizeof (void *);
+ }
+ typelib_InterfaceTypeDescription const * base = type->ppBaseTypes[i];
+ // ignore XInterface:
+ if (base->nBaseTypes > 0) {
+ if (__td_equals(
+ reinterpret_cast<
+ typelib_TypeDescriptionReference const * >(base),
+ demandedType))
+ {
+ return true;
+ }
+ // Profiling showed that it is important to speed up the common case
+ // of only one base:
+ if (type->nBaseTypes == 1) {
+ type = base;
+ goto next;
+ }
+ if (recursivelyFindType(demandedType, base, offset)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+}
+
+static inline void * __queryDeepNoXInterface(
+ typelib_TypeDescriptionReference * pDemandedTDR, class_data * cd, void * that )
+ SAL_THROW( (RuntimeException) )
+{
+ type_entry * pEntries = __getTypeEntries( cd );
+ sal_Int32 nTypes = cd->m_nTypes;
+ sal_Int32 n;
+
+ // try top interfaces without getting td
+ for ( n = 0; n < nTypes; ++n )
+ {
+ if (__td_equals( pEntries[ n ].m_type.typeRef, pDemandedTDR ))
+ {
+ return makeInterface( pEntries[ n ].m_offset, that );
+ }
+ }
+ // query deep getting td
+ for ( n = 0; n < nTypes; ++n )
+ {
+ typelib_TypeDescription * pTD = 0;
+ TYPELIB_DANGER_GET( &pTD, pEntries[ n ].m_type.typeRef );
+ if (pTD)
+ {
+ // exclude top (already tested) and bottom (XInterface) interface
+ OSL_ENSURE(
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(pTD)->
+ nBaseTypes > 0,
+ "### want to implement XInterface:"
+ " template argument is XInterface?!?!?!" );
+ sal_IntPtr offset = pEntries[n].m_offset;
+ bool found = recursivelyFindType(
+ pDemandedTDR,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(pTD),
+ &offset);
+ TYPELIB_DANGER_RELEASE( pTD );
+ if (found) {
+ return makeInterface( offset, that );
+ }
+ }
+ else
+ {
+ OUStringBuffer buf( 64 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("cannot get type description for type \"") );
+ buf.append( pEntries[ n ].m_type.typeRef->pTypeName );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") );
+ OUString msg( buf.makeStringAndClear() );
+#if OSL_DEBUG_LEVEL > 0
+ OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( 0, str.getStr() );
+#endif
+ throw RuntimeException( msg, Reference< XInterface >() );
+ }
+ }
+ return 0;
+}
+
+// ImplHelper
+//==================================================================================================
+Any SAL_CALL ImplHelper_query(
+ Type const & rType, class_data * cd, void * that )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ void * p;
+ // shortcut for XInterface
+ if (isXInterface( pTDR->pTypeName ))
+ {
+ // take first one
+ p = makeInterface( cd->m_typeEntries[ 0 ].m_offset, that );
+ }
+ else
+ {
+ p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (! p)
+ {
+ return Any();
+ }
+ }
+ return Any( &p, pTDR );
+}
+//==================================================================================================
+Any SAL_CALL ImplHelper_queryNoXInterface(
+ Type const & rType, class_data * cd, void * that )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ void * p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (p)
+ {
+ return Any( &p, pTDR );
+ }
+ else
+ {
+ return Any();
+ }
+}
+//==================================================================================================
+Sequence< sal_Int8 > SAL_CALL ImplHelper_getImplementationId( class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ if (! cd->m_createdId)
+ {
+ sal_uInt8 * id = (sal_uInt8 *)alloca( 16 );
+ ::rtl_createUuid( (sal_uInt8 *)id, 0, sal_True );
+
+ MutexGuard guard( getImplHelperInitMutex() );
+ if (! cd->m_createdId)
+ {
+ memcpy( cd->m_id, id, 16 );
+ cd->m_createdId = sal_True;
+ }
+ }
+
+ sal_Sequence * seq = 0;
+ ::rtl_byte_sequence_constructFromArray( &seq, cd->m_id, 16 );
+ return Sequence< sal_Int8 >( seq, SAL_NO_ACQUIRE );
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL ImplHelper_getTypes(
+ class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ Sequence< Type > types( cd->m_nTypes );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ return types;
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL ImplInhHelper_getTypes(
+ class_data * cd, Sequence< Type > const & rAddTypes )
+ SAL_THROW( (RuntimeException) )
+{
+ sal_Int32 nImplTypes = cd->m_nTypes;
+ sal_Int32 nAddTypes = rAddTypes.getLength();
+ Sequence< Type > types( nImplTypes + nAddTypes );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ // append base types
+ Type const * pAddTypes = rAddTypes.getConstArray();
+ while (nAddTypes--)
+ {
+ pTypes[ nImplTypes + nAddTypes ] = pAddTypes[ nAddTypes ];
+ }
+ return types;
+}
+
+// WeakImplHelper
+//==================================================================================================
+Any SAL_CALL WeakImplHelper_query(
+ Type const & rType, class_data * cd, void * that, OWeakObject * pBase )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ // shortcut XInterface to OWeakObject
+ if (! isXInterface( pTDR->pTypeName ))
+ {
+ void * p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (p)
+ {
+ return Any( &p, pTDR );
+ }
+ }
+ return pBase->OWeakObject::queryInterface( rType );
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL WeakImplHelper_getTypes(
+ class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ sal_Int32 nTypes = cd->m_nTypes;
+ Sequence< Type > types( nTypes +1 );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ pTypes[ nTypes ] = ::getCppuType( (Reference< XWeak > const *)0 );
+ return types;
+}
+
+// WeakAggImplHelper
+//==================================================================================================
+Any SAL_CALL WeakAggImplHelper_queryAgg(
+ Type const & rType, class_data * cd, void * that, OWeakAggObject * pBase )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ // shortcut XInterface to OWeakAggObject
+ if (! isXInterface( pTDR->pTypeName ))
+ {
+ void * p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (p)
+ {
+ return Any( &p, pTDR );
+ }
+ }
+ return pBase->OWeakAggObject::queryAggregation( rType );
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL WeakAggImplHelper_getTypes(
+ class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ sal_Int32 nTypes = cd->m_nTypes;
+ Sequence< Type > types( nTypes +2 );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ pTypes[ nTypes++ ] = ::getCppuType( (Reference< XWeak > const *)0 );
+ pTypes[ nTypes ] = ::getCppuType( (const Reference< XAggregation > *)0 );
+ return types;
+}
+
+// WeakComponentImplHelper
+//==================================================================================================
+Any SAL_CALL WeakComponentImplHelper_query(
+ Type const & rType, class_data * cd, void * that, WeakComponentImplHelperBase * pBase )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ // shortcut XInterface to WeakComponentImplHelperBase
+ if (! isXInterface( pTDR->pTypeName ))
+ {
+ void * p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (p)
+ {
+ return Any( &p, pTDR );
+ }
+ }
+ return pBase->WeakComponentImplHelperBase::queryInterface( rType );
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL WeakComponentImplHelper_getTypes(
+ class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ sal_Int32 nTypes = cd->m_nTypes;
+ Sequence< Type > types( nTypes +2 );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ pTypes[ nTypes++ ] = ::getCppuType( (Reference< XWeak > const *)0 );
+ pTypes[ nTypes ] = ::getCppuType( (Reference< lang::XComponent > const *)0 );
+ return types;
+}
+
+// WeakAggComponentImplHelper
+//==================================================================================================
+Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
+ Type const & rType, class_data * cd, void * that, WeakAggComponentImplHelperBase * pBase )
+ SAL_THROW( (RuntimeException) )
+{
+ checkInterface( rType );
+ typelib_TypeDescriptionReference * pTDR = rType.getTypeLibType();
+
+ // shortcut XInterface to WeakAggComponentImplHelperBase
+ if (! isXInterface( pTDR->pTypeName ))
+ {
+ void * p = __queryDeepNoXInterface( pTDR, cd, that );
+ if (p)
+ {
+ return Any( &p, pTDR );
+ }
+ }
+ return pBase->WeakAggComponentImplHelperBase::queryAggregation( rType );
+}
+//==================================================================================================
+Sequence< Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
+ class_data * cd )
+ SAL_THROW( (RuntimeException) )
+{
+ sal_Int32 nTypes = cd->m_nTypes;
+ Sequence< Type > types( nTypes +3 );
+ Type * pTypes = types.getArray();
+ __fillTypes( pTypes, cd );
+ pTypes[ nTypes++ ] = ::getCppuType( (Reference< XWeak > const *)0 );
+ pTypes[ nTypes++ ] = ::getCppuType( (const Reference< XAggregation > *)0 );
+ pTypes[ nTypes ] = ::getCppuType( (const Reference< lang::XComponent > *)0 );
+ return types;
+}
+
+}
diff --git a/cppuhelper/source/implementationentry.cxx b/cppuhelper/source/implementationentry.cxx
new file mode 100644
index 000000000000..967a1095fce4
--- /dev/null
+++ b/cppuhelper/source/implementationentry.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <cppuhelper/implementationentry.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+namespace cppu {
+
+sal_Bool component_writeInfoHelper(
+ void *, void *pRegistryKey , const struct ImplementationEntry entries[] )
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ if( pRegistryKey )
+ {
+ for( sal_Int32 i = 0; entries[i].create ; i ++ )
+ {
+ OUStringBuffer buf( 124 );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
+ buf.append( entries[i].getImplementationName() );
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( "/UNO/SERVICES" ) );
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( buf.makeStringAndClear() ) );
+
+ Sequence< OUString > seq = entries[i].getSupportedServiceNames();
+ const OUString *pArray = seq.getConstArray();
+ for ( sal_Int32 nPos = 0 ; nPos < seq.getLength(); nPos ++ )
+ xNewKey->createKey( pArray[nPos] );
+ }
+ bRet = sal_True;
+ }
+ }
+ catch ( InvalidRegistryException & )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ return bRet;
+}
+
+
+void * component_getFactoryHelper(
+ const sal_Char * pImplName, void *, void *,
+ const struct ImplementationEntry entries[] )
+{
+
+ void * pRet = 0;
+ Reference< XSingleComponentFactory > xFactory;
+
+ for( sal_Int32 i = 0 ; entries[i].create ; i ++ )
+ {
+ OUString implName = entries[i].getImplementationName();
+ if( 0 == implName.compareToAscii( pImplName ) )
+ {
+ xFactory = entries[i].createFactory(
+ entries[i].create,
+ implName,
+ entries[i].getSupportedServiceNames(),
+ entries[i].moduleCounter );
+ }
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ return pRet;
+}
+
+}
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
new file mode 100644
index 000000000000..3053193d5ee6
--- /dev/null
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -0,0 +1,731 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+
+#include <hash_map>
+
+#include <com/sun/star/lang/XEventListener.hpp>
+
+
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+namespace cppu
+{
+
+//===================================================================
+//===================================================================
+//===================================================================
+/**
+ * Reallocate the sequence.
+ */
+static void realloc( Sequence< Reference< XInterface > > & rSeq, sal_Int32 nNewLen )
+ SAL_THROW( () )
+{
+ rSeq.realloc( nNewLen );
+}
+
+/**
+ * Remove an element from an interface sequence.
+ */
+static void sequenceRemoveElementAt( Sequence< Reference< XInterface > > & rSeq, sal_Int32 index )
+ SAL_THROW( () )
+{
+ sal_Int32 nNewLen = rSeq.getLength() - 1;
+
+ Sequence< Reference< XInterface > > aDestSeq( rSeq.getLength() - 1 );
+ // getArray on a const sequence is faster
+ const Reference< XInterface > * pSource = ((const Sequence< Reference< XInterface > > &)rSeq).getConstArray();
+ Reference< XInterface > * pDest = aDestSeq.getArray();
+ sal_Int32 i = 0;
+ for( ; i < index; i++ )
+ pDest[i] = pSource[i];
+ for( sal_Int32 j = i ; j < nNewLen; j++ )
+ pDest[j] = pSource[j+1];
+ rSeq = aDestSeq;
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+#ifdef _MSC_VER
+#pragma warning( disable: 4786 )
+#endif
+
+//===================================================================
+//===================================================================
+//===================================================================
+OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont_ )
+ SAL_THROW( () )
+ : rCont( rCont_ )
+{
+ MutexGuard aGuard( rCont.rMutex );
+ if( rCont.bInUse )
+ // worst case, two iterators at the same time
+ rCont.copyAndResetInUse();
+ bIsList = rCont_.bIsList;
+ pData = rCont_.pData;
+ if( bIsList )
+ {
+ rCont.bInUse = sal_True;
+ nRemain = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ }
+ else if( pData )
+ {
+ ((XInterface *)pData)->acquire();
+ nRemain = 1;
+ }
+ else
+ nRemain = 0;
+}
+
+OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () )
+{
+ sal_Bool bShared;
+ {
+ MutexGuard aGuard( rCont.rMutex );
+ // bResetInUse protect the iterator against recursion
+ bShared = pData == rCont.pData && rCont.bIsList;
+ if( bShared )
+ {
+ OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" );
+ rCont.bInUse = sal_False;
+ }
+ }
+
+ if( !bShared )
+ {
+ if( bIsList )
+ // Sequence owned by the iterator
+ delete (Sequence< Reference< XInterface > >*)pData;
+ else if( pData )
+ // Interface is acquired by the iterator
+ ((XInterface*)pData)->release();
+ }
+}
+
+XInterface * OInterfaceIteratorHelper::next() SAL_THROW( () )
+{
+ if( nRemain )
+ {
+ nRemain--;
+ if( bIsList )
+ // typecase to const,so the getArray method is faster
+ return ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
+ else if( pData )
+ return (XInterface*)pData;
+ }
+ // exception
+ return 0;
+}
+
+void OInterfaceIteratorHelper::remove() SAL_THROW( () )
+{
+ if( bIsList )
+ {
+ OSL_ASSERT( nRemain >= 0 &&
+ nRemain < ((const Sequence< Reference< XInterface > >*)pData)->getLength() );
+ XInterface * p =
+ ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
+ rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) );
+ }
+ else
+ {
+ OSL_ASSERT( 0 == nRemain );
+ rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&pData));
+ }
+}
+
+//===================================================================
+//===================================================================
+//===================================================================
+
+
+OInterfaceContainerHelper::OInterfaceContainerHelper( Mutex & rMutex_ ) SAL_THROW( () )
+ : pData( 0 )
+ , rMutex( rMutex_ )
+ , bInUse( sal_False )
+ , bIsList( sal_False )
+{
+}
+
+OInterfaceContainerHelper::~OInterfaceContainerHelper() SAL_THROW( () )
+{
+ OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" );
+ if( bIsList )
+ delete (Sequence< Reference< XInterface > >*)pData;
+ else if( pData )
+ ((XInterface*)pData)->release();
+}
+
+sal_Int32 OInterfaceContainerHelper::getLength() const SAL_THROW( () )
+{
+ MutexGuard aGuard( rMutex );
+ if( bIsList )
+ return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ else if( pData )
+ return 1;
+ return 0;
+}
+
+Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const SAL_THROW( () )
+{
+ MutexGuard aGuard( rMutex );
+ if( bIsList )
+ return *(Sequence< Reference< XInterface > >*)pData;
+ else if( pData )
+ {
+ Reference<XInterface> x( (XInterface *)pData );
+ return Sequence< Reference< XInterface > >( &x, 1 );
+ }
+ return Sequence< Reference< XInterface > >();
+}
+
+void OInterfaceContainerHelper::copyAndResetInUse() SAL_THROW( () )
+{
+ OSL_ENSURE( bInUse, "OInterfaceContainerHelper not in use" );
+ if( bInUse )
+ {
+ // this should be the worst case. If a iterator is active
+ // and a new Listener is added.
+ if( bIsList )
+ pData = new Sequence< Reference< XInterface > >( *(Sequence< Reference< XInterface > >*)pData );
+ else if( pData )
+ ((XInterface*)pData)->acquire();
+
+ bInUse = sal_False;
+ }
+}
+
+sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> & rListener ) SAL_THROW( () )
+{
+ OSL_ASSERT( rListener.is() );
+ MutexGuard aGuard( rMutex );
+ if( bInUse )
+ copyAndResetInUse();
+
+ if( bIsList )
+ {
+ sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ realloc( *(Sequence< Reference< XInterface > >*)pData, nLen +1 );
+ ((Sequence< Reference< XInterface > >*)pData)->getArray()[ nLen ] = rListener;
+ return nLen +1;
+ }
+ else if( pData )
+ {
+ Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 );
+ Reference<XInterface> * pArray = pSeq->getArray();
+ pArray[0] = (XInterface *)pData;
+ pArray[1] = rListener;
+ ((XInterface *)pData)->release();
+ pData = pSeq;
+ bIsList = sal_True;
+ return 2;
+ }
+ else
+ {
+ pData = rListener.get();
+ if( rListener.is() )
+ rListener->acquire();
+ return 1;
+ }
+}
+
+sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface> & rListener ) SAL_THROW( () )
+{
+ OSL_ASSERT( rListener.is() );
+ MutexGuard aGuard( rMutex );
+ if( bInUse )
+ copyAndResetInUse();
+
+ if( bIsList )
+ {
+ const Reference<XInterface> * pL = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray();
+ sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ sal_Int32 i;
+ for( i = 0; i < nLen; i++ )
+ {
+ // It is not valid to compare the Pointer direkt, but is is is much
+ // more faster.
+ if( pL[i].get() == rListener.get() )
+ {
+ sequenceRemoveElementAt( *(Sequence< Reference< XInterface > >*)pData, i );
+ break;
+ }
+ }
+
+ if( i == nLen )
+ {
+ // interface not found, use the correct compare method
+ for( i = 0; i < nLen; i++ )
+ {
+ if( pL[i] == rListener )
+ {
+ sequenceRemoveElementAt(*(Sequence< Reference< XInterface > >*)pData, i );
+ break;
+ }
+ }
+ }
+
+ if( ((Sequence< Reference< XInterface > >*)pData)->getLength() == 1 )
+ {
+ XInterface * p = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[0].get();
+ p->acquire();
+ delete (Sequence< Reference< XInterface > >*)pData;
+ pData = p;
+ bIsList = sal_False;
+ return 1;
+ }
+ else
+ return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ }
+ else if( pData && Reference<XInterface>( (XInterface*)pData ) == rListener )
+ {
+ ((XInterface *)pData)->release();
+ pData = 0;
+ }
+ return pData ? 1 : 0;
+}
+
+void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_THROW( () )
+{
+ ClearableMutexGuard aGuard( rMutex );
+ OInterfaceIteratorHelper aIt( *this );
+ // Container freigeben, falls im disposing neue Einträge kommen
+ OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
+ if( !bIsList && pData )
+ ((XInterface *)pData)->release();
+ // set the member to null, the iterator delete the values
+ pData = NULL;
+ bIsList = sal_False;
+ bInUse = sal_False;
+ aGuard.clear();
+ while( aIt.hasMoreElements() )
+ {
+ try
+ {
+ Reference<XEventListener > xLst( aIt.next(), UNO_QUERY );
+ if( xLst.is() )
+ xLst->disposing( rEvt );
+ }
+ catch ( RuntimeException & )
+ {
+ // be robust, if e.g. a remote bridge has disposed already.
+ // there is no way, to delegate the error to the caller :o(.
+ }
+ }
+}
+
+
+void OInterfaceContainerHelper::clear() SAL_THROW( () )
+{
+ ClearableMutexGuard aGuard( rMutex );
+ OInterfaceIteratorHelper aIt( *this );
+ // Container freigeben, falls im disposing neue Einträge kommen
+ OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
+ if( !bIsList && pData )
+ ((XInterface *)pData)->release();
+ // set the member to null, the iterator delete the values
+ pData = 0;
+ bIsList = sal_False;
+ bInUse = sal_False;
+ // release mutex before aIt destructor call
+ aGuard.clear();
+}
+
+//##################################################################################################
+//##################################################################################################
+//##################################################################################################
+
+// specialized class for type
+
+typedef ::std::vector< std::pair < Type , void* > > t_type2ptr;
+
+OMultiTypeInterfaceContainerHelper::OMultiTypeInterfaceContainerHelper( Mutex & rMutex_ )
+ SAL_THROW( () )
+ : rMutex( rMutex_ )
+{
+ m_pMap = new t_type2ptr();
+}
+OMultiTypeInterfaceContainerHelper::~OMultiTypeInterfaceContainerHelper()
+ SAL_THROW( () )
+{
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::iterator iter = pMap->begin();
+ t_type2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ delete (OInterfaceContainerHelper*)(*iter).second;
+ (*iter).second = 0;
+ ++iter;
+ }
+ delete pMap;
+}
+Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const
+ SAL_THROW( () )
+{
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::size_type nSize;
+
+ ::osl::MutexGuard aGuard( rMutex );
+ nSize = pMap->size();
+ if( nSize )
+ {
+ ::com::sun::star::uno::Sequence< Type > aInterfaceTypes( nSize );
+ Type * pArray = aInterfaceTypes.getArray();
+
+ t_type2ptr::iterator iter = pMap->begin();
+ t_type2ptr::iterator end = pMap->end();
+
+ sal_Int32 i = 0;
+ while( iter != end )
+ {
+ // are interfaces added to this container?
+ if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() )
+ // yes, put the type in the array
+ pArray[i++] = (*iter).first;
+ ++iter;
+ }
+ if( (t_type2ptr::size_type)i != nSize ) {
+ // may be empty container, reduce the sequence to the right size
+ aInterfaceTypes = ::com::sun::star::uno::Sequence< Type >( pArray, i );
+ }
+ return aInterfaceTypes;
+ }
+ return ::com::sun::star::uno::Sequence< Type >();
+}
+
+static t_type2ptr::iterator findType(t_type2ptr *pMap, const Type & rKey )
+{
+ t_type2ptr::iterator iter = pMap->begin();
+ t_type2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ if (iter->first == rKey)
+ break;
+ iter++;
+ }
+ return iter;
+}
+
+OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelper::getContainer( const Type & rKey ) const
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::iterator iter = findType( pMap, rKey );
+ if( iter != pMap->end() )
+ return (OInterfaceContainerHelper*) (*iter).second;
+ return 0;
+}
+sal_Int32 OMultiTypeInterfaceContainerHelper::addInterface(
+ const Type & rKey, const Reference< XInterface > & rListener )
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::iterator iter = findType( pMap, rKey );
+ if( iter == pMap->end() )
+ {
+ OInterfaceContainerHelper * pLC = new OInterfaceContainerHelper( rMutex );
+ pMap->push_back(std::pair<Type, void*>(rKey, pLC));
+ return pLC->addInterface( rListener );
+ }
+ else
+ return ((OInterfaceContainerHelper*)(*iter).second)->addInterface( rListener );
+}
+sal_Int32 OMultiTypeInterfaceContainerHelper::removeInterface(
+ const Type & rKey, const Reference< XInterface > & rListener )
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ // search container with id nUik
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::iterator iter = findType( pMap, rKey );
+ // container found?
+ if( iter != pMap->end() )
+ return ((OInterfaceContainerHelper*)(*iter).second)->removeInterface( rListener );
+
+ // no container with this id. Always return 0
+ return 0;
+}
+void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt )
+ SAL_THROW( () )
+{
+ t_type2ptr::size_type nSize = 0;
+ OInterfaceContainerHelper ** ppListenerContainers = NULL;
+ {
+ ::osl::MutexGuard aGuard( rMutex );
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ nSize = pMap->size();
+ if( nSize )
+ {
+ typedef OInterfaceContainerHelper* ppp;
+ ppListenerContainers = new ppp[nSize];
+ //ppListenerContainers = new (ListenerContainer*)[nSize];
+
+ t_type2ptr::iterator iter = pMap->begin();
+ t_type2ptr::iterator end = pMap->end();
+
+ t_type2ptr::size_type i = 0;
+ while( iter != end )
+ {
+ ppListenerContainers[i++] = (OInterfaceContainerHelper*)(*iter).second;
+ ++iter;
+ }
+ }
+ }
+
+ // create a copy, because do not fire event in a guarded section
+ for( t_type2ptr::size_type i = 0;
+ i < nSize; i++ )
+ {
+ if( ppListenerContainers[i] )
+ ppListenerContainers[i]->disposeAndClear( rEvt );
+ }
+
+ delete [] ppListenerContainers;
+}
+void OMultiTypeInterfaceContainerHelper::clear()
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ t_type2ptr * pMap = (t_type2ptr *)m_pMap;
+ t_type2ptr::iterator iter = pMap->begin();
+ t_type2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ ((OInterfaceContainerHelper*)(*iter).second)->clear();
+ ++iter;
+ }
+}
+
+
+//##################################################################################################
+//##################################################################################################
+//##################################################################################################
+
+// specialized class for long
+
+typedef ::std::vector< std::pair < sal_Int32 , void* > > t_long2ptr;
+
+static t_long2ptr::iterator findLong(t_long2ptr *pMap, sal_Int32 nKey )
+{
+ t_long2ptr::iterator iter = pMap->begin();
+ t_long2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ if (iter->first == nKey)
+ break;
+ iter++;
+ }
+ return iter;
+}
+
+OMultiTypeInterfaceContainerHelperInt32::OMultiTypeInterfaceContainerHelperInt32( Mutex & rMutex_ )
+ SAL_THROW( () )
+ : m_pMap( NULL )
+ , rMutex( rMutex_ )
+{
+ // delay pMap allocation until necessary.
+}
+OMultiTypeInterfaceContainerHelperInt32::~OMultiTypeInterfaceContainerHelperInt32()
+ SAL_THROW( () )
+{
+ if (!m_pMap)
+ return;
+
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::iterator iter = pMap->begin();
+ t_long2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ delete (OInterfaceContainerHelper*)(*iter).second;
+ (*iter).second = 0;
+ ++iter;
+ }
+ delete pMap;
+}
+Sequence< sal_Int32 > OMultiTypeInterfaceContainerHelperInt32::getContainedTypes() const
+ SAL_THROW( () )
+{
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::size_type nSize;
+
+ ::osl::MutexGuard aGuard( rMutex );
+ nSize = pMap ? pMap->size() : 0;
+ if( nSize )
+ {
+ ::com::sun::star::uno::Sequence< sal_Int32 > aInterfaceTypes( nSize );
+ sal_Int32 * pArray = aInterfaceTypes.getArray();
+
+ t_long2ptr::iterator iter = pMap->begin();
+ t_long2ptr::iterator end = pMap->end();
+
+ sal_Int32 i = 0;
+ while( iter != end )
+ {
+ // are interfaces added to this container?
+ if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() )
+ // yes, put the type in the array
+ pArray[i++] = (*iter).first;
+ ++iter;
+ }
+ if( (t_long2ptr::size_type)i != nSize ) {
+ // may be empty container, reduce the sequence to the right size
+ aInterfaceTypes = ::com::sun::star::uno::Sequence< sal_Int32 >( pArray, i );
+ }
+ return aInterfaceTypes;
+ }
+ return ::com::sun::star::uno::Sequence< sal_Int32 >();
+}
+OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelperInt32::getContainer( const sal_Int32 & rKey ) const
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ if (!m_pMap)
+ return 0;
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::iterator iter = findLong( pMap, rKey );
+ if( iter != pMap->end() )
+ return (OInterfaceContainerHelper*) (*iter).second;
+ return 0;
+}
+sal_Int32 OMultiTypeInterfaceContainerHelperInt32::addInterface(
+ const sal_Int32 & rKey, const Reference< XInterface > & rListener )
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ if (!m_pMap)
+ m_pMap = new t_long2ptr();
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::iterator iter = findLong( pMap, rKey );
+ if( iter == pMap->end() )
+ {
+ OInterfaceContainerHelper * pLC = new OInterfaceContainerHelper( rMutex );
+ pMap->push_back(std::pair< sal_Int32, void* >(rKey, pLC));
+ return pLC->addInterface( rListener );
+ }
+ else
+ return ((OInterfaceContainerHelper*)(*iter).second)->addInterface( rListener );
+}
+sal_Int32 OMultiTypeInterfaceContainerHelperInt32::removeInterface(
+ const sal_Int32 & rKey, const Reference< XInterface > & rListener )
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ if (!m_pMap)
+ return 0;
+ // search container with id nUik
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::iterator iter = findLong( pMap, rKey );
+ // container found?
+ if( iter != pMap->end() )
+ return ((OInterfaceContainerHelper*)(*iter).second)->removeInterface( rListener );
+
+ // no container with this id. Always return 0
+ return 0;
+}
+void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject & rEvt )
+ SAL_THROW( () )
+{
+ t_long2ptr::size_type nSize = 0;
+ OInterfaceContainerHelper ** ppListenerContainers = NULL;
+ {
+ ::osl::MutexGuard aGuard( rMutex );
+ if (!m_pMap)
+ return;
+
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ nSize = pMap->size();
+ if( nSize )
+ {
+ typedef OInterfaceContainerHelper* ppp;
+ ppListenerContainers = new ppp[nSize];
+ //ppListenerContainers = new (ListenerContainer*)[nSize];
+
+ t_long2ptr::iterator iter = pMap->begin();
+ t_long2ptr::iterator end = pMap->end();
+
+ t_long2ptr::size_type i = 0;
+ while( iter != end )
+ {
+ ppListenerContainers[i++] = (OInterfaceContainerHelper*)(*iter).second;
+ ++iter;
+ }
+ }
+ }
+
+ // create a copy, because do not fire event in a guarded section
+ for( t_long2ptr::size_type i = 0;
+ i < nSize; i++ )
+ {
+ if( ppListenerContainers[i] )
+ ppListenerContainers[i]->disposeAndClear( rEvt );
+ }
+
+ delete [] ppListenerContainers;
+}
+void OMultiTypeInterfaceContainerHelperInt32::clear()
+ SAL_THROW( () )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ if (!m_pMap)
+ return;
+ t_long2ptr * pMap = (t_long2ptr *)m_pMap;
+ t_long2ptr::iterator iter = pMap->begin();
+ t_long2ptr::iterator end = pMap->end();
+
+ while( iter != end )
+ {
+ ((OInterfaceContainerHelper*)(*iter).second)->clear();
+ ++iter;
+ }
+}
+
+}
+
diff --git a/cppuhelper/source/macro_expander.cxx b/cppuhelper/source/macro_expander.cxx
new file mode 100644
index 000000000000..936487618ace
--- /dev/null
+++ b/cppuhelper/source/macro_expander.cxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <rtl/bootstrap.hxx>
+
+#include <uno/mapping.hxx>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/component_context.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+#include "macro_expander.hxx"
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+#define SERVICE_NAME_A "com.sun.star.lang.MacroExpander"
+#define SERVICE_NAME_B "com.sun.star.lang.BootstrapMacroExpander"
+#define IMPL_NAME "com.sun.star.lang.comp.cppuhelper.BootstrapMacroExpander"
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+//---- private forward -----------------------------------------------------------------------------
+Bootstrap const & get_unorc() SAL_THROW( () );
+}
+
+namespace cppuhelper { namespace detail {
+
+rtl::OUString expandMacros(rtl::OUString const & text) {
+ rtl::OUString t(text);
+ rtl_bootstrap_expandMacros_from_handle(
+ cppu::get_unorc().getHandle(), &t.pData);
+ return t;
+}
+
+} }
+
+namespace
+{
+inline OUString s_impl_name() { return OUSTR(IMPL_NAME); }
+static Sequence< OUString > const & s_get_service_names()
+{
+ static Sequence< OUString > const * s_pnames = 0;
+ if (! s_pnames)
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if (! s_pnames)
+ {
+ static Sequence< OUString > s_names( 2 );
+ s_names[ 0 ] = OUSTR(SERVICE_NAME_A);
+ s_names[ 1 ] = OUSTR(SERVICE_NAME_B);
+ s_pnames = &s_names;
+ }
+ }
+ return *s_pnames;
+}
+
+typedef ::cppu::WeakComponentImplHelper2<
+ util::XMacroExpander, lang::XServiceInfo > t_uno_impl;
+
+struct mutex_holder
+{
+ Mutex m_mutex;
+};
+class Bootstrap_MacroExpander : public mutex_holder, public t_uno_impl
+{
+protected:
+ virtual void SAL_CALL disposing();
+
+public:
+ inline Bootstrap_MacroExpander( Reference< XComponentContext > const & ) SAL_THROW( () )
+ : t_uno_impl( m_mutex )
+ {}
+ virtual ~Bootstrap_MacroExpander()
+ SAL_THROW( () );
+
+ // XMacroExpander impl
+ virtual OUString SAL_CALL expandMacros( OUString const & exp )
+ throw (lang::IllegalArgumentException);
+ // XServiceInfo impl
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName )
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+};
+
+//__________________________________________________________________________________________________
+void Bootstrap_MacroExpander::disposing()
+{}
+//__________________________________________________________________________________________________
+Bootstrap_MacroExpander::~Bootstrap_MacroExpander() SAL_THROW( () )
+{}
+
+// XServiceInfo impl
+//__________________________________________________________________________________________________
+OUString Bootstrap_MacroExpander::getImplementationName()
+ throw (RuntimeException)
+{
+ return s_impl_name();
+}
+//__________________________________________________________________________________________________
+sal_Bool Bootstrap_MacroExpander::supportsService( OUString const & serviceName )
+ throw (RuntimeException)
+{
+ Sequence< OUString > const & service_names = s_get_service_names();
+ OUString const * p = service_names.getConstArray();
+ for ( sal_Int32 nPos = service_names.getLength(); nPos--; )
+ {
+ if (p[ nPos ].equals( serviceName ))
+ return sal_True;
+ }
+ return sal_False;
+}
+//__________________________________________________________________________________________________
+Sequence< OUString > Bootstrap_MacroExpander::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ return s_get_service_names();
+}
+
+// XMacroExpander impl
+//__________________________________________________________________________________________________
+OUString Bootstrap_MacroExpander::expandMacros( OUString const & exp )
+ throw (lang::IllegalArgumentException)
+{
+ return cppuhelper::detail::expandMacros( exp );
+}
+
+//==================================================================================================
+Reference< XInterface > SAL_CALL service_create(
+ Reference< XComponentContext > const & xComponentContext )
+ SAL_THROW( (RuntimeException) )
+{
+ return static_cast< ::cppu::OWeakObject * >( new Bootstrap_MacroExpander( xComponentContext ) );
+}
+
+}
+
+namespace cppu
+{
+
+//##################################################################################################
+Reference< lang::XSingleComponentFactory > create_boostrap_macro_expander_factory() SAL_THROW( () )
+{
+ Reference< lang::XSingleComponentFactory > free(::cppu::createSingleComponentFactory(
+ service_create,
+ s_impl_name(),
+ s_get_service_names() ));
+
+ uno::Environment curr_env(Environment::getCurrent());
+ uno::Environment target_env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))));
+
+ uno::Mapping target2curr(target_env, curr_env);
+
+ return Reference<lang::XSingleComponentFactory>(
+ reinterpret_cast<lang::XSingleComponentFactory *>(
+ target2curr.mapInterface(free.get(), ::getCppuType(&free))),
+ SAL_NO_ACQUIRE);
+}
+
+}
diff --git a/cppuhelper/source/macro_expander.hxx b/cppuhelper/source/macro_expander.hxx
new file mode 100644
index 000000000000..a692f63abc39
--- /dev/null
+++ b/cppuhelper/source/macro_expander.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CPPUHELPER_SOURCE_MACRO_EXPANDER_HXX
+#define CPPUHELPER_SOURCE_MACRO_EXPANDER_HXX
+
+#include "sal/config.h"
+
+namespace rtl { class OUString; }
+
+namespace cppuhelper {
+
+namespace detail {
+
+/**
+ * Helper function to expand macros based on the unorc/uno.ini.
+ *
+ * @internal
+ *
+ * @param text
+ * Some text.
+ *
+ * @return
+ * The expanded text.
+ *
+ * @exception com::sun::star::lang::IllegalArgumentException
+ * If uriReference is a vnd.sun.star.expand URL reference that contains unknown
+ * macros.
+ */
+::rtl::OUString expandMacros(rtl::OUString const & text);
+
+}
+
+}
+
+#endif
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
new file mode 100644
index 000000000000..5755ed77631c
--- /dev/null
+++ b/cppuhelper/source/makefile.mk
@@ -0,0 +1,192 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=cppuhelper
+TARGET=cppuhelper
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# not strictly a bootstrap service but containing
+# bootstrap code that may require generated files
+# without "-L" (light) switch
+BOOTSTRAP_SERVICE=TRUE
+
+.IF "$(OS)" != "WNT" && "$(GUI)"!="OS2"
+UNIXVERSIONNAMES=UDK
+.ENDIF # WNT
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb
+UNOUCRDEP=$(UNOUCRRDB)
+UNOUCROUT=$(OUT)$/inc$/$(TARGET)
+INCPRE+=$(OUT)$/inc$/$(TARGET) $(OUT)$/inc$/private
+
+CPPUMAKERFLAGS= -C
+
+UNOTYPES= \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.PropertyValue \
+ com.sun.star.beans.XFastPropertySet \
+ com.sun.star.beans.XMultiPropertySet \
+ com.sun.star.beans.XPropertyAccess \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.bridge.UnoUrlResolver \
+ com.sun.star.bridge.XUnoUrlResolver \
+ com.sun.star.connection.SocketPermission \
+ com.sun.star.container.XElementAccess \
+ com.sun.star.container.XEnumerationAccess \
+ com.sun.star.container.XHierarchicalNameAccess \
+ com.sun.star.container.XNameAccess \
+ com.sun.star.container.XNameContainer \
+ com.sun.star.container.XSet \
+ com.sun.star.io.FilePermission \
+ com.sun.star.io.IOException \
+ com.sun.star.lang.DisposedException \
+ com.sun.star.lang.WrappedTargetRuntimeException \
+ com.sun.star.lang.XComponent \
+ com.sun.star.lang.XEventListener \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XMultiComponentFactory \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XSingleComponentFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.reflection.XArrayTypeDescription \
+ com.sun.star.reflection.XCompoundTypeDescription \
+ com.sun.star.reflection.XEnumTypeDescription \
+ com.sun.star.reflection.XIdlClass \
+ com.sun.star.reflection.XIdlClassProvider \
+ com.sun.star.reflection.XIdlField2 \
+ com.sun.star.reflection.XIdlReflection \
+ com.sun.star.reflection.XIndirectTypeDescription \
+ com.sun.star.reflection.XInterfaceAttributeTypeDescription \
+ com.sun.star.reflection.XInterfaceAttributeTypeDescription2 \
+ com.sun.star.reflection.XInterfaceMemberTypeDescription \
+ com.sun.star.reflection.XInterfaceMethodTypeDescription \
+ com.sun.star.reflection.XInterfaceTypeDescription2 \
+ com.sun.star.reflection.XMethodParameter \
+ com.sun.star.reflection.XStructTypeDescription \
+ com.sun.star.reflection.XTypeDescription \
+ com.sun.star.reflection.XUnionTypeDescription \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.security.RuntimePermission \
+ com.sun.star.security.XAccessController \
+ com.sun.star.uno.DeploymentException \
+ com.sun.star.uno.RuntimeException \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XComponentContext \
+ com.sun.star.uno.XCurrentContext \
+ com.sun.star.uno.XUnloadingPreference \
+ com.sun.star.uno.XWeak \
+ com.sun.star.util.XMacroExpander
+
+.IF "$(debug)" != ""
+# msvc++: no inlining for debugging
+.IF "$(COM)" == "MSC"
+CFLAGS += -Ob0
+.ENDIF
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/typeprovider.obj \
+ $(SLO)$/exc_thrower.obj \
+ $(SLO)$/servicefactory.obj \
+ $(SLO)$/bootstrap.obj \
+ $(SLO)$/implbase.obj \
+ $(SLO)$/implbase_ex.obj \
+ $(SLO)$/propshlp.obj \
+ $(SLO)$/weak.obj \
+ $(SLO)$/interfacecontainer.obj \
+ $(SLO)$/stdidlclass.obj \
+ $(SLO)$/factory.obj \
+ $(SLO)$/component_context.obj \
+ $(SLO)$/component.obj \
+ $(SLO)$/shlib.obj \
+ $(SLO)$/tdmgr.obj \
+ $(SLO)$/implementationentry.obj \
+ $(SLO)$/access_control.obj \
+ $(SLO)$/macro_expander.obj \
+ $(SLO)$/unourl.obj \
+ $(SLO)$/propertysetmixin.obj \
+ $(SLO)$/findsofficepath.obj
+
+OBJFILES = $(OBJ)$/findsofficepath.obj
+
+.IF "$(GUI)" == "WNT"
+SHL1TARGET=$(TARGET)$(UDK_MAJOR)$(COMID)
+.ELIF "$(GUI)" == "OS2"
+SHL1TARGET=cppuh
+SHL1TARGET=cppuh$(UDK_MAJOR)
+.ELSE
+SHL1TARGET=uno_$(TARGET)$(COMID)
+.ENDIF
+
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(CPPULIB)
+.IF "$(OS)" == "WNT"
+SHL1STDLIBS += $(ADVAPI32LIB)
+.ENDIF
+
+SHL1DEPN=
+SHL1IMPLIB=i$(TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH=URELIB
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+
+.IF "$(COMNAME)"=="msci"
+SHL1VERSIONMAP=msvc_win32_intel.map
+.ELIF "$(COMNAME)"=="sunpro5"
+SHL1VERSIONMAP=cc5_solaris_sparc.map
+.ELIF "$(GUI)$(COMNAME)"=="OS2gcc3"
+SHL1VERSIONMAP=gcc3os2.map
+.ELIF "$(COMNAME)"=="gcc3"
+SHL1VERSIONMAP=gcc3.map
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(diag)"!=""
+CFLAGS += -DDIAG=$(diag)
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
new file mode 100644
index 000000000000..6d5a491ab925
--- /dev/null
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -0,0 +1,280 @@
+UDK_3_0_0 {
+ global:
+GetVersionInfo;
+??0OComponentHelper@cppu@@QAE@AAVMutex@osl@@@Z;
+??1OComponentHelper@cppu@@UAE@XZ;
+??BOWeakObject@cppu@@QAA?AV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+??BWeakReferenceHelper@uno@star@sun@com@@QBA?AV?$Reference@VXInterface@uno@star@sun@com@@@1234@XZ;
+??_7OComponentHelper@cppu@@6BOWeakObject@1@@;
+??_7OComponentHelper@cppu@@6BXAggregation@uno@star@sun@com@@@;
+??_7OComponentHelper@cppu@@6BXComponent@lang@star@sun@com@@@;
+??_7OComponentHelper@cppu@@6BXTypeProvider@lang@star@sun@com@@@;
+??_7OWeakAggObject@cppu@@6BOWeakObject@1@@;
+??_7OWeakAggObject@cppu@@6BXAggregation@uno@star@sun@com@@@;
+??_7OWeakObject@cppu@@6B@;
+??_GOComponentHelper@cppu@@UAEPAXI@Z;
+??_GOWeakAggObject@cppu@@MAEPAXI@Z;
+??_GOWeakObject@cppu@@MAEPAXI@Z;
+?addEventListener@OComponentHelper@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+?dispose@OComponentHelper@cppu@@UAAXXZ;
+?disposing@OComponentHelper@cppu@@MAAXXZ;
+?release@OComponentHelper@cppu@@UAAXXZ;
+?removeEventListener@OComponentHelper@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+??1OTypeCollection@cppu@@QAE@XZ;
+?createFactoryProxy@cppu@@YA?AV?$Reference@VXSingleServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABV23456@@Z;
+?createOneInstanceRegistryFactory@cppu@@YA?AV?$Reference@VXSingleServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABVOUString@rtl@@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@3456@@Z;
+?createSingleRegistryFactory@cppu@@YA?AV?$Reference@VXSingleServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABVOUString@rtl@@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@3456@@Z;
+?getTypes@OTypeCollection@cppu@@QAA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?createStandardClassWithSequence@cppu@@YAPAVXIdlClass@reflection@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@uno@456@ABVOUString@rtl@@ABV?$Reference@VXIdlClass@reflection@star@sun@com@@@8456@ABV?$Sequence@VOUString@rtl@@@8456@@Z;
+??0OInterfaceContainerHelper@cppu@@QAE@AAVMutex@osl@@@Z;
+??0OInterfaceIteratorHelper@cppu@@QAE@AAVOInterfaceContainerHelper@1@@Z;
+??1OInterfaceContainerHelper@cppu@@QAE@XZ;
+??1OInterfaceIteratorHelper@cppu@@QAE@XZ;
+?addInterface@OInterfaceContainerHelper@cppu@@QAAJABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+?clear@OInterfaceContainerHelper@cppu@@QAAXXZ;
+?copyAndResetInUse@OInterfaceContainerHelper@cppu@@AAEXXZ;
+?disposeAndClear@OInterfaceContainerHelper@cppu@@QAAXABUEventObject@lang@star@sun@com@@@Z;
+?getElements@OInterfaceContainerHelper@cppu@@QBA?AV?$Sequence@V?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?getLength@OInterfaceContainerHelper@cppu@@QBAJXZ;
+?next@OInterfaceIteratorHelper@cppu@@QAAPAVXInterface@uno@star@sun@com@@XZ;
+?removeInterface@OInterfaceContainerHelper@cppu@@QAAJABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+??0WeakReferenceHelper@uno@star@sun@com@@QAE@ABV01234@@Z;
+??0WeakReferenceHelper@uno@star@sun@com@@QAE@ABV?$Reference@VXInterface@uno@star@sun@com@@@1234@@Z;
+??1OWeakAggObject@cppu@@MAE@XZ;
+??1OWeakObject@cppu@@MAE@XZ;
+??1WeakReferenceHelper@uno@star@sun@com@@QAE@XZ;
+??4WeakReferenceHelper@uno@star@sun@com@@QAAAAV01234@ABV01234@@Z;
+??4WeakReferenceHelper@uno@star@sun@com@@QAAAAV01234@ABV?$Reference@VXInterface@uno@star@sun@com@@@1234@@Z;
+?acquire@OWeakAggObject@cppu@@UAAXXZ;
+?acquire@OWeakObject@cppu@@UAAXXZ;
+?get@WeakReferenceHelper@uno@star@sun@com@@QBA?AV?$Reference@VXInterface@uno@star@sun@com@@@2345@XZ;
+?queryAdapter@OWeakObject@cppu@@UAA?AV?$Reference@VXAdapter@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?queryAggregation@OWeakAggObject@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@OWeakAggObject@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@OWeakObject@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?release@OWeakAggObject@cppu@@UAAXXZ;
+?release@OWeakObject@cppu@@UAAXXZ;
+?setDelegator@OWeakAggObject@cppu@@UAAXABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+??0OPropertyArrayHelper@cppu@@QAE@ABV?$Sequence@UProperty@beans@star@sun@com@@@uno@star@sun@com@@E@Z;
+??0OPropertyArrayHelper@cppu@@QAE@PAUProperty@beans@star@sun@com@@JE@Z;
+??1IPropertyArrayHelper@cppu@@UAE@XZ;
+??1OPropertyArrayHelper@cppu@@UAE@XZ;
+??1OPropertySetHelper@cppu@@QAE@XZ;
+??_7IPropertyArrayHelper@cppu@@6B@;
+??_7OPropertyArrayHelper@cppu@@6B@;
+??_7OPropertySetHelper@cppu@@6BXFastPropertySet@beans@star@sun@com@@@;
+??_7OPropertySetHelper@cppu@@6BXMultiPropertySet@beans@star@sun@com@@@;
+??_7OPropertySetHelper@cppu@@6BXPropertySet@beans@star@sun@com@@@;
+??_GIPropertyArrayHelper@cppu@@UAEPAXI@Z;
+??_GOPropertyArrayHelper@cppu@@UAEPAXI@Z;
+?addPropertiesChangeListener@OPropertySetHelper@cppu@@UAAXABV?$Sequence@VOUString@rtl@@@uno@star@sun@com@@ABV?$Reference@VXPropertiesChangeListener@beans@star@sun@com@@@4567@@Z;
+?addPropertyChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXPropertyChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+?addVetoableChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXVetoableChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+?createPropertySetInfo@OPropertySetHelper@cppu@@SA?AV?$Reference@VXPropertySetInfo@beans@star@sun@com@@@uno@star@sun@com@@AAVIPropertyArrayHelper@2@@Z;
+?disposing@OPropertySetHelper@cppu@@QAAXXZ;
+?fillHandles@OPropertyArrayHelper@cppu@@UAAJPAJABV?$Sequence@VOUString@rtl@@@uno@star@sun@com@@@Z;
+?fillPropertyMembersByHandle@OPropertyArrayHelper@cppu@@UAAEPAVOUString@rtl@@PAFJ@Z;
+?fire@OPropertySetHelper@cppu@@IAAXPAJPBVAny@uno@star@sun@com@@1JE@Z;
+?firePropertiesChangeEvent@OPropertySetHelper@cppu@@UAAXABV?$Sequence@VOUString@rtl@@@uno@star@sun@com@@ABV?$Reference@VXPropertiesChangeListener@beans@star@sun@com@@@4567@@Z;
+?getCount@OPropertyArrayHelper@cppu@@QBAJXZ;
+?getFastPropertyValue@OPropertySetHelper@cppu@@UAA?AVAny@uno@star@sun@com@@J@Z;
+?getHandleByName@OPropertyArrayHelper@cppu@@UAAJABVOUString@rtl@@@Z;
+?getProperties@OPropertyArrayHelper@cppu@@UAA?AV?$Sequence@UProperty@beans@star@sun@com@@@uno@star@sun@com@@XZ;
+?getPropertyByName@OPropertyArrayHelper@cppu@@UAA?AUProperty@beans@star@sun@com@@ABVOUString@rtl@@@Z;
+?getPropertyValue@OPropertySetHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVOUString@rtl@@@Z;
+?getPropertyValues@OPropertySetHelper@cppu@@UAA?AV?$Sequence@VAny@uno@star@sun@com@@@uno@star@sun@com@@ABV?$Sequence@VOUString@rtl@@@4567@@Z;
+?hasPropertyByName@OPropertyArrayHelper@cppu@@UAAEABVOUString@rtl@@@Z;
+?init@OPropertyArrayHelper@cppu@@AAEXE@Z;
+?queryInterface@OPropertySetHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@OPropertySetHelper@cppu@@W3AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@OPropertySetHelper@cppu@@W7AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?removePropertiesChangeListener@OPropertySetHelper@cppu@@UAAXABV?$Reference@VXPropertiesChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+?removePropertyChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXPropertyChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+?removeVetoableChangeListener@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABV?$Reference@VXVetoableChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+?setFastPropertyValue@OPropertySetHelper@cppu@@UAAXJABVAny@uno@star@sun@com@@@Z;
+?setFastPropertyValues@OPropertySetHelper@cppu@@IAAXJPAJPBVAny@uno@star@sun@com@@J@Z;
+?setPropertyValue@OPropertySetHelper@cppu@@UAAXABVOUString@rtl@@ABVAny@uno@star@sun@com@@@Z;
+?setPropertyValues@OPropertySetHelper@cppu@@UAAXABV?$Sequence@VOUString@rtl@@@uno@star@sun@com@@ABV?$Sequence@VAny@uno@star@sun@com@@@4567@@Z;
+??0ClassDataBase@cppu@@QAE@J@Z;
+??0ClassDataBase@cppu@@QAE@XZ;
+??1ClassDataBase@cppu@@QAE@XZ;
+?getImplHelperInitMutex@cppu@@YAAAVMutex@osl@@XZ;
+?getImplementationId@ClassData@cppu@@QAA?AV?$Sequence@C@uno@star@sun@com@@XZ;
+?getTypes@ClassData@cppu@@QAA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?initTypeProvider@ClassData@cppu@@QAAXXZ;
+?query@ClassData@cppu@@QAA?AVAny@uno@star@sun@com@@ABVType@4567@PAVXTypeProvider@lang@567@@Z;
+?writeTypeOffset@ClassData@cppu@@QAAXABVType@uno@star@sun@com@@J@Z;
+?createRegistryServiceFactory@cppu@@YA?AV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@0E0@Z;
+?throwException@cppu@@YAXABVAny@uno@star@sun@com@@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@00000000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@0000000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@000000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@00000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@0000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@000000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@00000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@0000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@000ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@00ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@0ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??0OTypeCollection@cppu@@QAE@ABVType@uno@star@sun@com@@ABV?$Sequence@VType@uno@star@sun@com@@@3456@@Z;
+??1OImplementationId@cppu@@QAE@XZ;
+?getImplementationId@OImplementationId@cppu@@QBA?AV?$Sequence@C@uno@star@sun@com@@XZ;
+?writeSharedLibComponentInfo@cppu@@YAXABVOUString@rtl@@0ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@5678@@Z;
+?remove@OInterfaceIteratorHelper@cppu@@QAAXXZ;
+??0OWeakObject@cppu@@QAE@XZ;
+?installTypeDescriptionManager@cppu@@YAEABV?$Reference@VXHierarchicalNameAccess@container@star@sun@com@@@uno@star@sun@com@@@Z;
+?loadSharedLibComponentFactory@cppu@@YA?AV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@00ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABV?$Reference@VXRegistryKey@registry@star@sun@com@@@3456@@Z;
+?createComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@PBUContextEntry_Init@1@JABV23456@@Z;
+?bootstrap_InitialComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXSimpleRegistry@registry@star@sun@com@@@3456@ABVOUString@rtl@@@Z;
+?createNestedRegistry@cppu@@YA?AV?$Reference@VXSimpleRegistry@registry@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@@Z;
+?createSimpleRegistry@cppu@@YA?AV?$Reference@VXSimpleRegistry@registry@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@@Z;
+??0WeakAggComponentImplHelperBase@cppu@@IAE@AAVMutex@osl@@@Z;
+??0WeakComponentImplHelperBase@cppu@@IAE@AAVMutex@osl@@@Z;
+?acquire@WeakAggComponentImplHelperBase@cppu@@UAAXXZ;
+?acquire@WeakComponentImplHelperBase@cppu@@UAAXXZ;
+?addEventListener@WeakAggComponentImplHelperBase@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+?addEventListener@WeakComponentImplHelperBase@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+?dispose@WeakAggComponentImplHelperBase@cppu@@UAAXXZ;
+?dispose@WeakComponentImplHelperBase@cppu@@UAAXXZ;
+?queryAggregation@WeakAggComponentImplHelperBase@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@WeakAggComponentImplHelperBase@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@WeakComponentImplHelperBase@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?release@WeakAggComponentImplHelperBase@cppu@@UAAXXZ;
+?release@WeakComponentImplHelperBase@cppu@@UAAXXZ;
+?removeEventListener@WeakAggComponentImplHelperBase@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+?removeEventListener@WeakComponentImplHelperBase@cppu@@UAAXABV?$Reference@VXEventListener@lang@star@sun@com@@@uno@star@sun@com@@@Z;
+??1WeakAggComponentImplHelperBase@cppu@@UAE@XZ;
+??1WeakComponentImplHelperBase@cppu@@UAE@XZ;
+?disposing@WeakAggComponentImplHelperBase@cppu@@MAAXXZ;
+?disposing@WeakComponentImplHelperBase@cppu@@MAAXXZ;
+?createOneInstanceFactory@cppu@@YA?AV?$Reference@VXSingleServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABVOUString@rtl@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@0@ZABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
+?createSingleComponentFactory@cppu@@YA?AV?$Reference@VXSingleComponentFactory@lang@star@sun@com@@@uno@star@sun@com@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@3456@@ZABVOUString@rtl@@ABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
+?createSingleFactory@cppu@@YA?AV?$Reference@VXSingleServiceFactory@lang@star@sun@com@@@uno@star@sun@com@@ABV?$Reference@VXMultiServiceFactory@lang@star@sun@com@@@3456@ABVOUString@rtl@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@0@ZABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
+?defaultBootstrap_InitialComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?acquire@OComponentHelper@cppu@@UAAXXZ;
+?getTypes@OComponentHelper@cppu@@UAA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?queryAggregation@OComponentHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?queryInterface@OComponentHelper@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+?removeListener@?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@cppu@@QAEXABVType@uno@star@sun@com@@ABV?$Reference@VXInterface@uno@star@sun@com@@@4567@@Z;
+??0OMultiTypeInterfaceContainerHelper@cppu@@QAE@AAVMutex@osl@@@Z;
+??0OMultiTypeInterfaceContainerHelperInt32@cppu@@QAE@AAVMutex@osl@@@Z;
+??1OMultiTypeInterfaceContainerHelper@cppu@@QAE@XZ;
+??1OMultiTypeInterfaceContainerHelperInt32@cppu@@QAE@XZ;
+?addInterface@OMultiTypeInterfaceContainerHelper@cppu@@QAAJABVType@uno@star@sun@com@@ABV?$Reference@VXInterface@uno@star@sun@com@@@4567@@Z;
+?addInterface@OMultiTypeInterfaceContainerHelperInt32@cppu@@QAAJABJABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+?clear@OMultiTypeInterfaceContainerHelper@cppu@@QAAXXZ;
+?clear@OMultiTypeInterfaceContainerHelperInt32@cppu@@QAAXXZ;
+?disposeAndClear@OMultiTypeInterfaceContainerHelper@cppu@@QAAXABUEventObject@lang@star@sun@com@@@Z;
+?disposeAndClear@OMultiTypeInterfaceContainerHelperInt32@cppu@@QAAXABUEventObject@lang@star@sun@com@@@Z;
+?getContainedTypes@OMultiTypeInterfaceContainerHelper@cppu@@QBA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+?getContainedTypes@OMultiTypeInterfaceContainerHelperInt32@cppu@@QBA?AV?$Sequence@J@uno@star@sun@com@@XZ;
+?getContainer@OMultiTypeInterfaceContainerHelper@cppu@@QBAPAVOInterfaceContainerHelper@2@ABVType@uno@star@sun@com@@@Z;
+?getContainer@OMultiTypeInterfaceContainerHelperInt32@cppu@@QBAPAVOInterfaceContainerHelper@2@ABJ@Z;
+?removeInterface@OMultiTypeInterfaceContainerHelper@cppu@@QAAJABVType@uno@star@sun@com@@ABV?$Reference@VXInterface@uno@star@sun@com@@@4567@@Z;
+?removeInterface@OMultiTypeInterfaceContainerHelperInt32@cppu@@QAAJABJABV?$Reference@VXInterface@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+??0OPropertySetHelper@cppu@@QAE@AAU?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@1@@Z;
+?addListener@?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@cppu@@QAEXABVType@uno@star@sun@com@@ABV?$Reference@VXInterface@uno@star@sun@com@@@4567@@Z;
+?component_writeInfoHelper@cppu@@YAEPAX0QBUImplementationEntry@1@@Z;
+?component_getFactoryHelper@cppu@@YAPAXPBDPAX1QBUImplementationEntry@1@@Z;
+?ImplHelper_query@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAX@Z;
+?ImplHelper_queryNoXInterface@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAX@Z;
+?ImplHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@@Z;
+?ImplInhHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@ABV23456@@Z;
+?ImplHelper_getImplementationId@cppu@@YA?AV?$Sequence@C@uno@star@sun@com@@PAUclass_data@1@@Z;
+?WeakImplHelper_query@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAXPAVOWeakObject@1@@Z;
+?WeakImplHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@@Z;
+?WeakAggImplHelper_queryAgg@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAXPAVOWeakAggObject@1@@Z;
+?WeakAggComponentImplHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@@Z;
+?WeakComponentImplHelper_query@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAXPAVWeakComponentImplHelperBase@1@@Z;
+?WeakAggImplHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@@Z;
+?WeakAggComponentImplHelper_queryAgg@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAUclass_data@1@PAXPAVWeakAggComponentImplHelperBase@1@@Z;
+?WeakComponentImplHelper_getTypes@cppu@@YA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@PAUclass_data@1@@Z;
+?defaultBootstrap_InitialComponentContext@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@ABVOUString@rtl@@@Z;
+
+??0AccessControl@cppu@@QAE@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@@Z;
+??0AccessControl@cppu@@QAE@ABV?$Reference@VXAccessController@security@star@sun@com@@@uno@star@sun@com@@@Z;
+??0AccessControl@cppu@@QAE@ABV01@@Z;
+?checkRuntimePermission@AccessControl@cppu@@QAAXABVOUString@rtl@@@Z;
+?checkFilePermission@AccessControl@cppu@@QAAXABVOUString@rtl@@0@Z;
+?checkSocketPermission@AccessControl@cppu@@QAAXABVOUString@rtl@@0@Z;
+
+??0UnoUrl@cppu@@QAE@ABV01@@Z;
+??0UnoUrl@cppu@@QAE@ABVOUString@rtl@@@Z;
+??0UnoUrlDescriptor@cppu@@QAE@ABV01@@Z;
+??0UnoUrlDescriptor@cppu@@QAE@ABVOUString@rtl@@@Z;
+??1UnoUrl@cppu@@QAE@XZ;
+??1UnoUrlDescriptor@cppu@@QAE@XZ;
+??4UnoUrl@cppu@@QAEAAV01@ABV01@@Z;
+??4UnoUrlDescriptor@cppu@@QAEAAV01@ABV01@@Z;
+?getConnection@UnoUrl@cppu@@QBEABVUnoUrlDescriptor@2@XZ;
+?getDescriptor@UnoUrlDescriptor@cppu@@QBEABVOUString@rtl@@XZ;
+?getName@UnoUrlDescriptor@cppu@@QBEABVOUString@rtl@@XZ;
+?getObjectName@UnoUrl@cppu@@QBEABVOUString@rtl@@XZ;
+?getParameter@UnoUrlDescriptor@cppu@@QBE?AVOUString@rtl@@ABV34@@Z;
+?getProtocol@UnoUrl@cppu@@QBEABVUnoUrlDescriptor@2@XZ;
+?hasParameter@UnoUrlDescriptor@cppu@@QBE_NABVOUString@rtl@@@Z;
+
+ local:
+ *;
+};
+
+UDK_3.1 {
+ global:
+ ?getCaughtException@cppu@@YA?AVAny@uno@star@sun@com@@XZ;
+
+ ??0OPropertySetHelper@cppu@@QAE@AAU?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@1@_N@Z;
+
+ ?bootstrap@cppu@@YA?AV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+ ??0BootstrapException@cppu@@QAE@XZ;
+ ??0BootstrapException@cppu@@QAE@ABVOUString@rtl@@@Z;
+ ??0BootstrapException@cppu@@QAE@ABV01@@Z;
+ ??1BootstrapException@cppu@@UAE@XZ;
+ ??4BootstrapException@cppu@@QAEAAV01@ABV01@@Z;
+ ?getMessage@BootstrapException@cppu@@QBEABVOUString@rtl@@XZ;
+} UDK_3_0_0;
+
+UDK_3.2 {
+ global:
+ ??1PropertySetMixinImpl@cppu@@AAE@XZ;
+ ?queryInterface@PropertySetMixinImpl@cppu@@MAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z;
+ ?getPropertySetInfo@PropertySetMixinImpl@cppu@@MAA?AV?$Reference@VXPropertySetInfo@beans@star@sun@com@@@uno@star@sun@com@@XZ;
+ ?notify@BoundListeners@PropertySetMixinImpl@cppu@@QBEXXZ;
+ ?setPropertyValue@PropertySetMixinImpl@cppu@@MAAXABVOUString@rtl@@ABVAny@uno@star@sun@com@@@Z;
+ ?getPropertyValue@PropertySetMixinImpl@cppu@@MAA?AVAny@uno@star@sun@com@@ABVOUString@rtl@@@Z;
+ ?removePropertyChangeListener@PropertySetMixinImpl@cppu@@MAAXABVOUString@rtl@@ABV?$Reference@VXPropertyChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+ ?removeVetoableChangeListener@PropertySetMixinImpl@cppu@@MAAXABVOUString@rtl@@ABV?$Reference@VXVetoableChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+ ?setFastPropertyValue@PropertySetMixinImpl@cppu@@MAAXJABVAny@uno@star@sun@com@@@Z;
+ ?getFastPropertyValue@PropertySetMixinImpl@cppu@@MAA?AVAny@uno@star@sun@com@@J@Z;
+ ?getPropertyValues@PropertySetMixinImpl@cppu@@MAA?AV?$Sequence@UPropertyValue@beans@star@sun@com@@@uno@star@sun@com@@XZ;
+ ?setPropertyValues@PropertySetMixinImpl@cppu@@MAAXABV?$Sequence@UPropertyValue@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+ ?prepareSet@PropertySetMixinImpl@cppu@@IAEXABVOUString@rtl@@ABVAny@uno@star@sun@com@@1PAVBoundListeners@12@@Z;
+ ??0BoundListeners@PropertySetMixinImpl@cppu@@QAE@XZ;
+ ??1BoundListeners@PropertySetMixinImpl@cppu@@QAE@XZ;
+ ??0PropertySetMixinImpl@cppu@@AAE@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@W4Implements@01@ABV?$Sequence@VOUString@rtl@@@3456@ABVType@3456@@Z;
+ ?dispose@PropertySetMixinImpl@cppu@@IAEXXZ;
+ ?addPropertyChangeListener@PropertySetMixinImpl@cppu@@MAAXABVOUString@rtl@@ABV?$Reference@VXPropertyChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+ ?addVetoableChangeListener@PropertySetMixinImpl@cppu@@MAAXABVOUString@rtl@@ABV?$Reference@VXVetoableChangeListener@beans@star@sun@com@@@uno@star@sun@com@@@Z;
+} UDK_3.1;
+
+UDK_3.3 {
+ global:
+ ?getTypes@OPropertySetHelper@cppu@@QAE?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ;
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.4
+ global:
+ ?bootstrap_expandUri@cppu@@YA?AVOUString@rtl@@ABV23@@Z; # rtl::OUString cppu::bootstrap_expandUri(rtl::OUString const &)
+} UDK_3.3;
+
+UDK_3.5 { # OOo 3.0
+ global:
+ ??0OPropertySetHelper@cppu@@QAE@AAU?$OBroadcastHelperVar@VOMultiTypeInterfaceContainerHelper@cppu@@VType@uno@star@sun@com@@@1@PAVIEventNotificationHook@1@_N@Z;
+} UDK_3.4;
+
+UDK_3.6 { # OOo 3.3
+ global:
+ ?disposeWeakConnectionPoint@OWeakObject@cppu@@IAEXXZ;
+ ?clear@WeakReferenceHelper@uno@star@sun@com@@QAAXXZ;
+ ?createOneInstanceComponentFactory@cppu@@YA?AV?$Reference@VXSingleComponentFactory@lang@star@sun@com@@@uno@star@sun@com@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@3456@@ZABVOUString@rtl@@ABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
+} UDK_3.5;
diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx
new file mode 100644
index 000000000000..d12fd408f035
--- /dev/null
+++ b/cppuhelper/source/propertysetmixin.cxx
@@ -0,0 +1,1428 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include "sal/config.h"
+
+#include "cppuhelper/propertysetmixin.hxx"
+
+#include "com/sun/star/beans/Property.hpp"
+#include "com/sun/star/beans/PropertyChangeEvent.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/IllegalAccessException.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
+#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/reflection/XCompoundTypeDescription.hpp"
+#include "com/sun/star/reflection/XIdlClass.hpp"
+#include "com/sun/star/reflection/XIdlField2.hpp"
+#include "com/sun/star/reflection/XIdlReflection.hpp"
+#include "com/sun/star/reflection/XIndirectTypeDescription.hpp"
+#include "com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp"
+#include "com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp"
+#include "com/sun/star/reflection/XInterfaceTypeDescription2.hpp"
+#include "com/sun/star/reflection/XStructTypeDescription.hpp"
+#include "com/sun/star/reflection/XTypeDescription.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/DeploymentException.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/TypeClass.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include <algorithm>
+#include <map>
+#include <new>
+#include <set>
+#include <vector>
+
+using cppu::PropertySetMixinImpl;
+
+namespace css = com::sun::star;
+
+namespace {
+
+template< typename T > struct AutoDispose {
+ AutoDispose() {}
+
+ ~AutoDispose() {
+ try {
+ dispose();
+ } catch (...) {}
+ }
+
+ void dispose() {
+ css::uno::Reference< css::lang::XComponent > comp(
+ ifc, css::uno::UNO_QUERY);
+ if (comp.is()) {
+ comp->dispose();
+ }
+ ifc.clear();
+ }
+
+ css::uno::Reference< T > ifc;
+
+private:
+ AutoDispose(AutoDispose &); // not defined
+ void operator =(AutoDispose); // not defined
+};
+
+struct PropertyData {
+ explicit PropertyData(
+ css::beans::Property const & theProperty, bool thePresent):
+ property(theProperty), present(thePresent) {}
+
+ css::beans::Property property;
+ bool present;
+};
+
+struct Data: public salhelper::SimpleReferenceObject {
+ typedef std::map< rtl::OUString, PropertyData > PropertyMap;
+
+ PropertyMap properties;
+
+ PropertyMap::const_iterator get(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name) const;
+
+protected:
+ void initProperties(
+ css::uno::Reference< css::reflection::XTypeDescription > const & type,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ std::vector< rtl::OUString > * handleNames)
+ {
+ TypeSet seen;
+ initProperties(type, absentOptional, handleNames, &seen);
+ }
+
+private:
+ typedef std::set< rtl::OUString > TypeSet;
+
+ void initProperties(
+ css::uno::Reference< css::reflection::XTypeDescription > const & type,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ std::vector< rtl::OUString > * handleNames, TypeSet * seen);
+
+ static css::uno::Reference< css::reflection::XTypeDescription >
+ resolveTypedefs(
+ css::uno::Reference< css::reflection::XTypeDescription > const & type);
+};
+
+Data::PropertyMap::const_iterator Data::get(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name) const
+{
+ PropertyMap::const_iterator i(properties.find(name));
+ if (i == properties.end() || !i->second.present) {
+ throw css::beans::UnknownPropertyException(name, object);
+ }
+ return i;
+}
+
+void Data::initProperties(
+ css::uno::Reference< css::reflection::XTypeDescription > const & type,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ std::vector< rtl::OUString > * handleNames, TypeSet * seen)
+{
+ css::uno::Reference< css::reflection::XInterfaceTypeDescription2 > ifc(
+ resolveTypedefs(type), css::uno::UNO_QUERY_THROW);
+ if (seen->insert(ifc->getName()).second) {
+ css::uno::Sequence<
+ css::uno::Reference< css::reflection::XTypeDescription > > bases(
+ ifc->getBaseTypes());
+ for (sal_Int32 i = 0; i < bases.getLength(); ++i) {
+ initProperties(bases[i], absentOptional, handleNames, seen);
+ }
+ css::uno::Sequence<
+ css::uno::Reference<
+ css::reflection::XInterfaceMemberTypeDescription > > members(
+ ifc->getMembers());
+ rtl::OUString const * absentBegin = absentOptional.getConstArray();
+ rtl::OUString const * absentEnd =
+ absentBegin + absentOptional.getLength();
+ for (sal_Int32 i = 0; i < members.getLength(); ++i) {
+ if (members[i]->getTypeClass()
+ == css::uno::TypeClass_INTERFACE_ATTRIBUTE)
+ {
+ css::uno::Reference<
+ css::reflection::XInterfaceAttributeTypeDescription2 > attr(
+ members[i], css::uno::UNO_QUERY_THROW);
+ sal_Int16 attrAttribs = 0;
+ if (attr->isBound()) {
+ attrAttribs |= css::beans::PropertyAttribute::BOUND;
+ }
+ bool setUnknown = false;
+ if (attr->isReadOnly()) {
+ attrAttribs |= css::beans::PropertyAttribute::READONLY;
+ setUnknown = true;
+ }
+ css::uno::Sequence<
+ css::uno::Reference<
+ css::reflection::XCompoundTypeDescription > > excs(
+ attr->getGetExceptions());
+ bool getUnknown = false;
+ //XXX Special interpretation of getter/setter exceptions only
+ // works if the specified exceptions are of the exact type, not
+ // of a supertype:
+ for (sal_Int32 j = 0; j < excs.getLength(); ++j) {
+ if (excs[j]->getName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.UnknownPropertyException")))
+ {
+ getUnknown = true;
+ break;
+ }
+ }
+ excs = attr->getSetExceptions();
+ for (sal_Int32 j = 0; j < excs.getLength(); ++j) {
+ if (excs[j]->getName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.UnknownPropertyException")))
+ {
+ setUnknown = true;
+ } else if (excs[j]->getName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans."
+ "PropertyVetoException")))
+ {
+ attrAttribs
+ |= css::beans::PropertyAttribute::CONSTRAINED;
+ }
+ }
+ if (getUnknown && setUnknown) {
+ attrAttribs |= css::beans::PropertyAttribute::OPTIONAL;
+ }
+ css::uno::Reference< css::reflection::XTypeDescription > t(
+ attr->getType());
+ for (;;)
+ {
+ t = resolveTypedefs(t);
+ sal_Int16 n;
+ if (t->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.Ambiguous<")))
+ {
+ n = css::beans::PropertyAttribute::MAYBEAMBIGUOUS;
+ } else if (t->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.Defaulted<")))
+ {
+ n = css::beans::PropertyAttribute::MAYBEDEFAULT;
+ } else if (t->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.Optional<")))
+ {
+ n = css::beans::PropertyAttribute::MAYBEVOID;
+ } else {
+ break;
+ }
+ if ((attrAttribs & n) != 0) {
+ break;
+ }
+ attrAttribs |= n;
+ css::uno::Sequence<
+ css::uno::Reference< css::reflection::XTypeDescription > >
+ args(
+ css::uno::Reference<
+ css::reflection::XStructTypeDescription >(
+ t,
+ css::uno::UNO_QUERY_THROW)->getTypeArguments());
+ if (args.getLength() != 1) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "inconsistent UNO type registry")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ t = args[0];
+ }
+ std::vector< rtl::OUString >::size_type handles
+ = handleNames->size();
+ if (handles > SAL_MAX_INT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "interface type has too many attributes")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ rtl::OUString name(members[i]->getMemberName());
+ if (!properties.insert(
+ PropertyMap::value_type(
+ name,
+ PropertyData(
+ css::beans::Property(
+ name, static_cast< sal_Int32 >(handles),
+ css::uno::Type(
+ t->getTypeClass(), t->getName()),
+ attrAttribs),
+ (std::find(absentBegin, absentEnd, name)
+ == absentEnd)))).
+ second)
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "inconsistent UNO type registry")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ handleNames->push_back(name);
+ }
+ }
+ }
+}
+
+css::uno::Reference< css::reflection::XTypeDescription > Data::resolveTypedefs(
+ css::uno::Reference< css::reflection::XTypeDescription > const & type)
+{
+ css::uno::Reference< css::reflection::XTypeDescription > t(type);
+ while (t->getTypeClass() == css::uno::TypeClass_TYPEDEF) {
+ t = css::uno::Reference< css::reflection::XIndirectTypeDescription >(
+ t, css::uno::UNO_QUERY_THROW)->getReferencedType();
+ }
+ return t;
+}
+
+class Info: public cppu::WeakImplHelper1< css::beans::XPropertySetInfo > {
+public:
+ explicit Info(Data * data): m_data(data) {}
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties()
+ throw (css::uno::RuntimeException);
+
+ virtual css::beans::Property SAL_CALL getPropertyByName(
+ rtl::OUString const & name)
+ throw (
+ css::beans::UnknownPropertyException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasPropertyByName(rtl::OUString const & name)
+ throw (css::uno::RuntimeException);
+
+private:
+ rtl::Reference< Data > m_data;
+};
+
+css::uno::Sequence< css::beans::Property > Info::getProperties()
+ throw (css::uno::RuntimeException)
+{
+ try {
+ OSL_ASSERT(m_data->properties.size() <= SAL_MAX_INT32);
+ css::uno::Sequence< css::beans::Property > s(
+ static_cast< sal_Int32 >(m_data->properties.size()));
+ sal_Int32 n = 0;
+ for (Data::PropertyMap::iterator i(m_data->properties.begin());
+ i != m_data->properties.end(); ++i)
+ {
+ if (i->second.present) {
+ s[n++] = i->second.property;
+ }
+ }
+ s.realloc(n);
+ return s;
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+css::beans::Property Info::getPropertyByName(rtl::OUString const & name)
+ throw (css::beans::UnknownPropertyException, css::uno::RuntimeException)
+{
+ return m_data->get(static_cast< cppu::OWeakObject * >(this), name)->
+ second.property;
+}
+
+sal_Bool Info::hasPropertyByName(rtl::OUString const & name)
+ throw (css::uno::RuntimeException)
+{
+ Data::PropertyMap::iterator i(m_data->properties.find(name));
+ return i != m_data->properties.end() && i->second.present;
+}
+
+typedef
+std::multiset< css::uno::Reference< css::beans::XPropertyChangeListener > >
+BoundListenerBag;
+
+}
+
+class PropertySetMixinImpl::BoundListeners::Impl {
+public:
+ BoundListenerBag specificListeners;
+ BoundListenerBag unspecificListeners;
+ css::beans::PropertyChangeEvent event;
+};
+
+PropertySetMixinImpl::BoundListeners::BoundListeners(): m_impl(new Impl) {}
+
+PropertySetMixinImpl::BoundListeners::~BoundListeners() {
+ delete m_impl;
+}
+
+void PropertySetMixinImpl::BoundListeners::notify() const {
+ for (BoundListenerBag::const_iterator i(m_impl->specificListeners.begin());
+ i != m_impl->specificListeners.end(); ++i)
+ {
+ try {
+ (*i)->propertyChange(m_impl->event);
+ } catch (css::lang::DisposedException &) {}
+ }
+ for (BoundListenerBag::const_iterator i(
+ m_impl->unspecificListeners.begin());
+ i != m_impl->unspecificListeners.end(); ++i)
+ {
+ try {
+ (*i)->propertyChange(m_impl->event);
+ } catch (css::lang::DisposedException &) {}
+ }
+}
+
+class PropertySetMixinImpl::Impl: public Data {
+public:
+ Impl(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ Implements theImplements,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ css::uno::Type const & type);
+
+ rtl::OUString translateHandle(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ sal_Int32 handle) const;
+
+ void setProperty(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name, css::uno::Any const & value,
+ bool isAmbiguous, bool isDefaulted, sal_Int16 illegalArgumentPosition)
+ const;
+
+ css::uno::Any getProperty(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name, css::beans::PropertyState * state) const;
+
+ PropertySetMixinImpl::Implements implements;
+ css::uno::Sequence< rtl::OUString > handleMap;
+
+ typedef std::map< rtl::OUString, BoundListenerBag > BoundListenerMap;
+
+ typedef
+ std::multiset< css::uno::Reference< css::beans::XVetoableChangeListener > >
+ VetoListenerBag;
+
+ typedef std::map< rtl::OUString, VetoListenerBag > VetoListenerMap;
+
+ mutable osl::Mutex mutex;
+ BoundListenerMap boundListeners;
+ VetoListenerMap vetoListeners;
+ bool disposed;
+
+private:
+ css::uno::Reference< css::reflection::XIdlClass > getReflection(
+ rtl::OUString const & typeName) const;
+
+ static css::uno::Any wrapValue(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ css::uno::Any const & value,
+ css::uno::Reference< css::reflection::XIdlClass > const & type,
+ bool wrapAmbiguous, bool isAmbiguous, bool wrapDefaulted,
+ bool isDefaulted, bool wrapOptional);
+
+ css::uno::Reference< css::uno::XComponentContext > const & m_context;
+ css::uno::Sequence< rtl::OUString > m_absentOptional;
+ css::uno::Type m_type;
+ css::uno::Reference< css::reflection::XIdlClass > m_idlClass;
+};
+
+PropertySetMixinImpl::Impl::Impl(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ Implements theImplements,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ css::uno::Type const & type):
+ implements(theImplements), disposed(false), m_context(context),
+ m_absentOptional(absentOptional), m_type(type)
+{
+ OSL_ASSERT(
+ context.is()
+ && ((implements
+ & ~(IMPLEMENTS_PROPERTY_SET | IMPLEMENTS_FAST_PROPERTY_SET
+ | IMPLEMENTS_PROPERTY_ACCESS))
+ == 0));
+ m_idlClass = getReflection(m_type.getTypeName());
+ css::uno::Reference< css::reflection::XTypeDescription > ifc;
+ try {
+ ifc = css::uno::Reference< css::reflection::XTypeDescription >(
+ css::uno::Reference< css::container::XHierarchicalNameAccess >(
+ m_context->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/com.sun.star.reflection."
+ "theTypeDescriptionManager"))),
+ css::uno::UNO_QUERY_THROW)->getByHierarchicalName(
+ m_type.getTypeName()),
+ css::uno::UNO_QUERY_THROW);
+ } catch (css::container::NoSuchElementException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.container.NoSuchElementException: "))
+ + e.Message),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ std::vector< rtl::OUString > handleNames;
+ initProperties(ifc, m_absentOptional, &handleNames);
+ std::vector< rtl::OUString >::size_type size = handleNames.size();
+ OSL_ASSERT(size <= SAL_MAX_INT32);
+ handleMap.realloc(static_cast< sal_Int32 >(size));
+ std::copy(handleNames.begin(), handleNames.end(), handleMap.getArray());
+}
+
+rtl::OUString PropertySetMixinImpl::Impl::translateHandle(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ sal_Int32 handle) const
+{
+ if (handle < 0 || handle >= handleMap.getLength()) {
+ throw css::beans::UnknownPropertyException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad handle "))
+ + rtl::OUString::valueOf(handle)),
+ object);
+ }
+ return handleMap[handle];
+}
+
+void PropertySetMixinImpl::Impl::setProperty(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name, css::uno::Any const & value, bool isAmbiguous,
+ bool isDefaulted, sal_Int16 illegalArgumentPosition) const
+{
+ PropertyMap::const_iterator i(properties.find(name));
+ if (i == properties.end()) {
+ throw css::beans::UnknownPropertyException(name, object);
+ }
+ if ((isAmbiguous
+ && ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEAMBIGUOUS)
+ == 0))
+ || (isDefaulted
+ && ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEDEFAULT)
+ == 0)))
+ {
+ throw css::lang::IllegalArgumentException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "flagging as ambiguous/defaulted non-ambiguous/defaulted"
+ " property "))
+ + name),
+ object, illegalArgumentPosition);
+ }
+ css::uno::Reference< css::reflection::XIdlField2 > f(
+ m_idlClass->getField(name), css::uno::UNO_QUERY_THROW);
+ css::uno::Any o(object->queryInterface(m_type));
+ css::uno::Any v(
+ wrapValue(
+ object, value,
+ (css::uno::Reference< css::reflection::XIdlField2 >(
+ m_idlClass->getField(name), css::uno::UNO_QUERY_THROW)->
+ getType()),
+ ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEAMBIGUOUS)
+ != 0),
+ isAmbiguous,
+ ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEDEFAULT)
+ != 0),
+ isDefaulted,
+ ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEVOID)
+ != 0)));
+ try {
+ f->set(o, v);
+ } catch (css::lang::IllegalArgumentException & e) {
+ if (e.ArgumentPosition == 1) {
+ throw css::lang::IllegalArgumentException(
+ e.Message, object, illegalArgumentPosition);
+ } else {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ object);
+ }
+ } catch (css::lang::IllegalAccessException &) {
+ //TODO Clarify whether PropertyVetoException is the correct exception
+ // to throw when trying to set a read-only property:
+ throw css::beans::PropertyVetoException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("cannot set read-only property "))
+ + name),
+ object);
+ } catch (css::lang::WrappedTargetRuntimeException & e) {
+ //FIXME A WrappedTargetRuntimeException from XIdlField2.get is not
+ // guaranteed to originate directly within XIdlField2.get (and thus have
+ // the expected semantics); it might also be passed through from lower
+ // layers.
+ if (e.TargetException.isExtractableTo(
+ getCppuType(
+ static_cast< css::beans::UnknownPropertyException * >(0)))
+ && ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::OPTIONAL)
+ != 0))
+ {
+ throw css::beans::UnknownPropertyException(name, object);
+ } else if (e.TargetException.isExtractableTo(
+ getCppuType(
+ static_cast< css::beans::PropertyVetoException * >(
+ 0)))
+ && ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::CONSTRAINED)
+ != 0))
+ {
+ throw css::beans::PropertyVetoException(name, object);
+ } else {
+ throw css::lang::WrappedTargetException(
+ e.Message, object, e.TargetException);
+ }
+ }
+}
+
+css::uno::Any PropertySetMixinImpl::Impl::getProperty(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ rtl::OUString const & name, css::beans::PropertyState * state) const
+{
+ PropertyMap::const_iterator i(properties.find(name));
+ if (i == properties.end()) {
+ throw css::beans::UnknownPropertyException(name, object);
+ }
+ css::uno::Reference< css::reflection::XIdlField2 > field(
+ m_idlClass->getField(name), css::uno::UNO_QUERY_THROW);
+ css::uno::Any value;
+ try {
+ value = field->get(object->queryInterface(m_type));
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ object);
+ } catch (css::lang::WrappedTargetRuntimeException & e) {
+ //FIXME A WrappedTargetRuntimeException from XIdlField2.get is not
+ // guaranteed to originate directly within XIdlField2.get (and thus have
+ // the expected semantics); it might also be passed through from lower
+ // layers.
+ if (e.TargetException.isExtractableTo(
+ getCppuType(
+ static_cast< css::beans::UnknownPropertyException * >(0)))
+ && ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::OPTIONAL)
+ != 0))
+ {
+ throw css::beans::UnknownPropertyException(name, object);
+ } else {
+ throw css::lang::WrappedTargetException(
+ e.Message, object, e.TargetException);
+ }
+ }
+ bool undoAmbiguous
+ = ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEAMBIGUOUS)
+ != 0);
+ bool undoDefaulted
+ = ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEDEFAULT)
+ != 0);
+ bool undoOptional
+ = ((i->second.property.Attributes
+ & css::beans::PropertyAttribute::MAYBEVOID)
+ != 0);
+ bool isAmbiguous = false;
+ bool isDefaulted = false;
+ while (undoAmbiguous || undoDefaulted || undoOptional) {
+ if (undoAmbiguous
+ && value.getValueTypeName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.beans.Ambiguous<")))
+ {
+ css::uno::Reference< css::reflection::XIdlClass > ambiguous(
+ getReflection(value.getValueTypeName()));
+ try {
+ if (!(css::uno::Reference< css::reflection::XIdlField2 >(
+ ambiguous->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsAmbiguous"))),
+ css::uno::UNO_QUERY_THROW)->get(value)
+ >>= isAmbiguous))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected type of"
+ " com.sun.star.beans.Ambiguous IsAmbiguous"
+ " member")),
+ object);
+ }
+ value = css::uno::Reference< css::reflection::XIdlField2 >(
+ ambiguous->getField(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW)->get(value);
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected com.sun.star.lang."
+ "IllegalArgumentException: "))
+ + e.Message),
+ object);
+ }
+ undoAmbiguous = false;
+ } else if (undoDefaulted
+ && value.getValueTypeName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.Defaulted<")))
+ {
+ css::uno::Reference< css::reflection::XIdlClass > defaulted(
+ getReflection(value.getValueTypeName()));
+ try {
+
+ if (!(css::uno::Reference< css::reflection::XIdlField2 >(
+ defaulted->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsDefaulted"))),
+ css::uno::UNO_QUERY_THROW)->get(value)
+ >>= isDefaulted))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected type of"
+ " com.sun.star.beans.Defaulted IsDefaulted"
+ " member")),
+ object);
+ }
+ value = css::uno::Reference< css::reflection::XIdlField2 >(
+ defaulted->getField(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW)->get(value);
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected com.sun.star.lang."
+ "IllegalArgumentException: "))
+ + e.Message),
+ object);
+ }
+ undoDefaulted = false;
+ } else if (undoOptional
+ && value.getValueTypeName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.beans.Optional<")))
+ {
+ css::uno::Reference< css::reflection::XIdlClass > optional(
+ getReflection(value.getValueTypeName()));
+ try {
+ bool present = false;
+ if (!(css::uno::Reference< css::reflection::XIdlField2 >(
+ optional->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsPresent"))),
+ css::uno::UNO_QUERY_THROW)->get(value)
+ >>= present))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected type of com.sun.star.beans.Optional"
+ " IsPresent member")),
+ object);
+ }
+ if (!present) {
+ value.clear();
+ break;
+ }
+ value = css::uno::Reference< css::reflection::XIdlField2 >(
+ optional->getField(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW)->get(value);
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected com.sun.star.lang."
+ "IllegalArgumentException: "))
+ + e.Message),
+ object);
+ }
+ undoOptional = false;
+ } else {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected type of attribute "))
+ + name),
+ object);
+ }
+ }
+ if (state != 0) {
+ //XXX If isAmbiguous && isDefaulted, arbitrarily choose AMBIGUOUS_VALUE
+ // over DEFAULT_VALUE:
+ *state = isAmbiguous
+ ? css::beans::PropertyState_AMBIGUOUS_VALUE
+ : isDefaulted
+ ? css::beans::PropertyState_DEFAULT_VALUE
+ : css::beans::PropertyState_DIRECT_VALUE;
+ }
+ return value;
+}
+
+css::uno::Reference< css::reflection::XIdlClass >
+PropertySetMixinImpl::Impl::getReflection(rtl::OUString const & typeName) const
+{
+ css::uno::Reference< css::lang::XMultiComponentFactory > factory(
+ m_context->getServiceManager(), css::uno::UNO_QUERY_THROW);
+ AutoDispose< css::reflection::XIdlReflection > refl;
+ try {
+ refl.ifc = css::uno::Reference< css::reflection::XIdlReflection >(
+ factory->createInstanceWithContext(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.reflection.CoreReflection")),
+ m_context),
+ css::uno::UNO_QUERY_THROW);
+ } catch (css::uno::RuntimeException &) {
+ throw;
+ } catch (css::uno::Exception & e) {
+ throw css::uno::DeploymentException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "component context fails to supply service"
+ " com.sun.star.reflection.CoreReflection: "))
+ + e.Message),
+ m_context);
+ }
+ css::uno::Reference< css::reflection::XIdlClass > idlClass(
+ refl.ifc->forName(typeName), css::uno::UNO_QUERY_THROW);
+ refl.dispose();
+ return idlClass;
+}
+
+css::uno::Any PropertySetMixinImpl::Impl::wrapValue(
+ css::uno::Reference< css::uno::XInterface > const & object,
+ css::uno::Any const & value,
+ css::uno::Reference< css::reflection::XIdlClass > const & type,
+ bool wrapAmbiguous, bool isAmbiguous, bool wrapDefaulted, bool isDefaulted,
+ bool wrapOptional)
+{
+ OSL_ASSERT(
+ (wrapAmbiguous || !isAmbiguous) && (wrapDefaulted || !isDefaulted));
+ if (wrapAmbiguous
+ && type->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.beans.Ambiguous<")))
+ {
+ css::uno::Any strct;
+ type->createObject(strct);
+ try {
+ css::uno::Reference< css::reflection::XIdlField2 > field(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW);
+ field->set(
+ strct,
+ wrapValue(
+ object, value, field->getType(), false, false,
+ wrapDefaulted, isDefaulted, wrapOptional));
+ css::uno::Reference< css::reflection::XIdlField2 >(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsAmbiguous"))),
+ css::uno::UNO_QUERY_THROW)->set(
+ strct, css::uno::makeAny(isAmbiguous));
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ object);
+ } catch (css::lang::IllegalAccessException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalAccessException: "))
+ + e.Message),
+ object);
+ }
+ return strct;
+ } else if (wrapDefaulted
+ && type->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.beans.Defaulted<")))
+ {
+ css::uno::Any strct;
+ type->createObject(strct);
+ try {
+ css::uno::Reference< css::reflection::XIdlField2 > field(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW);
+ field->set(
+ strct,
+ wrapValue(
+ object, value, field->getType(), wrapAmbiguous, isAmbiguous,
+ false, false, wrapOptional));
+ css::uno::Reference< css::reflection::XIdlField2 >(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsDefaulted"))),
+ css::uno::UNO_QUERY_THROW)->set(
+ strct, css::uno::makeAny(isDefaulted));
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ object);
+ } catch (css::lang::IllegalAccessException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalAccessException: "))
+ + e.Message),
+ object);
+ }
+ return strct;
+ } else if (wrapOptional
+ && type->getName().matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.beans.Optional<")))
+ {
+ css::uno::Any strct;
+ type->createObject(strct);
+ bool present = value.hasValue();
+ try {
+ css::uno::Reference< css::reflection::XIdlField2 >(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IsPresent"))),
+ css::uno::UNO_QUERY_THROW)->set(
+ strct, css::uno::makeAny(present));
+ if (present) {
+ css::uno::Reference< css::reflection::XIdlField2 > field(
+ type->getField(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Value"))),
+ css::uno::UNO_QUERY_THROW);
+ field->set(
+ strct,
+ wrapValue(
+ object, value, field->getType(), wrapAmbiguous,
+ isAmbiguous, wrapDefaulted, isDefaulted, false));
+ }
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ object);
+ } catch (css::lang::IllegalAccessException & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected"
+ " com.sun.star.lang.IllegalAccessException: "))
+ + e.Message),
+ object);
+ }
+ return strct;
+ } else {
+ if (wrapAmbiguous || wrapDefaulted || wrapOptional) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unexpected type of attribute")),
+ object);
+ }
+ return value;
+ }
+}
+
+PropertySetMixinImpl::PropertySetMixinImpl(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ Implements implements,
+ css::uno::Sequence< rtl::OUString > const & absentOptional,
+ css::uno::Type const & type)
+{
+ m_impl = new Impl(context, implements, absentOptional, type);
+ m_impl->acquire();
+}
+
+PropertySetMixinImpl::~PropertySetMixinImpl() {
+ m_impl->release();
+}
+
+void PropertySetMixinImpl::checkUnknown(rtl::OUString const & propertyName) {
+ if (propertyName.getLength() != 0) {
+ m_impl->get(
+ static_cast< css::beans::XPropertySet * >(this), propertyName);
+ }
+}
+
+void PropertySetMixinImpl::prepareSet(
+ rtl::OUString const & propertyName, css::uno::Any const & oldValue,
+ css::uno::Any const & newValue, BoundListeners * boundListeners)
+{
+ Impl::PropertyMap::const_iterator it(m_impl->properties.find(propertyName));
+ OSL_ASSERT(it != m_impl->properties.end());
+ Impl::VetoListenerBag specificVeto;
+ Impl::VetoListenerBag unspecificVeto;
+ {
+ osl::MutexGuard g(m_impl->mutex);
+ if (m_impl->disposed) {
+ throw css::lang::DisposedException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("disposed")),
+ static_cast< css::beans::XPropertySet * >(this));
+ }
+ if ((it->second.property.Attributes
+ & css::beans::PropertyAttribute::CONSTRAINED)
+ != 0)
+ {
+ Impl::VetoListenerMap::const_iterator i(
+ m_impl->vetoListeners.find(propertyName));
+ if (i != m_impl->vetoListeners.end()) {
+ specificVeto = i->second;
+ }
+ i = m_impl->vetoListeners.find(rtl::OUString());
+ if (i != m_impl->vetoListeners.end()) {
+ unspecificVeto = i->second;
+ }
+ }
+ if ((it->second.property.Attributes
+ & css::beans::PropertyAttribute::BOUND)
+ != 0)
+ {
+ OSL_ASSERT(boundListeners != 0);
+ Impl::BoundListenerMap::const_iterator i(
+ m_impl->boundListeners.find(propertyName));
+ if (i != m_impl->boundListeners.end()) {
+ boundListeners->m_impl->specificListeners = i->second;
+ }
+ i = m_impl->boundListeners.find(rtl::OUString());
+ if (i != m_impl->boundListeners.end()) {
+ boundListeners->m_impl->unspecificListeners = i->second;
+ }
+ }
+ }
+ if ((it->second.property.Attributes
+ & css::beans::PropertyAttribute::CONSTRAINED)
+ != 0)
+ {
+ css::beans::PropertyChangeEvent event(
+ static_cast< css::beans::XPropertySet * >(this), propertyName,
+ false, it->second.property.Handle, oldValue, newValue);
+ for (Impl::VetoListenerBag::iterator i(specificVeto.begin());
+ i != specificVeto.end(); ++i)
+ {
+ try {
+ (*i)->vetoableChange(event);
+ } catch (css::lang::DisposedException &) {}
+ }
+ for (Impl::VetoListenerBag::iterator i(unspecificVeto.begin());
+ i != unspecificVeto.end(); ++i)
+ {
+ try {
+ (*i)->vetoableChange(event);
+ } catch (css::lang::DisposedException &) {}
+ }
+ }
+ if ((it->second.property.Attributes & css::beans::PropertyAttribute::BOUND)
+ != 0)
+ {
+ OSL_ASSERT(boundListeners != 0);
+ boundListeners->m_impl->event = css::beans::PropertyChangeEvent(
+ static_cast< css::beans::XPropertySet * >(this), propertyName,
+ false, it->second.property.Handle, oldValue, newValue);
+ }
+}
+
+void PropertySetMixinImpl::dispose() {
+ Impl::BoundListenerMap boundListeners;
+ Impl::VetoListenerMap vetoListeners;
+ {
+ osl::MutexGuard g(m_impl->mutex);
+ boundListeners.swap(m_impl->boundListeners);
+ vetoListeners.swap(m_impl->vetoListeners);
+ m_impl->disposed = true;
+ }
+ css::lang::EventObject event(
+ static_cast< css::beans::XPropertySet * >(this));
+ for (Impl::BoundListenerMap::iterator i(boundListeners.begin());
+ i != boundListeners.end(); ++i)
+ {
+ for (BoundListenerBag::iterator j(i->second.begin());
+ j != i->second.end(); ++j)
+ {
+ (*j)->disposing(event);
+ }
+ }
+ for (Impl::VetoListenerMap::iterator i(vetoListeners.begin());
+ i != vetoListeners.end(); ++i)
+ {
+ for (Impl::VetoListenerBag::iterator j(i->second.begin());
+ j != i->second.end(); ++j)
+ {
+ (*j)->disposing(event);
+ }
+ }
+}
+
+css::uno::Any PropertySetMixinImpl::queryInterface(css::uno::Type const & type)
+ throw (css::uno::RuntimeException)
+{
+ if (((m_impl->implements & IMPLEMENTS_PROPERTY_SET) != 0
+ && type == css::beans::XPropertySet::static_type()))
+ {
+ css::uno::Reference< css::uno::XInterface > ifc(
+ static_cast< css::beans::XPropertySet * >(this));
+ return css::uno::Any(&ifc, type);
+ } else if ((m_impl->implements & IMPLEMENTS_FAST_PROPERTY_SET) != 0
+ && type == css::beans::XFastPropertySet::static_type())
+ {
+ css::uno::Reference< css::uno::XInterface > ifc(
+ static_cast< css::beans::XFastPropertySet * >(this));
+ return css::uno::Any(&ifc, type);
+ } else if ((m_impl->implements & IMPLEMENTS_PROPERTY_ACCESS) != 0
+ && type == css::beans::XPropertyAccess::static_type())
+ {
+ css::uno::Reference< css::uno::XInterface > ifc(
+ static_cast< css::beans::XPropertyAccess * >(this));
+ return css::uno::Any(&ifc, type);
+ } else {
+ return css::uno::Any();
+ }
+}
+
+css::uno::Reference< css::beans::XPropertySetInfo >
+PropertySetMixinImpl::getPropertySetInfo() throw (css::uno::RuntimeException) {
+ try {
+ return new Info(m_impl);
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::setPropertyValue(
+ rtl::OUString const & propertyName, css::uno::Any const & value)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ try {
+ m_impl->setProperty(
+ static_cast< css::beans::XPropertySet * >(this), propertyName,
+ value, false, false, 1);
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+css::uno::Any PropertySetMixinImpl::getPropertyValue(
+ rtl::OUString const & propertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ try {
+ return m_impl->getProperty(
+ static_cast< css::beans::XPropertySet * >(this), propertyName, 0);
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::addPropertyChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const & listener)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ css::uno::Reference< css::beans::XPropertyChangeListener >(
+ listener, css::uno::UNO_QUERY_THROW); // reject NULL listener
+ checkUnknown(propertyName);
+ try {
+ bool disposed;
+ {
+ osl::MutexGuard g(m_impl->mutex);
+ disposed = m_impl->disposed;
+ if (!disposed) {
+ m_impl->boundListeners[propertyName].insert(listener);
+ }
+ }
+ if (disposed) {
+ listener->disposing(
+ css::lang::EventObject(
+ static_cast< css::beans::XPropertySet * >(this)));
+ }
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::removePropertyChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const & listener)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ OSL_ASSERT(listener.is());
+ checkUnknown(propertyName);
+ try {
+ osl::MutexGuard g(m_impl->mutex);
+ Impl::BoundListenerMap::iterator i(
+ m_impl->boundListeners.find(propertyName));
+ if (i != m_impl->boundListeners.end()) {
+ BoundListenerBag::iterator j(i->second.find(listener));
+ if (j != i->second.end()) {
+ i->second.erase(j);
+ }
+ }
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::addVetoableChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const & listener)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ css::uno::Reference< css::beans::XVetoableChangeListener >(
+ listener, css::uno::UNO_QUERY_THROW); // reject NULL listener
+ checkUnknown(propertyName);
+ try {
+ bool disposed;
+ {
+ osl::MutexGuard g(m_impl->mutex);
+ disposed = m_impl->disposed;
+ if (!disposed) {
+ m_impl->vetoListeners[propertyName].insert(listener);
+ }
+ }
+ if (disposed) {
+ listener->disposing(
+ css::lang::EventObject(
+ static_cast< css::beans::XPropertySet * >(this)));
+ }
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::removeVetoableChangeListener(
+ rtl::OUString const & propertyName,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const & listener)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ OSL_ASSERT(listener.is());
+ checkUnknown(propertyName);
+ try {
+ osl::MutexGuard g(m_impl->mutex);
+ Impl::VetoListenerMap::iterator i(
+ m_impl->vetoListeners.find(propertyName));
+ if (i != m_impl->vetoListeners.end()) {
+ Impl::VetoListenerBag::iterator j(i->second.find(listener));
+ if (j != i->second.end()) {
+ i->second.erase(j);
+ }
+ }
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::setFastPropertyValue(
+ sal_Int32 handle, css::uno::Any const & value)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ try {
+ m_impl->setProperty(
+ static_cast< css::beans::XPropertySet * >(this),
+ m_impl->translateHandle(
+ static_cast< css::beans::XPropertySet * >(this), handle),
+ value, false, false, 1);
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+css::uno::Any PropertySetMixinImpl::getFastPropertyValue(sal_Int32 handle)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ try {
+ return m_impl->getProperty(
+ static_cast< css::beans::XPropertySet * >(this),
+ m_impl->translateHandle(
+ static_cast< css::beans::XPropertySet * >(this), handle),
+ 0);
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+css::uno::Sequence< css::beans::PropertyValue >
+PropertySetMixinImpl::getPropertyValues() throw (css::uno::RuntimeException) {
+ try {
+ css::uno::Sequence< css::beans::PropertyValue > s(
+ m_impl->handleMap.getLength());
+ sal_Int32 n = 0;
+ for (sal_Int32 i = 0; i < m_impl->handleMap.getLength(); ++i) {
+ try {
+ s[n].Value = m_impl->getProperty(
+ static_cast< css::beans::XPropertySet * >(this),
+ m_impl->handleMap[i], &s[n].State);
+ } catch (css::beans::UnknownPropertyException &) {
+ continue;
+ } catch (css::lang::WrappedTargetException & e) {
+ throw css::lang::WrappedTargetRuntimeException(
+ e.Message, static_cast< css::beans::XPropertySet * >(this),
+ e.TargetException);
+ }
+ s[n].Name = m_impl->handleMap[i];
+ s[n].Handle = i;
+ ++n;
+ }
+ s.realloc(n);
+ return s;
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
+
+void PropertySetMixinImpl::setPropertyValues(
+ css::uno::Sequence< css::beans::PropertyValue > const & props)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ try {
+ for (sal_Int32 i = 0; i < props.getLength(); ++i) {
+ if (props[i].Handle != -1
+ && (props[i].Name
+ != m_impl->translateHandle(
+ static_cast< css::beans::XPropertySet * >(this),
+ props[i].Handle)))
+ {
+ throw css::beans::UnknownPropertyException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name "))
+ + props[i].Name
+ + rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(" does not match handle "))
+ + rtl::OUString::valueOf(props[i].Handle)),
+ static_cast< css::beans::XPropertySet * >(this));
+ }
+ m_impl->setProperty(
+ static_cast< css::beans::XPropertySet * >(this), props[i].Name,
+ props[i].Value,
+ props[i].State == css::beans::PropertyState_AMBIGUOUS_VALUE,
+ props[i].State == css::beans::PropertyState_DEFAULT_VALUE, 0);
+ }
+ } catch (std::bad_alloc &) {
+ //TODO OutOfMemoryException:
+ throw css::uno::RuntimeException(
+ rtl::OUString(), static_cast< css::beans::XPropertySet * >(this));
+ }
+}
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
new file mode 100644
index 000000000000..fe455781a1a7
--- /dev/null
+++ b/cppuhelper/source/propshlp.cxx
@@ -0,0 +1,1241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include "osl/diagnose.h"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/propshlp.hxx"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+
+
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace rtl;
+using namespace cppu;
+
+namespace cppu {
+
+IPropertyArrayHelper::~IPropertyArrayHelper()
+{
+}
+
+inline const ::com::sun::star::uno::Type & getPropertyTypeIdentifier( ) SAL_THROW( () )
+{
+ return ::getCppuType( (Reference< XPropertyChangeListener > *)0 );
+}
+inline const ::com::sun::star::uno::Type & getPropertiesTypeIdentifier() SAL_THROW( () )
+{
+ return ::getCppuType( (Reference< XPropertiesChangeListener > *)0 );
+}
+inline const ::com::sun::star::uno::Type & getVetoableTypeIdentifier() SAL_THROW( () )
+{
+ return ::getCppuType( (Reference< XVetoableChangeListener > *)0 );
+}
+
+extern "C" {
+
+static int compare_OUString_Property_Impl( const void *arg1, const void *arg2 )
+ SAL_THROW_EXTERN_C()
+{
+ return ((OUString *)arg1)->compareTo( ((Property *)arg2)->Name );
+}
+
+}
+
+/**
+ * The class which implements the PropertySetInfo interface.
+ */
+
+class OPropertySetHelperInfo_Impl
+ : public WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
+{
+ Sequence < Property > aInfos;
+
+public:
+ OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ ) SAL_THROW( () );
+
+ // XPropertySetInfo-Methoden
+ virtual Sequence< Property > SAL_CALL getProperties(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual Property SAL_CALL getPropertyByName(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& PropertyName) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+/**
+ * Create an object that implements XPropertySetInfo IPropertyArrayHelper.
+ */
+OPropertySetHelperInfo_Impl::OPropertySetHelperInfo_Impl(
+ IPropertyArrayHelper & rHelper_ )
+ SAL_THROW( () )
+ :aInfos( rHelper_.getProperties() )
+{
+}
+
+/**
+ * Return the sequence of properties, which are provided throug the constructor.
+ */
+Sequence< Property > OPropertySetHelperInfo_Impl::getProperties(void) throw(::com::sun::star::uno::RuntimeException)
+
+{
+ return aInfos;
+}
+
+/**
+ * Return the sequence of properties, which are provided throug the constructor.
+ */
+Property OPropertySetHelperInfo_Impl::getPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ Property * pR;
+ pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ if( !pR ) {
+ throw UnknownPropertyException();
+ }
+
+ return *pR;
+}
+
+/**
+ * Return the sequence of properties, which are provided throug the constructor.
+ */
+sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Property * pR;
+ pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ return pR != NULL;
+}
+
+// ----------------------------------------------------
+// class PropertySetHelper_Impl
+// ----------------------------------------------------
+class OPropertySetHelper::Impl {
+
+public:
+ Impl ( bool i_bIgnoreRuntimeExceptionsWhileFiring,
+ IEventNotificationHook *i_pFireEvents)
+ : m_bIgnoreRuntimeExceptionsWhileFiring(
+ i_bIgnoreRuntimeExceptionsWhileFiring ),
+ m_pFireEvents( i_pFireEvents )
+ { }
+
+ bool m_bIgnoreRuntimeExceptionsWhileFiring;
+ class IEventNotificationHook * const m_pFireEvents;
+};
+
+
+// ----------------------------------------------------
+// class PropertySetHelper
+// ----------------------------------------------------
+OPropertySetHelper::OPropertySetHelper(
+ OBroadcastHelper & rBHelper_ ) SAL_THROW( () )
+ : rBHelper( rBHelper_ ),
+ aBoundLC( rBHelper_.rMutex ),
+ aVetoableLC( rBHelper_.rMutex ),
+ m_pReserved( new Impl(false, 0) )
+{
+}
+
+OPropertySetHelper::OPropertySetHelper(
+ OBroadcastHelper & rBHelper_, bool bIgnoreRuntimeExceptionsWhileFiring )
+ : rBHelper( rBHelper_ ),
+ aBoundLC( rBHelper_.rMutex ),
+ aVetoableLC( rBHelper_.rMutex ),
+ m_pReserved( new Impl( bIgnoreRuntimeExceptionsWhileFiring, 0 ) )
+{
+}
+
+OPropertySetHelper::OPropertySetHelper(
+ OBroadcastHelper & rBHelper_, IEventNotificationHook * i_pFireEvents,
+ bool bIgnoreRuntimeExceptionsWhileFiring)
+ : rBHelper( rBHelper_ ),
+ aBoundLC( rBHelper_.rMutex ),
+ aVetoableLC( rBHelper_.rMutex ),
+ m_pReserved(
+ new Impl( bIgnoreRuntimeExceptionsWhileFiring, i_pFireEvents) )
+{
+}
+
+/**
+ * You must call disposing before.
+ */
+OPropertySetHelper::~OPropertySetHelper() SAL_THROW( () )
+{
+}
+
+/**
+ * These method is called from queryInterface, if no delegator is set.
+ * Otherwise this method is called from the delegator.
+ */
+// XAggregation
+Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw (RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType,
+ static_cast< XPropertySet * >( this ),
+ static_cast< XMultiPropertySet * >( this ),
+ static_cast< XFastPropertySet * >( this ) );
+}
+
+/**
+ * called from the derivee's XTypeProvider::getTypes implementation
+ */
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > OPropertySetHelper::getTypes()
+ throw (RuntimeException)
+{
+ Sequence< ::com::sun::star::uno::Type > aTypes( 3 );
+ aTypes[ 0 ] = XPropertySet::static_type();
+ aTypes[ 1 ] = XMultiPropertySet::static_type();
+ aTypes[ 2 ] = XFastPropertySet::static_type();
+ return aTypes;
+}
+
+// ComponentHelper
+void OPropertySetHelper::disposing() SAL_THROW( () )
+{
+ // Create an event with this as sender
+ Reference < XPropertySet > rSource( SAL_STATIC_CAST( XPropertySet * , this ) , UNO_QUERY );
+ EventObject aEvt;
+ aEvt.Source = rSource;
+
+ // inform all listeners to reelease this object
+ // The listener container are automaticly cleared
+ aBoundLC.disposeAndClear( aEvt );
+ aVetoableLC.disposeAndClear( aEvt );
+}
+
+Reference < XPropertySetInfo > OPropertySetHelper::createPropertySetInfo(
+ IPropertyArrayHelper & rProperties ) SAL_THROW( () )
+{
+ return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) );
+}
+
+// XPropertySet
+void OPropertySetHelper::setPropertyValue(
+ const OUString& rPropertyName, const Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ // call the method of the XFastPropertySet interface
+ setFastPropertyValue( nHandle, rValue );
+}
+
+// XPropertySet
+Any OPropertySetHelper::getPropertyValue(
+ const OUString& rPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ // call the method of the XFastPropertySet interface
+ return getFastPropertyValue( nHandle );
+}
+
+// XPropertySet
+void OPropertySetHelper::addPropertyChangeListener(
+ const OUString& rPropertyName,
+ const Reference < XPropertyChangeListener > & rxListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSURE( !rBHelper.bInDispose, "do not addPropertyChangeListener in the dispose call" );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ // only add listeners if you are not disposed
+ // a listener with no name means all properties
+ if( rPropertyName.getLength() )
+ {
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ if( nHandle == -1 ) {
+ // property not known throw exception
+ throw UnknownPropertyException() ;
+ }
+
+ sal_Int16 nAttributes;
+ rPH.fillPropertyMembersByHandle( NULL, &nAttributes, nHandle );
+ if( !(nAttributes & ::com::sun::star::beans::PropertyAttribute::BOUND) )
+ {
+ OSL_ENSURE( sal_False, "add listener to an unbound property" );
+ // silent ignore this
+ return;
+ }
+ // add the change listener to the helper container
+
+ aBoundLC.addInterface( (sal_Int32)nHandle, rxListener );
+ }
+ else
+ // add the change listener to the helper container
+ rBHelper.aLC.addInterface(
+ getPropertyTypeIdentifier( ),
+ rxListener
+ );
+ }
+}
+
+
+// XPropertySet
+void OPropertySetHelper::removePropertyChangeListener(
+ const OUString& rPropertyName,
+ const Reference < XPropertyChangeListener >& rxListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ if( rPropertyName.getLength() )
+ {
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ if( nHandle == -1 )
+ // property not known throw exception
+ throw UnknownPropertyException();
+ aBoundLC.removeInterface( (sal_Int32)nHandle, rxListener );
+ }
+ else {
+ // remove the change listener to the helper container
+ rBHelper.aLC.removeInterface(
+ getPropertyTypeIdentifier( ),
+ rxListener
+ );
+ }
+ }
+}
+
+// XPropertySet
+void OPropertySetHelper::addVetoableChangeListener(
+ const OUString& rPropertyName,
+ const Reference< XVetoableChangeListener > & rxListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSURE( !rBHelper.bInDispose, "do not addVetoableChangeListener in the dispose call" );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ // only add listeners if you are not disposed
+ // a listener with no name means all properties
+ if( rPropertyName.getLength() )
+ {
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ if( nHandle == -1 ) {
+ // property not known throw exception
+ throw UnknownPropertyException();
+ }
+
+ sal_Int16 nAttributes;
+ rPH.fillPropertyMembersByHandle( NULL, &nAttributes, nHandle );
+ if( !(nAttributes & PropertyAttribute::CONSTRAINED) )
+ {
+ OSL_ENSURE( sal_False, "addVetoableChangeListener, and property is not constrained" );
+ // silent ignore this
+ return;
+ }
+ // add the vetoable listener to the helper container
+ aVetoableLC.addInterface( (sal_Int32)nHandle, rxListener );
+ }
+ else
+ // add the vetoable listener to the helper container
+ rBHelper.aLC.addInterface(
+ getVetoableTypeIdentifier( ),
+ rxListener
+ );
+ }
+}
+
+// XPropertySet
+void OPropertySetHelper::removeVetoableChangeListener(
+ const OUString& rPropertyName,
+ const Reference < XVetoableChangeListener > & rxListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ if( rPropertyName.getLength() )
+ {
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // map the name to the handle
+ sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
+ if( nHandle == -1 ) {
+ // property not known throw exception
+ throw UnknownPropertyException();
+ }
+ // remove the vetoable listener to the helper container
+ aVetoableLC.removeInterface( (sal_Int32)nHandle, rxListener );
+ }
+ else
+ // add the vetoable listener to the helper container
+ rBHelper.aLC.removeInterface(
+ getVetoableTypeIdentifier( ),
+ rxListener
+ );
+ }
+}
+
+// XFastPropertySet
+void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ OSL_ENSURE( !rBHelper.bInDispose, "do not setFastPropertyValue in the dispose call" );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+
+ IPropertyArrayHelper & rInfo = getInfoHelper();
+ sal_Int16 nAttributes;
+ if( !rInfo.fillPropertyMembersByHandle( NULL, &nAttributes, nHandle ) ) {
+ // unknown property
+ throw UnknownPropertyException();
+ }
+ if( nAttributes & PropertyAttribute::READONLY )
+ throw PropertyVetoException();
+
+ Any aConvertedVal;
+ Any aOldVal;
+
+ // Will the property change?
+ sal_Bool bChanged;
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ bChanged = convertFastPropertyValue( aConvertedVal, aOldVal, nHandle, rValue );
+ // release guard to fire events
+ }
+ if( bChanged )
+ {
+ // Is it a constrained property?
+ if( nAttributes & PropertyAttribute::CONSTRAINED )
+ {
+ // In aValue is the converted rValue
+ // fire a constarined event
+ // second parameter NULL means constrained
+ fire( &nHandle, &rValue, &aOldVal, 1, sal_True );
+ }
+
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ try
+ {
+ // set the property to the new value
+ setFastPropertyValue_NoBroadcast( nHandle, aConvertedVal );
+ }
+ catch (const ::com::sun::star::beans::UnknownPropertyException& ) { throw; /* allowed to leave */ }
+ catch (const ::com::sun::star::beans::PropertyVetoException& ) { throw; /* allowed to leave */ }
+ catch (const ::com::sun::star::lang::IllegalArgumentException& ) { throw; /* allowed to leave */ }
+ catch (const ::com::sun::star::lang::WrappedTargetException& ) { throw; /* allowed to leave */ }
+ catch (const ::com::sun::star::uno::RuntimeException& ) { throw; /* allowed to leave */ }
+ catch (const ::com::sun::star::uno::Exception& e )
+ {
+ // not allowed to leave this meathod
+ ::com::sun::star::lang::WrappedTargetException aWrap;
+ aWrap.Context = static_cast< ::com::sun::star::beans::XPropertySet* >( this );
+ aWrap.TargetException <<= e;
+
+ throw ::com::sun::star::lang::WrappedTargetException( aWrap );
+ }
+
+ // release guard to fire events
+ }
+ // file a change event, if the value changed
+ fire( &nHandle, &rValue, &aOldVal, 1, sal_False );
+ }
+}
+
+// XFastPropertySet
+Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+
+{
+ IPropertyArrayHelper & rInfo = getInfoHelper();
+ if( !rInfo.fillPropertyMembersByHandle( NULL, NULL, nHandle ) )
+ // unknown property
+ throw UnknownPropertyException();
+
+ Any aRet;
+ MutexGuard aGuard( rBHelper.rMutex );
+ getFastPropertyValue( aRet, nHandle );
+ return aRet;
+}
+
+//--------------------------------------------------------------------------
+void OPropertySetHelper::fire
+(
+ sal_Int32 * pnHandles,
+ const Any * pNewValues,
+ const Any * pOldValues,
+ sal_Int32 nHandles, // These is the Count of the array
+ sal_Bool bVetoable
+)
+{
+ OSL_ENSURE( m_pReserved.get(), "No OPropertySetHelper::Impl" );
+ if (m_pReserved->m_pFireEvents) {
+ m_pReserved->m_pFireEvents->fireEvents(
+ pnHandles, nHandles, bVetoable,
+ m_pReserved->m_bIgnoreRuntimeExceptionsWhileFiring);
+ }
+
+ // Only fire, if one or more properties changed
+ if( nHandles )
+ {
+ // create the event sequence of all changed properties
+ Sequence< PropertyChangeEvent > aEvts( nHandles );
+ PropertyChangeEvent * pEvts = aEvts.getArray();
+ Reference < XInterface > xSource( (XPropertySet *)this, UNO_QUERY );
+ sal_Int32 i;
+ sal_Int32 nChangesLen = 0;
+ // Loop over all changed properties to fill the event struct
+ for( i = 0; i < nHandles; i++ )
+ {
+ // Vetoable fire and constrained attribute set or
+ // Change fire and Changed and bound attribute set
+ IPropertyArrayHelper & rInfo = getInfoHelper();
+ sal_Int16 nAttributes;
+ OUString aPropName;
+ rInfo.fillPropertyMembersByHandle( &aPropName, &nAttributes, pnHandles[i] );
+
+ if(
+ (bVetoable && (nAttributes & PropertyAttribute::CONSTRAINED)) ||
+ (!bVetoable && (nAttributes & PropertyAttribute::BOUND))
+ )
+ {
+ pEvts[nChangesLen].Source = xSource;
+ pEvts[nChangesLen].PropertyName = aPropName;
+ pEvts[nChangesLen].PropertyHandle = pnHandles[i];
+ pEvts[nChangesLen].OldValue = pOldValues[i];
+ pEvts[nChangesLen].NewValue = pNewValues[i];
+ nChangesLen++;
+ }
+ }
+
+ bool bIgnoreRuntimeExceptionsWhileFiring =
+ m_pReserved->m_bIgnoreRuntimeExceptionsWhileFiring;
+
+ // fire the events for all changed properties
+ for( i = 0; i < nChangesLen; i++ )
+ {
+ // get the listener container for the property name
+ OInterfaceContainerHelper * pLC;
+ if( bVetoable ) // fire change Events?
+ pLC = aVetoableLC.getContainer( pEvts[i].PropertyHandle );
+ else
+ pLC = aBoundLC.getContainer( pEvts[i].PropertyHandle );
+ if( pLC )
+ {
+ // Ueber alle Listener iterieren und Events senden
+ OInterfaceIteratorHelper aIt( *pLC);
+ while( aIt.hasMoreElements() )
+ {
+ XInterface * pL = aIt.next();
+ try
+ {
+ try
+ {
+ if( bVetoable ) // fire change Events?
+ {
+ ((XVetoableChangeListener *)pL)->vetoableChange(
+ pEvts[i] );
+ }
+ else
+ {
+ ((XPropertyChangeListener *)pL)->propertyChange(
+ pEvts[i] );
+ }
+ }
+ catch (DisposedException & exc)
+ {
+ OSL_ENSURE( exc.Context.is(),
+ "DisposedException without Context!" );
+ if (exc.Context == pL)
+ aIt.remove();
+ else
+ throw;
+ }
+ }
+ catch (RuntimeException & exc)
+ {
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "caught RuntimeException while "
+ "firing listeners: ") ) +
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if (! bIgnoreRuntimeExceptionsWhileFiring)
+ throw;
+ }
+ }
+ }
+ // broadcast to all listeners with "" property name
+ if( bVetoable ){
+ // fire change Events?
+ pLC = rBHelper.aLC.getContainer(
+ getVetoableTypeIdentifier()
+ );
+ }
+ else {
+ pLC = rBHelper.aLC.getContainer(
+ getPropertyTypeIdentifier( )
+ );
+ }
+ if( pLC )
+ {
+ // Ueber alle Listener iterieren und Events senden
+ OInterfaceIteratorHelper aIt( *pLC);
+ while( aIt.hasMoreElements() )
+ {
+ XInterface * pL = aIt.next();
+ try
+ {
+ try
+ {
+ if( bVetoable ) // fire change Events?
+ {
+ ((XVetoableChangeListener *)pL)->vetoableChange(
+ pEvts[i] );
+ }
+ else
+ {
+ ((XPropertyChangeListener *)pL)->propertyChange(
+ pEvts[i] );
+ }
+ }
+ catch (DisposedException & exc)
+ {
+ OSL_ENSURE( exc.Context.is(),
+ "DisposedException without Context!" );
+ if (exc.Context == pL)
+ aIt.remove();
+ else
+ throw;
+ }
+ }
+ catch (RuntimeException & exc)
+ {
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "caught RuntimeException while "
+ "firing listeners: ") ) +
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if (! bIgnoreRuntimeExceptionsWhileFiring)
+ throw;
+ }
+ }
+ }
+ }
+
+ // reduce array to changed properties
+ aEvts.realloc( nChangesLen );
+
+ if( !bVetoable )
+ {
+ OInterfaceContainerHelper * pCont = 0;
+ pCont = rBHelper.aLC.getContainer(
+ getPropertiesTypeIdentifier( )
+ );
+ if( pCont )
+ {
+ // Here is a Bug, unbound properties are also fired
+ OInterfaceIteratorHelper aIt( *pCont );
+ while( aIt.hasMoreElements() )
+ {
+ XPropertiesChangeListener * pL =
+ (XPropertiesChangeListener *)aIt.next();
+ try
+ {
+ try
+ {
+ // fire the hole event sequence to the
+ // XPropertiesChangeListener's
+ pL->propertiesChange( aEvts );
+ }
+ catch (DisposedException & exc)
+ {
+ OSL_ENSURE( exc.Context.is(),
+ "DisposedException without Context!" );
+ if (exc.Context == pL)
+ aIt.remove();
+ else
+ throw;
+ }
+ }
+ catch (RuntimeException & exc)
+ {
+ OSL_TRACE(
+ OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "caught RuntimeException while "
+ "firing listeners: ") ) +
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if (! bIgnoreRuntimeExceptionsWhileFiring)
+ throw;
+ }
+ }
+ }
+ }
+ }
+}
+
+// OPropertySetHelper
+void OPropertySetHelper::setFastPropertyValues(
+ sal_Int32 nSeqLen,
+ sal_Int32 * pHandles,
+ const Any * pValues,
+ sal_Int32 nHitCount )
+ SAL_THROW( (::com::sun::star::uno::Exception) )
+{
+ OSL_ENSURE( !rBHelper.bInDispose, "do not getFastPropertyValue in the dispose call" );
+ OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" );
+
+ Any * pConvertedValues = NULL;
+ Any * pOldValues = NULL;
+
+ try
+ {
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+
+ pConvertedValues = new Any[ nHitCount ];
+ pOldValues = new Any[ nHitCount ];
+ sal_Int32 n = 0;
+ sal_Int32 i;
+
+ {
+ // must lock the mutex outside the loop. So all values are consistent.
+ MutexGuard aGuard( rBHelper.rMutex );
+ for( i = 0; i < nSeqLen; i++ )
+ {
+ if( pHandles[i] != -1 )
+ {
+ sal_Int16 nAttributes;
+ rPH.fillPropertyMembersByHandle( NULL, &nAttributes, pHandles[i] );
+ if( nAttributes & PropertyAttribute::READONLY ) {
+ throw PropertyVetoException();
+ }
+ // Will the property change?
+ if( convertFastPropertyValue( pConvertedValues[ n ], pOldValues[n],
+ pHandles[i], pValues[i] ) )
+ {
+ // only increment if the property really change
+ pHandles[n] = pHandles[i];
+ n++;
+ }
+ }
+ }
+ // release guard to fire events
+ }
+
+ // fire vetoable events
+ fire( pHandles, pConvertedValues, pOldValues, n, sal_True );
+
+ {
+ // must lock the mutex outside the loop.
+ MutexGuard aGuard( rBHelper.rMutex );
+ // Loop over all changed properties
+ for( i = 0; i < n; i++ )
+ {
+ // Will the property change?
+ setFastPropertyValue_NoBroadcast( pHandles[i], pConvertedValues[i] );
+ }
+ // release guard to fire events
+ }
+
+ // fire change events
+ fire( pHandles, pConvertedValues, pOldValues, n, sal_False );
+ }
+ catch( ... )
+ {
+ delete [] pOldValues;
+ delete [] pConvertedValues;
+ throw;
+ }
+ delete [] pOldValues;
+ delete [] pConvertedValues;
+}
+
+// XMultiPropertySet
+/**
+ * The sequence may be conatain not known properties. The implementation
+ * must ignore these properties.
+ */
+void OPropertySetHelper::setPropertyValues(
+ const Sequence<OUString>& rPropertyNames,
+ const Sequence<Any>& rValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 * pHandles = NULL;
+ try
+ {
+ sal_Int32 nSeqLen = rPropertyNames.getLength();
+ pHandles = new sal_Int32[ nSeqLen ];
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // fill the handle array
+ sal_Int32 nHitCount = rPH.fillHandles( pHandles, rPropertyNames );
+ if( nHitCount != 0 )
+ setFastPropertyValues( nSeqLen, pHandles, rValues.getConstArray(), nHitCount );
+ }
+ catch( ... )
+ {
+ delete [] pHandles;
+ throw;
+ }
+ delete [] pHandles;
+}
+
+// XMultiPropertySet
+Sequence<Any> OPropertySetHelper::getPropertyValues( const Sequence<OUString>& rPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nSeqLen = rPropertyNames.getLength();
+ sal_Int32 * pHandles = new sal_Int32[ nSeqLen ];
+ Sequence< Any > aValues( nSeqLen );
+
+ // get the map table
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ // fill the handle array
+ rPH.fillHandles( pHandles, rPropertyNames );
+
+ Any * pValues = aValues.getArray();
+
+ MutexGuard aGuard( rBHelper.rMutex );
+ // fill the sequence with the values
+ for( sal_Int32 i = 0; i < nSeqLen; i++ )
+ getFastPropertyValue( pValues[i], pHandles[i] );
+
+ delete [] pHandles;
+ return aValues;
+}
+
+// XMultiPropertySet
+void OPropertySetHelper::addPropertiesChangeListener(
+ const Sequence<OUString> & ,
+ const Reference < XPropertiesChangeListener > & rListener )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ rBHelper.addListener( getCppuType(&rListener) , rListener );
+}
+
+// XMultiPropertySet
+void OPropertySetHelper::removePropertiesChangeListener(
+ const Reference < XPropertiesChangeListener > & rListener )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ rBHelper.removeListener( getCppuType(&rListener) , rListener );
+}
+
+// XMultiPropertySet
+void OPropertySetHelper::firePropertiesChangeEvent(
+ const Sequence<OUString>& rPropertyNames,
+ const Reference < XPropertiesChangeListener >& rListener )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nLen = rPropertyNames.getLength();
+ sal_Int32 * pHandles = new sal_Int32[nLen];
+ IPropertyArrayHelper & rPH = getInfoHelper();
+ rPH.fillHandles( pHandles, rPropertyNames );
+ const OUString* pNames = rPropertyNames.getConstArray();
+
+ // get the count of matching properties
+ sal_Int32 nFireLen = 0;
+ sal_Int32 i;
+ for( i = 0; i < nLen; i++ )
+ if( pHandles[i] != -1 )
+ nFireLen++;
+
+ Sequence<PropertyChangeEvent> aChanges( nFireLen );
+ PropertyChangeEvent* pChanges = aChanges.getArray();
+
+ sal_Int32 nFirePos = 0;
+ {
+ // must lock the mutex outside the loop. So all values are consistent.
+ MutexGuard aGuard( rBHelper.rMutex );
+ Reference < XInterface > xSource( (XPropertySet *)this, UNO_QUERY );
+ for( i = 0; i < nLen; i++ )
+ {
+ if( pHandles[i] != -1 )
+ {
+ pChanges[nFirePos].Source = xSource;
+ pChanges[nFirePos].PropertyName = pNames[i];
+ pChanges[nFirePos].PropertyHandle = pHandles[i];
+ getFastPropertyValue( pChanges[nFirePos].OldValue, pHandles[i] );
+ pChanges[nFirePos].NewValue = pChanges[nFirePos].OldValue;
+ nFirePos++;
+ }
+ }
+ // release guard to fire events
+ }
+ if( nFireLen )
+ rListener->propertiesChange( aChanges );
+
+ delete [] pHandles;
+}
+
+#ifdef xdvnsdfln
+// XPropertyState
+PropertyState OPropertySetHelper::getPropertyState( const OUString& PropertyName )
+{
+ PropertyState aState;
+ return aState;
+}
+
+// XPropertyState
+Sequence< PropertyState > OPropertySetHelper::getPropertyStates( const Sequence< OUString >& PropertyNames )
+{
+ ULONG nNames = PropertyNames.getLength();
+ const OUString* pNames = PropertyNames.getConstArray();
+
+ Sequence< PropertyState > aStates( nNames );
+ return aStates;
+
+}
+
+void OPropertySetHelper::setPropertyToDefault( const OUString& aPropertyName )
+{
+ setPropertyValue( aPropertyName, Any() );
+}
+
+Any OPropertySetHelper::getPropertyDefault( const OUString& aPropertyName ) const
+{
+ return Any();
+}
+
+void OPropertySetHelper::addPropertyStateChangeListener( const OUString& aPropertyName, const XPropertyStateChangeListenerRef& Listener )
+{
+}
+
+void OPropertySetHelper::removePropertyStateChangeListener( const OUString& aPropertyName, const XPropertyStateChangeListenerRef& Listener )
+{
+}
+#endif
+
+//========================================================================
+//== OPropertyArrayHelper ================================================
+//========================================================================
+
+//========================================================================
+
+// static OUString makeOUString( sal_Char *p )
+// {
+// sal_Int32 nLen = strlen(p);
+// sal_Unicode *pw = new sal_Unicode[nLen];
+
+// for( int i = 0 ; i < nLen ; i ++ ) {
+
+// // Only ascii strings allowed with this helper !
+// OSL_ASSERT( p[i] < 127 );
+// pw[i] = p[i];
+// }
+// OUString ow( pw , nLen );
+// delete pw;
+// return ow;
+// }
+
+extern "C" {
+
+static int compare_Property_Impl( const void *arg1, const void *arg2 )
+ SAL_THROW_EXTERN_C()
+{
+ return ((Property *)arg1)->Name.compareTo( ((Property *)arg2)->Name );
+}
+
+}
+
+void OPropertyArrayHelper::init( sal_Bool bSorted ) SAL_THROW( () )
+{
+ sal_Int32 i, nElements = aInfos.getLength();
+ const Property* pProperties = aInfos.getConstArray();
+
+ for( i = 1; i < nElements; i++ )
+ {
+ if( pProperties[i-1].Name >= pProperties[i].Name )
+ {
+#ifndef OS2 // YD disabled, too many troubles with debug builds!
+ if (bSorted) {
+ OSL_ENSURE( false, "Property array is not sorted" );
+ }
+#endif
+ // not sorted
+ qsort( aInfos.getArray(), nElements, sizeof( Property ),
+ compare_Property_Impl );
+ break;
+ }
+ }
+ // may be that the array is resorted
+ pProperties = aInfos.getConstArray();
+ for( i = 0; i < nElements; i++ )
+ if( pProperties[i].Handle != i )
+ return;
+ // The handle is the index
+ bRightOrdered = sal_True;
+}
+
+OPropertyArrayHelper::OPropertyArrayHelper(
+ Property * pProps,
+ sal_Int32 nEle,
+ sal_Bool bSorted )
+ SAL_THROW( () )
+ : aInfos(pProps, nEle)
+ , bRightOrdered( sal_False )
+{
+ init( bSorted );
+}
+
+OPropertyArrayHelper::OPropertyArrayHelper(
+ const Sequence< Property > & aProps,
+ sal_Bool bSorted )
+ SAL_THROW( () )
+ : aInfos(aProps)
+ , bRightOrdered( sal_False )
+{
+ init( bSorted );
+}
+
+//========================================================================
+sal_Int32 OPropertyArrayHelper::getCount() const
+{
+ return aInfos.getLength();
+}
+
+//========================================================================
+sal_Bool OPropertyArrayHelper::fillPropertyMembersByHandle
+(
+ OUString * pPropName,
+ sal_Int16 * pAttributes,
+ sal_Int32 nHandle
+)
+{
+ const Property* pProperties = aInfos.getConstArray();
+ sal_Int32 nElements = aInfos.getLength();
+
+ if( bRightOrdered )
+ {
+ if( nHandle < 0 || nHandle >= nElements )
+ return sal_False;
+ if( pPropName )
+ *pPropName = pProperties[ nHandle ].Name;
+ if( pAttributes )
+ *pAttributes = pProperties[ nHandle ].Attributes;
+ return sal_True;
+ }
+ else
+ {
+ // normally the array is sorted
+ for( sal_Int32 i = 0; i < nElements; i++ )
+ {
+ if( pProperties[i].Handle == nHandle )
+ {
+ if( pPropName )
+ *pPropName = pProperties[ i ].Name;
+ if( pAttributes )
+ *pAttributes = pProperties[ i ].Attributes;
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+//========================================================================
+Sequence< Property > OPropertyArrayHelper::getProperties(void)
+{
+ /*if( aInfos.getLength() != nElements )
+ {
+ ((OPropertyArrayHelper *)this)->aInfos.realloc( nElements );
+ Property * pProps = ((OPropertyArrayHelper *)this)->aInfos.getArray();
+ for( sal_Int32 i = 0; i < nElements; i++ )
+ {
+ pProps[i].Name = pProperties[i].Name;
+ pProps[i].Handle = pProperties[i].Handle;
+ pProps[i].Type = pProperties[i].Type;
+ pProps[i].Attributes = pProperties[i].Attributes;
+ }
+ }*/
+ return aInfos;
+}
+
+//========================================================================
+Property OPropertyArrayHelper::getPropertyByName(const OUString& aPropertyName)
+ throw (UnknownPropertyException)
+{
+ Property * pR;
+ pR = (Property *)bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ if( !pR ) {
+ throw UnknownPropertyException();
+ }
+
+ /*Property aProp;
+ aProp.Name = pR->Name;
+ aProp.Handle = pR->Handle;
+ aProp.Type = pR->Type;
+ aProp.Attributes = pR->Attributes;
+ return aProp;*/
+ return *pR;
+}
+
+//========================================================================
+sal_Bool OPropertyArrayHelper::hasPropertyByName(const OUString& aPropertyName)
+{
+ Property * pR;
+ pR = (Property *)bsearch( &aPropertyName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ return pR != NULL;
+}
+
+//========================================================================
+sal_Int32 OPropertyArrayHelper::getHandleByName( const OUString & rPropName )
+{
+ Property * pR;
+ pR = (Property *)bsearch( &rPropName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ return pR ? pR->Handle : -1;
+}
+
+//========================================================================
+sal_Int32 OPropertyArrayHelper::fillHandles( sal_Int32 * pHandles, const Sequence< OUString > & rPropNames )
+{
+ sal_Int32 nHitCount = 0;
+ const OUString * pReqProps = rPropNames.getConstArray();
+ sal_Int32 nReqLen = rPropNames.getLength();
+ const Property * pCur = aInfos.getConstArray();
+ const Property * pEnd = pCur + aInfos.getLength();
+
+ for( sal_Int32 i = 0; i < nReqLen; i++ )
+ {
+ // Logarithmus ermitteln
+ sal_Int32 n = (sal_Int32)(pEnd - pCur);
+ sal_Int32 nLog = 0;
+ while( n )
+ {
+ nLog += 1;
+ n = n >> 1;
+ }
+
+ // Anzahl der noch zu suchenden Properties * dem Log2 der verbleibenden
+ // zu dursuchenden Properties.
+ if( (nReqLen - i) * nLog >= pEnd - pCur )
+ {
+ // linear search is better
+ while( pCur < pEnd && pReqProps[i] > pCur->Name )
+ {
+ pCur++;
+ }
+ if( pCur < pEnd && pReqProps[i] == pCur->Name )
+ {
+ pHandles[i] = pCur->Handle;
+ nHitCount++;
+ }
+ else
+ pHandles[i] = -1;
+ }
+ else
+ {
+ // binary search is better
+ sal_Int32 nCompVal = 1;
+ const Property * pOldEnd = pEnd--;
+ const Property * pMid = pCur;
+
+ while( nCompVal != 0 && pCur <= pEnd )
+ {
+ pMid = (pEnd - pCur) / 2 + pCur;
+
+ nCompVal = pReqProps[i].compareTo( pMid->Name );
+
+ if( nCompVal > 0 )
+ pCur = pMid + 1;
+ else
+ pEnd = pMid - 1;
+ }
+
+ if( nCompVal == 0 )
+ {
+ pHandles[i] = pMid->Handle;
+ nHitCount++;
+ pCur = pMid +1;
+ }
+ else if( nCompVal > 0 )
+ {
+ pHandles[i] = -1;
+ pCur = pMid +1;
+ }
+ else
+ {
+ pHandles[i] = -1;
+ pCur = pMid;
+ }
+ pEnd = pOldEnd;
+ }
+ }
+ return nHitCount;
+}
+
+} // end namespace cppu
+
+
+
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
new file mode 100644
index 000000000000..57eae9a51087
--- /dev/null
+++ b/cppuhelper/source/servicefactory.cxx
@@ -0,0 +1,660 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#if OSL_DEBUG_LEVEL > 0
+#include <stdio.h>
+#endif
+#include <vector>
+
+#include "rtl/string.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/bootstrap.hxx"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "osl/module.h"
+#include "osl/process.h"
+#include "cppuhelper/shlib.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/component_context.hxx"
+#include "cppuhelper/servicefactory.hxx"
+#include "cppuhelper/bootstrap.hxx"
+
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/container/XSet.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/registry/XImplementationRegistration.hpp"
+#include "com/sun/star/security/XAccessController.hpp"
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+
+// private forward decl
+void addFactories(
+ char const * const * ppNames /* lib, implname, ..., 0 */,
+ OUString const & bootstrapPath,
+ Reference< lang::XMultiComponentFactory > const & xMgr,
+ Reference< registry::XRegistryKey > const & xKey )
+ SAL_THROW( (Exception) );
+
+Reference< security::XAccessController >
+createDefaultAccessController() SAL_THROW( () );
+
+Reference< lang::XSingleComponentFactory >
+create_boostrap_macro_expander_factory() SAL_THROW( () );
+
+OUString const & get_this_libpath();
+
+
+static Reference< XInterface > SAL_CALL createInstance(
+ Reference< XInterface > const & xFactory,
+ Reference< XComponentContext > const & xContext =
+ Reference< XComponentContext >() )
+{
+ Reference< lang::XSingleComponentFactory > xFac( xFactory, UNO_QUERY );
+ if (xFac.is())
+ {
+ return xFac->createInstanceWithContext( xContext );
+ }
+ else
+ {
+ Reference< lang::XSingleServiceFactory > xFac2( xFactory, UNO_QUERY );
+ if (xFac2.is())
+ {
+ OSL_ENSURE( !xContext.is(), "### ignoring context!" );
+ return xFac2->createInstance();
+ }
+ }
+ throw RuntimeException(
+ OUSTR("no factory object given!"),
+ Reference< XInterface >() );
+}
+
+Reference< registry::XSimpleRegistry > SAL_CALL createSimpleRegistry(
+ OUString const & rBootstrapPath )
+ SAL_THROW( () )
+{
+ try
+ {
+ return Reference< registry::XSimpleRegistry >(
+ createInstance(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
+ 0 == rBootstrapPath.getLength()
+ ? get_this_libpath() : rBootstrapPath,
+ OUSTR("com.sun.star.comp.stoc.SimpleRegistry"),
+ Reference< lang::XMultiServiceFactory >(),
+ Reference< registry::XRegistryKey >() ) ),
+ UNO_QUERY );
+ }
+ catch (Exception & exc)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ OString cstr_msg(
+ OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( !"### exception occured:", cstr_msg.getStr() );
+#else
+ (void) exc; // avoid warning about unused variable
+#endif
+ }
+
+ return Reference< registry::XSimpleRegistry >();
+}
+
+Reference< registry::XSimpleRegistry > SAL_CALL createNestedRegistry(
+ OUString const & rBootstrapPath )
+ SAL_THROW( () )
+{
+ try
+ {
+ return Reference< registry::XSimpleRegistry >(
+ createInstance(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
+ 0 == rBootstrapPath.getLength()
+ ? get_this_libpath() : rBootstrapPath,
+ OUSTR("com.sun.star.comp.stoc.NestedRegistry"),
+ Reference< lang::XMultiServiceFactory >(),
+ Reference< registry::XRegistryKey >() ) ),
+ UNO_QUERY );
+ }
+ catch (Exception & exc)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ OString cstr_msg(
+ OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_ENSURE( !"### exception occured:", cstr_msg.getStr() );
+#else
+ (void) exc; // avoid warning about unused variable
+#endif
+ }
+
+ return Reference< registry::XSimpleRegistry >();
+}
+
+
+/** bootstrap variables:
+
+ UNO_AC=<mode> [mandatory]
+ -- mode := { on, off, dynamic-only, single-user, single-default-user }
+ UNO_AC_SERVICE=<service_name> [optional]
+ -- override ac singleton service name
+ UNO_AC_SINGLEUSER=<user-id|nothing> [optional]
+ -- run with this user id or with default user policy (<nothing>)
+ set UNO_AC=single-[default-]user
+ UNO_AC_USERCACHE_SIZE=<cache_size>
+ -- number of user permission sets to be cached
+
+ UNO_AC_POLICYSERVICE=<service_name> [optional]
+ -- override policy singleton service name
+ UNO_AC_POLICYFILE=<file_url> [optional]
+ -- read policy out of simple text file
+*/
+static void add_access_control_entries(
+ ::std::vector< ContextEntry_Init > * values,
+ Bootstrap const & bootstrap )
+ SAL_THROW( (Exception) )
+{
+ ContextEntry_Init entry;
+ ::std::vector< ContextEntry_Init > & context_values = *values;
+
+ OUString ac_policy;
+ if (bootstrap.getFrom( OUSTR("UNO_AC_POLICYSERVICE"), ac_policy ))
+ {
+ // overridden service name
+ // - policy singleton
+ entry.bLateInitService = true;
+ entry.name = OUSTR("/singletons/com.sun.star.security.thePolicy");
+ entry.value <<= ac_policy;
+ context_values.push_back( entry );
+ }
+ else if (bootstrap.getFrom( OUSTR("UNO_AC_POLICYFILE"), ac_policy ))
+ {
+ // check for file policy
+ // - file policy prop: file-name
+ if (0 != ac_policy.compareToAscii(
+ RTL_CONSTASCII_STRINGPARAM("file:///") ))
+ {
+ // no file url
+ OUString baseDir;
+ if ( ::osl_getProcessWorkingDir( &baseDir.pData )
+ != osl_Process_E_None )
+ {
+ OSL_ASSERT( false );
+ }
+ OUString fileURL;
+ if ( ::osl_getAbsoluteFileURL(
+ baseDir.pData, ac_policy.pData, &fileURL.pData )
+ != osl_File_E_None )
+ {
+ OSL_ASSERT( false );
+ }
+ ac_policy = fileURL;
+ }
+
+ entry.bLateInitService = false;
+ entry.name =
+ OUSTR("/implementations/com.sun.star.security.comp.stoc.FilePolicy/"
+ "file-name");
+ entry.value <<= ac_policy;
+ context_values.push_back( entry );
+ // - policy singleton
+ entry.bLateInitService = true;
+ entry.name = OUSTR("/singletons/com.sun.star.security.thePolicy");
+ entry.value <<= OUSTR("com.sun.star.security.comp.stoc.FilePolicy");
+ context_values.push_back( entry );
+ } // else policy singleton comes from storage
+
+ OUString ac_mode;
+ if (! bootstrap.getFrom( OUSTR("UNO_AC"), ac_mode ))
+ {
+ ac_mode = OUSTR("off"); // default
+ }
+ OUString ac_user;
+ if (bootstrap.getFrom( OUSTR("UNO_AC_SINGLEUSER"), ac_user ))
+ {
+ // ac in single-user mode
+ if (ac_user.getLength())
+ {
+ // - ac prop: single-user-id
+ entry.bLateInitService = false;
+ entry.name =
+ OUSTR("/services/com.sun.star.security.AccessController/"
+ "single-user-id");
+ entry.value <<= ac_user;
+ context_values.push_back( entry );
+ if (! ac_mode.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("single-user") ))
+ {
+ throw SecurityException(
+ OUSTR("set UNO_AC=single-user "
+ "if you set UNO_AC_SINGLEUSER=<user-id>!"),
+ Reference< XInterface >() );
+ }
+ }
+ else
+ {
+ if (! ac_mode.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("single-default-user") ))
+ {
+ throw SecurityException(
+ OUSTR("set UNO_AC=single-default-user "
+ "if you set UNO_AC_SINGLEUSER=<nothing>!"),
+ Reference< XInterface >() );
+ }
+ }
+ }
+
+ OUString ac_service;
+ if (! bootstrap.getFrom( OUSTR("UNO_AC_SERVICE"), ac_service ))
+ {
+ // override service name
+ ac_service = OUSTR("com.sun.star.security.AccessController"); // default
+// ac = OUSTR("com.sun.star.security.comp.stoc.AccessController");
+ }
+
+ // - ac prop: user-cache-size
+ OUString ac_cache;
+ if (bootstrap.getFrom( OUSTR("UNO_AC_USERCACHE_SIZE"), ac_cache ))
+ {
+ // ac cache size
+ sal_Int32 n = ac_cache.toInt32();
+ if (0 < n)
+ {
+ entry.bLateInitService = false;
+ entry.name =
+ OUSTR("/services/com.sun.star.security.AccessController/"
+ "user-cache-size");
+ entry.value <<= n;
+ context_values.push_back( entry );
+ }
+ }
+
+ // - ac prop: mode
+ // { "off", "on", "dynamic-only", "single-user", "single-default-user" }
+ entry.bLateInitService = false;
+ entry.name = OUSTR("/services/com.sun.star.security.AccessController/mode");
+ entry.value <<= ac_mode;
+ context_values.push_back( entry );
+ // - ac singleton
+ entry.bLateInitService = true;
+ entry.name = OUSTR("/singletons/com.sun.star.security.theAccessController");
+ entry.value <<= ac_service;
+ context_values.push_back( entry );
+}
+
+Reference< lang::XMultiComponentFactory > bootstrapInitialSF(
+ OUString const & rBootstrapPath )
+ SAL_THROW( (Exception) )
+{
+ OUString const & bootstrap_path =
+ 0 == rBootstrapPath.getLength() ? get_this_libpath() : rBootstrapPath;
+
+ Reference< lang::XMultiComponentFactory > xMgr(
+ createInstance(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION), bootstrap_path,
+ OUSTR("com.sun.star.comp.stoc.ORegistryServiceManager"),
+ Reference< lang::XMultiServiceFactory >(),
+ Reference< registry::XRegistryKey >() ) ),
+ UNO_QUERY );
+
+ // add initial bootstrap services
+ static char const * ar[] = {
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.OServiceManagerWrapper",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.DLLComponentLoader",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.SimpleRegistry",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.NestedRegistry",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.TypeDescriptionManager",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.comp.stoc.ImplementationRegistration",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.security.comp.stoc.AccessController",
+ "bootstrap.uno" SAL_DLLEXTENSION,
+ "com.sun.star.security.comp.stoc.FilePolicy",
+ 0
+ };
+ addFactories(
+ ar, bootstrap_path,
+ xMgr, Reference< registry::XRegistryKey >() );
+
+ return xMgr;
+}
+
+// returns context with UNinitialized smgr
+Reference< XComponentContext > bootstrapInitialContext(
+ Reference< lang::XMultiComponentFactory > const & xSF,
+ Reference< registry::XSimpleRegistry > const & types_xRegistry,
+ Reference< registry::XSimpleRegistry > const & services_xRegistry,
+ OUString const & rBootstrapPath, Bootstrap const & bootstrap )
+ SAL_THROW( (Exception) )
+{
+ Reference< lang::XInitialization > xSFInit( xSF, UNO_QUERY );
+ if (! xSFInit.is())
+ {
+ throw RuntimeException(
+ OUSTR("servicemanager does not support XInitialization!"),
+ Reference< XInterface >() );
+ }
+
+ // basic context values
+ ContextEntry_Init entry;
+ ::std::vector< ContextEntry_Init > context_values;
+ context_values.reserve( 14 );
+
+ // macro expander singleton for loader
+ entry.bLateInitService = true;
+ entry.name = OUSTR("/singletons/com.sun.star.util.theMacroExpander");
+ entry.value <<= create_boostrap_macro_expander_factory();
+ context_values.push_back( entry );
+
+ // tdmgr singleton
+ entry.bLateInitService = true;
+ entry.name =
+ OUSTR("/singletons/com.sun.star.reflection.theTypeDescriptionManager");
+ entry.value <<= OUSTR("com.sun.star.comp.stoc.TypeDescriptionManager");
+ context_values.push_back( entry );
+
+ // read out singleton infos from registry
+ if (services_xRegistry.is())
+ {
+ Reference< registry::XRegistryKey > xKey(
+ services_xRegistry->getRootKey() );
+ if (xKey.is())
+ {
+ xKey = xKey->openKey( OUSTR("/SINGLETONS") );
+ if (xKey.is())
+ {
+ entry.bLateInitService = true;
+
+ Sequence< Reference< registry::XRegistryKey > > keys(
+ xKey->openKeys() );
+ Reference< registry::XRegistryKey > const * pKeys =
+ keys.getConstArray();
+ for ( sal_Int32 nPos = keys.getLength(); nPos--; )
+ {
+ Reference< registry::XRegistryKey > const & xKey2 =
+ pKeys[ nPos ];
+ try
+ {
+ OUStringBuffer buf( 32 );
+ buf.appendAscii(
+ RTL_CONSTASCII_STRINGPARAM("/singletons/") );
+ buf.append(
+ xKey2->getKeyName().copy(
+ sizeof("/SINGLETONS") /* -\0 +'/' */ ) );
+ entry.name = buf.makeStringAndClear();
+ entry.value <<= xKey2->getStringValue();
+ context_values.push_back( entry );
+ }
+ catch (Exception & rExc)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ OString aStr(
+ OUStringToOString(
+ xKey2->getKeyName().copy( 11 ),
+ RTL_TEXTENCODING_ASCII_US ) );
+ OString aStr2(
+ OUStringToOString(
+ rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ fprintf(
+ stderr,
+ "### failed reading singleton [%s]"
+ " service name from registry: %s\n",
+ aStr.getStr(), aStr2.getStr() );
+#else
+ (void) rExc; // avoid warning about unused variable
+#endif
+ }
+ }
+ }
+ }
+ }
+
+ // ac, policy:
+ add_access_control_entries( &context_values, bootstrap );
+
+ // smgr singleton
+ entry.bLateInitService = false;
+ entry.name = OUSTR("/singletons/com.sun.star.lang.theServiceManager");
+ entry.value <<= xSF;
+ context_values.push_back( entry );
+
+ Reference< XComponentContext > xContext(
+ createComponentContext(
+ &context_values[ 0 ], context_values.size(),
+ Reference< XComponentContext >() ) );
+ // set default context
+ Reference< beans::XPropertySet > xProps( xSF, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ if (xProps.is())
+ {
+ xProps->setPropertyValue(
+ OUSTR("DefaultContext"), makeAny( xContext ) );
+ }
+
+ Reference< container::XHierarchicalNameAccess > xTDMgr;
+
+ // get tdmgr singleton
+ if (xContext->getValueByName(
+ OUSTR("/singletons/"
+ "com.sun.star.reflection.theTypeDescriptionManager") )
+ >>= xTDMgr)
+ {
+ if (types_xRegistry.is()) // insert rdb provider?
+ {
+ // add registry td provider factory to smgr and instance to tdmgr
+ Reference< lang::XSingleComponentFactory > xFac(
+ loadSharedLibComponentFactory(
+ OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
+ 0 == rBootstrapPath.getLength()
+ ? get_this_libpath() : rBootstrapPath,
+ OUSTR("com.sun.star.comp.stoc.RegistryTypeDescriptionProvider"),
+ Reference< lang::XMultiServiceFactory >( xSF, UNO_QUERY ),
+ Reference< registry::XRegistryKey >() ), UNO_QUERY );
+ OSL_ASSERT( xFac.is() );
+
+ // smgr
+ Reference< container::XSet > xSet( xSF, UNO_QUERY );
+ xSet->insert( makeAny( xFac ) );
+ OSL_ENSURE(
+ xSet->has( makeAny( xFac ) ),
+ "### failed registering registry td provider at smgr!" );
+ // tdmgr
+ xSet.set( xTDMgr, UNO_QUERY );
+ OSL_ASSERT( xSet.is() );
+ Any types_RDB( makeAny( types_xRegistry ) );
+ Any rdbtdp( makeAny( xFac->createInstanceWithArgumentsAndContext(
+ Sequence< Any >( &types_RDB, 1 ), xContext ) ) );
+ xSet->insert( rdbtdp );
+ OSL_ENSURE(
+ xSet->has( rdbtdp ),
+ "### failed inserting registry td provider to tdmgr!" );
+ }
+ // install callback
+ installTypeDescriptionManager( xTDMgr );
+ }
+
+ return xContext;
+}
+
+static Reference< lang::XMultiComponentFactory > createImplServiceFactory(
+ const OUString & rWriteRegistry,
+ const OUString & rReadRegistry,
+ sal_Bool bReadOnly,
+ const OUString & rBootstrapPath )
+ SAL_THROW( (Exception) )
+{
+ Reference< lang::XMultiComponentFactory > xSF(
+ bootstrapInitialSF( rBootstrapPath ) );
+
+ Reference< registry::XSimpleRegistry > xRegistry;
+
+ // open a registry
+ sal_Bool bRegistryShouldBeValid = sal_False;
+ if (rWriteRegistry.getLength() && !rReadRegistry.getLength())
+ {
+ bRegistryShouldBeValid = sal_True;
+ xRegistry.set( createSimpleRegistry( rBootstrapPath ) );
+ if (xRegistry.is())
+ {
+ if (bReadOnly)
+ {
+ xRegistry->open( rWriteRegistry, sal_True, sal_False );
+ }
+ else
+ {
+ xRegistry->open( rWriteRegistry, sal_False, sal_True );
+ }
+ }
+ }
+ else if (rWriteRegistry.getLength() && rReadRegistry.getLength())
+ {
+ // default registry
+ bRegistryShouldBeValid = sal_True;
+ xRegistry.set( createNestedRegistry( rBootstrapPath ) );
+
+ Reference< registry::XSimpleRegistry > xWriteReg(
+ createSimpleRegistry( rBootstrapPath ) );
+ if (xWriteReg.is())
+ {
+ if (bReadOnly)
+ {
+ try
+ {
+ xWriteReg->open( rWriteRegistry, sal_True, sal_False );
+ }
+ catch (registry::InvalidRegistryException &)
+ {
+ }
+
+ if (! xWriteReg->isValid())
+ {
+ throw RuntimeException(
+ OUSTR("specified first registry "
+ "could not be open readonly!"),
+ Reference< XInterface >() );
+ }
+ }
+ else
+ {
+ xWriteReg->open( rWriteRegistry, sal_False, sal_True );
+ }
+ }
+
+ Reference< registry::XSimpleRegistry > xReadReg(
+ createSimpleRegistry( rBootstrapPath ) );
+ if (xReadReg.is())
+ {
+ xReadReg->open( rReadRegistry, sal_True, sal_False );
+ }
+
+ Reference< lang::XInitialization > xInit( xRegistry, UNO_QUERY );
+ Sequence< Any > aInitSeq( 2 );
+ aInitSeq[ 0 ] <<= xWriteReg;
+ aInitSeq[ 1 ] <<= xReadReg;
+ xInit->initialize( aInitSeq );
+ }
+
+ if (bRegistryShouldBeValid && (!xRegistry.is() || !xRegistry->isValid()))
+ {
+ throw RuntimeException(
+ OUSTR("specified registry could not be initialized"),
+ Reference< XInterface >() );
+ }
+
+ Bootstrap bootstrap;
+ Reference< XComponentContext > xContext(
+ bootstrapInitialContext(
+ xSF, xRegistry, xRegistry, rBootstrapPath, bootstrap ) );
+
+ // initialize sf
+ Reference< lang::XInitialization > xInit( xSF, UNO_QUERY );
+ OSL_ASSERT( xInit.is() );
+ Sequence< Any > aSFInit( 1 );
+ aSFInit[ 0 ] <<= xRegistry;
+ xInit->initialize( aSFInit );
+
+ return xSF;
+}
+
+Reference< lang::XMultiServiceFactory > SAL_CALL createRegistryServiceFactory(
+ const OUString & rWriteRegistry,
+ const OUString & rReadRegistry,
+ sal_Bool bReadOnly,
+ const OUString & rBootstrapPath )
+ SAL_THROW( (Exception) )
+{
+ return Reference< lang::XMultiServiceFactory >( createImplServiceFactory(
+ rWriteRegistry, rReadRegistry, bReadOnly, rBootstrapPath ), UNO_QUERY );
+}
+
+Reference< XComponentContext > SAL_CALL bootstrap_InitialComponentContext(
+ Reference< registry::XSimpleRegistry > const & xRegistry,
+ OUString const & rBootstrapPath )
+ SAL_THROW( (Exception) )
+{
+ Bootstrap bootstrap;
+
+ Reference< lang::XMultiComponentFactory > xSF(
+ bootstrapInitialSF( rBootstrapPath ) );
+ Reference< XComponentContext > xContext(
+ bootstrapInitialContext(
+ xSF, xRegistry, xRegistry, rBootstrapPath, bootstrap ) );
+
+ // initialize sf
+ Reference< lang::XInitialization > xInit( xSF, UNO_QUERY );
+ OSL_ASSERT( xInit.is() );
+ Sequence< Any > aSFInit( 2 );
+ aSFInit[ 0 ] <<= xRegistry;
+ aSFInit[ 1 ] <<= xContext; // default context
+ xInit->initialize( aSFInit );
+
+ return xContext;
+}
+
+}
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
new file mode 100644
index 000000000000..d9cf79396090
--- /dev/null
+++ b/cppuhelper/source/shlib.cxx
@@ -0,0 +1,609 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include "osl/diagnose.h"
+#include "osl/file.hxx"
+#include "osl/mutex.hxx"
+#include "osl/module.hxx"
+#include "rtl/unload.h"
+#include "rtl/ustrbuf.hxx"
+#include "uno/environment.h"
+#include "uno/mapping.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/shlib.hxx"
+
+#include "com/sun/star/beans/XPropertySet.hpp"
+
+#if OSL_DEBUG_LEVEL > 1
+#include <stdio.h>
+#endif
+#include <vector>
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace cppu
+{
+
+#if OSL_DEBUG_LEVEL > 1
+//------------------------------------------------------------------------------
+static inline void out( const char * p ) SAL_THROW( () )
+{
+ printf( p );
+}
+static inline void out( const OUString & r ) throw ()
+{
+ OString s( OUStringToOString( r, RTL_TEXTENCODING_ASCII_US ) );
+ out( s.getStr() );
+}
+#endif
+
+//------------------------------------------------------------------------------
+static const ::std::vector< OUString > * getAccessDPath() SAL_THROW( () )
+{
+ static ::std::vector< OUString > * s_p = 0;
+ static bool s_bInit = false;
+
+ if (! s_bInit)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! s_bInit)
+ {
+ const char * pEnv = ::getenv( "CPLD_ACCESSPATH" );
+ if (pEnv)
+ {
+ static ::std::vector< OUString > s_v;
+
+ OString aEnv( pEnv );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ OUString aStr( OStringToOUString(
+ aEnv.getToken( 0, ';', nIndex ),
+ RTL_TEXTENCODING_ASCII_US ) );
+ OUString aFileUrl;
+ if (FileBase::getFileURLFromSystemPath(aStr, aFileUrl)
+ != FileBase::E_None)
+ {
+ OSL_ASSERT(false);
+ }
+ s_v.push_back( aFileUrl );
+ } while( nIndex != -1 );
+#if OSL_DEBUG_LEVEL > 1
+ out( "> cpld: acknowledged following access path(s): \"" );
+ ::std::vector< OUString >::const_iterator iPos( s_v.begin() );
+ while (iPos != s_v.end())
+ {
+ out( *iPos );
+ ++iPos;
+ if (iPos != s_v.end())
+ out( ";" );
+ }
+ out( "\"\n" );
+#endif
+ s_p = & s_v;
+ }
+ else
+ {
+ // no access path env set
+#if OSL_DEBUG_LEVEL > 1
+ out( "=> no CPLD_ACCESSPATH set.\n" );
+#endif
+ }
+ s_bInit = true;
+ }
+ }
+
+ return s_p;
+}
+
+//------------------------------------------------------------------------------
+static bool checkAccessPath( OUString * pComp ) throw ()
+{
+ const ::std::vector< OUString > * pPath = getAccessDPath();
+
+ if (pPath)
+ {
+ sal_Bool bAbsolute = (pComp->compareToAscii( "file://" , 7 ) == 0);
+ for ( ::std::vector< OUString >::const_iterator iPos( pPath->begin() );
+ iPos != pPath->end(); ++iPos )
+ {
+ OUString aBaseDir( *iPos );
+ OUString aAbs;
+
+ if ( bAbsolute )
+ {
+ aAbs = *pComp;
+#if OSL_DEBUG_LEVEL > 1
+ out( "> taking path: \"" );
+ out( aAbs );
+#endif
+ }
+ else
+ {
+ if (osl_File_E_None !=
+ ::osl_getAbsoluteFileURL(
+ aBaseDir.pData, pComp->pData, &aAbs.pData ))
+ {
+ continue;
+ }
+#if OSL_DEBUG_LEVEL > 1
+ out( "> found path: \"" );
+ out( aBaseDir );
+ out( "\" + \"" );
+ out( *pComp );
+ out( "\" => \"" );
+ out( aAbs );
+#endif
+ }
+
+ if (0 == aAbs.indexOf( aBaseDir ) && // still part of it?
+ aBaseDir.getLength() < aAbs.getLength() &&
+ (aBaseDir[ aBaseDir.getLength() -1 ] == (sal_Unicode)'/' ||
+ // dir boundary
+ aAbs[ aBaseDir.getLength() ] == (sal_Unicode)'/'))
+ {
+#if OSL_DEBUG_LEVEL > 1
+ out( ": ok.\n" );
+#endif
+ // load from absolute path
+ *pComp = aAbs;
+ return true;
+ }
+#if OSL_DEBUG_LEVEL > 1
+ else
+ {
+ out( "\" ...does not match given path \"" );
+ out( aBaseDir );
+ out( "\".\n" );
+ }
+#endif
+ }
+ return false;
+ }
+ else
+ {
+ // no access path env set
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------------
+static inline sal_Int32 endsWith(
+ const OUString & rText, const OUString & rEnd ) SAL_THROW( () )
+{
+ if (rText.getLength() >= rEnd.getLength() &&
+ rEnd.equalsIgnoreAsciiCase(
+ rText.copy( rText.getLength() - rEnd.getLength() ) ))
+ {
+ return rText.getLength() - rEnd.getLength();
+ }
+ return -1;
+}
+
+//------------------------------------------------------------------------------
+static OUString makeComponentPath(
+ const OUString & rLibName, const OUString & rPath )
+{
+#if OSL_DEBUG_LEVEL > 0
+ // No system path allowed here !
+ {
+ OUString aComp;
+ OSL_ASSERT( FileBase::E_None ==
+ FileBase::getSystemPathFromFileURL( rLibName, aComp ) );
+ OSL_ASSERT(
+ ! rPath.getLength() ||
+ FileBase::E_None ==
+ FileBase::getSystemPathFromFileURL( rPath, aComp ) );
+ }
+#endif
+
+ OUStringBuffer buf( rPath.getLength() + rLibName.getLength() + 12 );
+
+ if (0 != rPath.getLength())
+ {
+ buf.append( rPath );
+ if (rPath[ rPath.getLength() -1 ] != '/')
+ buf.append( (sal_Unicode) '/' );
+ }
+ sal_Int32 nEnd = endsWith( rLibName, OUSTR(SAL_DLLEXTENSION) );
+ if (nEnd < 0) // !endsWith
+ {
+#ifndef OS2
+//this is always triggered with .uno components
+#if (OSL_DEBUG_LEVEL >= 2)
+ OSL_ENSURE(
+ !"### library name has no proper extension!",
+ OUStringToOString( rLibName, RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+#endif // OS2
+
+#if defined SAL_DLLPREFIX
+ nEnd = endsWith( rLibName, OUSTR(".uno") );
+ if (nEnd < 0) // !endsWith
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLPREFIX) );
+#endif
+ buf.append( rLibName );
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLEXTENSION) );
+ }
+ else // name is completely pre/postfixed
+ {
+ buf.append( rLibName );
+ }
+
+ OUString out( buf.makeStringAndClear() );
+#if OSL_DEBUG_LEVEL > 1
+ OString str( OUStringToOString( out, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "component path=%s\n", str.getStr() );
+#endif
+
+ return out;
+}
+
+//==============================================================================
+static OUString getLibEnv(OUString const & aModulePath,
+ oslModule lib,
+ uno::Environment * pEnv,
+ OUString * pSourceEnv_name,
+ uno::Environment const & cTargetEnv,
+ OUString const & cImplName = OUString())
+{
+ OUString aExcMsg;
+
+ sal_Char const * pEnvTypeName = NULL;
+
+ OUString aGetEnvNameExt = OUSTR(COMPONENT_GETENVEXT);
+ component_getImplementationEnvironmentExtFunc pGetImplEnvExt =
+ (component_getImplementationEnvironmentExtFunc)osl_getFunctionSymbol(lib, aGetEnvNameExt.pData);
+
+ if (pGetImplEnvExt)
+ {
+ OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
+ pGetImplEnvExt(&pEnvTypeName, (uno_Environment **)pEnv, implName.getStr(), cTargetEnv.get());
+ }
+ else
+ {
+ OUString aGetEnvName = OUSTR(COMPONENT_GETENV);
+ component_getImplementationEnvironmentFunc pGetImplEnv =
+ (component_getImplementationEnvironmentFunc)osl_getFunctionSymbol(
+ lib, aGetEnvName.pData );
+ if (pGetImplEnv)
+ pGetImplEnv(&pEnvTypeName, (uno_Environment **)pEnv);
+
+ else
+ {
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": cannot get symbol: ");
+ aExcMsg += aGetEnvName;
+ aExcMsg += OUSTR("- nor: ");
+ }
+ }
+
+ if (!pEnv->is() && pEnvTypeName)
+ {
+ *pSourceEnv_name = OUString::createFromAscii(pEnvTypeName);
+ const char * pUNO_ENV_LOG = ::getenv( "UNO_ENV_LOG" );
+ if (pUNO_ENV_LOG && rtl_str_getLength(pUNO_ENV_LOG) )
+ {
+ OString implName(OUStringToOString(cImplName, RTL_TEXTENCODING_ASCII_US));
+ OString aEnv( pUNO_ENV_LOG );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ const OString aStr( aEnv.getToken( 0, ';', nIndex ) );
+ if ( aStr.equals(implName) )
+ {
+ *pSourceEnv_name += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":log"));
+ break;
+ }
+ } while( nIndex != -1 );
+ }
+
+ }
+
+ return aExcMsg;
+}
+
+extern "C" {static void s_getFactory(va_list * pParam)
+{
+ component_getFactoryFunc pSym = va_arg(*pParam, component_getFactoryFunc);
+ OString const * pImplName = va_arg(*pParam, OString const *);
+ void * pSMgr = va_arg(*pParam, void *);
+ void * pKey = va_arg(*pParam, void *);
+ void ** ppSSF = va_arg(*pParam, void **);
+
+ *ppSSF = pSym(pImplName->getStr(), pSMgr, pKey);
+}}
+
+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) )
+{
+ OUString aModulePath( makeComponentPath( rLibName, rPath ) );
+ if (! checkAccessPath( &aModulePath ))
+ {
+ throw loader::CannotActivateFactoryException(
+ OUSTR("permission denied to load component library: ") +
+ aModulePath,
+ Reference< XInterface >() );
+ }
+
+ oslModule lib = osl_loadModule(
+ aModulePath.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ if (! lib)
+ {
+ throw loader::CannotActivateFactoryException(
+ OUSTR("loading component library failed: ") + aModulePath,
+ Reference< XInterface >() );
+ }
+
+ Reference< XInterface > xRet;
+
+ uno::Environment currentEnv(Environment::getCurrent());
+ uno::Environment env;
+
+ OUString aEnvTypeName;
+
+ OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv, rImplName);
+ if (!aExcMsg.getLength())
+ {
+ OUString aGetFactoryName = OUSTR(COMPONENT_GETFACTORY);
+ oslGenericFunction pSym = osl_getFunctionSymbol( lib, aGetFactoryName.pData );
+ if (pSym != 0)
+ {
+ OString aImplName(
+ OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
+
+ if (!env.is())
+ env = uno::Environment(aEnvTypeName);
+
+ if (env.is() && currentEnv.is())
+ {
+#if OSL_DEBUG_LEVEL > 1
+ {
+ rtl::OString libName(rtl::OUStringToOString(rLibName, RTL_TEXTENCODING_ASCII_US));
+ rtl::OString implName(rtl::OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US));
+ rtl::OString envDcp(rtl::OUStringToOString(env.getTypeName(), RTL_TEXTENCODING_ASCII_US));
+
+ fprintf(stderr, "loadSharedLibComponentFactory envDcp: %-12.12s implName: %30.30s libName: %-15.15s\n", envDcp.getStr(), implName.getStr() + (implName.getLength() > 30 ? implName.getLength() - 30 : 0), libName.getStr());
+ }
+#endif
+
+ Mapping aCurrent2Env( currentEnv, env );
+ Mapping aEnv2Current( env, currentEnv );
+
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xMgr.get(), ::getCppuType( &xMgr ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( &xKey ) );
+
+ void * pSSF = NULL;
+
+ env.invoke(s_getFactory, pSym, &aImplName, pSMgr, pKey, &pSSF);
+
+ if (pKey)
+ {
+ (env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pKey );
+ }
+ if (pSMgr)
+ {
+ (*env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pSMgr );
+ }
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( &xRet ) );
+ (env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pSSF );
+ }
+ else
+ {
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": cannot get factory of "
+ "demanded implementation: ");
+ aExcMsg += OStringToOUString(
+ aImplName, RTL_TEXTENCODING_ASCII_US );
+ }
+ }
+ else
+ {
+ aExcMsg =
+ OUSTR("cannot get uno mappings: C++ <=> UNO!");
+ }
+ }
+ else
+ {
+ aExcMsg = OUSTR("cannot get uno environments!");
+ }
+ }
+ else
+ {
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": cannot get symbol: ");
+ aExcMsg += aGetFactoryName;
+ }
+ }
+
+ if (! xRet.is())
+ {
+ osl_unloadModule( lib );
+#if OSL_DEBUG_LEVEL > 1
+ out( "### cannot activate factory: " );
+ out( aExcMsg );
+ out( "\n" );
+#endif
+ throw loader::CannotActivateFactoryException(
+ aExcMsg,
+ Reference< XInterface >() );
+ }
+
+ rtl_registerModuleForUnloading( lib);
+ return xRet;
+}
+
+//==============================================================================
+extern "C" { static void s_writeInfo(va_list * pParam)
+{
+ component_writeInfoFunc pSym = va_arg(*pParam, component_writeInfoFunc);
+ void * pSMgr = va_arg(*pParam, void *);
+ void * pKey = va_arg(*pParam, void *);
+ sal_Bool * pbRet = va_arg(*pParam, sal_Bool *);
+
+ *pbRet = pSym(pSMgr, pKey);
+
+}}
+
+void SAL_CALL writeSharedLibComponentInfo(
+ OUString const & rLibName, OUString const & rPath,
+ Reference< lang::XMultiServiceFactory > const & xMgr,
+ Reference< registry::XRegistryKey > const & xKey )
+ SAL_THROW( (registry::CannotRegisterImplementationException) )
+{
+ OUString aModulePath( makeComponentPath( rLibName, rPath ) );
+
+ if (! checkAccessPath( &aModulePath ))
+ {
+ throw registry::CannotRegisterImplementationException(
+ OUSTR("permission denied to load component library: ") +
+ aModulePath,
+ Reference< XInterface >() );
+ }
+
+ oslModule lib = osl_loadModule(
+ aModulePath.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ if (! lib)
+ {
+ throw registry::CannotRegisterImplementationException(
+ OUSTR("loading component library failed: ") + aModulePath,
+ Reference< XInterface >() );
+ }
+
+ sal_Bool bRet = sal_False;
+
+ uno::Environment currentEnv(Environment::getCurrent());
+ uno::Environment env;
+
+ OUString aEnvTypeName;
+ OUString aExcMsg = getLibEnv(aModulePath, lib, &env, &aEnvTypeName, currentEnv);
+ if (!aExcMsg.getLength())
+ {
+ OUString aWriteInfoName = OUSTR(COMPONENT_WRITEINFO);
+ oslGenericFunction pSym = osl_getFunctionSymbol( lib, aWriteInfoName.pData );
+ if (pSym != 0)
+ {
+ if (!env.is())
+ env = uno::Environment(aEnvTypeName);
+
+ if (env.is() && currentEnv.is())
+ {
+ Mapping aCurrent2Env( currentEnv, env );
+ if (aCurrent2Env.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xMgr.get(), ::getCppuType( &xMgr ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( &xKey ) );
+ if (pKey)
+ {
+ env.invoke(s_writeInfo, pSym, pSMgr, pKey, &bRet);
+
+
+ (*env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pKey );
+ if (! bRet)
+ {
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": component_writeInfo() "
+ "returned false!");
+ }
+ }
+ else
+ {
+ // key is mandatory
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": registry is mandatory to invoke"
+ " component_writeInfo()!");
+ }
+
+ if (pSMgr)
+ {
+ (*env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pSMgr );
+ }
+ }
+ else
+ {
+ aExcMsg = OUSTR("cannot get uno mapping: C++ <=> UNO!");
+ }
+ }
+ else
+ {
+ aExcMsg = OUSTR("cannot get uno environments!");
+ }
+ }
+ else
+ {
+ aExcMsg = aModulePath;
+ aExcMsg += OUSTR(": cannot get symbol: ");
+ aExcMsg += aWriteInfoName;
+ }
+ }
+
+//!
+//! OK: please look at #88219#
+//!
+//! ::osl_unloadModule( lib);
+ if (! bRet)
+ {
+#if OSL_DEBUG_LEVEL > 1
+ out( "### cannot write component info: " );
+ out( aExcMsg );
+ out( "\n" );
+#endif
+ throw registry::CannotRegisterImplementationException(
+ aExcMsg, Reference< XInterface >() );
+ }
+}
+
+}
diff --git a/cppuhelper/source/stdidlclass.cxx b/cppuhelper/source/stdidlclass.cxx
new file mode 100644
index 000000000000..fdfc9bc34a65
--- /dev/null
+++ b/cppuhelper/source/stdidlclass.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <osl/mutex.hxx>
+
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/stdidlclass.hxx>
+
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
+#include <com/sun/star/reflection/XIdlReflection.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/uno/DeploymentException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::reflection;
+using namespace rtl;
+
+namespace cppu {
+
+/*---------------------------------------------------------
+* This helper class implements XIdlClass. Is used by
+* createStdIdlClass()
+*---------------------------------------------------------*/
+class OStdIdlClass :
+ public OWeakObject,
+ public XIdlClass,
+ public XIdlClassProvider
+{
+public:
+ OStdIdlClass(
+ const Reference < XMultiServiceFactory > &rSMgr ,
+ const OUString & sImplementationName ,
+ const Reference < XIdlClass > & rSuperClass,
+ const Sequence < OUString > &seq
+ ) SAL_THROW( () );
+
+ // XInterface
+ Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // XIdlClassProvider
+ Sequence< Reference < XIdlClass > > SAL_CALL getIdlClasses(void)
+ throw (RuntimeException);
+
+ // XIdlClass
+ virtual Sequence< Reference< XIdlClass > > SAL_CALL getClasses( ) throw(RuntimeException)
+ { return Sequence < Reference < XIdlClass > > (); }
+ virtual Reference< XIdlClass > SAL_CALL getClass( const ::rtl::OUString& ) throw(RuntimeException)
+ { return Reference < XIdlClass > (); }
+ virtual sal_Bool SAL_CALL equals( const Reference< XIdlClass >& Type ) throw(RuntimeException)
+ { return getName() == Type->getName(); }
+ virtual sal_Bool SAL_CALL isAssignableFrom( const Reference< XIdlClass >& xType ) throw(RuntimeException)
+ { return equals( xType ); }
+ virtual TypeClass SAL_CALL getTypeClass( ) throw(RuntimeException)
+ { return TypeClass_UNKNOWN; }
+ virtual OUString SAL_CALL getName( ) throw(RuntimeException)
+ { return m_sImplementationName; }
+ virtual Uik SAL_CALL getUik( ) throw(RuntimeException)
+ { return Uik(); }
+ virtual Sequence< Reference< XIdlClass > > SAL_CALL getSuperclasses( ) throw(RuntimeException)
+ { return m_seqSuperClasses; }
+ virtual Sequence< Reference< XIdlClass > > SAL_CALL getInterfaces( ) throw(RuntimeException);
+
+ virtual Reference< XIdlClass > SAL_CALL getComponentType( ) throw(RuntimeException)
+ { return Reference < XIdlClass > (); }
+ virtual Reference< XIdlField > SAL_CALL getField( const ::rtl::OUString& ) throw(RuntimeException)
+ { return Reference < XIdlField > (); }
+ virtual Sequence< Reference< XIdlField > > SAL_CALL getFields( ) throw(RuntimeException)
+ { return Sequence< Reference < XIdlField > > (); }
+ virtual Reference< XIdlMethod > SAL_CALL getMethod( const ::rtl::OUString& ) throw(RuntimeException)
+ { return Reference < XIdlMethod > (); }
+ virtual Sequence< Reference< XIdlMethod > > SAL_CALL getMethods( ) throw(RuntimeException)
+ { return Sequence < Reference < XIdlMethod > > (); }
+ virtual Reference< XIdlArray > SAL_CALL getArray( ) throw(RuntimeException)
+ { return Reference < XIdlArray > (); }
+ virtual void SAL_CALL createObject( Any& ) throw(RuntimeException) {}
+
+private:
+ OUString m_sImplementationName;
+ Sequence < OUString > m_seqSupportedInterface;
+ Sequence < Reference < XIdlClass > > m_seqSuperClasses;
+ Reference < XMultiServiceFactory > m_rSMgr;
+
+ Reference< XIdlReflection > m_xCorefl;
+ Reference< XIdlReflection > const & get_corefl() SAL_THROW( (RuntimeException) );
+};
+
+Reference< XIdlReflection > const & OStdIdlClass::get_corefl()
+ SAL_THROW( (RuntimeException) )
+{
+ if (! m_xCorefl.is())
+ {
+ if( m_rSMgr.is() )
+ {
+ Reference< beans::XPropertySet > xProps( m_rSMgr, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ if (xProps.is())
+ {
+ Reference< XComponentContext > xContext;
+ xProps->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext;
+ OSL_ASSERT( xContext.is() );
+ if (xContext.is())
+ {
+ Reference < XIdlReflection > x;
+ xContext->getValueByName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection") ) ) >>= x;
+ OSL_ENSURE( x.is(), "### CoreReflection singleton not accessible!?" );
+
+ if (x.is())
+ {
+ ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if (! m_xCorefl.is())
+ {
+ m_xCorefl = x;
+ }
+ }
+ }
+ }
+ }
+ if (! m_xCorefl.is())
+ {
+ throw DeploymentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection singleton not accessible") ),
+ Reference< XInterface >() );
+ }
+ }
+ return m_xCorefl;
+}
+
+OStdIdlClass::OStdIdlClass(
+ const Reference < XMultiServiceFactory > &rSMgr ,
+ const OUString & sImplementationName ,
+ const Reference < XIdlClass > & rSuperClass,
+ const Sequence < OUString > &seq
+ ) SAL_THROW( () ) :
+ m_sImplementationName( sImplementationName ) ,
+ m_seqSupportedInterface( seq ),
+ m_rSMgr( rSMgr )
+{
+ if( rSuperClass.is() )
+ m_seqSuperClasses = Sequence< Reference < XIdlClass > >( &rSuperClass, 1 );
+
+}
+
+Any SAL_CALL OStdIdlClass::queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Any aRet( ::cppu::queryInterface(
+ rType, static_cast< XIdlClass * >( this ), static_cast< XIdlClassProvider * >( this ) ) );
+
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+
+Sequence< Reference< XIdlClass > > SAL_CALL OStdIdlClass::getInterfaces( ) throw(RuntimeException)
+{
+ int nMax = m_seqSupportedInterface.getLength();
+
+ Reference< XIdlReflection > const & rCoreRefl = get_corefl();
+ if( rCoreRefl.is() )
+ {
+ Sequence< Reference< XIdlClass > > seqClasses( nMax );
+
+ for( int n = 0 ; n < nMax ; n++ )
+ {
+ seqClasses.getArray()[n] = rCoreRefl->forName( m_seqSupportedInterface.getArray()[n] );
+ }
+
+ return seqClasses;
+ }
+ return Sequence< Reference< XIdlClass > > () ;
+}
+
+
+// XIdlClassProvider
+Sequence< Reference < XIdlClass > > SAL_CALL OStdIdlClass::getIdlClasses(void)
+ throw (RuntimeException)
+{
+ // weak reference to cache the standard class
+ static WeakReference< XIdlClass > weakRef;
+
+ // try to make weakref hard
+ Reference < XIdlClass > r = weakRef;
+
+ if( ! r.is() ) {
+ // xidlclass has not been initialized before or has been destroyed already.
+ r = ::cppu::createStandardClass(
+ m_rSMgr ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.cppuhelper.OStdIdlClass") ) ,
+ Reference < XIdlClass > () ,
+ SAL_STATIC_CAST( XIdlClassProvider * , this ) ,
+ SAL_STATIC_CAST( XIdlClass * , this )
+ );
+
+ // store reference for later use
+ weakRef = r;
+ }
+
+ return Sequence < Reference < XIdlClass > > ( &r , 1 );
+}
+
+
+
+
+// external constructor
+XIdlClass * SAL_CALL createStandardClassWithSequence(
+ const Reference < XMultiServiceFactory > &rSMgr ,
+ const OUString & sImplementationName ,
+ const Reference < XIdlClass > & rSuperClass,
+ const Sequence < OUString > &seqInterfaceNames )
+ SAL_THROW( () )
+{
+ return SAL_STATIC_CAST(
+ XIdlClass * ,
+ new OStdIdlClass(
+ rSMgr ,
+ sImplementationName,
+ rSuperClass,
+ seqInterfaceNames
+ )
+ );
+}
+
+} //end namespace cppu
diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx
new file mode 100644
index 000000000000..1174c1822fb6
--- /dev/null
+++ b/cppuhelper/source/tdmgr.cxx
@@ -0,0 +1,762 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <sal/alloca.h>
+
+#include <osl/diagnose.h>
+#include <rtl/alloc.h>
+#include <rtl/ustring.hxx>
+
+#include <uno/mapping.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <typelib/typedescription.h>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/reflection/XTypeDescription.hpp>
+#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
+#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
+#include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
+#include <com/sun/star/reflection/XInterfaceAttributeTypeDescription.hpp>
+#include <com/sun/star/reflection/XMethodParameter.hpp>
+#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
+#include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
+#include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
+#include <com/sun/star/reflection/XStructTypeDescription.hpp>
+#include <com/sun/star/reflection/XUnionTypeDescription.hpp>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+#include "boost/scoped_array.hpp"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::reflection;
+
+
+namespace cppu
+{
+
+static typelib_TypeDescription * createCTD(
+ Reference< container::XHierarchicalNameAccess > const & access,
+ const Reference< XTypeDescription > & xType );
+
+//==================================================================================================
+inline static sal_Int64 coerceToInt64( const Any & rVal )
+{
+ switch (rVal.getValueTypeClass())
+ {
+ case TypeClass_CHAR:
+ return *(sal_Unicode *)rVal.getValue();
+ case TypeClass_BOOLEAN:
+ return (*(sal_Bool *)rVal.getValue() ? 1 : 0);
+ case TypeClass_BYTE:
+ return *(sal_Int8 *)rVal.getValue();
+ case TypeClass_SHORT:
+ return *(sal_Int16 *)rVal.getValue();
+ case TypeClass_UNSIGNED_SHORT:
+ return *(sal_uInt16 *)rVal.getValue();
+ case TypeClass_LONG:
+ return *(sal_Int32 *)rVal.getValue();
+ case TypeClass_UNSIGNED_LONG:
+ return *(sal_uInt32 *)rVal.getValue();
+ case TypeClass_HYPER:
+ return *(sal_Int64 *)rVal.getValue();
+ case TypeClass_UNSIGNED_HYPER:
+ return *(sal_uInt64 *)rVal.getValue();
+ case TypeClass_ENUM:
+ return *(int *)rVal.getValue();
+ default:
+ OSL_ASSERT(false);
+ return 0;
+ }
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ const Reference< XUnionTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is())
+ {
+ OUString aTypeName( xType->getName() );
+
+ // discriminant type
+ Reference< XTypeDescription > xDiscrTD( xType->getDiscriminantType() );
+ OUString aDiscrTypeName( xDiscrTD->getName() );
+ typelib_TypeDescriptionReference * pDiscrTypeRef = 0;
+ typelib_typedescriptionreference_new( &pDiscrTypeRef,
+ (typelib_TypeClass)xDiscrTD->getTypeClass(),
+ aDiscrTypeName.pData );
+ // default member type
+ Reference< XTypeDescription > xDefaultMemberTD( xType->getDefaultMemberType() );
+ OUString aDefMemberTypeName( xDefaultMemberTD->getName() );
+ typelib_TypeDescriptionReference * pDefMemberTypeRef = 0;
+ typelib_typedescriptionreference_new( &pDefMemberTypeRef,
+ (typelib_TypeClass)xDefaultMemberTD->getTypeClass(),
+ aDefMemberTypeName.pData );
+ // init array
+ Sequence< Any > aDiscriminants( xType->getDiscriminants() );
+ Sequence< Reference< XTypeDescription > > aMemberTypes( xType->getMemberTypes() );
+ Sequence< OUString > aMemberNames( xType->getMemberNames() );
+ sal_Int32 nMembers = aDiscriminants.getLength();
+ OSL_ASSERT( nMembers == aMemberNames.getLength() && nMembers == aMemberTypes.getLength() );
+
+ const Any * pDiscriminants = aDiscriminants.getConstArray();
+ const Reference< XTypeDescription > * pMemberTypes = aMemberTypes.getConstArray();
+ const OUString * pMemberNames = aMemberNames.getConstArray();
+
+ typelib_Union_Init * pMembers = (typelib_Union_Init *)alloca( nMembers * sizeof(typelib_Union_Init) );
+
+ sal_Int32 nPos;
+ for ( nPos = nMembers; nPos--; )
+ {
+ typelib_Union_Init & rEntry = pMembers[nPos];
+ // member discriminant
+ rEntry.nDiscriminant = coerceToInt64( pDiscriminants[nPos] );
+ // member type
+ OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
+ rEntry.pTypeRef = 0;
+ typelib_typedescriptionreference_new( &rEntry.pTypeRef,
+ (typelib_TypeClass)pMemberTypes[nPos]->getTypeClass(),
+ aMemberTypeName.pData );
+ // member name
+ rEntry.pMemberName = pMemberNames[nPos].pData;
+ }
+
+ typelib_typedescription_newUnion( &pRet, aTypeName.pData,
+ pDiscrTypeRef,
+ coerceToInt64( xType->getDefaultDiscriminant() ),
+ pDefMemberTypeRef,
+ nMembers, pMembers );
+
+ for ( nPos = nMembers; nPos--; )
+ {
+ typelib_typedescriptionreference_release( pMembers[nPos].pTypeRef );
+ }
+
+ typelib_typedescriptionreference_release( pDiscrTypeRef );
+ typelib_typedescriptionreference_release( pDefMemberTypeRef );
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ const Reference< XCompoundTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is())
+ {
+ typelib_TypeDescription * pBaseType = createCTD(
+ Reference< XCompoundTypeDescription >::query( xType->getBaseType() ) );
+ if (pBaseType)
+ typelib_typedescription_register( &pBaseType );
+
+ // construct member init array
+ const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
+ const Sequence< OUString > & rMemberNames = xType->getMemberNames();
+
+ const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
+ const OUString * pMemberNames = rMemberNames.getConstArray();
+
+ sal_Int32 nMembers = rMemberTypes.getLength();
+ OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
+
+ OUString aTypeName( xType->getName() );
+
+ typelib_CompoundMember_Init * pMemberInits = (typelib_CompoundMember_Init *)alloca(
+ sizeof(typelib_CompoundMember_Init) * nMembers );
+
+ sal_Int32 nPos;
+ for ( nPos = nMembers; nPos--; )
+ {
+ typelib_CompoundMember_Init & rInit = pMemberInits[nPos];
+ rInit.eTypeClass = (typelib_TypeClass)pMemberTypes[nPos]->getTypeClass();
+
+ OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
+ rtl_uString_acquire( rInit.pTypeName = aMemberTypeName.pData );
+
+ // string is held by rMemberNames
+ rInit.pMemberName = pMemberNames[nPos].pData;
+ }
+
+ typelib_typedescription_new(
+ &pRet,
+ (typelib_TypeClass)xType->getTypeClass(),
+ aTypeName.pData,
+ (pBaseType ? pBaseType->pWeakRef : 0),
+ nMembers, pMemberInits );
+
+ // cleanup
+ for ( nPos = nMembers; nPos--; )
+ {
+ rtl_uString_release( pMemberInits[nPos].pTypeName );
+ }
+ if (pBaseType)
+ typelib_typedescription_release( pBaseType );
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ Reference< container::XHierarchicalNameAccess > const & access,
+ const Reference< XStructTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is() && xType->getTypeParameters().getLength() == 0)
+ {
+ typelib_TypeDescription * pBaseType = createCTD(
+ access, xType->getBaseType() );
+ if (pBaseType)
+ typelib_typedescription_register( &pBaseType );
+
+ // construct member init array
+ const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
+ const Sequence< OUString > & rMemberNames = xType->getMemberNames();
+
+ const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
+ const OUString * pMemberNames = rMemberNames.getConstArray();
+
+ sal_Int32 nMembers = rMemberTypes.getLength();
+ OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
+
+ OUString aTypeName( xType->getName() );
+
+ typelib_StructMember_Init * pMemberInits = (typelib_StructMember_Init *)alloca(
+ sizeof(typelib_StructMember_Init) * nMembers );
+
+ Sequence< Reference< XTypeDescription > > templateMemberTypes;
+ sal_Int32 i = aTypeName.indexOf('<');
+ if (i >= 0) {
+ Reference< XStructTypeDescription > templateDesc(
+ access->getByHierarchicalName(aTypeName.copy(0, i)),
+ UNO_QUERY_THROW);
+ OSL_ASSERT(
+ templateDesc->getTypeParameters().getLength()
+ == xType->getTypeArguments().getLength());
+ templateMemberTypes = templateDesc->getMemberTypes();
+ OSL_ASSERT(templateMemberTypes.getLength() == nMembers);
+ }
+
+ sal_Int32 nPos;
+ for ( nPos = nMembers; nPos--; )
+ {
+ typelib_StructMember_Init & rInit = pMemberInits[nPos];
+ rInit.aBase.eTypeClass
+ = (typelib_TypeClass)pMemberTypes[nPos]->getTypeClass();
+
+ OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
+ rtl_uString_acquire(
+ rInit.aBase.pTypeName = aMemberTypeName.pData );
+
+ // string is held by rMemberNames
+ rInit.aBase.pMemberName = pMemberNames[nPos].pData;
+
+ rInit.bParameterizedType = templateMemberTypes.getLength() != 0
+ && (templateMemberTypes[nPos]->getTypeClass()
+ == TypeClass_UNKNOWN);
+ }
+
+ typelib_typedescription_newStruct(
+ &pRet,
+ aTypeName.pData,
+ (pBaseType ? pBaseType->pWeakRef : 0),
+ nMembers, pMemberInits );
+
+ // cleanup
+ for ( nPos = nMembers; nPos--; )
+ {
+ rtl_uString_release( pMemberInits[nPos].aBase.pTypeName );
+ }
+ if (pBaseType)
+ typelib_typedescription_release( pBaseType );
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ const Reference< XInterfaceAttributeTypeDescription > & xAttribute )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xAttribute.is())
+ {
+ OUString aMemberName( xAttribute->getName() );
+ Reference< XTypeDescription > xType( xAttribute->getType() );
+ OUString aMemberTypeName( xType->getName() );
+
+ typelib_typedescription_newInterfaceAttribute(
+ (typelib_InterfaceAttributeTypeDescription **)&pRet,
+ xAttribute->getPosition(),
+ aMemberName.pData, // name
+ (typelib_TypeClass)xType->getTypeClass(),
+ aMemberTypeName.pData, // type name
+ xAttribute->isReadOnly() );
+ }
+ return pRet;
+}
+//==================================================================================================
+static typelib_TypeDescription * createCTD(
+ const Reference< XInterfaceMethodTypeDescription > & xMethod )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xMethod.is())
+ {
+ Reference< XTypeDescription > xReturnType( xMethod->getReturnType() );
+
+ // init all params
+ const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters();
+ const Reference< XMethodParameter > * pParams = rParams.getConstArray();
+ sal_Int32 nParams = rParams.getLength();
+
+ typelib_Parameter_Init * pParamInit = (typelib_Parameter_Init *)alloca(
+ sizeof(typelib_Parameter_Init) * nParams );
+
+ sal_Int32 nPos;
+ for ( nPos = nParams; nPos--; )
+ {
+ const Reference< XMethodParameter > & xParam = pParams[nPos];
+ const Reference< XTypeDescription > & xType = xParam->getType();
+ typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()];
+
+ rInit.eTypeClass = (typelib_TypeClass)xType->getTypeClass();
+ OUString aParamTypeName( xType->getName() );
+ rtl_uString_acquire( rInit.pTypeName = aParamTypeName.pData );
+ OUString aParamName( xParam->getName() );
+ rtl_uString_acquire( rInit.pParamName = aParamName.pData );
+ rInit.bIn = xParam->isIn();
+ rInit.bOut = xParam->isOut();
+ }
+
+ // init all exception strings
+ const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions();
+ const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray();
+ sal_Int32 nExceptions = rExceptions.getLength();
+ rtl_uString ** ppExceptionNames = (rtl_uString **)alloca(
+ sizeof(rtl_uString *) * nExceptions );
+
+ for ( nPos = nExceptions; nPos--; )
+ {
+ OUString aExceptionTypeName( pExceptions[nPos]->getName() );
+ rtl_uString_acquire( ppExceptionNames[nPos] = aExceptionTypeName.pData );
+ }
+
+ OUString aTypeName( xMethod->getName() );
+ OUString aReturnTypeName( xReturnType->getName() );
+
+ typelib_typedescription_newInterfaceMethod(
+ (typelib_InterfaceMethodTypeDescription **)&pRet,
+ xMethod->getPosition(),
+ xMethod->isOneway(),
+ aTypeName.pData,
+ (typelib_TypeClass)xReturnType->getTypeClass(),
+ aReturnTypeName.pData,
+ nParams, pParamInit,
+ nExceptions, ppExceptionNames );
+
+ for ( nPos = nParams; nPos--; )
+ {
+ rtl_uString_release( pParamInit[nPos].pTypeName );
+ rtl_uString_release( pParamInit[nPos].pParamName );
+ }
+ for ( nPos = nExceptions; nPos--; )
+ {
+ rtl_uString_release( ppExceptionNames[nPos] );
+ }
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ Reference< container::XHierarchicalNameAccess > const & access,
+ const Reference< XInterfaceTypeDescription2 > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is())
+ {
+ Sequence< Reference< XTypeDescription > > aBases(xType->getBaseTypes());
+ sal_Int32 nBases = aBases.getLength();
+ // Exploit the fact that a typelib_TypeDescription for an interface type
+ // is also the typelib_TypeDescriptionReference for that type:
+ boost::scoped_array< typelib_TypeDescription * > aBaseTypes(
+ new typelib_TypeDescription *[nBases]);
+ {for (sal_Int32 i = 0; i < nBases; ++i) {
+ typelib_TypeDescription * p = createCTD(access, aBases[i]);
+ OSL_ASSERT(
+ !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(p->eTypeClass));
+ typelib_typedescription_register(&p);
+ aBaseTypes[i] = p;
+ }}
+ typelib_TypeDescriptionReference ** pBaseTypeRefs
+ = reinterpret_cast< typelib_TypeDescriptionReference ** >(
+ aBaseTypes.get());
+
+ // construct all member refs
+ const Sequence<Reference< XInterfaceMemberTypeDescription > > & rMembers = xType->getMembers();
+ sal_Int32 nMembers = rMembers.getLength();
+
+ typelib_TypeDescriptionReference ** ppMemberRefs = (typelib_TypeDescriptionReference **)alloca(
+ sizeof(typelib_TypeDescriptionReference *) * nMembers );
+
+ const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray();
+
+ OUString aTypeName( xType->getName() );
+
+ sal_Int32 nPos;
+ for ( nPos = nMembers; nPos--; )
+ {
+ OUString aMemberTypeName( pMembers[nPos]->getName() );
+ ppMemberRefs[nPos] = 0;
+ typelib_typedescriptionreference_new(
+ ppMemberRefs + nPos,
+ (typelib_TypeClass)pMembers[nPos]->getTypeClass(),
+ aMemberTypeName.pData );
+ }
+
+ Uik uik = xType->getUik();
+
+ typelib_typedescription_newMIInterface(
+ (typelib_InterfaceTypeDescription **)&pRet,
+ aTypeName.pData,
+ uik.m_Data1, uik.m_Data2, uik.m_Data3, uik.m_Data4, uik.m_Data5,
+ nBases, pBaseTypeRefs,
+ nMembers, ppMemberRefs );
+
+ // cleanup refs and base type
+ {for (int i = 0; i < nBases; ++i) {
+ typelib_typedescription_release(aBaseTypes[i]);
+ }}
+
+ for ( nPos = nMembers; nPos--; )
+ {
+ typelib_typedescriptionreference_release( ppMemberRefs[nPos] );
+ }
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD( const Reference< XEnumTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is())
+ {
+ OUString aTypeName( xType->getName() );
+ Sequence< OUString > aNames( xType->getEnumNames() );
+ OSL_ASSERT( sizeof(OUString) == sizeof(rtl_uString *) ); // !!!
+ Sequence< sal_Int32 > aValues( xType->getEnumValues() );
+
+ typelib_typedescription_newEnum(
+ &pRet, aTypeName.pData, xType->getDefaultEnumValue(),
+ aNames.getLength(),
+ (rtl_uString **)aNames.getConstArray(),
+ const_cast< sal_Int32 * >( aValues.getConstArray() ) );
+ }
+ return pRet;
+}
+//==================================================================================================
+inline static typelib_TypeDescription * createCTD(
+ Reference< container::XHierarchicalNameAccess > const & access,
+ const Reference< XIndirectTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+ if (xType.is())
+ {
+ typelib_TypeDescription * pRefType = createCTD(
+ access, xType->getReferencedType() );
+ typelib_typedescription_register( &pRefType );
+
+ OUString aTypeName( xType->getName() );
+
+ typelib_typedescription_new(
+ &pRet,
+ (typelib_TypeClass)xType->getTypeClass(),
+ aTypeName.pData,
+ pRefType->pWeakRef,
+ 0, 0 );
+
+ // cleanup
+ if (pRefType)
+ typelib_typedescription_release( pRefType );
+ }
+ return pRet;
+}
+
+//==================================================================================================
+static typelib_TypeDescription * createCTD(
+ Reference< container::XHierarchicalNameAccess > const & access,
+ const Reference< XTypeDescription > & xType )
+{
+ typelib_TypeDescription * pRet = 0;
+
+ if (xType.is())
+ {
+ switch (xType->getTypeClass())
+ {
+ // built in types
+ case TypeClass_VOID:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("void") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_VOID, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_CHAR:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("char") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_CHAR, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_BOOLEAN:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("boolean") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_BOOLEAN, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_BYTE:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("byte") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_BYTE, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_SHORT:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("short") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_SHORT, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("unsigned short") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_SHORT, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_LONG:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("long") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_LONG, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_UNSIGNED_LONG:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("unsigned long") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_LONG, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_HYPER:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("hyper") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_HYPER, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("unsigned hyper") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_HYPER, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_FLOAT:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("float") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_FLOAT, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_DOUBLE:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("double") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_DOUBLE, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_STRING:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("string") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_STRING, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_TYPE:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("type") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_TYPE, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+ case TypeClass_ANY:
+ {
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("any") );
+ typelib_typedescription_new( &pRet, typelib_TypeClass_ANY, aTypeName.pData, 0, 0, 0 );
+ break;
+ }
+
+ case TypeClass_UNION:
+ pRet = createCTD( Reference< XUnionTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_EXCEPTION:
+ pRet = createCTD( Reference< XCompoundTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_STRUCT:
+ pRet = createCTD(
+ access, Reference< XStructTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_ENUM:
+ pRet = createCTD( Reference< XEnumTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_TYPEDEF:
+ {
+ Reference< XIndirectTypeDescription > xTypedef( xType, UNO_QUERY );
+ if (xTypedef.is())
+ pRet = createCTD( access, xTypedef->getReferencedType() );
+ break;
+ }
+ case TypeClass_SEQUENCE:
+ pRet = createCTD(
+ access, Reference< XIndirectTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_INTERFACE:
+ pRet = createCTD(
+ access,
+ Reference< XInterfaceTypeDescription2 >::query( xType ) );
+ break;
+ case TypeClass_INTERFACE_METHOD:
+ pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) );
+ break;
+ case TypeClass_INTERFACE_ATTRIBUTE:
+ pRet = createCTD( Reference< XInterfaceAttributeTypeDescription >::query( xType ) );
+ break;
+ default:
+ break;
+ }
+ }
+
+ return pRet;
+}
+
+
+//==================================================================================================
+extern "C"
+{
+static void SAL_CALL typelib_callback(
+ void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName )
+{
+ OSL_ENSURE( pContext && ppRet && pTypeName, "### null ptr!" );
+ if (ppRet)
+ {
+ if (*ppRet)
+ {
+ ::typelib_typedescription_release( *ppRet );
+ *ppRet = 0;
+ }
+ if (pContext && pTypeName)
+ {
+ Reference< container::XHierarchicalNameAccess > access(
+ reinterpret_cast< container::XHierarchicalNameAccess * >(
+ pContext));
+ try
+ {
+ OUString const & rTypeName = OUString::unacquired( &pTypeName );
+ Reference< XTypeDescription > xTD;
+ if (access->getByHierarchicalName(rTypeName ) >>= xTD)
+ {
+ *ppRet = createCTD( access, xTD );
+ }
+ }
+ catch (container::NoSuchElementException & exc)
+ {
+ (void) exc; // avoid warning about unused variable
+ OSL_TRACE(
+ "typelibrary type not available: %s",
+ OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ catch (Exception & exc)
+ {
+ (void) exc; // avoid warning about unused variable
+ OSL_TRACE(
+ "%s",
+ OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+}
+}
+
+//==================================================================================================
+class EventListenerImpl
+ : public WeakImplHelper1< lang::XEventListener >
+{
+ Reference< container::XHierarchicalNameAccess > m_xTDMgr;
+
+public:
+ inline EventListenerImpl(
+ Reference< container::XHierarchicalNameAccess > const & xTDMgr )
+ SAL_THROW( () )
+ : m_xTDMgr( xTDMgr )
+ {}
+
+ // XEventListener
+ virtual void SAL_CALL disposing( lang::EventObject const & rEvt )
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+void EventListenerImpl::disposing( lang::EventObject const & rEvt )
+ throw (RuntimeException)
+{
+ if (rEvt.Source != m_xTDMgr) {
+ OSL_ASSERT(false);
+ }
+ // deregister of c typelib callback
+ ::typelib_typedescription_revokeCallback( m_xTDMgr.get(), typelib_callback );
+}
+
+//==================================================================================================
+sal_Bool SAL_CALL installTypeDescriptionManager(
+ Reference< container::XHierarchicalNameAccess > const & xTDMgr_c )
+ SAL_THROW( () )
+{
+ uno::Environment curr_env(Environment::getCurrent());
+ uno::Environment target_env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))));
+
+ uno::Mapping curr2target(curr_env, target_env);
+
+
+ Reference<container::XHierarchicalNameAccess> xTDMgr(
+ reinterpret_cast<container::XHierarchicalNameAccess *>(
+ curr2target.mapInterface(xTDMgr_c.get(), ::getCppuType(&xTDMgr_c))),
+ SAL_NO_ACQUIRE);
+
+ Reference< lang::XComponent > xComp( xTDMgr, UNO_QUERY );
+ if (xComp.is())
+ {
+ xComp->addEventListener( new EventListenerImpl( xTDMgr ) );
+ // register c typelib callback
+ ::typelib_typedescription_registerCallback( xTDMgr.get(), typelib_callback );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+} // end namespace cppu
+
diff --git a/cppuhelper/source/typeprovider.cxx b/cppuhelper/source/typeprovider.cxx
new file mode 100644
index 000000000000..1df32079b052
--- /dev/null
+++ b/cppuhelper/source/typeprovider.cxx
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/mutex.hxx>
+
+using namespace osl;
+using namespace com::sun::star::uno;
+
+namespace cppu
+{
+
+//__________________________________________________________________________________________________
+OImplementationId::~OImplementationId() SAL_THROW( () )
+{
+ delete _pSeq;
+}
+//__________________________________________________________________________________________________
+Sequence< sal_Int8 > OImplementationId::getImplementationId() const SAL_THROW( () )
+{
+ if (! _pSeq)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! _pSeq)
+ {
+ Sequence< sal_Int8 > * pSeq = new Sequence< sal_Int8 >( 16 );
+ ::rtl_createUuid( (sal_uInt8 *)pSeq->getArray(), 0, _bUseEthernetAddress );
+ _pSeq = pSeq;
+ }
+ }
+ return *_pSeq;
+}
+
+//--------------------------------------------------------------------------------------------------
+static inline void copy( Sequence< Type > & rDest, const Sequence< Type > & rSource, sal_Int32 nOffset )
+ SAL_THROW( () )
+{
+ Type * pDest = rDest.getArray();
+ const Type * pSource = rSource.getConstArray();
+
+ for ( sal_Int32 nPos = rSource.getLength(); nPos--; )
+ pDest[nOffset+ nPos] = pSource[nPos];
+}
+
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 1 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ copy( _aTypes, rAddTypes, 1 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 2 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ copy( _aTypes, rAddTypes, 2 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 3 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ copy( _aTypes, rAddTypes, 3 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 4 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ copy( _aTypes, rAddTypes, 4 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 5 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ copy( _aTypes, rAddTypes, 5 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 6 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ copy( _aTypes, rAddTypes, 6 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 7 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ copy( _aTypes, rAddTypes, 7 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Type & rType8,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 8 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ _aTypes[7] = rType8;
+ copy( _aTypes, rAddTypes, 8 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Type & rType8,
+ const Type & rType9,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 9 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ _aTypes[7] = rType8;
+ _aTypes[8] = rType9;
+ copy( _aTypes, rAddTypes, 9 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Type & rType8,
+ const Type & rType9,
+ const Type & rType10,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 10 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ _aTypes[7] = rType8;
+ _aTypes[8] = rType9;
+ _aTypes[9] = rType10;
+ copy( _aTypes, rAddTypes, 10 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Type & rType8,
+ const Type & rType9,
+ const Type & rType10,
+ const Type & rType11,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 11 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ _aTypes[7] = rType8;
+ _aTypes[8] = rType9;
+ _aTypes[9] = rType10;
+ _aTypes[10] = rType11;
+ copy( _aTypes, rAddTypes, 11 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Type & rType3,
+ const Type & rType4,
+ const Type & rType5,
+ const Type & rType6,
+ const Type & rType7,
+ const Type & rType8,
+ const Type & rType9,
+ const Type & rType10,
+ const Type & rType11,
+ const Type & rType12,
+ const Sequence< Type > & rAddTypes )
+ SAL_THROW( () )
+ : _aTypes( 12 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ _aTypes[1] = rType2;
+ _aTypes[2] = rType3;
+ _aTypes[3] = rType4;
+ _aTypes[4] = rType5;
+ _aTypes[5] = rType6;
+ _aTypes[6] = rType7;
+ _aTypes[7] = rType8;
+ _aTypes[8] = rType9;
+ _aTypes[9] = rType10;
+ _aTypes[10] = rType11;
+ _aTypes[11] = rType12;
+ copy( _aTypes, rAddTypes, 12 );
+}
+
+}
+
diff --git a/cppuhelper/source/unorc b/cppuhelper/source/unorc
new file mode 100644
index 000000000000..c5af031bd4cd
--- /dev/null
+++ b/cppuhelper/source/unorc
@@ -0,0 +1,30 @@
+=*************************************************************************
+=
+= DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+=
+= Copyright 2000, 2010 Oracle and/or its affiliates.
+=
+= OpenOffice.org - a multi-platform office productivity suite
+=
+= This file is part of OpenOffice.org.
+=
+= OpenOffice.org is free software: you can redistribute it and/or modify
+= it under the terms of the GNU Lesser General Public License version 3
+= only, as published by the Free Software Foundation.
+=
+= OpenOffice.org is distributed in the hope that it will be useful,
+= but WITHOUT ANY WARRANTY; without even the implied warranty of
+= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+= GNU Lesser General Public License version 3 for more details
+= (a copy is included in the LICENSE file that accompanied this code).
+=
+= You should have received a copy of the GNU Lesser General Public License
+= version 3 along with OpenOffice.org. If not, see
+= <http://www.openoffice.org/license.html>
+= for a copy of the LGPLv3 License.
+=
+=
+=*************************************************************************
+
+[Bootstrap]
+URE_INTERNAL_LIB_DIR=${ORIGIN}
diff --git a/cppuhelper/source/unourl.cxx b/cppuhelper/source/unourl.cxx
new file mode 100644
index 000000000000..6abf86d29845
--- /dev/null
+++ b/cppuhelper/source/unourl.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+#include "cppuhelper/unourl.hxx"
+
+#include "osl/diagnose.h"
+#include "rtl/malformeduriexception.hxx"
+#include "rtl/string.h"
+#include "rtl/textenc.h"
+#include "rtl/uri.h"
+#include "rtl/uri.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include <map>
+
+using cppu::UnoUrl;
+using cppu::UnoUrlDescriptor;
+
+namespace {
+
+inline bool isAlphanum(sal_Unicode c)
+{
+ return (c >= 0x30 && c <= 0x39) // '0'--'9'
+ || (c >= 0x41 && c <= 0x5A) // 'A'--'Z'
+ || (c >= 0x61 && c <= 0x7A); // 'a'--'z'
+}
+
+}
+
+class UnoUrlDescriptor::Impl
+{
+public:
+ typedef std::map< rtl::OUString, rtl::OUString > Parameters;
+
+ rtl::OUString m_aDescriptor;
+ rtl::OUString m_aName;
+ Parameters m_aParameters;
+
+ /** @exception rtl::MalformedUriException
+ */
+ explicit inline Impl(rtl::OUString const & m_aDescriptor);
+
+ inline Impl * clone() const { return new Impl(*this); }
+};
+
+inline UnoUrlDescriptor::Impl::Impl(rtl::OUString const & rDescriptor)
+{
+ m_aDescriptor = rDescriptor;
+ enum State { STATE_NAME0, STATE_NAME, STATE_KEY0, STATE_KEY, STATE_VALUE };
+ State eState = STATE_NAME0;
+ sal_Int32 nStart = 0;
+ rtl::OUString aKey;
+ for (sal_Int32 i = 0;; ++i)
+ {
+ bool bEnd = i == rDescriptor.getLength();
+ sal_Unicode c = bEnd ? 0 : rDescriptor.getStr()[i];
+ switch (eState)
+ {
+ case STATE_NAME0:
+ if (bEnd || !isAlphanum(c))
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains bad descriptor name")));
+ nStart = i;
+ eState = STATE_NAME;
+ break;
+
+ case STATE_NAME:
+ if (bEnd || c == 0x2C) // ','
+ {
+ m_aName
+ = rDescriptor.copy(nStart, i - nStart).toAsciiLowerCase();
+ eState = STATE_KEY0;
+ }
+ else if (!isAlphanum(c))
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains bad descriptor name")));
+ break;
+
+ case STATE_KEY0:
+ if (bEnd || !isAlphanum(c))
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains bad parameter key")));
+ nStart = i;
+ eState = STATE_KEY;
+ break;
+
+ case STATE_KEY:
+ if (c == 0x3D) // '='
+ {
+ aKey = rDescriptor.copy(nStart, i - nStart).toAsciiLowerCase();
+ nStart = i + 1;
+ eState = STATE_VALUE;
+ }
+ else if (bEnd || !isAlphanum(c))
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains bad parameter key")));
+ break;
+
+ case STATE_VALUE:
+ if (bEnd || c == 0x2C) // ','
+ {
+ if (!m_aParameters.insert(
+ Parameters::value_type(
+ aKey,
+ rtl::Uri::decode(rDescriptor.copy(nStart,
+ i - nStart),
+ rtl_UriDecodeWithCharset,
+ RTL_TEXTENCODING_UTF8))).second)
+ throw rtl::MalformedUriException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains duplicated parameter")));
+ eState = STATE_KEY0;
+ }
+ break;
+ }
+ if (bEnd)
+ break;
+ }
+}
+
+UnoUrlDescriptor::UnoUrlDescriptor(rtl::OUString const & rDescriptor):
+ m_xImpl(new Impl(rDescriptor))
+{}
+
+UnoUrlDescriptor::UnoUrlDescriptor(std::auto_ptr< Impl > & rImpl):
+ m_xImpl(rImpl)
+{}
+
+UnoUrlDescriptor::UnoUrlDescriptor(UnoUrlDescriptor const & rOther):
+ m_xImpl(rOther.m_xImpl->clone())
+{}
+
+UnoUrlDescriptor::~UnoUrlDescriptor()
+{}
+
+UnoUrlDescriptor & UnoUrlDescriptor::operator =(UnoUrlDescriptor const & rOther)
+{
+ m_xImpl.reset(rOther.m_xImpl->clone());
+ return *this;
+}
+
+rtl::OUString const & UnoUrlDescriptor::getDescriptor() const
+{
+ return m_xImpl->m_aDescriptor;
+}
+
+rtl::OUString const & UnoUrlDescriptor::getName() const
+{
+ return m_xImpl->m_aName;
+}
+
+bool UnoUrlDescriptor::hasParameter(rtl::OUString const & rKey) const
+{
+ return m_xImpl->m_aParameters.find(rKey.toAsciiLowerCase())
+ != m_xImpl->m_aParameters.end();
+}
+
+rtl::OUString UnoUrlDescriptor::getParameter(rtl::OUString const & rKey) const
+{
+ Impl::Parameters::const_iterator
+ aIt(m_xImpl->m_aParameters.find(rKey.toAsciiLowerCase()));
+ return aIt == m_xImpl->m_aParameters.end() ? rtl::OUString() : aIt->second;
+}
+
+class UnoUrl::Impl
+{
+public:
+ UnoUrlDescriptor m_aConnection;
+ UnoUrlDescriptor m_aProtocol;
+ rtl::OUString m_aObjectName;
+
+ inline Impl * clone() const { return new Impl(*this); }
+
+ /** @exception rtl::MalformedUriException
+ */
+ static inline Impl * create(rtl::OUString const & rUrl);
+
+private:
+ inline Impl(std::auto_ptr< UnoUrlDescriptor::Impl > & rConnection,
+ std::auto_ptr< UnoUrlDescriptor::Impl > & rProtocol,
+ rtl::OUString const & rObjectName);
+};
+
+inline UnoUrl::Impl::Impl(std::auto_ptr< UnoUrlDescriptor::Impl > & rConnection,
+ std::auto_ptr< UnoUrlDescriptor::Impl > & rProtocol,
+ rtl::OUString const & rObjectName):
+ m_aConnection(rConnection),
+ m_aProtocol(rProtocol),
+ m_aObjectName(rObjectName)
+{}
+
+inline UnoUrl::Impl * UnoUrl::Impl::create(rtl::OUString const & rUrl)
+{
+ if (!rUrl.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("uno:"), 0))
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL does not start with \"uno:\"")));
+ sal_Int32 i = RTL_CONSTASCII_LENGTH("uno:");
+ sal_Int32 j = rUrl.indexOf(';', i);
+ if (j < 0)
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL has too few semicolons")));
+ std::auto_ptr< UnoUrlDescriptor::Impl >
+ xConnection(new UnoUrlDescriptor::Impl(rUrl.copy(i, j - i)));
+ i = j + 1;
+ j = rUrl.indexOf(0x3B, i); // ';'
+ if (j < 0)
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL has too few semicolons")));
+ std::auto_ptr< UnoUrlDescriptor::Impl >
+ xProtocol(new UnoUrlDescriptor::Impl(rUrl.copy(i, j - i)));
+ i = j + 1;
+ if (i == rUrl.getLength())
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains empty ObjectName")));
+ for (j = i; j < rUrl.getLength(); ++j)
+ {
+ sal_Unicode c = rUrl.getStr()[j];
+ if (!isAlphanum(c) && c != 0x21 && c != 0x24 // '!', '$'
+ && c != 0x26 && c != 0x27 && c != 0x28 // '&', ''', '('
+ && c != 0x28 && c != 0x2A && c != 0x2B // ')', '*', '+'
+ && c != 0x2C && c != 0x2D && c != 0x2E // ',', '-', '.'
+ && c != 0x2F && c != 0x3A && c != 0x3D // '/', ':', '='
+ && c != 0x3F && c != 0x40 && c != 0x5F // '?', '@', '_'
+ && c != 0x7E) // '~'
+ throw rtl::MalformedUriException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "UNO URL contains invalid ObjectName")));
+ }
+ return new Impl(xConnection, xProtocol, rUrl.copy(i));
+}
+
+UnoUrl::UnoUrl(rtl::OUString const & rUrl): m_xImpl(Impl::create(rUrl))
+{}
+
+UnoUrl::UnoUrl(UnoUrl const & rOther): m_xImpl(rOther.m_xImpl->clone())
+{}
+
+UnoUrl::~UnoUrl()
+{}
+
+UnoUrl & UnoUrl::operator =(UnoUrl const & rOther)
+{
+ m_xImpl.reset(rOther.m_xImpl->clone());
+ return *this;
+}
+
+UnoUrlDescriptor const & UnoUrl::getConnection() const
+{
+ return m_xImpl->m_aConnection;
+}
+
+UnoUrlDescriptor const & UnoUrl::getProtocol() const
+{
+ return m_xImpl->m_aProtocol;
+}
+
+rtl::OUString const & UnoUrl::getObjectName() const
+{
+ return m_xImpl->m_aObjectName;
+}
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
new file mode 100644
index 000000000000..27b94f6a4c34
--- /dev/null
+++ b/cppuhelper/source/weak.cxx
@@ -0,0 +1,553 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+#include <osl/mutex.hxx>
+#ifndef _CPPU_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+#ifndef _CPPU_HELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#include "cppuhelper/exc_hlp.hxx"
+
+using namespace osl;
+using namespace com::sun::star::uno;
+
+/** */ //for docpp
+namespace cppu
+{
+
+// due to static Reflection destruction from usr, ther must be a mutex leak (#73272#)
+inline static Mutex & getWeakMutex() SAL_THROW( () )
+{
+ static Mutex * s_pMutex = 0;
+ if (! s_pMutex)
+ s_pMutex = new Mutex();
+ return *s_pMutex;
+}
+
+//------------------------------------------------------------------------
+//-- OWeakConnectionPoint ----------------------------------------------------
+//------------------------------------------------------------------------
+class OWeakConnectionPoint : public XAdapter
+{
+public:
+ /**
+ Hold the weak object without an acquire (only the pointer).
+ */
+ OWeakConnectionPoint( OWeakObject* pObj ) SAL_THROW( () )
+ : m_aRefCount( 0 )
+ , m_pObject(pObj)
+ , m_aReferences( getWeakMutex() )
+ {}
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+
+ // XAdapter
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL queryAdapted() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XReference >& xRef ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XReference >& xRef ) throw(::com::sun::star::uno::RuntimeException);
+
+ /// Called from the weak object if the reference count goes to zero.
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ OWeakConnectionPoint(OWeakConnectionPoint &); // not defined
+ void operator =(OWeakConnectionPoint &); // not defined
+
+ virtual ~OWeakConnectionPoint() {}
+
+ /// The reference counter.
+ oslInterlockedCount m_aRefCount;
+ /// The weak object
+ OWeakObject* m_pObject;
+ /// The container to hold the weak references
+ OInterfaceContainerHelper m_aReferences;
+};
+
+// XInterface
+Any SAL_CALL OWeakConnectionPoint::queryInterface( const Type & rType )
+ throw(com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType, static_cast< XAdapter * >( this ), static_cast< XInterface * >( this ) );
+}
+
+// XInterface
+void SAL_CALL OWeakConnectionPoint::acquire() throw()
+{
+ osl_incrementInterlockedCount( &m_aRefCount );
+}
+
+// XInterface
+void SAL_CALL OWeakConnectionPoint::release() throw()
+{
+ if (! osl_decrementInterlockedCount( &m_aRefCount ))
+ delete this;
+}
+
+void SAL_CALL OWeakConnectionPoint::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ Any ex;
+ OInterfaceIteratorHelper aIt( m_aReferences );
+ while( aIt.hasMoreElements() )
+ {
+ try
+ {
+ ((XReference *)aIt.next())->dispose();
+ }
+ catch (com::sun::star::lang::DisposedException &) {}
+ catch (RuntimeException &)
+ {
+ ex = cppu::getCaughtException();
+ }
+ }
+ if (ex.hasValue())
+ {
+ cppu::throwException(ex);
+ }
+}
+
+// XInterface
+Reference< XInterface > SAL_CALL OWeakConnectionPoint::queryAdapted() throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference< XInterface > ret;
+
+ ClearableMutexGuard guard(getWeakMutex());
+
+ if (m_pObject)
+ {
+ oslInterlockedCount n = osl_incrementInterlockedCount( &m_pObject->m_refCount );
+
+ if (n > 1)
+ {
+ // The refence is incremented. The object cannot be destroyed.
+ // Release the guard at the earliest point.
+ guard.clear();
+ // WeakObject has a (XInterface *) cast operator
+ ret = *m_pObject;
+ n = osl_decrementInterlockedCount( &m_pObject->m_refCount );
+ }
+ else
+ // Another thread wait in the dispose method at the guard
+ n = osl_decrementInterlockedCount( &m_pObject->m_refCount );
+ }
+
+ return ret;
+}
+
+// XInterface
+void SAL_CALL OWeakConnectionPoint::addReference(const Reference< XReference >& rRef)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ m_aReferences.addInterface( (const Reference< XInterface > &)rRef );
+}
+
+// XInterface
+void SAL_CALL OWeakConnectionPoint::removeReference(const Reference< XReference >& rRef)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ m_aReferences.removeInterface( (const Reference< XInterface > &)rRef );
+}
+
+
+//------------------------------------------------------------------------
+//-- OWeakObject -------------------------------------------------------
+//------------------------------------------------------------------------
+
+#ifdef _MSC_VER
+// Accidentally occurs in msvc mapfile = > had to be outlined.
+OWeakObject::OWeakObject() SAL_THROW( () )
+ : m_refCount( 0 ),
+ m_pWeakConnectionPoint( 0 )
+{
+}
+#endif
+
+// XInterface
+Any SAL_CALL OWeakObject::queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType,
+ static_cast< XWeak * >( this ), static_cast< XInterface * >( this ) );
+}
+
+// XInterface
+void SAL_CALL OWeakObject::acquire() throw()
+{
+ osl_incrementInterlockedCount( &m_refCount );
+}
+
+// XInterface
+void SAL_CALL OWeakObject::release() throw()
+{
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
+ // notify/clear all weak-refs before object's dtor is executed
+ // (which may check weak-refs to this object):
+ disposeWeakConnectionPoint();
+ // destroy object:
+ delete this;
+ }
+}
+
+void OWeakObject::disposeWeakConnectionPoint()
+{
+ OSL_PRECOND( m_refCount == 0, "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" );
+ if (m_pWeakConnectionPoint != 0) {
+ OWeakConnectionPoint * const p = m_pWeakConnectionPoint;
+ m_pWeakConnectionPoint = 0;
+ try {
+ p->dispose();
+ }
+ catch (RuntimeException const& exc) {
+ OSL_ENSURE(
+ false, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ static_cast<void>(exc);
+ }
+ p->release();
+ }
+}
+
+OWeakObject::~OWeakObject() SAL_THROW( (RuntimeException) )
+{
+}
+
+// XWeak
+Reference< XAdapter > SAL_CALL OWeakObject::queryAdapter()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if (!m_pWeakConnectionPoint)
+ {
+ // only acquire mutex if member is not created
+ MutexGuard aGuard( getWeakMutex() );
+ if( !m_pWeakConnectionPoint )
+ {
+ OWeakConnectionPoint * p = new OWeakConnectionPoint(this);
+ p->acquire();
+ m_pWeakConnectionPoint = p;
+ }
+ }
+
+ return m_pWeakConnectionPoint;
+}
+
+//------------------------------------------------------------------------
+//-- OWeakAggObject ----------------------------------------------------
+//------------------------------------------------------------------------
+OWeakAggObject::~OWeakAggObject() SAL_THROW( (RuntimeException) )
+{
+}
+
+// XInterface
+void OWeakAggObject::acquire() throw()
+{
+ Reference<XInterface > x( xDelegator );
+ if (x.is())
+ x->acquire();
+ else
+ OWeakObject::acquire();
+}
+
+// XInterface
+void OWeakAggObject::release() throw()
+{
+ Reference<XInterface > x( xDelegator );
+ if (x.is())
+ x->release();
+ else
+ OWeakObject::release();
+}
+
+// XInterface
+Any OWeakAggObject::queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference< XInterface > x( xDelegator ); // harden ref
+ return (x.is() ? x->queryInterface( rType ) : queryAggregation( rType ));
+
+// // set rOut to zero, if failed
+// if( !xDelegator.queryHardRef( aUik, rOut ) )
+// {
+// XInterfaceRef x;
+// if( !xDelegator.queryHardRef( ((XInterface*)0)->getSmartUik(), x ) )
+// // reference is not valid
+// queryAggregation( aUik, rOut );
+// }
+// return rOut.is();
+}
+
+// XAggregation
+Any OWeakAggObject::queryAggregation( const Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType,
+ static_cast< XInterface * >( static_cast< OWeakObject * >( this ) ),
+ static_cast< XAggregation * >( this ),
+ static_cast< XWeak * >( this ) );
+}
+
+// XAggregation
+void OWeakAggObject::setDelegator( const Reference<XInterface > & rDelegator ) throw(::com::sun::star::uno::RuntimeException)
+{
+ xDelegator = rDelegator;
+}
+
+}
+
+/** */ //for docpp
+namespace com
+{
+/** */ //for docpp
+namespace sun
+{
+/** */ //for docpp
+namespace star
+{
+/** */ //for docpp
+namespace uno
+{
+
+
+//------------------------------------------------------------------------
+//-- OWeakRefListener -----------------------------------------------------
+//------------------------------------------------------------------------
+class OWeakRefListener : public XReference
+{
+public:
+ OWeakRefListener(const OWeakRefListener& rRef) SAL_THROW( () );
+ OWeakRefListener(const Reference< XInterface >& xInt) SAL_THROW( () );
+ virtual ~OWeakRefListener() SAL_THROW( () );
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType ) throw(RuntimeException);
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+
+ // XReference
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ /// The reference counter.
+ oslInterlockedCount m_aRefCount;
+ /// The connection point of the weak object
+ Reference< XAdapter > m_XWeakConnectionPoint;
+
+private:
+ OWeakRefListener& SAL_CALL operator=(const OWeakRefListener& rRef) SAL_THROW( () );
+};
+
+OWeakRefListener::OWeakRefListener(const OWeakRefListener& rRef) SAL_THROW( () )
+ : com::sun::star::uno::XReference()
+ , m_aRefCount( 1 )
+{
+ try
+ {
+ m_XWeakConnectionPoint = rRef.m_XWeakConnectionPoint;
+
+ if (m_XWeakConnectionPoint.is())
+ {
+ m_XWeakConnectionPoint->addReference((XReference*)this);
+ }
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+ osl_decrementInterlockedCount( &m_aRefCount );
+}
+
+OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt) SAL_THROW( () )
+ : m_aRefCount( 1 )
+{
+ try
+ {
+ Reference< XWeak > xWeak( Reference< XWeak >::query( xInt ) );
+
+ if (xWeak.is())
+ {
+ m_XWeakConnectionPoint = xWeak->queryAdapter();
+
+ if (m_XWeakConnectionPoint.is())
+ {
+ m_XWeakConnectionPoint->addReference((XReference*)this);
+ }
+ }
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+ osl_decrementInterlockedCount( &m_aRefCount );
+}
+
+OWeakRefListener::~OWeakRefListener() SAL_THROW( () )
+{
+ try
+ {
+ if (m_XWeakConnectionPoint.is())
+ {
+ acquire(); // dont die again
+ m_XWeakConnectionPoint->removeReference((XReference*)this);
+ }
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+}
+
+// XInterface
+Any SAL_CALL OWeakRefListener::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType, static_cast< XReference * >( this ), static_cast< XInterface * >( this ) );
+}
+
+// XInterface
+void SAL_CALL OWeakRefListener::acquire() throw()
+{
+ osl_incrementInterlockedCount( &m_aRefCount );
+}
+
+// XInterface
+void SAL_CALL OWeakRefListener::release() throw()
+{
+ if( ! osl_decrementInterlockedCount( &m_aRefCount ) )
+ delete this;
+}
+
+void SAL_CALL OWeakRefListener::dispose()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Reference< XAdapter > xAdp;
+ {
+ MutexGuard guard(cppu::getWeakMutex());
+ if( m_XWeakConnectionPoint.is() )
+ {
+ xAdp = m_XWeakConnectionPoint;
+ m_XWeakConnectionPoint.clear();
+ }
+ }
+
+ if( xAdp.is() )
+ xAdp->removeReference((XReference*)this);
+}
+
+//------------------------------------------------------------------------
+//-- WeakReferenceHelper ----------------------------------------------------------
+//------------------------------------------------------------------------
+WeakReferenceHelper::WeakReferenceHelper(const Reference< XInterface >& xInt) SAL_THROW( () )
+ : m_pImpl( 0 )
+{
+ if (xInt.is())
+ {
+ m_pImpl = new OWeakRefListener(xInt);
+ m_pImpl->acquire();
+ }
+}
+
+WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
+ : m_pImpl( 0 )
+{
+ Reference< XInterface > xInt( rWeakRef.get() );
+ if (xInt.is())
+ {
+ m_pImpl = new OWeakRefListener(xInt);
+ m_pImpl->acquire();
+ }
+}
+
+void WeakReferenceHelper::clear() SAL_THROW( () )
+{
+ try
+ {
+ if (m_pImpl)
+ {
+ if (m_pImpl->m_XWeakConnectionPoint.is())
+ {
+ m_pImpl->m_XWeakConnectionPoint->removeReference(
+ (XReference*)m_pImpl);
+ m_pImpl->m_XWeakConnectionPoint.clear();
+ }
+ m_pImpl->release();
+ m_pImpl = 0;
+ }
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+}
+
+WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef) SAL_THROW( () )
+{
+ if (this == &rWeakRef)
+ {
+ return *this;
+ }
+ Reference< XInterface > xInt( rWeakRef.get() );
+ return operator = ( xInt );
+}
+
+WeakReferenceHelper & SAL_CALL
+WeakReferenceHelper::operator= (const Reference< XInterface > & xInt)
+SAL_THROW( () )
+{
+ try
+ {
+ clear();
+ if (xInt.is())
+ {
+ m_pImpl = new OWeakRefListener(xInt);
+ m_pImpl->acquire();
+ }
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+ return *this;
+}
+
+WeakReferenceHelper::~WeakReferenceHelper() SAL_THROW( () )
+{
+ clear();
+}
+
+Reference< XInterface > WeakReferenceHelper::get() const SAL_THROW( () )
+{
+ try
+ {
+ Reference< XAdapter > xAdp;
+ {
+ MutexGuard guard(cppu::getWeakMutex());
+ if( m_pImpl && m_pImpl->m_XWeakConnectionPoint.is() )
+ xAdp = m_pImpl->m_XWeakConnectionPoint;
+ }
+
+ if (xAdp.is())
+ return xAdp->queryAdapted();
+ }
+ catch (RuntimeException &) { OSL_ASSERT( 0 ); } // assert here, but no unexpected()
+
+ return Reference< XInterface >();
+}
+
+}
+}
+}
+}
+