summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/inc/cppuhelper/compbase.hxx249
-rw-r--r--cppuhelper/inc/cppuhelper/compbase1.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase10.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase11.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase12.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase2.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase3.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase4.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase5.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase6.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase7.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase8.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/compbase9.hxx73
-rw-r--r--cppuhelper/inc/cppuhelper/component.hxx147
-rw-r--r--cppuhelper/inc/cppuhelper/exc_hlp.hxx84
-rw-r--r--cppuhelper/inc/cppuhelper/factory.hxx272
-rw-r--r--cppuhelper/inc/cppuhelper/implbase.hxx239
-rw-r--r--cppuhelper/inc/cppuhelper/implbase1.hxx75
-rw-r--r--cppuhelper/inc/cppuhelper/implbase10.hxx77
-rw-r--r--cppuhelper/inc/cppuhelper/implbase11.hxx77
-rw-r--r--cppuhelper/inc/cppuhelper/implbase12.hxx77
-rw-r--r--cppuhelper/inc/cppuhelper/implbase2.hxx75
-rw-r--r--cppuhelper/inc/cppuhelper/implbase3.hxx75
-rw-r--r--cppuhelper/inc/cppuhelper/implbase4.hxx75
-rw-r--r--cppuhelper/inc/cppuhelper/implbase5.hxx76
-rw-r--r--cppuhelper/inc/cppuhelper/implbase6.hxx76
-rw-r--r--cppuhelper/inc/cppuhelper/implbase7.hxx76
-rw-r--r--cppuhelper/inc/cppuhelper/implbase8.hxx76
-rw-r--r--cppuhelper/inc/cppuhelper/implbase9.hxx78
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.h376
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.hxx240
-rw-r--r--cppuhelper/inc/cppuhelper/propshlp.hxx479
-rw-r--r--cppuhelper/inc/cppuhelper/proptypehlp.h116
-rw-r--r--cppuhelper/inc/cppuhelper/proptypehlp.hxx556
-rw-r--r--cppuhelper/inc/cppuhelper/queryinterface.hxx487
-rw-r--r--cppuhelper/inc/cppuhelper/servicefactory.hxx148
-rw-r--r--cppuhelper/inc/cppuhelper/stdidlclass.hxx554
-rw-r--r--cppuhelper/inc/cppuhelper/typeprovider.hxx226
-rw-r--r--cppuhelper/inc/cppuhelper/weak.hxx160
-rw-r--r--cppuhelper/inc/cppuhelper/weakagg.hxx149
-rw-r--r--cppuhelper/inc/cppuhelper/weakref.hxx182
-rw-r--r--cppuhelper/prj/d.lst57
-rw-r--r--cppuhelper/source/component.cxx212
-rw-r--r--cppuhelper/source/exc_thrower.cxx287
-rw-r--r--cppuhelper/source/factory.cxx719
-rw-r--r--cppuhelper/source/implbase.cxx227
-rw-r--r--cppuhelper/source/interfacecontainer.cxx383
-rw-r--r--cppuhelper/source/makefile.mk167
-rw-r--r--cppuhelper/source/propshlp.cxx1106
-rw-r--r--cppuhelper/source/servicefactory.cxx507
-rw-r--r--cppuhelper/source/stdidlclass.cxx240
-rw-r--r--cppuhelper/source/typeprovider.cxx344
-rw-r--r--cppuhelper/source/weak.cxx521
-rw-r--r--cppuhelper/test/helpertest.idl117
-rw-r--r--cppuhelper/test/makefile.mk133
-rw-r--r--cppuhelper/test/testhelper.cxx132
-rw-r--r--cppuhelper/test/testhelper.hxx64
-rw-r--r--cppuhelper/test/testidlclass.cxx259
-rw-r--r--cppuhelper/test/testimplhelper.cxx387
-rw-r--r--cppuhelper/test/testpropshlp.cxx1198
-rw-r--r--cppuhelper/test/testproptyphlp.cxx116
61 files changed, 13629 insertions, 0 deletions
diff --git a/cppuhelper/inc/cppuhelper/compbase.hxx b/cppuhelper/inc/cppuhelper/compbase.hxx
new file mode 100644
index 000000000000..7e3522e1097f
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase.hxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#define _CPPUHELPER_COMPBASE_HXX_
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+
+//==================================================================================================
+#define __DEF_COMPIMPLHELPER_A( N ) \
+namespace cppu \
+{ \
+template< __CLASS_IFC##N > \
+class WeakComponentImplHelper##N \
+ : public ::cppu::OWeakObject \
+ , public ::com::sun::star::lang::XComponent \
+ , public ImplHelperBase##N< __IFC##N > \
+{ \
+ static ClassData##N s_aCD; \
+protected: \
+ ::cppu::OBroadcastHelper rBHelper; \
+ virtual void SAL_CALL disposing() \
+ {} \
+public: \
+ WeakComponentImplHelper##N( ::osl::Mutex & rMutex ) \
+ : rBHelper( rMutex ) \
+ {} \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
+ if (aRet.hasValue()) \
+ return aRet; \
+ if (rType == ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > *)0 )) \
+ { \
+ void * p = static_cast< ::com::sun::star::lang::XComponent * >( this ); \
+ return ::com::sun::star::uno::Any( &p, rType ); \
+ } \
+ return OWeakObject::queryInterface( rType ); \
+ } \
+ virtual void SAL_CALL acquire() throw() \
+ { OWeakObject::acquire(); } \
+ virtual void SAL_CALL release() throw() \
+ { \
+ if (1 == m_refCount && !rBHelper.bDisposed) \
+ { \
+ dispose(); \
+ } \
+ OWeakObject::release(); \
+ } \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getTypes(); } \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getImplementationId(); } \
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::ClearableMutexGuard aGuard( rBHelper.rMutex ); \
+ if (!rBHelper.bDisposed && !rBHelper.bInDispose) \
+ { \
+ rBHelper.bInDispose = sal_True; \
+ aGuard.clear(); \
+ ::com::sun::star::lang::EventObject aEvt( static_cast< ::cppu::OWeakObject * >( this ) ); \
+ rBHelper.aLC.disposeAndClear( aEvt ); \
+ disposing(); \
+ rBHelper.bDisposed = sal_True; \
+ rBHelper.bInDispose = sal_False; \
+ } \
+ } \
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::MutexGuard aGuard( rBHelper.rMutex ); \
+ OSL_ENSHURE( !rBHelper.bInDispose, "do not add listeners in the dispose call" ); \
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" ); \
+ if (!rBHelper.bInDispose && !rBHelper.bDisposed) \
+ rBHelper.aLC.addInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > *)0 ), xListener ); \
+ } \
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::MutexGuard aGuard( rBHelper.rMutex ); \
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" ); \
+ if (!rBHelper.bInDispose && !rBHelper.bDisposed) \
+ rBHelper.aLC.removeInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > *)0 ), xListener ); \
+ } \
+}; \
+template< __CLASS_IFC##N > \
+class WeakAggComponentImplHelper##N \
+ : public ::cppu::OWeakAggObject \
+ , public ::com::sun::star::lang::XComponent \
+ , public ImplHelperBase##N< __IFC##N > \
+{ \
+ static ClassData##N s_aCD; \
+protected: \
+ ::cppu::OBroadcastHelper rBHelper; \
+ virtual void SAL_CALL disposing() \
+ {} \
+public: \
+ WeakAggComponentImplHelper##N( ::osl::Mutex & rMutex ) \
+ : rBHelper( rMutex ) \
+ {} \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { return OWeakAggObject::queryInterface( rType ); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
+ if (aRet.hasValue()) \
+ return aRet; \
+ if (rType == ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > *)0 )) \
+ { \
+ void * p = static_cast< ::com::sun::star::lang::XComponent * >( this ); \
+ return ::com::sun::star::uno::Any( &p, rType ); \
+ } \
+ return OWeakAggObject::queryAggregation( rType ); \
+ } \
+ virtual void SAL_CALL acquire() throw() \
+ { OWeakAggObject::acquire(); } \
+ virtual void SAL_CALL release() throw() \
+ { \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > x( xDelegator ); \
+ if (!x.is() && 1 == m_refCount && !rBHelper.bDisposed) \
+ dispose(); \
+ OWeakAggObject::release(); \
+ } \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getTypes(); } \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getImplementationId(); } \
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::ClearableMutexGuard aGuard( rBHelper.rMutex ); \
+ if (!rBHelper.bDisposed && !rBHelper.bInDispose) \
+ { \
+ rBHelper.bInDispose = sal_True; \
+ aGuard.clear(); \
+ ::com::sun::star::lang::EventObject aEvt( static_cast< ::cppu::OWeakObject * >( this ) ); \
+ rBHelper.aLC.disposeAndClear( aEvt ); \
+ disposing(); \
+ rBHelper.bDisposed = sal_True; \
+ rBHelper.bInDispose = sal_False; \
+ } \
+ } \
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::MutexGuard aGuard( rBHelper.rMutex ); \
+ OSL_ENSHURE( !rBHelper.bInDispose, "do not add listeners in the dispose call" ); \
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" ); \
+ if (!rBHelper.bInDispose && !rBHelper.bDisposed) \
+ rBHelper.aLC.addInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > *)0 ), xListener ); \
+ } \
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::osl::MutexGuard aGuard( rBHelper.rMutex ); \
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" ); \
+ if (!rBHelper.bInDispose && !rBHelper.bDisposed) \
+ rBHelper.aLC.removeInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > *)0 ), xListener ); \
+ } \
+};
+
+//==================================================================================================
+#define __DEF_COMPIMPLHELPER_B( N ) \
+template< __CLASS_IFC##N > \
+ClassData##N WeakComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 4 ); \
+template< __CLASS_IFC##N > \
+ClassData##N WeakAggComponentImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 3 );
+//==================================================================================================
+#define __DEF_COMPIMPLHELPER_C( N ) \
+}
+//==================================================================================================
+// The Mac OS X gcc compiler cannot handle assignments to static data members
+// of the generic template class. It can only handle assignments to specific
+// instantiations of a template class.
+#ifdef MACOSX
+#define __DEF_COMPIMPLHELPER( N ) \
+__DEF_COMPIMPLHELPER_A( N ) \
+__DEF_COMPIMPLHELPER_C( N )
+#else /* MACOSX */
+#define __DEF_COMPIMPLHELPER( N ) \
+__DEF_COMPIMPLHELPER_A( N ) \
+__DEF_COMPIMPLHELPER_B( N ) \
+__DEF_COMPIMPLHELPER_C( N )
+#endif /* MACOSX */
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase1.hxx b/cppuhelper/inc/cppuhelper/compbase1.hxx
new file mode 100644
index 000000000000..e50d61b7eb5c
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase1.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase1.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE1_HXX_
+#define _CPPUHELPER_COMPBASE1_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 1 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase10.hxx b/cppuhelper/inc/cppuhelper/compbase10.hxx
new file mode 100644
index 000000000000..bd868f157133
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase10.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase10.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE10_HXX_
+#define _CPPUHELPER_COMPBASE10_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE10_HXX_
+#include <cppuhelper/implbase10.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 10 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase11.hxx b/cppuhelper/inc/cppuhelper/compbase11.hxx
new file mode 100644
index 000000000000..a16e743bdf4a
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase11.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase11.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE11_HXX_
+#define _CPPUHELPER_COMPBASE11_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE11_HXX_
+#include <cppuhelper/implbase11.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 11 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase12.hxx b/cppuhelper/inc/cppuhelper/compbase12.hxx
new file mode 100644
index 000000000000..cb54a6c008fa
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase12.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase12.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE12_HXX_
+#define _CPPUHELPER_COMPBASE12_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE12_HXX_
+#include <cppuhelper/implbase12.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 12 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase2.hxx b/cppuhelper/inc/cppuhelper/compbase2.hxx
new file mode 100644
index 000000000000..ff5d0d7af786
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase2.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE2_HXX_
+#define _CPPUHELPER_COMPBASE2_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 2 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase3.hxx b/cppuhelper/inc/cppuhelper/compbase3.hxx
new file mode 100644
index 000000000000..d74519250cf7
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase3.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase3.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE3_HXX_
+#define _CPPUHELPER_COMPBASE3_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 3 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase4.hxx b/cppuhelper/inc/cppuhelper/compbase4.hxx
new file mode 100644
index 000000000000..3639e183b87d
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase4.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase4.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE4_HXX_
+#define _CPPUHELPER_COMPBASE4_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 4 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase5.hxx b/cppuhelper/inc/cppuhelper/compbase5.hxx
new file mode 100644
index 000000000000..47ce9b31e2a4
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase5.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase5.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE5_HXX_
+#define _CPPUHELPER_COMPBASE5_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase5.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 5 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase6.hxx b/cppuhelper/inc/cppuhelper/compbase6.hxx
new file mode 100644
index 000000000000..9d5931064592
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase6.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase6.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE6_HXX_
+#define _CPPUHELPER_COMPBASE6_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE6_HXX_
+#include <cppuhelper/implbase6.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 6 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase7.hxx b/cppuhelper/inc/cppuhelper/compbase7.hxx
new file mode 100644
index 000000000000..d7791db9b068
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase7.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase7.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE7_HXX_
+#define _CPPUHELPER_COMPBASE7_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE7_HXX_
+#include <cppuhelper/implbase7.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 7 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase8.hxx b/cppuhelper/inc/cppuhelper/compbase8.hxx
new file mode 100644
index 000000000000..b15675bf0279
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase8.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase8.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE8_HXX_
+#define _CPPUHELPER_COMPBASE8_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE8_HXX_
+#include <cppuhelper/implbase8.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 8 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/compbase9.hxx b/cppuhelper/inc/cppuhelper/compbase9.hxx
new file mode 100644
index 000000000000..8ac9379daf7c
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/compbase9.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: compbase9.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPBASE9_HXX_
+#define _CPPUHELPER_COMPBASE9_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE9_HXX_
+#include <cppuhelper/implbase9.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE_HXX_
+#include <cppuhelper/compbase.hxx>
+#endif
+
+__DEF_COMPIMPLHELPER( 9 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/component.hxx b/cppuhelper/inc/cppuhelper/component.hxx
new file mode 100644
index 000000000000..8689bf126f64
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/component.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * $RCSfile: component.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_COMPONENT_HXX_
+#define _CPPUHELPER_COMPONENT_HXX_
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+
+/** */ //for docpp
+namespace cppu
+{
+
+/**
+ * The helper implementation for a basic broadcaster. This implementation
+ * supports aggregation and weak references.
+ *
+ * @author Markus Meyer
+ * @since 98/04/12
+ */
+class OComponentHelper : public ::cppu::WeakAggImplHelper1< ::com::sun::star::lang::XComponent >
+{
+public:
+ /**
+ * Create an object that implements XComponent.
+ *
+ * @param rMutex the mutex used to protect multi thread access.
+ * The lifetime must be longer than the lifetime
+ * of this object.
+ */
+ OComponentHelper( ::osl::Mutex & rMutex );
+ /**
+ * If dispose is not previous called, first acquire is called to protect against
+ * double delete and than call dispose.<BR> Note in this situation no destructor
+ * of derived classes are called.
+ */
+ ~OComponentHelper();
+
+ // XInterface
+ virtual void SAL_CALL release() throw();
+
+ // XTypeProvider getImplementationId() has to be implemented separately!
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ /**
+ * Called in the dispose method after the listeners are notified.
+ * In this situation rBHelper.bDisposed is false
+ * and rBHelper.bDisposing is true.
+ */
+ virtual void SAL_CALL disposing();
+
+ /**
+ * Contains a mutex, a listener container and the dispose states.
+ * Subclasses should only modify the listener container.
+ */
+ OBroadcastHelper rBHelper;
+private:
+ OComponentHelper( const OComponentHelper & );
+ OComponentHelper & operator = ( const OComponentHelper & );
+};
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/exc_hlp.hxx b/cppuhelper/inc/cppuhelper/exc_hlp.hxx
new file mode 100644
index 000000000000..6ac1b14c62c8
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/exc_hlp.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: exc_hlp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_EXC_HLP_HXX_
+#define _CPPUHELPER_EXC_HLP_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+namespace cppu
+{
+
+/**
+ * This function throws the exception given in the Any rExc. The given value has to be of type class
+ * EXCEPTION and must be dervived from or of type com.sun.star.uno.Exception.
+ *<BR>
+ * @param rExc exception to be thrown.
+ */
+void SAL_CALL throwException( const ::com::sun::star::uno::Any & rExc )
+ throw (::com::sun::star::uno::Exception);
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx
new file mode 100644
index 000000000000..44e157f3fe3a
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/factory.hxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#define _CPPUHELPER_FACTORY_HXX_
+
+#ifndef _RTL_STRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _UNO_DISPATCHER_H_
+#include <uno/dispatcher.h>
+#endif
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+//##################################################################################################
+
+#define COMPONENT_GETENV "component_getImplementationEnvironment"
+#define COMPONENT_GETDESCRIPTION "component_getDescription"
+#define COMPONENT_WRITEINFO "component_writeInfo"
+#define COMPONENT_GETFACTORY "component_getFactory"
+
+typedef struct _uno_Environment uno_Environment;
+
+/***************************************************************************************************
+ * Function to determine the environment of the implementation.
+ * If the environment is NOT session specific (needs no additional context), then this function
+ * should return the environment type name and leave ppEnv (0).
+ *<BR>
+ * @param ppEnvTypeName environment type name; string must be constant
+ * @param ppEnv function returns its environment if the environment is
+ * session specific, i.e. has special context
+ */
+typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv );
+
+/***************************************************************************************************
+ * Optional function to retrieve a component description.
+ *<BR>
+ * @return an XML formatted string containing a short component description
+ */
+typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void);
+
+/***************************************************************************************************
+ * Writes component registry info, at least writing the supported service names.
+ *<BR>
+ * @param pServiceManager a service manager
+ * (the type is XMultiServiceFactory to be used by the environment
+ * returned by component_getImplementationEnvironment)
+ * @param pRegistryKey a registry key
+ * (the type is XRegistryKey to be used by the environment
+ * returned by component_getImplementationEnvironment)
+ * @return true if everything went fine
+ */
+typedef sal_Bool (SAL_CALL * component_writeInfoFunc)(
+ void * pServiceManager, void * pRegistryKey );
+
+/***************************************************************************************************
+ * Retrieves a factory to create component instances.
+ *<BR>
+ * @param pImplName desired implementation name
+ * @param pServiceManager a service manager
+ * (the type is XMultiServiceFactory to be used by the environment
+ * returned by component_getImplementationEnvironment)
+ * @param pRegistryKey a registry key
+ * (the type is XRegistryKey to be used by the environment
+ * returned by component_getImplementationEnvironment)
+ * @return acquired component factory
+ * (the type is XSingleServiceFactory to be used by the environment
+ * returned by component_getImplementationEnvironment)
+ */
+typedef void * (SAL_CALL * component_getFactoryFunc)(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
+
+//##################################################################################################
+
+#define WRITE_COMPONENT_INFO_FUNCTION "writeComponentInfo"
+#define CREATE_COMPONENT_FACTORY_FUNCTION "createComponentFactory"
+
+/** This function pointer describes a function to write needed administrativ information
+ * about a component into the registry.
+ */
+typedef sal_Bool (SAL_CALL * WriteComponentInfoFunc)( uno_Interface * pXKey );
+
+/** This function pointer describes a function to create a factory for one or more components.
+ */
+typedef uno_Interface* (SAL_CALL * CreateComponentFactoryFunc)(
+ const sal_Unicode *, uno_Interface * pXSMgr, uno_Interface * pXKey );
+
+
+/** */ //for docpp
+namespace cppu
+{
+
+/**
+ * The type of the instanciate function used as argument of the create*Fcatory functions.
+ * @see createSingleFactory
+ * @see createOneInstanceFactory
+ */
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(SAL_CALL * ComponentInstantiation)
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager
+);
+
+/**
+ * Create a single service factory.<BR>
+ * Note: The function pointer ComponentInstantiation points to a function throws Exception.
+ *
+ * @param rServiceManager the service manager used by the implementation.
+ * @param rImplementationName the implementation name. An empty string is possible.
+ * @param ComponentInstantiation the function pointer to create an object.
+ * @param rServiceNames the service supported by the implementation.
+ * @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ * XSingleServiceFactory and XComponent.
+ *
+ * @see createOneInstanceFactory
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL createSingleFactory
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rImplementationName,
+ ComponentInstantiation pCreateFunction,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rServiceNames
+);
+
+/**
+ * Create a factory, that wrappes another one.<BR>
+ * This means the methods of the interfaces XServiceProvider, XServiceInfo and
+ * XSingleServiceFactory are forwarded.
+ * <B>It is not possible to put a factory into two service managers!<BR>
+ * The XComponent interface is not supported!</B>
+ *
+ * @param rServiceManager the service manager used by the implementation.
+ * @param xSingleServiceFactory the wrapped service factory.
+ * @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ * XSingleServiceFactory.
+ *
+ * @see createSingleFactory
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL createFactoryProxy
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > & rFactory
+);
+
+/**
+ * Create a single service factory which hold the instance created. If the
+ * "XSingleServiceFactory::createFactoryWithArguments" method is called with arguments
+ * new objects are created.
+ * Note: The function pointer ComponentInstantiation points to a function throws Exception.
+ *
+ * @param rServiceManager the service manager used by the implementation.
+ * @param rImplementationName the implementation name. An empty string is possible.
+ * @param ComponentInstantiation the function pointer to create an object.
+ * @param rServiceNames the service supported by the implementation.
+ * @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ * XSingleServiceFactory and XComponent.
+ *
+ * @see createSingleFactory
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL createOneInstanceFactory
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rComponentName,
+ ComponentInstantiation pCreateFunction,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rServiceNames
+);
+
+/**
+ * Create a single service factory.<BR>
+ * Note: The function pointer ComponentInstantiation points to a function throws Exception.
+ *
+ * @param rServiceManager the service manager used by the implementation.
+ * @param rImplementationName the implementation name. An empty string is possible.
+ * @param ComponentInstantiation the function pointer to create an object.
+ * @param rImplementationKey the registry key of the implementation section.
+ * @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ * XSingleServiceFactory and XComponent.
+ */
+SAL_DLLEXPORT ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL createSingleRegistryFactory
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rImplementationName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > & rImplementationKey
+);
+
+/**
+ * Create a single service factory which hold the instance created. If the
+ * "XSingleServiceFactory::createFactoryWithArguments" method is called with arguments
+ * new objects are created.
+ * Note: The function pointer ComponentInstantiation points to a function throws Exception.
+ *
+ * @param rServiceManager the service manager used by the implementation.
+ * @param rImplementationName the implementation name. An empty string is possible.
+ * @param ComponentInstantiation the function pointer to create an object.
+ * @param rImplementationKey the registry key of the implementation section.
+ * @return a factory that support the interfaces XServiceProvider, XServiceInfo
+ * XSingleServiceFactory and XComponent.
+ *
+ * @see createSingleRegistryFactory
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL createOneInstanceRegistryFactory
+(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rServiceManager,
+ const ::rtl::OUString & rComponentName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > & rImplementationKey
+);
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/implbase.hxx b/cppuhelper/inc/cppuhelper/implbase.hxx
new file mode 100644
index 000000000000..3d8696df1ffd
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase.hxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#define _CPPUHELPER_IMPLBASE_HXX_
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+
+namespace cppu
+{
+
+struct Type_Offset
+{
+ sal_Int32 nOffset;
+ typelib_InterfaceTypeDescription * pTD;
+};
+struct ClassDataBase
+{
+ sal_Bool bOffsetsInit;
+ sal_Int32 nType2Offset;
+
+ sal_Int32 nClassCode;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > * pTypes;
+ ::com::sun::star::uno::Sequence< sal_Int8 > * pId;
+
+ ClassDataBase();
+ ClassDataBase( sal_Int32 nClassCode );
+ ~ClassDataBase();
+};
+struct ClassData : public ClassDataBase
+{
+ Type_Offset arType2Offset[1];
+
+ void SAL_CALL initTypeProvider();
+ void SAL_CALL writeTypeOffset( const ::com::sun::star::uno::Type & rType, sal_Int32 nOffset );
+
+ ::com::sun::star::uno::Any SAL_CALL query(
+ const ::com::sun::star::uno::Type & rType, ::com::sun::star::lang::XTypeProvider * pBase );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes();
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId();
+};
+
+}
+
+//
+// settle down beavis, here comes the macro template hell :]
+//
+
+//==================================================================================================
+#define __DEF_IMPLHELPER_PRE( N ) \
+namespace cppu \
+{ \
+struct ClassData##N : public ClassDataBase \
+{ \
+ Type_Offset arType2Offset[ N ]; \
+ ClassData##N( sal_Int32 nClassCode ) \
+ : ClassDataBase( nClassCode ) \
+ {} \
+}; \
+template< __CLASS_IFC##N > \
+class ImplHelperBase##N \
+ : public ::com::sun::star::lang::XTypeProvider, __PUBLIC_IFC##N \
+{ \
+protected: \
+ ClassData & SAL_CALL getClassData( ClassDataBase & s_aCD ) \
+ { \
+ ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \
+ if (! rCD.bOffsetsInit) \
+ { \
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if (! rCD.bOffsetsInit) \
+ { \
+ char * pBase = (char *)this;
+//==================================================================================================
+#define __IFC_WRITEOFFSET( N ) \
+ rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< Ifc##N > *)0 ), \
+ (char *)(Ifc##N *)this - pBase );
+//==================================================================================================
+#define __DEF_IMPLHELPER_POST_A( N ) \
+ rCD.bOffsetsInit = sal_True; \
+ } \
+ } \
+ return rCD; \
+ } \
+}; \
+template< __CLASS_IFC##N > \
+class ImplHelper##N \
+ : public ImplHelperBase##N< __IFC##N > \
+{ \
+ static ClassData##N s_aCD; \
+public: \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ); } \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getTypes(); } \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getImplementationId(); } \
+}; \
+template< __CLASS_IFC##N > \
+class WeakImplHelper##N \
+ : public ::cppu::OWeakObject \
+ , public ImplHelperBase##N< __IFC##N > \
+{ \
+ static ClassData##N s_aCD; \
+public: \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); \
+ } \
+ virtual void SAL_CALL acquire() throw() \
+ { OWeakObject::acquire(); } \
+ virtual void SAL_CALL release() throw() \
+ { OWeakObject::release(); } \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getTypes(); } \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getImplementationId(); } \
+}; \
+template< __CLASS_IFC##N > \
+class WeakAggImplHelper##N \
+ : public ::cppu::OWeakAggObject \
+ , public ImplHelperBase##N< __IFC##N > \
+{ \
+ static ClassData##N s_aCD; \
+public: \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { return OWeakAggObject::queryInterface( rType ); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); \
+ } \
+ virtual void SAL_CALL acquire() throw() \
+ { OWeakAggObject::acquire(); } \
+ virtual void SAL_CALL release() throw() \
+ { OWeakAggObject::release(); } \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getTypes(); } \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
+ { return getClassData( s_aCD ).getImplementationId(); } \
+};
+
+//==================================================================================================
+#define __DEF_IMPLHELPER_POST_B( N ) \
+template< __CLASS_IFC##N > \
+ClassData##N ImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 0 ); \
+template< __CLASS_IFC##N > \
+ClassData##N WeakImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 1 ); \
+template< __CLASS_IFC##N > \
+ClassData##N WeakAggImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 2 );
+//==================================================================================================
+#define __DEF_IMPLHELPER_POST_C( N ) \
+}
+//==================================================================================================
+// The Mac OS X gcc compiler cannot handle assignments to static data members
+// of the generic template class. It can only handle assignments to specific
+// instantiations of a template class.
+#ifdef MACOSX
+#define __DEF_IMPLHELPER_POST( N ) \
+__DEF_IMPLHELPER_POST_A( N ) \
+__DEF_IMPLHELPER_POST_C( N )
+#else /* MACOSX */
+#define __DEF_IMPLHELPER_POST( N ) \
+__DEF_IMPLHELPER_POST_A( N ) \
+__DEF_IMPLHELPER_POST_B( N ) \
+__DEF_IMPLHELPER_POST_C( N )
+#endif /* MACOSX */
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase1.hxx b/cppuhelper/inc/cppuhelper/implbase1.hxx
new file mode 100644
index 000000000000..83601a702a89
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase1.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase1.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#define _CPPUHELPER_IMPLBASE1_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC1 Ifc1
+#define __CLASS_IFC1 class Ifc1
+#define __PUBLIC_IFC1 public Ifc1
+__DEF_IMPLHELPER_PRE( 1 )
+ __IFC_WRITEOFFSET( 1 )
+__DEF_IMPLHELPER_POST( 1 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase10.hxx b/cppuhelper/inc/cppuhelper/implbase10.hxx
new file mode 100644
index 000000000000..567153e4da27
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase10.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase10.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE10_HXX_
+#define _CPPUHELPER_IMPLBASE10_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC10 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10
+#define __CLASS_IFC10 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10
+#define __PUBLIC_IFC10 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
+__DEF_IMPLHELPER_PRE( 10 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 ) __IFC_WRITEOFFSET( 8 )
+ __IFC_WRITEOFFSET( 9 ) __IFC_WRITEOFFSET( 10 )
+__DEF_IMPLHELPER_POST( 10 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase11.hxx b/cppuhelper/inc/cppuhelper/implbase11.hxx
new file mode 100644
index 000000000000..7524160f6912
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase11.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase11.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE11_HXX_
+#define _CPPUHELPER_IMPLBASE11_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC11 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11
+#define __CLASS_IFC11 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11
+#define __PUBLIC_IFC11 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
+__DEF_IMPLHELPER_PRE( 11 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 ) __IFC_WRITEOFFSET( 8 )
+ __IFC_WRITEOFFSET( 9 ) __IFC_WRITEOFFSET( 10 ) __IFC_WRITEOFFSET( 11 )
+__DEF_IMPLHELPER_POST( 11 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase12.hxx b/cppuhelper/inc/cppuhelper/implbase12.hxx
new file mode 100644
index 000000000000..703cdbae1147
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase12.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase12.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE12_HXX_
+#define _CPPUHELPER_IMPLBASE12_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC12 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12
+#define __CLASS_IFC12 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12
+#define __PUBLIC_IFC12 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12
+__DEF_IMPLHELPER_PRE( 12 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 ) __IFC_WRITEOFFSET( 8 )
+ __IFC_WRITEOFFSET( 9 ) __IFC_WRITEOFFSET( 10 ) __IFC_WRITEOFFSET( 11 ) __IFC_WRITEOFFSET( 12 )
+__DEF_IMPLHELPER_POST( 12 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase2.hxx b/cppuhelper/inc/cppuhelper/implbase2.hxx
new file mode 100644
index 000000000000..a88647073d36
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase2.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#define _CPPUHELPER_IMPLBASE2_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC2 Ifc1, Ifc2
+#define __CLASS_IFC2 class Ifc1, class Ifc2
+#define __PUBLIC_IFC2 public Ifc1, public Ifc2
+__DEF_IMPLHELPER_PRE( 2 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 )
+__DEF_IMPLHELPER_POST( 2 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase3.hxx b/cppuhelper/inc/cppuhelper/implbase3.hxx
new file mode 100644
index 000000000000..aeeed371786d
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase3.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase3.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#define _CPPUHELPER_IMPLBASE3_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC3 Ifc1, Ifc2, Ifc3
+#define __CLASS_IFC3 class Ifc1, class Ifc2, class Ifc3
+#define __PUBLIC_IFC3 public Ifc1, public Ifc2, public Ifc3
+__DEF_IMPLHELPER_PRE( 3 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 )
+__DEF_IMPLHELPER_POST( 3 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase4.hxx b/cppuhelper/inc/cppuhelper/implbase4.hxx
new file mode 100644
index 000000000000..47da75657c7b
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase4.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase4.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#define _CPPUHELPER_IMPLBASE4_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC4 Ifc1, Ifc2, Ifc3, Ifc4
+#define __CLASS_IFC4 class Ifc1, class Ifc2, class Ifc3, class Ifc4
+#define __PUBLIC_IFC4 public Ifc1, public Ifc2, public Ifc3, public Ifc4
+__DEF_IMPLHELPER_PRE( 4 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+__DEF_IMPLHELPER_POST( 4 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase5.hxx b/cppuhelper/inc/cppuhelper/implbase5.hxx
new file mode 100644
index 000000000000..7310f5c56bd2
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase5.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase5.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#define _CPPUHELPER_IMPLBASE5_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC5 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5
+#define __CLASS_IFC5 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5
+#define __PUBLIC_IFC5 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
+__DEF_IMPLHELPER_PRE( 5 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 )
+__DEF_IMPLHELPER_POST( 5 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase6.hxx b/cppuhelper/inc/cppuhelper/implbase6.hxx
new file mode 100644
index 000000000000..4ca1605d0372
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase6.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase6.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE6_HXX_
+#define _CPPUHELPER_IMPLBASE6_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC6 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6
+#define __CLASS_IFC6 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6
+#define __PUBLIC_IFC6 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
+__DEF_IMPLHELPER_PRE( 6 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 )
+__DEF_IMPLHELPER_POST( 6 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase7.hxx b/cppuhelper/inc/cppuhelper/implbase7.hxx
new file mode 100644
index 000000000000..3192c6adeb3b
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase7.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase7.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE7_HXX_
+#define _CPPUHELPER_IMPLBASE7_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC7 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7
+#define __CLASS_IFC7 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7
+#define __PUBLIC_IFC7 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7
+__DEF_IMPLHELPER_PRE( 7 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 )
+__DEF_IMPLHELPER_POST( 7 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase8.hxx b/cppuhelper/inc/cppuhelper/implbase8.hxx
new file mode 100644
index 000000000000..174bff44675f
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase8.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase8.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE8_HXX_
+#define _CPPUHELPER_IMPLBASE8_HXX_
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC8 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8
+#define __CLASS_IFC8 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8
+#define __PUBLIC_IFC8 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
+__DEF_IMPLHELPER_PRE( 8 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 ) __IFC_WRITEOFFSET( 8 )
+__DEF_IMPLHELPER_POST( 8 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/implbase9.hxx b/cppuhelper/inc/cppuhelper/implbase9.hxx
new file mode 100644
index 000000000000..3c8bde78aca4
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/implbase9.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase9.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_IMPLBASE9_HXX_
+#define _CPPUHELPER_IMPLBASE9_HXX_
+
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#define __IFC9 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9
+#define __CLASS_IFC9 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9
+#define __PUBLIC_IFC9 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9
+__DEF_IMPLHELPER_PRE( 9 )
+ __IFC_WRITEOFFSET( 1 ) __IFC_WRITEOFFSET( 2 ) __IFC_WRITEOFFSET( 3 ) __IFC_WRITEOFFSET( 4 )
+ __IFC_WRITEOFFSET( 5 ) __IFC_WRITEOFFSET( 6 ) __IFC_WRITEOFFSET( 7 ) __IFC_WRITEOFFSET( 8 )
+ __IFC_WRITEOFFSET( 9 )
+__DEF_IMPLHELPER_POST( 9 )
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h
new file mode 100644
index 000000000000..cfaaa8784350
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h
@@ -0,0 +1,376 @@
+/*************************************************************************
+ *
+ * $RCSfile: interfacecontainer.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#define _CPPUHELPER_INTERFACECONTAINER_H_
+
+#include <stl/hash_map>
+#include <stl/functional>
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_EVENTOBJECT_HXX_
+#include <com/sun/star/lang/EventObject.hpp>
+#endif
+
+
+/** */ //for docpp
+namespace cppu
+{
+
+//===================================================================
+class OInterfaceContainerHelper;
+/**
+ * This is the iterator of a InterfaceContainerHelper. The iterator
+ * ist is not thread save. It is not allowed to assign or copy an
+ * instance of this class.
+ *
+ * @version 0.1
+ * @author Markus Meyer
+ * @since 03/12/98
+ * @see OInterfaceContainerHelper
+ */
+class OInterfaceIteratorHelper
+{
+public:
+ OInterfaceIteratorHelper();
+ /**
+ * Create an iterator over the elements of the container. The iterator
+ * copies the elements of the conatainer. A change to the container does not
+ * affect the iterator.<BR>
+ * Remark: The copy is on demand. The iterator copy the elements only if the container
+ * change the contens. It is not allowed to destroy the container if a iterator exist.
+ *
+ * @param rCont the container of the elements.
+ */
+ OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont );
+
+ /**
+ * Release the connection to the container.
+ */
+ ~OInterfaceIteratorHelper();
+
+ /** Return true, if there are more elements in the iterator. */
+ sal_Bool SAL_CALL hasMoreElements() const { return nRemain != 0; }
+ /** Return the next element of the iterator. Call this method if
+ * hasMoreElements return false, is an error.
+ */
+ ::com::sun::star::uno::XInterface * SAL_CALL next();
+
+private:
+ OInterfaceContainerHelper & rCont;
+ sal_Bool bIsList;
+ void * pData;
+ sal_Int32 nRemain;
+
+ OInterfaceIteratorHelper( const OInterfaceIteratorHelper & );
+ OInterfaceIteratorHelper & operator = ( const OInterfaceIteratorHelper & );
+};
+
+//===================================================================
+/**
+ * A container of interfaces. To access the elements use an iterator.
+ * This implementation is thread save.<BR>
+ * <B>Inserting null pointers is allowed, but is not tested and does not work.</B>
+ *
+ * @version 0.1
+ * @author Markus Meyer
+ * @since 03/12/98
+ * @see OInterfaceIteratorHelper
+ */
+class OInterfaceContainerHelper
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ /**
+ * Create an interface container. The internal representation
+ * is an array, so it is not effective to store a large number
+ * of elements.
+ *
+ * @param rMutex the mutex to protect multi thread access.
+ * The lifetime must be longer than the lifetime
+ * of this object.
+ */
+ OInterfaceContainerHelper( ::osl::Mutex & rMutex );
+ /**
+ * Release all interfaces. All iterators must be destroyed before
+ * the container.
+ */
+ ~OInterfaceContainerHelper();
+ /**
+ * Return the number of Elements in the container. Only usefull if you are acquire
+ * the mutex.
+ */
+ sal_Int32 SAL_CALL getLength() const;
+
+ /**
+ * Return all interfaces added to this container.
+ **/
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElements() const;
+
+ /**
+ * Insert an element in the container. The position is not specified.
+ * @param rxIFace the added interface. It is allowed to insert null or
+ * the same pointer more than once.
+ * @return the new count of elements in the container.
+ */
+ sal_Int32 SAL_CALL addInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace );
+ /**
+ * Remove an element from the container. It uses the equal definition of
+ * uno objects to remove the interfaces.
+ * @param rxIFace the removed interface.
+ * @return the new count of elements in the container.
+ */
+ sal_Int32 SAL_CALL removeInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace );
+ /**
+ * Call disposing on all object in the container that
+ * support XEventListener. Than clear the container.
+ */
+ void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt );
+ /**
+ * Remove all elements.
+ */
+ void SAL_CALL clear();
+
+private:
+friend class OInterfaceIteratorHelper;
+ /**
+ * bIsList == TRUE -> pData of type Sequence< XInterfaceSequence >,
+ * otherwise pData == of type (XEventListener *)
+ */
+ void * pData;
+ ::osl::Mutex & rMutex;
+ /** TRUE -> used by an iterator. */
+ sal_Bool bInUse;
+ /** TRUE -> pData is of type Sequence< XInterfaceSequence >. */
+ sal_Bool bIsList;
+
+ OInterfaceContainerHelper( const OInterfaceContainerHelper & );
+ OInterfaceContainerHelper & operator = ( const OInterfaceContainerHelper & );
+
+ /**
+ * Dulicate content of the conaitner and release the old one without destroing.
+ * The mutex must be locked and the memberbInUse must be true.
+ */
+ void copyAndResetInUse();
+public:
+};
+
+
+
+//===================================================================
+/**
+ * A generic class to support the implementation of the XConnectionPointContainer interface.
+ * This class holds a STL hash_map to acces the InterfaceContainerHelper through a generic
+ * key value.
+ * The InterfaceContainerHelper you get with the method getContainer( ... ) exist
+ * until the whole PropertyListenerContainer is destroyed.
+ *
+ * @author Markus Meyer
+ * @since 03/12/98
+ * @see OInterfaceIteratorHelper
+ * @see OInterfaceContainerHelper
+ */
+template< class key , class hashImpl , class equalImpl >
+class OMultiTypeInterfaceContainerHelperVar
+{
+public:
+ /**
+ * Create a container of interface containers.
+ *
+ * @param rMutex the mutex to protect multi thread access.
+ * The lifetime must be longer than the lifetime
+ * of this object.
+ */
+ inline OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & );
+ /**
+ * Delete all containers.
+ */
+ inline ~OMultiTypeInterfaceContainerHelperVar();
+
+ /**
+ * Return all id's under which at least one interface is added.
+ */
+ inline ::com::sun::star::uno::Sequence< key > SAL_CALL getContainedTypes() const;
+
+ /**
+ * Return the container created under this key.
+ * @return the container created under this key. If the container
+ * was not created, null was returned.
+ */
+ inline OInterfaceContainerHelper * SAL_CALL getContainer( const key & ) const;
+
+ /**
+ * Insert an element in the container specified with the key. The position is not specified.
+ * @param rKey the id of the container.
+ * @param rxIFace the added interface. It is allowed to insert null or
+ * the same pointer more than once.
+ * @return the new count of elements in the container.
+ */
+ inline sal_Int32 SAL_CALL addInterface(
+ const key & rKey, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r );
+
+ /**
+ * Remove an element from the container specified with the key.
+ * It uses the equal definition of uno objects to remove the interfaces.
+ * @param rKey the id of the container.
+ * @param rxIFace the removed interface.
+ * @return the new count of elements in the container.
+ */
+ inline sal_Int32 SAL_CALL removeInterface(
+ const key & rKey, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace );
+
+ /**
+ * Call disposing on all object in the container that
+ * support XEventListener. Than clear the container.
+ */
+ inline void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt );
+ /**
+ * Remove all elements of all containers. Does not delete the container.
+ */
+ inline void SAL_CALL clear();
+
+private:
+ ::std::hash_map< key , void* , hashImpl , equalImpl > *m_pMap;
+ ::osl::Mutex & rMutex;
+
+ inline OMultiTypeInterfaceContainerHelperVar( const OMultiTypeInterfaceContainerHelperVar & );
+ inline OMultiTypeInterfaceContainerHelperVar & operator = ( const OMultiTypeInterfaceContainerHelperVar & );
+};
+
+
+
+
+/**
+ * This struct contain the standard variables of a broadcaster. Helper
+ * classes only know a reference to this struct instead of references
+ * to the four members. The access to the members must be guarded with
+ * rMutex.
+ *
+ * @author Markus Meyer
+ * @since 03/12/98
+ */
+template < class container >
+struct OBroadcastHelperVar
+{
+ /** The shared mutex. */
+ ::osl::Mutex & rMutex;
+ /** ListenerContainer class is thread save. */
+ container aLC;
+ /** Dispose call ready. */
+ sal_Bool bDisposed;
+ /** In dispose call. */
+ sal_Bool bInDispose;
+
+ /**
+ * Initialize the structur. bDispose and bInDispose are set to false.
+ * @param rMutex the mutex reference.
+ */
+ OBroadcastHelperVar( ::osl::Mutex & rMutex_ )
+ : rMutex( rMutex_ )
+ , aLC( rMutex_ )
+ , bDisposed( sal_False )
+ , bInDispose( sal_False )
+ {}
+};
+
+/*------------------------------------------
+*
+* In general, the above templates are used with a Type as key.
+* Therefore a default declaration is given ( OMultiTypeInterfaceContainerHelper and OBroadcastHelper )
+*
+*------------------------------------------*/
+
+// helper function call class
+struct hashType_Impl
+{
+ size_t operator()(const ::com::sun::star::uno::Type & s) const
+ { return s.getTypeName().hashCode(); }
+};
+
+
+typedef OMultiTypeInterfaceContainerHelperVar<
+ ::com::sun::star::uno::Type,
+ hashType_Impl,
+ std::equal_to< ::com::sun::star::uno::Type > > OMultiTypeInterfaceContainerHelper;
+
+typedef OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper > OBroadcastHelper;
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.hxx b/cppuhelper/inc/cppuhelper/interfacecontainer.hxx
new file mode 100644
index 000000000000..680407ac070a
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.hxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * $RCSfile: interfacecontainer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#define _CPPUHELPER_INTERFACECONTAINER_HXX_
+
+#include <cppuhelper/interfacecontainer.h>
+
+
+#define CONT_HASHMAP ::std::hash_map< key , void* , hashImpl , equalImpl >
+
+namespace cppu
+{
+
+template< class key , class hashImpl , class equalImpl >
+inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & rMutex_ )
+ : rMutex( rMutex_ )
+{
+ m_pMap = new CONT_HASHMAP;
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::~OMultiTypeInterfaceContainerHelperVar()
+{
+ CONT_HASHMAP::iterator iter = m_pMap->begin();
+ CONT_HASHMAP::iterator end = m_pMap->end();
+
+ while( iter != end )
+ {
+ delete (OInterfaceContainerHelper*)(*iter).second;
+ (*iter).second = 0;
+ ++iter;
+ }
+ delete m_pMap;
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+inline ::com::sun::star::uno::Sequence< key > OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainedTypes() const
+{
+ CONT_HASHMAP::size_type nSize;
+
+ ::osl::MutexGuard aGuard( rMutex );
+ if( nSize = m_pMap->size() )
+ {
+ ::com::sun::star::uno::Sequence< key > aInterfaceTypes( nSize );
+ key * pArray = aInterfaceTypes.getArray();
+
+ CONT_HASHMAP::iterator iter = m_pMap->begin();
+ CONT_HASHMAP::iterator end = m_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( i != nSize ) {
+ // may be empty container, reduce the sequence to the right size
+ aInterfaceTypes = ::com::sun::star::uno::Sequence<key>( pArray, i );
+ }
+ return aInterfaceTypes;
+ }
+ return ::com::sun::star::uno::Sequence<key>();
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainer
+(
+ const key & rKey
+) const
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ CONT_HASHMAP::iterator iter = m_pMap->find( rKey );
+ if( iter != m_pMap->end() )
+ return (OInterfaceContainerHelper*) (*iter).second;
+ return 0;
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::addInterface
+(
+ const key & rKey,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener
+)
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ CONT_HASHMAP::iterator
+ iter = m_pMap->find( rKey );
+ if( iter == m_pMap->end() )
+ {
+ OInterfaceContainerHelper * pLC = new OInterfaceContainerHelper( rMutex );
+ (*m_pMap)[rKey] = pLC;
+ return pLC->addInterface( rListener );
+ }
+ else
+ return ((OInterfaceContainerHelper*)(*iter).second)->addInterface( rListener );
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+inline sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::removeInterface
+(
+ const key & rKey,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener
+)
+{
+ ::osl::MutexGuard aGuard( rMutex );
+
+ // search container with id nUik
+ CONT_HASHMAP::iterator iter = m_pMap->find( rKey );
+ // container found?
+ if( iter != m_pMap->end() )
+ return ((OInterfaceContainerHelper*)(*iter).second)->removeInterface( rListener );
+
+ // no container with this id. Always return 0
+ return 0;
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt )
+{
+ CONT_HASHMAP::size_type nSize = 0;
+ OInterfaceContainerHelper ** ppListenerContainers = NULL;
+ {
+ ::osl::MutexGuard aGuard( rMutex );
+ if( nSize = m_pMap->size() )
+ {
+ typedef OInterfaceContainerHelper* ppp;
+ ppListenerContainers = new ppp[nSize];
+ //ppListenerContainers = new (ListenerContainer*)[nSize];
+
+ CONT_HASHMAP::iterator iter = m_pMap->begin();
+ CONT_HASHMAP::iterator end = m_pMap->end();
+
+ CONT_HASHMAP::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( CONT_HASHMAP::size_type i = 0;
+ i < nSize; i++ )
+ {
+ if( ppListenerContainers[i] )
+ ppListenerContainers[i]->disposeAndClear( rEvt );
+ }
+
+ delete [] ppListenerContainers;
+}
+
+//===================================================================
+template< class key , class hashImpl , class equalImpl >
+void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::clear()
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ CONT_HASHMAP::iterator iter = m_pMap->begin();
+ CONT_HASHMAP::iterator end = m_pMap->end();
+
+ while( iter != end )
+ {
+ ((OInterfaceContainerHelper*)(*iter)).second->clear();
+ ++iter;
+ }
+}
+
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
new file mode 100644
index 000000000000..bf4449f94ca1
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -0,0 +1,479 @@
+/*************************************************************************
+ *
+ * $RCSfile: propshlp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_PROPSHLP_HXX
+#define _CPPUHELPER_PROPSHLP_HXX
+
+#include <rtl/alloc.h>
+
+#include <stl/hash_map>
+
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+
+namespace cppu
+{
+
+
+/*************************************************************************
+*************************************************************************/
+
+
+/**
+ * This interface is used by the OPropertyHelper, to access the property description.
+ */
+class IPropertyArrayHelper
+{
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ /**
+ * Folowing the rule, the first virtual method impies the virtual destructor.
+ */
+ virtual ~IPropertyArrayHelper();
+
+ /**
+ * Return the property members Name and Attribute from the handle nHandle.
+ * @param nHandle the handle of a property. If the values of the handles
+ * are sorted in the same way as the names and the highest handle value
+ * is getCount() -1, than it must be an indexed acces to the property array.
+ * @param pPropName is an out parameter filled with property name of the property with the
+ * handle nHandle. May be NULL.
+ * @param rAttributes is an out parameter filled with attributes of the property with the
+ * handle nHandle. May be NULL.
+ * @return True, if the handle exist, otherwise false.
+ */
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
+ ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
+ /**
+ * Return the sequence of properties. The sequence is sorted by name.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
+ /**
+ * Return the property with the name rPropertyName.
+ * @param rPropertyName the name of the property.
+ * @exception UnknownPropertyException thrown if the property name is unknown.
+ */
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
+ const ::rtl::OUString& rPropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException) = 0;
+ /**
+ * Return true if the property with the name rPropertyName exist, otherwise false.
+ * @param rPropertyName the name of the property.
+ */
+ virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
+ /**
+ * Return the handle of the property with the name rPropertyName.
+ * If the property does not exist -1 is returned.
+ * @param rPropertyName the name of the property.
+ */
+ virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
+ /**
+ * Fill the array with the handles of the properties.
+ * @return the handles of the names from the pHandles array. -1
+ * indicates an unknown property name.
+ */
+ virtual sal_Int32 SAL_CALL fillHandles(
+ /*out*/ sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
+};
+
+/**
+ * You can use this helper class to map a XPropertySet-Interface to a XFast-
+ * or a XMultiPropertySet interface.
+ */
+class OPropertyArrayHelper : public IPropertyArrayHelper
+{
+public:
+ /*********
+ * Create an object which supports the common property interfaces.
+ *
+ * @param pProps array of properties
+ * The array pProps should be sorted.
+ * @param nElements is the number of properties in the pProps structure.
+ * @param bSorted indicates that the elements are sorted.
+ *********/
+ OPropertyArrayHelper( ::com::sun::star::beans::Property *pProps,
+ sal_Int32 nElements ,
+ sal_Bool bSorted = sal_True );
+
+ /*********
+ * Create an object which supports the common property interfaces.
+ * @param aProps sequence of properties which are supported by this helper.
+ * The sequence aProps should be sorted.
+ * @param bSorted indicates that the elements are sorted.
+ *********/
+ OPropertyArrayHelper( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
+ sal_Bool bSorted = sal_True );
+ /**
+ * Return the number of properties.
+ */
+ sal_Int32 SAL_CALL getCount() const;
+ /**
+ * Return the property members Name and Attribute from the handle nHandle.
+ * @param nHandle the handle of a property. If the values of the handles
+ * are sorted in the same way as the names and the highest handle value
+ * is getCount() -1, than it is only an indexed acces to the property array.
+ * Otherwise it is a linear search through the array.
+ * @param pPropName is an out parameter filled with property name of the property with the
+ * handle nHandle. May be NULL.
+ * @param rAttributes is an out parameter filled with attributes of the property with the
+ * handle nHandle. May be NULL.
+ * @return True, if the handle exist, otherwise false.
+ */
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
+ ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
+ /**
+ * Return the sequence of properties. The sequence is sorted by name.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void);
+ /**
+ * Return the property with the name rPropertyName.
+ * @param rPropertyName the name of the property.
+ * @exception UnknownPropertyException thrown if the property name is unknown.
+ */
+ ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString& rPropertyName)
+ throw (::com::sun::star::beans::UnknownPropertyException);
+ /**
+ * Return true if the property with the name rPropertyName exist, otherwise false.
+ * @param rPropertyName the name of the property.
+ */
+ sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
+ /**
+ * Return the handle of the property with the name rPropertyName.
+ * If the property does not exist -1 is returned.
+ * @param rPropertyName the name of the property.
+ */
+ sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
+ /**
+ * Fill the array with the handles of the properties.
+ * @return the handles of the names from the pHandles array. -1
+ * indicates an unknown property name.
+ */
+ sal_Int32 SAL_CALL fillHandles(
+ /*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
+private:
+ void init( sal_Bool bSorted );
+
+ /** The sequence generstet from the pProperties array. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aInfos;
+ /**
+ * True, If the values of the handles are sorted in the same way as the names
+ * and the highest handle value is getCount() -1, otherwise false.
+ */
+ sal_Bool bRightOrdered;
+};
+
+
+/**
+ * This abstract class map the methods of the interfaces XMultiPropertySet, XFastPropertySet
+ * and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
+ * setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must subclass
+ * this one and overload the methods.<BR>
+ * It provide a standard implementation of the XPropertySetInfo.<BR>
+ * The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.<BR>
+ * The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
+ * in the rBHelper.aLC structure. So it is possible to advise property listeners with
+ * the connection point interfaces. But only listeners that listen to all property changes.
+ * The subclass must explicite allow the access through the XConnectionPoint interface.<BR>
+ * <B>Not tested under MT conditions</B>
+ *
+ * @see OConnectionPointContainerHelper
+ * @see createPropertySetInfo
+ * @author Markus Meyer
+ * @since 12/04/98
+ */
+
+
+
+//-----------------------------------------------------------------------------
+// helper defines needed for an interface container with a 32 bit key values
+
+struct equalInt32_Impl
+{
+ bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const
+ { return i1 == i2; }
+};
+
+
+struct hashInt32_Impl
+{
+ size_t operator()(const sal_Int32 & i) const
+ { return i; }
+};
+typedef OMultiTypeInterfaceContainerHelperVar< sal_Int32, hashInt32_Impl, equalInt32_Impl >
+ OMultiTypeInterfaceContainerHelperInt32;
+
+
+class OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
+ public ::com::sun::star::beans::XFastPropertySet,
+ public ::com::sun::star::beans::XPropertySet
+{
+public:
+ /**
+ * Create empty property listener container and hold the helper structure.
+ *
+ * @param rBHelper this structure containes the basic members of
+ * a broadcaster.
+ * The lifetime must be longer as the lifetime
+ * of this object. Stored in the variable rBHelper.
+ */
+ OPropertySetHelper( OBroadcastHelper & rBHelper );
+ /**
+ * You must call disposing before destruction.
+ */
+ ~OPropertySetHelper();
+
+ /**
+ * Only return a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
+ * XEventListener.
+ * <B>Do not return a reference to XInterface.</B>
+ */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType );
+
+ /**
+ * Send a disposing notification to the listeners in the conatiners aBoundLC
+ * and aVetoableLC.
+ *
+ * @see OComponentHelper
+ */
+ void SAL_CALL disposing();
+
+ // XPropertySet
+ //XPropertySetInfoRef getPropertySetInfo() const;
+ /**
+ * Throw UnknownPropertyException or PropertyVetoException if the property with the name
+ * rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
+ * value and setFastPropertyValue is called.
+ */
+ void SAL_CALL setPropertyValue(const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue);
+ /**
+ * Throw UnknownPropertyException if the property with the name
+ * rPropertyName does not exist.
+ */
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName);
+ /** Ignored if the property is not bound. */
+ void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ /** Ignored if the property is not bound. */
+ void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ /** Ignored if the property is not constrained. */
+ void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ /** Ignored if the property is not constrained. */
+ void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ /**
+ * Throw UnknownPropertyException or PropertyVetoException if the property with the name
+ * rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
+ * is called, than the vetoable listeners are notified. After this the value of the property
+ * is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
+ * notified.
+ */
+ void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::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);
+
+ /**
+ * Throw UnknownPropertyException if the property with the handle
+ * nHandle does not exist.
+ */
+ ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ void SAL_CALL setPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames );
+
+ void SAL_CALL addPropertiesChangeListener(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener );
+
+ void SAL_CALL removePropertiesChangeListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener );
+ void SAL_CALL firePropertiesChangeEvent(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener );
+ /**
+ * The property sequence is create in the call. The interface isn't used after the call.
+ */
+ static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL createPropertySetInfo( IPropertyArrayHelper & rProperties );
+protected:
+ /**
+ * This method fire events to all registered property listeners.
+ * @param pnHandles the id's of the properties that changed.
+ * @param pNewValues the new values of the properties.
+ * @param pOldValues the old values of the properties.
+ * @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
+ * @param bVetoable true means fire to VetoableChangeListener, false means fire to
+ * XPropertyChangedListener and XMultiPropertyChangedListener.
+ */
+ void SAL_CALL fire( sal_Int32 * pnHandles,
+ const ::com::sun::star::uno::Any * pNewValues,
+ const ::com::sun::star::uno::Any * pOldValues,
+ sal_Int32 nCount,
+ sal_Bool bVetoable );
+
+ /**
+ * Set multible properties with the handles.
+ * @param nSeqLen the length of the arrays pHandles and Values.
+ * @param pHandles the handles of the properties. The number of elements
+ * in the Values sequence is the length of the handle array. A value of -1
+ * of a handle means invalid property. These are ignored.
+ * @param pValues the values of the properties.
+ * @param nHitCount the number of valid entries in the handle array.
+ */
+ void SAL_CALL setFastPropertyValues( sal_Int32 nSeqLen,
+ sal_Int32 * pHandles,
+ const ::com::sun::star::uno::Any * pValues,
+ sal_Int32 nHitCount )
+ throw (::com::sun::star::uno::Exception);
+
+ /**
+ * This abstract method must return the name to index table. This table contains all property
+ * names and types of this object. The method is not implemented in this class.
+ */
+ virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
+
+ /**
+ * Converted the value rValue and return the result in rConvertedValue and the
+ * old value in rOldValue. A IllegalArgumentException is thrown.
+ * The method is not implemented in this class. After this call the vetoable
+ * listeners are notified.
+ *
+ * @param rConvertedValue the converted value. Only set if return is true.
+ * @param rOldValue the old value. Only set if return is true.
+ * @param nHandle the handle of the proberty.
+ * @return true if the value converted.
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException) = 0;
+ /**
+ * The same as setFastProperyValue, but no exception is thrown and nHandle
+ * is always valid. You must not broadcast the changes in this method.<BR>
+ * <B>You type is correct you need't test it.</B>
+ * The method is not implemented in this class.
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception) = 0;
+ /**
+ * The same as getFastProperyValue, but return the value through rValue and nHandle
+ * is always valid.
+ * The method is not implemented in this class.
+ */
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle ) const = 0;
+
+ /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
+ OBroadcastHelper &rBHelper;
+ /**
+ * Container for the XProperyChangedListener. The listeners are inserted by handle.<BR>
+ * Listeners added without name are inserted in the rBHelper.aLC container under
+ * the Uik XPropertyChangeListener::getSmartUik().
+ */
+ OMultiTypeInterfaceContainerHelperInt32 aBoundLC;
+ /**
+ * Container for the XPropertyVetoableListener. The listeners are inserted by handle.
+ * Listeners added without name are inserted in the rBHelper.aLC container under
+ * the Uik XVetoableChangeListener::getSmartUik().
+ */
+ OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
+private:
+ OPropertySetHelper( const OPropertySetHelper & );
+ OPropertySetHelper & operator = ( const OPropertySetHelper & );
+};
+
+} // end namespace cppuhelper
+#endif //
+
+
+
diff --git a/cppuhelper/inc/cppuhelper/proptypehlp.h b/cppuhelper/inc/cppuhelper/proptypehlp.h
new file mode 100644
index 000000000000..3592932c34e7
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/proptypehlp.h
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: proptypehlp.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_PROPTYPEHLP_H
+#define _CPPUHELPER_PROPTYPEHLP_H
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/TypeClass.hpp>
+
+
+namespace cppu {
+
+/**
+ * Convert a property value to the specified type of the property.
+ * Look at the XPropertySet interface about the conversion rules.<BR>
+ *
+ * If a property could not be converted a IllegalArgumentException is thrown.
+ *
+ */
+
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , const ::com::sun::star::uno::Any & a);
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+// This template is needed at least for msci4 compiler
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , ::com::sun::star::uno::Any & a);
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+/****
+*
+* conversion of basic types
+*
+*****/
+inline void SAL_CALL convertPropertyValue( sal_Int64 & target , const ::com::sun::star::uno::Any & source )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_uInt64 & target, const ::com::sun::star::uno::Any & source )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_Int32 & target , const ::com::sun::star::uno::Any & source )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_uInt32 & target, const ::com::sun::star::uno::Any & source )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_Int16 & target , const ::com::sun::star::uno::Any & source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_uInt16 & target, const ::com::sun::star::uno::Any & source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( sal_Int8 & target , const ::com::sun::star::uno::Any & source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( float & target , const ::com::sun::star::uno::Any & source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( double &target , const ::com::sun::star::uno::Any &source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+inline void SAL_CALL convertPropertyValue( ::rtl::OUString &target , const ::com::sun::star::uno::Any &source )
+ throw( ::com::sun::star::lang::IllegalArgumentException);
+
+} // end namespace cppu
+
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/proptypehlp.hxx b/cppuhelper/inc/cppuhelper/proptypehlp.hxx
new file mode 100644
index 000000000000..174b4a081a89
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/proptypehlp.hxx
@@ -0,0 +1,556 @@
+/*************************************************************************
+ *
+ * $RCSfile: proptypehlp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_PROPTYPEHLP_HXX
+#define _CPPUHELPER_PROPTYPEHLP_HXX
+
+#include <cppuhelper/proptypehlp.h>
+
+namespace cppu
+{
+
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , const ::com::sun::star::uno::Any & a)
+{
+// any sense ?
+// const ::com::sun::star::uno::Type &t = ::getCppuType( &value );
+// enum TypeClass tc = t.getTypeClass();
+
+ if( !( a >>= value ) ) {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+
+// This template is needed at least for msci4 compiler
+template < class target >
+inline void SAL_CALL convertPropertyValue( target &value , ::com::sun::star::uno::Any & a)
+{
+ convertPropertyValue( value , (const ::com::sun::star::uno::Any & ) a );
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Bool & b , const ::com::sun::star::uno::Any & a )
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ b = ( sal_Bool )i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c = *(sal_Unicode*) a.getValue();
+ b = ( sal_Bool ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ b = ( sal_Bool ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ b = *((sal_Bool*)a.getValue());
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ b = ( sal_Bool ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ b = ( sal_Bool ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ b = ( sal_Bool ) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int64 & i , const ::com::sun::star::uno::Any & a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
+ a >>= i;
+ }
+ else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
+ sal_uInt64 i64;
+ a >>= i64;
+ i = ( sal_Int64 ) i64;
+ }
+ else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ i = ( sal_Int64 )i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode *)a.getValue();
+ i = ( sal_Int64 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ i = ( sal_Int64 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_Int64 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_Int64 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ i = ( sal_Int64 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ i = ( sal_Int64 ) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+
+inline void SAL_CALL convertPropertyValue( sal_uInt64 & i , const ::com::sun::star::uno::Any & a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
+ a >>= i;
+ }
+ if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
+ sal_Int64 i64;
+ a >>= i64;
+ i = ( sal_uInt64 ) i64;
+ }
+ else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ i = ( sal_uInt64 )i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *( sal_Unicode * ) a.getValue() ;
+ i = ( sal_uInt64 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ i = ( sal_uInt64 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_uInt64 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_uInt64 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ i = ( sal_uInt64 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ i = ( sal_uInt64 ) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+// the basic types
+// sal_Int32
+inline void SAL_CALL convertPropertyValue( sal_Int32 & i , const ::com::sun::star::uno::Any & a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ a >>= i;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode*) a.getValue();
+ i = ( sal_Int32 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ i = ( sal_Int32 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_Int32 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_Int32 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ i = ( sal_Int32 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ i = ( sal_Int32 ) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_uInt32 & i , const ::com::sun::star::uno::Any & a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ a >>= i;
+ }
+ else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ i = (sal_uInt32 ) i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode*) a.getValue();
+ i = ( sal_uInt32 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ i = ( sal_uInt32 ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_uInt32 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_uInt32 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ i = ( sal_uInt32 ) i16;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+
+inline void SAL_CALL convertPropertyValue( sal_Int16 & i , const ::com::sun::star::uno::Any & a )
+ throw( ::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ a >>= i;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode*) a.getValue();
+ i = ( sal_Int16 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_Int16 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_Int16 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ i = ( sal_Int16 ) i16;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_uInt16 & i , const ::com::sun::star::uno::Any & a )
+ throw( ::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ a >>= i;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode *) a.getValue();
+ i = ( sal_Int16 ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_Int16 ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ i = ( sal_Int16 ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ i = ( sal_Int16 ) i16;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( sal_Int8 & i , const ::com::sun::star::uno::Any & a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ a >>= i;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ i = ( sal_Int8 ) b;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( float &f , const ::com::sun::star::uno::Any &a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
+ a >>= f;
+ }
+ else if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
+ double d;
+ a >>= d;
+ f = ( float ) d;
+ }
+ else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
+ sal_Int64 i64;
+ a >>= i64;
+ f = ( float ) i64;
+ }
+ // msci 4 does not support this conversion
+/* else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
+ sal_uInt64 i64;
+ a >>= i64;
+ f = ( float ) i64;
+ }
+*/ else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ f = ( float )i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode*) a.getValue();
+ f = ( float ) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ f = ( float ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ f = ( float ) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ f = ( float ) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ f = ( float ) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ f = ( float ) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+
+inline void SAL_CALL convertPropertyValue( double &d , const ::com::sun::star::uno::Any &a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ const enum ::com::sun::star::uno::TypeClass tc = a.getValueType().getTypeClass();
+
+ if( ::com::sun::star::uno::TypeClass_DOUBLE == tc ) {
+ float f;
+ a >>= f;
+ d = ( double ) f;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_FLOAT == tc ) {
+ float f;
+ a >>= f;
+ d = (double) f;
+ }
+ else if( ::com::sun::star::uno::TypeClass_HYPER == tc ) {
+ sal_Int64 i64;
+ a >>= i64;
+ d = (double) i64;
+ }
+ // msci 4 does not support this
+/* else if( ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER == tc ) {
+ sal_uInt64 i64;
+ a >>= i64;
+ d = (double) i64;
+ }
+*/ else if( ::com::sun::star::uno::TypeClass_LONG == tc ) {
+ sal_Int32 i32;
+ a >>= i32;
+ d = (double)i32;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_CHAR == tc ) {
+ sal_Unicode c;
+ c = *(sal_Unicode*) a.getValue();
+ d = (double) c;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_SHORT == tc ) {
+ sal_Int16 i16;
+ a >>= i16;
+ d = (double) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BOOLEAN == tc ) {
+ sal_Bool b;
+ b = *((sal_Bool * )a.getValue());
+ d = (double) b;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_BYTE == tc ) {
+ sal_Int8 i8;
+ a >>= i8;
+ d = (double) i8;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT == tc ) {
+ sal_uInt16 i16;
+ a >>= i16;
+ d = (double) i16;
+ }
+ else if ( ::com::sun::star::uno::TypeClass_UNSIGNED_LONG == tc ) {
+ sal_uInt32 i32;
+ a >>= i32;
+ d = (double) i32;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+inline void SAL_CALL convertPropertyValue( ::rtl::OUString &ow , const ::com::sun::star::uno::Any &a )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ if( ::com::sun::star::uno::TypeClass_STRING == a.getValueType().getTypeClass() ) {
+ a >>= ow;
+ }
+ else {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+}
+
+} // end namespace cppu
+
+#endif
+
+
diff --git a/cppuhelper/inc/cppuhelper/queryinterface.hxx b/cppuhelper/inc/cppuhelper/queryinterface.hxx
new file mode 100644
index 000000000000..67272aa33c4a
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/queryinterface.hxx
@@ -0,0 +1,487 @@
+/*************************************************************************
+ *
+ * $RCSfile: queryinterface.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#define _CPPUHELPER_QUERYINTERFACE_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+
+/** */ //for docpp
+namespace cppu
+{
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ */
+template< class Interface1 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ */
+template< class Interface1, class Interface2 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *)0 ))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *)0 ))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *)0 ))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *)0 ))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *)0 ))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface10 > *)0 ))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *)0 ))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *)0 ))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface10 > *)0 ))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface11 > *)0 ))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Compare types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ * @param p12 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11, class Interface12 >
+inline ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11, Interface12 * p12 )
+{
+ if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *)0 ))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *)0 ))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *)0 ))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *)0 ))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *)0 ))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *)0 ))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *)0 ))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *)0 ))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *)0 ))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface10 > *)0 ))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface11 > *)0 ))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else if (rType == ::getCppuType( (::com::sun::star::uno::Reference< Interface12 > *)0 ))
+ return ::com::sun::star::uno::Any( &p12, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+}
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/servicefactory.hxx b/cppuhelper/inc/cppuhelper/servicefactory.hxx
new file mode 100644
index 000000000000..c24b0dbe7534
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/servicefactory.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: servicefactory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ * This bootstraps an initial service factory up to the point
+ * that a dll component loader, simple and default registry and an implementation registration
+ * service is registered and available.
+ * All other services have to be registered somewhere else.
+ */
+
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#define _CPPUHELPER_SERVICEFACTORY_HXX_
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+
+namespace cppu
+{
+
+/**
+ * This bootstraps an initial service factory working on a registry. If the first or both
+ * parameters contain a value then the service factory is initialized with a simple registry
+ * or a nested registry. Otherwise the service factory must be initialized later with a valid
+ * registry.
+ *<BR>
+ * @param rWriteRegistryFile file name of the simple registry or the first registry file of
+ * the nested registry which will be opened with read/write rights. This
+ * file will be created if necessary.
+ * @param rReadRegistryFile file name of the second registry file of the nested registry
+ * which will be opened with readonly rights.
+ * @param bReadOnly flag which specify that the first registry file will be opened with
+ * readonly rights. Default is FALSE. If this flag is used the registry
+ * will not be created if not exist.
+ * @param rBootstrapPath specify a path where the bootstrap components could be find. If this
+ * parameter is an empty string the compoents will be searched in the normal
+ * path.
+ *
+ * @author Daniel Boelzle
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL
+ createRegistryServiceFactory( const ::rtl::OUString & rWriteRegistryFile,
+ const ::rtl::OUString & rReadRegistryFile,
+ sal_Bool bReadOnly = sal_False,
+ const ::rtl::OUString & rBootstrapPath = ::rtl::OUString() )
+ throw( ::com::sun::star::uno::Exception );
+
+
+/**
+ * This bootstraps an initial service factory working on a registry file.
+ *<BR>
+ * @param rRegistryFile file name of the registry to use/ create; if this is an empty
+ * string, the default registry is used instead
+ * @param bReadOnly flag which specify that the registry file will be opened with
+ * readonly rights. Default is FALSE. If this flag is used the registry
+ * will not be created if not exist.
+ *
+ * @author Daniel Boelzle
+ */
+inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL
+ createRegistryServiceFactory( const ::rtl::OUString & rRegistryFile,
+ sal_Bool bReadOnly = sal_False,
+ const ::rtl::OUString & rBootstrapPath = ::rtl::OUString() )
+ throw( ::com::sun::star::uno::Exception )
+{
+ return ::cppu::createRegistryServiceFactory( rRegistryFile, ::rtl::OUString(), bReadOnly, rBootstrapPath );
+}
+
+
+/**
+ * This bootstraps a service factory without initilaize a registry.
+ *<BR>
+ * @author Daniel Boelzle
+ */
+inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL
+ createServiceFactory(const ::rtl::OUString & rBootstrapPath = ::rtl::OUString())
+ throw( ::com::sun::star::uno::Exception )
+{
+ return ::cppu::createRegistryServiceFactory( ::rtl::OUString(), ::rtl::OUString(), sal_False, rBootstrapPath );
+}
+
+} // end namespace cppu
+
+#endif
+
diff --git a/cppuhelper/inc/cppuhelper/stdidlclass.hxx b/cppuhelper/inc/cppuhelper/stdidlclass.hxx
new file mode 100644
index 000000000000..b0a7ffc30593
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/stdidlclass.hxx
@@ -0,0 +1,554 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdidlclass.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_STDIDLCLASS_HXX_
+#define _CPPUHELPER_STDIDLCLASS_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/reflection/XIdlClass.hpp>
+
+
+namespace cppu {
+
+/*****
+*
+* Standardfunction to create a XIdlClass for a component.
+* This method is usually used as a helper class. ( Better use the methods below ).
+*
+* HACK : Function returns pointer to XIdlClass instead of
+* a reference. This is because of a MSC 4.x bug.
+*
+******/
+::com::sun::star::reflection::XIdlClass * SAL_CALL createStandardClassWithSequence(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr ,
+ const ::rtl::OUString & sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > & rSuperClass,
+ const ::com::sun::star::uno::Sequence < ::rtl::OUString > &seq );
+
+
+
+/*--------------------------------------------------
+* Standardfunction to create an XIdlClass for a component. There is a function for each number of supported
+* interfaces up to 10.
+*
+* HACK : Function returns pointer to XIdlClass instead of
+* a reference. This is because of a MSC 4.x bug.
+*
+* Sample use for an XIdlClassProvider :
+*
+* // XIdlClassProvider
+*Sequence< Reference < XIdlClass > > SAL_CALL MyComponent::getIdlClasses(void)
+*{
+* // 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 , // Servicemanager
+* L"com.sun.star.comp.cppuhelper.OStdIdlClass" , // ImplementationName
+* Reference < XIdlClass > () , // Base classes
+* STATIC_CAST(XIdlClassProvider *, this), // Supported Interfaces
+* STATIC_CAST(XServiceInfo *, this ) ,
+* STATIC_CAST(XMyService * , this )
+* // ....
+* );
+*
+* // store reference for later use
+* weakRef = r;
+* }
+*
+* return Sequence < Reference < XIdlClass > > ( &r , 1 );
+*}
+*
+*--------------------------------------------------*/
+template < class Interface1 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(1);
+ seqInterface.getArray()[0] =
+ ::getCppuType( ( ::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+template < class Interface1, class Interface2 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(2);
+ seqInterface.getArray()[0] =
+ ::getCppuType( ( ::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( ( ::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+
+template < class Interface1, class Interface2 , class Interface3 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(3);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+
+template < class Interface1, class Interface2 , class Interface3 , class Interface4 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(4);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+
+
+
+template < class Interface1, class Interface2 , class Interface3 , class Interface4 , class Interface5 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(5);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+template < class Interface1, class Interface2 , class Interface3 , class Interface4 , class Interface5 ,
+ class Interface6 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5 ,
+ const Interface6 *p6
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(6);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[5] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+
+template < class Interface1, class Interface2 , class Interface3 , class Interface4 , class Interface5 ,
+ class Interface6, class Interface7 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5 ,
+ const Interface6 *p6 ,
+ const Interface7 *p7
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(7);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[5] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[6] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+
+
+template < class Interface1, class Interface2, class Interface3 , class Interface4 , class Interface5 ,
+ class Interface6, class Interface7, class Interface8 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5 ,
+ const Interface6 *p6 ,
+ const Interface7 *p7 ,
+ const Interface8 *p8
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(8);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[5] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[6] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[7] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+
+
+template < class Interface1, class Interface2, class Interface3 , class Interface4 , class Interface5 ,
+ class Interface6, class Interface7, class Interface8 , class Interface9 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5 ,
+ const Interface6 *p6 ,
+ const Interface7 *p7 ,
+ const Interface8 *p8 ,
+ const Interface9 *p9
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(9);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[5] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[6] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[7] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[8] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+
+template < class Interface1, class Interface2, class Interface3 , class Interface4 , class Interface5 ,
+ class Interface6, class Interface7, class Interface8 , class Interface9 , class Interface10 >
+inline ::com::sun::star::reflection::XIdlClass * SAL_CALL
+//inline ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass >
+createStandardClass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &rSMgr,
+ const ::rtl::OUString &sImplementationName ,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::reflection::XIdlClass > &rSuperClass ,
+ const Interface1 *p1 ,
+ const Interface2 *p2 ,
+ const Interface3 *p3 ,
+ const Interface4 *p4 ,
+ const Interface5 *p5 ,
+ const Interface6 *p6 ,
+ const Interface7 *p7 ,
+ const Interface8 *p8 ,
+ const Interface9 *p9 ,
+ const Interface10 *p10
+ )
+{
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > seqInterface(10);
+ seqInterface.getArray()[0] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface1 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[1] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface2 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[2] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface3 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[3] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface4 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[4] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface5 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[5] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface6 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[6] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface7 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[7] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface8 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[8] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface9 > *) 0 ).getTypeName();
+
+ seqInterface.getArray()[9] =
+ ::getCppuType( (::com::sun::star::uno::Reference< Interface10 > *) 0 ).getTypeName();
+
+ return createStandardClassWithSequence(
+ rSMgr,
+ sImplementationName,
+ rSuperClass,
+ seqInterface
+ );
+}
+
+} // end namespace cppu
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/typeprovider.hxx b/cppuhelper/inc/cppuhelper/typeprovider.hxx
new file mode 100644
index 000000000000..b330363cd33f
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/typeprovider.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: typeprovider.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#define _CPPUHELPER_TYPEPROVIDER_HXX_
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+
+namespace cppu
+{
+
+//==================================================================================================
+class OTypeCollection
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > _aTypes;
+
+public:
+ OTypeCollection( const OTypeCollection & rCollection )
+ : _aTypes( rCollection._aTypes )
+ {}
+
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Type & rType8,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Type & rType8,
+ const ::com::sun::star::uno::Type & rType9,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Type & rType8,
+ const ::com::sun::star::uno::Type & rType9,
+ const ::com::sun::star::uno::Type & rType10,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Type & rType8,
+ const ::com::sun::star::uno::Type & rType9,
+ const ::com::sun::star::uno::Type & rType10,
+ const ::com::sun::star::uno::Type & rType11,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+ OTypeCollection(
+ const ::com::sun::star::uno::Type & rType1,
+ const ::com::sun::star::uno::Type & rType2,
+ const ::com::sun::star::uno::Type & rType3,
+ const ::com::sun::star::uno::Type & rType4,
+ const ::com::sun::star::uno::Type & rType5,
+ const ::com::sun::star::uno::Type & rType6,
+ const ::com::sun::star::uno::Type & rType7,
+ const ::com::sun::star::uno::Type & rType8,
+ const ::com::sun::star::uno::Type & rType9,
+ const ::com::sun::star::uno::Type & rType10,
+ const ::com::sun::star::uno::Type & rType11,
+ const ::com::sun::star::uno::Type & rType12,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ { return _aTypes; }
+};
+
+//==================================================================================================
+class OImplementationId
+{
+ mutable ::com::sun::star::uno::Sequence< sal_Int8 > * _pSeq;
+ sal_Bool _bUseEthernetAddress;
+
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ ~OImplementationId();
+ OImplementationId( sal_Bool bUseEthernetAddress = sal_True )
+ : _pSeq( 0 )
+ , _bUseEthernetAddress( bUseEthernetAddress )
+ {}
+ OImplementationId( const ::com::sun::star::uno::Sequence< sal_Int8 > & rSeq )
+ : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rSeq ) )
+ {}
+ OImplementationId( const OImplementationId & rId )
+ : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
+ {}
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const;
+};
+
+}
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/weak.hxx b/cppuhelper/inc/cppuhelper/weak.hxx
new file mode 100644
index 000000000000..a7886b725984
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/weak.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * $RCSfile: weak.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_WEAK_HXX_
+#define _CPPUHELPER_WEAK_HXX_
+
+#ifndef _OSL_INTERLOCK_H_
+#include <osl/interlck.h>
+#endif
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX_
+#include <cppuhelper/weakref.hxx>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_WEAK_HPP_
+#include <com/sun/star/uno/XWeak.hpp>
+#endif
+
+/** */ //for docpp
+namespace cppu
+{
+
+class OWeakConnectionPoint;
+
+/**
+ * The basic implementation to support weak references. The weak
+ * implementation is based on interfaces, but you should use this base class to avoid
+ * problems against changes in the future.
+ * <BR><B>Not fully tested.</B>
+ *
+ * @author Markus Meyer
+ * @since 98/04/12
+ */
+class OWeakObject : public ::com::sun::star::uno::XWeak
+{
+ friend class OWeakConnectionPoint;
+protected:
+ /**
+ * Call the destructor is only allowed if the reference count is zero.
+ */
+ virtual ~OWeakObject() throw(::com::sun::star::uno::RuntimeException);
+
+ /**
+ * The reference counter.
+ */
+ oslInterlockedCount m_refCount;
+
+ /**
+ * The container of all weak reference listeners and the connection point
+ * from the weak reference. Increment the reference count at m_pWeakConnectionPoint
+ * object does not affect the
+ */
+ OWeakConnectionPoint * m_pWeakConnectionPoint;
+public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ /**
+ * Set the reference count to zero.
+ */
+ OWeakObject() throw()
+ : m_refCount( 0 )
+ , m_pWeakConnectionPoint( 0 )
+ {}
+ /**
+ * Set the reference count to zero.
+ */
+ OWeakObject( const OWeakObject & rObj ) throw()
+ : m_refCount( 0 )
+ , m_pWeakConnectionPoint( 0 )
+ {}
+ /**
+ * The assignement does not affect the reference count and the weak references
+ * of this object.
+ */
+ inline OWeakObject & SAL_CALL operator = ( const OWeakObject & rObj) throw()
+ { return *this; }
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XWeak
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAdapter > SAL_CALL queryAdapter() throw();
+
+ /// Avoid ambigous cast error from compiler.
+ inline SAL_CALL operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () throw()
+ { return this; }
+};
+
+}
+
+#endif
+
+
diff --git a/cppuhelper/inc/cppuhelper/weakagg.hxx b/cppuhelper/inc/cppuhelper/weakagg.hxx
new file mode 100644
index 000000000000..4d87996a9f57
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/weakagg.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: weakagg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#define _CPPUHELPER_WEAKAGG_HXX_
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XAGGREGATION_HPP_
+#include <com/sun/star/uno/XAggregation.hpp>
+#endif
+
+/** */ //for docpp
+namespace cppu
+{
+
+/**
+ * The basic implementation to support weak references and aggregation. The aggregation
+ * implementation is based on interfaces, but you should use this class to avoid
+ * problems against changes in the future. Overload queryAggregation() instead of queryInterface()
+ * to return your interfaces.
+ * <BR><B>Not tested.</B>
+ *
+ * @author Markus Meyer
+ * @since 98/04/12
+ */
+class OWeakAggObject : public ::cppu::OWeakObject, public ::com::sun::star::uno::XAggregation
+{
+public:
+ /**
+ * Set the delegator to null.
+ */
+ OWeakAggObject()
+ {}
+
+ // XInterface
+ /**
+ * Increment the reference count if no delegator is set, otherwise call
+ * acquire at the delegator.
+ */
+ virtual void SAL_CALL acquire() throw();
+ /**
+ * Decrement the reference count if no delegator is set, otherwise call
+ * acquire at the delegator. If the reference count goes to zero the
+ * virtual destructor gets called.
+ */
+ virtual void SAL_CALL release() throw();
+ /**
+ * Delegates this call to the delegator, if one is set. Otherwise
+ * call the method queryAggregation.
+ * @see queryAggregation.
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XAggregation
+ /**
+ * Set the Delegator to the xDelegator member. This member is a weak
+ * reference.
+ * @param Delegator the object that delegate the queryInterface calls.
+ */
+ virtual void SAL_CALL setDelegator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Delegator )
+ throw(::com::sun::star::uno::RuntimeException);
+ /**
+ * Called from the delegator or queryInterface. Overload this method instead of
+ * queryInterface.
+ * @see queryInterfaces
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ /**
+ * Call the destructor is only allowed if the reference count is zero.
+ */
+ virtual ~OWeakAggObject();
+
+ /**
+ * The delegator set with setDelegator.
+ * @see setDelegator
+ */
+ ::com::sun::star::uno::WeakReferenceHelper xDelegator;
+private:
+ OWeakAggObject( const OWeakObject & rObj );
+
+ OWeakObject & operator = ( const OWeakObject & rObj );
+};
+
+}
+
+#endif
diff --git a/cppuhelper/inc/cppuhelper/weakref.hxx b/cppuhelper/inc/cppuhelper/weakref.hxx
new file mode 100644
index 000000000000..52eb59f5da70
--- /dev/null
+++ b/cppuhelper/inc/cppuhelper/weakref.hxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: weakref.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_WEAKREF_HXX_
+#define _CPPUHELPER_WEAKREF_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+
+/** */ //for docpp
+namespace com
+{
+/** */ //for docpp
+namespace sun
+{
+/** */ //for docpp
+namespace star
+{
+/** */ //for docpp
+namespace uno
+{
+
+class OWeakRefListener;
+
+//===================================================================
+/**
+ * Hold a weak reference to an object. This object must implement the XWeak interface.
+ * The implementation is thread safe. This means you can call set, assign and queryHardRef
+ * multible at one time.
+ *
+ * @see OWeakObject
+ * @see OWeakAggObject
+ * @author Markus Meyer
+ * @since 12/04/98
+ */
+class WeakReferenceHelper
+{
+public:
+ /** Create an empty weak reference. */
+ WeakReferenceHelper()
+ : m_pImpl( 0 )
+ {}
+
+ /** Initialize this reference with the same interface as in rWeakRef.*/
+ WeakReferenceHelper( const WeakReferenceHelper & rWeakRef );
+ /**
+ * Initialize this reference with the interface xInt. If the implementation behind
+ * xInt does not support XWeak or XInt is empty then this reference is empty too.
+ */
+ WeakReferenceHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xInt );
+ /**
+ * Release the reference.
+ */
+ ~WeakReferenceHelper();
+
+ /**
+ * Release the reference and take the from rWeakRef.
+ */
+ WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef );
+
+ /**
+ * Release the reference and take the from xInt. If the implementation behind
+ * xInt does not support XWeak or XInt is empty, than this reference is empty too.
+ */
+ WeakReferenceHelper & SAL_CALL operator = ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xInt )
+ { return operator = ( WeakReferenceHelper( xInt ) ); }
+
+ /**
+ * Return true if both OWeakRefs refer to the same object.
+ */
+ sal_Bool SAL_CALL operator == ( const WeakReferenceHelper & rObj ) const
+ { return (get() == rObj.get()); }
+
+ /**
+ * Get a real reference to the object.
+ * @return Null, if the interface was not found, otherwise the
+ * interface.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL get() const;
+
+ /**
+ * Return the reference to the interface. It is null, if the referenced object
+ * was destroyed or the weak reference was not set.
+ */
+ SAL_CALL operator Reference< XInterface > () const
+ { return get(); }
+
+protected:
+
+ OWeakRefListener * m_pImpl;
+};
+
+template< class interface_type >
+class WeakReference : public WeakReferenceHelper
+{
+public:
+ /** Set an empty weak reference. */
+ WeakReference()
+ : WeakReferenceHelper()
+ {}
+
+ /**
+ * Create a new weak reference with the given interface pInterface and acquire this one.
+ */
+ WeakReference( const Reference<interface_type > & rRef )
+ : WeakReferenceHelper( rRef )
+ {}
+
+ /**
+ * Return the reference to the interface. May be null.
+ */
+ SAL_CALL operator Reference< interface_type > () const
+ { return Reference< interface_type >::query( get() ); }
+};
+
+}
+}
+}
+}
+
+#endif
+
+
diff --git a/cppuhelper/prj/d.lst b/cppuhelper/prj/d.lst
new file mode 100644
index 000000000000..9f5ec8ad0afc
--- /dev/null
+++ b/cppuhelper/prj/d.lst
@@ -0,0 +1,57 @@
+mkdir: %_DEST%\inc%_EXT%\cppuhelper
+
+..\inc\cppuhelper\implbase.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase.hxx
+..\inc\cppuhelper\implbase1.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase1.hxx
+..\inc\cppuhelper\implbase2.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase2.hxx
+..\inc\cppuhelper\implbase3.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase3.hxx
+..\inc\cppuhelper\implbase4.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase4.hxx
+..\inc\cppuhelper\implbase5.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase5.hxx
+..\inc\cppuhelper\implbase6.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase6.hxx
+..\inc\cppuhelper\implbase7.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase7.hxx
+..\inc\cppuhelper\implbase8.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase8.hxx
+..\inc\cppuhelper\implbase9.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase9.hxx
+..\inc\cppuhelper\implbase10.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase10.hxx
+..\inc\cppuhelper\implbase11.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase11.hxx
+..\inc\cppuhelper\implbase12.hxx %_DEST%\inc%_EXT%\cppuhelper\implbase12.hxx
+
+..\inc\cppuhelper\compbase.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase.hxx
+..\inc\cppuhelper\compbase1.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase1.hxx
+..\inc\cppuhelper\compbase2.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase2.hxx
+..\inc\cppuhelper\compbase3.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase3.hxx
+..\inc\cppuhelper\compbase4.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase4.hxx
+..\inc\cppuhelper\compbase5.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase5.hxx
+..\inc\cppuhelper\compbase6.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase6.hxx
+..\inc\cppuhelper\compbase7.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase7.hxx
+..\inc\cppuhelper\compbase8.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase8.hxx
+..\inc\cppuhelper\compbase9.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase9.hxx
+..\inc\cppuhelper\compbase10.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase10.hxx
+..\inc\cppuhelper\compbase11.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase11.hxx
+..\inc\cppuhelper\compbase12.hxx %_DEST%\inc%_EXT%\cppuhelper\compbase12.hxx
+
+..\inc\cppuhelper\extract.hxx %_DEST%\inc%_EXT%\cppuhelper\extract.hxx
+..\inc\cppuhelper\exc_hlp.hxx %_DEST%\inc%_EXT%\cppuhelper\exc_hlp.hxx
+..\inc\cppuhelper\typeprovider.hxx %_DEST%\inc%_EXT%\cppuhelper\typeprovider.hxx
+..\inc\cppuhelper\factory.hxx %_DEST%\inc%_EXT%\cppuhelper\factory.hxx
+..\inc\cppuhelper\interfacecontainer.hxx %_DEST%\inc%_EXT%\cppuhelper\interfacecontainer.hxx
+..\inc\cppuhelper\interfacecontainer.h %_DEST%\inc%_EXT%\cppuhelper\interfacecontainer.h
+..\inc\cppuhelper\component.hxx %_DEST%\inc%_EXT%\cppuhelper\component.hxx
+..\inc\cppuhelper\propshlp.hxx %_DEST%\inc%_EXT%\cppuhelper\propshlp.hxx
+..\inc\cppuhelper\proptypehlp.hxx %_DEST%\inc%_EXT%\cppuhelper\proptypehlp.hxx
+..\inc\cppuhelper\proptypehlp.h %_DEST%\inc%_EXT%\cppuhelper\proptypehlp.h
+..\inc\cppuhelper\stdidlclass.hxx %_DEST%\inc%_EXT%\cppuhelper\stdidlclass.hxx
+..\inc\cppuhelper\weak.hxx %_DEST%\inc%_EXT%\cppuhelper\weak.hxx
+..\inc\cppuhelper\weakagg.hxx %_DEST%\inc%_EXT%\cppuhelper\weakagg.hxx
+..\inc\cppuhelper\queryinterface.hxx %_DEST%\inc%_EXT%\cppuhelper\queryinterface.hxx
+..\inc\cppuhelper\weakref.hxx %_DEST%\inc%_EXT%\cppuhelper\weakref.hxx
+..\inc\cppuhelper\servicefactory.hxx %_DEST%\inc%_EXT%\cppuhelper\servicefactory.hxx
+..\inc\cppuhelper\smartservices.hxx %_DEST%\inc%_EXT%\cppuhelper\smartservices.hxx
+
+..\%__SRC%\bin\cppuhelper*.dll %_DEST%\bin%_EXT%\cppuhelper*.dll
+..\%__SRC%\lib\*cppuhelper*.lib %_DEST%\lib%_EXT%\*
+
+..\%__SRC%\lib\libcppuhelper*.so %_DEST%\lib%_EXT%\*
+..\%__SRC%\lib\libcppuhelper*.dylib %_DEST%\lib%_EXT%\*
+..\%__SRC%\lib\libcppuhelper*.a %_DEST%\lib%_EXT%\*
+..\%__SRC%\lib\cppuhelper*.lib %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\cppuhelper*.pdb %_DEST%\misc%_EXT%\*
+..\version.mk %_DEST%\inc%_EXT%\cppuhelper\version.mk
diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx
new file mode 100644
index 000000000000..1e21d6e7a554
--- /dev/null
+++ b/cppuhelper/source/component.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: component.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _CPPUHELPER_COMPONENT_HXX_
+#include <cppuhelper/component.hxx>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::lang;
+
+namespace cppu
+{
+
+// ----------------------------------------------------
+// class OComponentHelper
+// ----------------------------------------------------
+OComponentHelper::OComponentHelper( Mutex & rMutex )
+ : rBHelper( rMutex )
+{
+}
+
+/**
+ * Call dispose if not previous called.
+ */
+OComponentHelper::~OComponentHelper()
+{
+}
+
+// XInterface
+void OComponentHelper::release() throw()
+{
+ Reference<XInterface > x( xDelegator );
+ if (! x.is())
+ {
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ if (! rBHelper.bDisposed)
+ {
+ Reference<XInterface > xHoldAlive( *this );
+ // First dispose
+ try
+ {
+ dispose();
+ }
+ catch(::com::sun::star::uno::Exception&)
+ {
+ // release should not throw exceptions
+ }
+
+ // 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();
+}
+
+// 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;
+ }
+ }
+
+ OSL_ENSHURE( bDoDispose, "dispose called twice" );
+ // Do not hold the mutex because we are broadcasting
+ if( bDoDispose )
+ {
+ // Create an event with this as sender
+ 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(::com::sun::star::uno::Exception& e)
+ {
+ // catch exception and throw again but signal that
+ // the object was disposed. Dispose should be called
+ // only once.
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ throw e;
+ }
+
+ // the values bDispose and bInDisposing must set in this order.
+ // No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard.
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ }
+}
+
+// XComponent
+void OComponentHelper::addEventListener(const Reference<XEventListener > & rxListener)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSHURE( !rBHelper.bInDispose, "do not add listeners in the dispose call" );
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ // only add listeners if you are not disposed
+ rBHelper.aLC.addInterface( ::getCppuType( (Reference< XEventListener > *)0 ), rxListener );
+}
+
+// XComponent
+void OComponentHelper::removeEventListener(const Reference<XEventListener > & rxListener)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ rBHelper.aLC.removeInterface( ::getCppuType( (Reference< XEventListener > *)0 ), rxListener );
+}
+
+}
+
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
new file mode 100644
index 000000000000..3fc8103d865e
--- /dev/null
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * $RCSfile: exc_thrower.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_INTERLOCK_H_
+#include <osl/interlck.h>
+#endif
+#ifndef _UNO_DISPATCHER_H_
+#include <uno/dispatcher.h>
+#endif
+#ifndef _UNO_MAPPING_HXX_
+#include <uno/mapping.hxx>
+#endif
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+
+namespace cppu
+{
+
+//************************************** generated, slightly modified for unicode revision
+class XThrower : public ::com::sun::star::uno::XInterface
+{
+public:
+
+ // Methods
+ virtual void SAL_CALL throwException( const ::com::sun::star::uno::Any& rExc ) throw(::com::sun::star::uno::Exception) = 0;
+};
+
+static
+const ::com::sun::star::uno::Type& getCppuType( const ::com::sun::star::uno::Reference< ::cppu::XThrower >* )
+{
+ static ::com::sun::star::uno::Type * pType_cppu_XThrower = 0;
+
+ if ( !pType_cppu_XThrower )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !pType_cppu_XThrower )
+ {
+ // Start inline typedescription generation
+ typelib_InterfaceTypeDescription * pTD = 0;
+
+ const Type & rSuperType = ::getCppuType( ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)0 );
+ typelib_TypeDescriptionReference * pMembers[1] = { 0 };
+ OUString aMemberTypeName( RTL_CONSTASCII_USTRINGPARAM("cppu.XThrower::throwException") );
+ typelib_typedescriptionreference_new( &pMembers[0],
+ (typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,
+ aMemberTypeName.pData );
+
+ OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("cppu.XThrower") );
+ typelib_typedescription_newInterface(
+ &pTD,
+ aTypeName.pData, 0x3313e220, 0xb491, 0xb491, 0x9ede0050, 0x04d7677e,
+ rSuperType.getTypeLibType(),
+ 1,
+ pMembers );
+
+ typelib_typedescription_register( (typelib_TypeDescription**)&pTD );
+ typelib_typedescriptionreference_release( pMembers[0] );
+ typelib_typedescription_release( (typelib_TypeDescription*)pTD );
+
+ static ::com::sun::star::uno::Type aType_cppu_XThrower(
+ ::com::sun::star::uno::TypeClass_INTERFACE, aTypeName.pData );
+ ::getCppuType( (const ::com::sun::star::uno::Exception*)0 );
+
+ typelib_InterfaceMethodTypeDescription * pMethod = 0;
+ {
+ typelib_Parameter_Init aParameters[1];
+ OUString aParamName( RTL_CONSTASCII_USTRINGPARAM("rExc") );
+ aParameters[0].pParamName = aParamName.pData;
+ aParameters[0].eTypeClass = (typelib_TypeClass)::com::sun::star::uno::TypeClass_ANY;
+ OUString aParamTypeName( RTL_CONSTASCII_USTRINGPARAM("any") );
+ aParameters[0].pTypeName = aParamTypeName.pData;
+ aParameters[0].bIn = sal_True;
+ aParameters[0].bOut = sal_False;
+ OUString aExceptionName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception") );
+ OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
+ typelib_typedescription_newInterfaceMethod( &pMethod,
+ 3, sal_False,
+ aMemberTypeName.pData,
+ (typelib_TypeClass)::com::sun::star::uno::TypeClass_VOID, aVoidName.pData,
+ 1, aParameters,
+ 1, &aExceptionName.pData );
+ typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
+ }
+ typelib_typedescription_release( (typelib_TypeDescription*)pMethod );
+ // End inline typedescription generation
+ pType_cppu_XThrower = &aType_cppu_XThrower;
+ }
+ }
+ return *pType_cppu_XThrower;
+}
+//**************************************
+
+
+//==================================================================================================
+struct ExceptionThrower : public uno_Interface
+{
+ oslInterlockedCount nRef;
+
+ inline ExceptionThrower();
+};
+//--------------------------------------------------------------------------------------------------
+void SAL_CALL ExceptionThrower_acquire( uno_Interface * pUnoI )
+{
+ osl_incrementInterlockedCount( & SAL_STATIC_CAST( ExceptionThrower *, pUnoI )->nRef );
+}
+//--------------------------------------------------------------------------------------------------
+void SAL_CALL ExceptionThrower_release( uno_Interface * pUnoI )
+{
+ if (! osl_decrementInterlockedCount( & SAL_STATIC_CAST( ExceptionThrower *, pUnoI )->nRef ))
+ delete SAL_STATIC_CAST( ExceptionThrower *, pUnoI );
+}
+//--------------------------------------------------------------------------------------------------
+static void SAL_CALL ExceptionThrower_dispatch(
+ uno_Interface * pUnoI, const typelib_TypeDescription * pMemberType,
+ void * pReturn, void * pArgs[], uno_Any ** ppException )
+{
+ OSL_ASSERT( pMemberType->eTypeClass == typelib_TypeClass_INTERFACE_METHOD );
+
+ switch (((typelib_InterfaceMemberTypeDescription *)pMemberType)->nPosition)
+ {
+ case 0: // queryInterace()
+ {
+ if (::getCppuType( (const Reference< XInterface > *)0 ).equals( *(const Type *)pArgs[0] ))
+ {
+ const Type & rType = ::getCppuType( (const Reference< XInterface > *)0 );
+ typelib_TypeDescription * pTD = 0;
+ TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() );
+ uno_any_construct( (uno_Any *)pReturn, &pUnoI, pTD, 0 );
+ TYPELIB_DANGER_RELEASE( pTD );
+ }
+ else if (getCppuType( (const Reference< XThrower > *)0 ).equals( *(const Type *)pArgs[0] ))
+ {
+ const Type & rType = getCppuType( (const Reference< XThrower > *)0 );
+ typelib_TypeDescription * pTD = 0;
+ TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() );
+ uno_any_construct( (uno_Any *)pReturn, &pUnoI, pTD, 0 );
+ TYPELIB_DANGER_RELEASE( pTD );
+ }
+ else
+ {
+ uno_any_construct( (uno_Any *)pReturn, 0, 0, 0 );
+ }
+ *ppException = 0;
+ break;
+ }
+ case 1: // acquire()
+ ExceptionThrower_acquire( pUnoI );
+ *ppException = 0;
+ break;
+ case 2: // release()
+ ExceptionThrower_release( pUnoI );
+ *ppException = 0;
+ break;
+ case 3: // throwException()
+ {
+ OSL_ASSERT( ((uno_Any *)pArgs[0])->pType->eTypeClass == typelib_TypeClass_EXCEPTION );
+
+ uno_type_any_construct(
+ *ppException, ((uno_Any *)pArgs[0])->pData, ((uno_Any *)pArgs[0])->pType, 0 );
+ break;
+ }
+ default:
+ OSL_ENSHURE( sal_False, "### illegal member called!" );
+ }
+}
+//__________________________________________________________________________________________________
+inline ExceptionThrower::ExceptionThrower()
+ : nRef( 0 )
+{
+ uno_Interface::acquire = ExceptionThrower_acquire;
+ uno_Interface::release = ExceptionThrower_release;
+ uno_Interface::pDispatcher = ExceptionThrower_dispatch;
+}
+
+//==================================================================================================
+void SAL_CALL throwException( const Any & rExc )
+ throw (Exception)
+{
+ if (rExc.getValueTypeClass() == TypeClass_EXCEPTION)
+ {
+ OUString aExceptionName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception") );
+ typelib_TypeDescription * pComp = 0;
+ TYPELIB_DANGER_GET( &pComp, rExc.getValueTypeRef() );
+ // must be derived from com.sun.star.uno.Exception
+ for ( typelib_CompoundTypeDescription * pTD = (typelib_CompoundTypeDescription *)pComp;
+ pTD; pTD = pTD->pBaseTypeDescription )
+ {
+ if (aExceptionName == ((typelib_TypeDescription *)pTD)->pTypeName)
+ {
+ Mapping aUno2Cpp( OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ) );
+ OSL_ENSHURE( aUno2Cpp.is(), "### cannot get uno to cpp mapping!" );
+ if (aUno2Cpp.is())
+ {
+ uno_Interface * pUnoI = new ExceptionThrower();
+ (*pUnoI->acquire)( pUnoI );
+ Reference< XThrower > xThrower;
+ aUno2Cpp.mapInterface(
+ reinterpret_cast< void ** >( &xThrower ),
+ pUnoI, ::cppu::getCppuType( (const Reference< XThrower > *)0 ) );
+ (*pUnoI->release)( pUnoI );
+
+ if (xThrower.is())
+ {
+ TYPELIB_DANGER_RELEASE( pComp );
+ xThrower->throwException( rExc );
+ }
+ }
+ break;
+ }
+ }
+ TYPELIB_DANGER_RELEASE( pComp );
+ }
+ throw RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("failed throwing exception generically!") ),
+ Reference< XInterface >() );
+}
+
+}
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
new file mode 100644
index 000000000000..5271391d0beb
--- /dev/null
+++ b/cppuhelper/source/factory.cxx
@@ -0,0 +1,719 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPONENT_HXX_
+#include <cppuhelper/component.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.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>
+
+using namespace osl;
+using namespace rtl;
+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:
+ OSingleFactoryHelper( const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ ComponentInstantiation pCreateFunction_,
+ const Sequence< OUString > * pServiceNames_ )
+ : xSMgr( rServiceManager )
+ , aImplementationName( rImplementationName_ )
+ , pCreateFunction( pCreateFunction_ )
+ {
+ if( pServiceNames_ )
+ aServiceNames = *pServiceNames_;
+ }
+
+ // old function, only for backward compatibility
+ OSingleFactoryHelper( const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_ )
+ : xSMgr( rServiceManager )
+ , aImplementationName( rImplementationName_ )
+ , pCreateFunction( NULL )
+ {
+ }
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XSingleServiceFactory
+ Reference<XInterface > SAL_CALL createInstance(void)
+ 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);
+
+ // 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()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ Reference<XMultiServiceFactory > xSMgr;
+ ComponentInstantiation pCreateFunction;
+ Sequence< OUString > aServiceNames;
+ OUString aImplementationName;
+};
+
+//-----------------------------------------------------------------------------
+Any OSingleFactoryHelper::queryInterface( const Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ rType, static_cast< XSingleServiceFactory * >( this ), static_cast< XServiceInfo * >( this ) );
+}
+
+// OSingleFactoryHelper
+Reference<XInterface > OSingleFactoryHelper::createInstanceEveryTime()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( pCreateFunction )
+ return pCreateFunction( xSMgr );
+ else
+ return Reference<XInterface >();
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OSingleFactoryHelper::createInstance()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return createInstanceEveryTime();
+}
+
+// XSingleServiceFactory
+Reference<XInterface > OSingleFactoryHelper::createInstanceWithArguments
+(
+ const Sequence<Any>& Arguments
+)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ Reference<XInterface > xRet = createInstanceEveryTime();
+
+ if( Arguments.getLength() )
+ {
+ Reference<XInitialization > xInit( xRet, UNO_QUERY );
+ if( xInit.is() )
+ xInit->initialize( Arguments );
+ else
+ throw IllegalArgumentException();
+ }
+ 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_,
+ const Sequence< OUString > * pServiceNames_,
+ sal_Bool bOneInstance_ = sal_False )
+ : OComponentHelper( aMutex )
+ , OSingleFactoryHelper( rServiceManager, rImplementationName_, pCreateFunction_, pServiceNames_ )
+ , bOneInstance( bOneInstance_ )
+ {
+ }
+
+ // old function, only for backward compatibility
+ OFactoryComponentHelper( const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ sal_Bool bOneInstance_ = sal_False )
+ : OComponentHelper( aMutex )
+ , OSingleFactoryHelper( rServiceManager, rImplementationName_ )
+ , bOneInstance( bOneInstance_ )
+ {
+ }
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+ { return OComponentHelper::queryInterface( rType ); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException)
+ { OComponentHelper::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException)
+ { 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);
+
+ // 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);
+
+ // OComponentHelper
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ Reference<XInterface > xTheInstance;
+ sal_Bool bOneInstance;
+};
+
+// 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)
+{
+ static OTypeCollection * pTypes = 0;
+ if (! pTypes)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! pTypes)
+ {
+ static OTypeCollection aTypes(
+ ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ),
+ ::getCppuType( (const Reference< XServiceInfo > *)0 ),
+ OComponentHelper::getTypes() );
+ pTypes = &aTypes;
+ }
+ }
+ return pTypes->getTypes();
+}
+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 )
+ {
+ 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 )
+ {
+ MutexGuard aGuard( aMutex );
+ if( !xTheInstance.is() )
+ xTheInstance = OSingleFactoryHelper::createInstanceWithArguments( Arguments );
+ return xTheInstance;
+ }
+ return OSingleFactoryHelper::createInstanceWithArguments( Arguments );
+}
+
+// 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();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class ORegistryFactoryHelper
+ : public OFactoryComponentHelper
+{
+public:
+ ORegistryFactoryHelper( const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName_,
+ const Reference<XRegistryKey > & xImplementationKey_,
+ sal_Bool bOneInstance_ = sal_False )
+ : OFactoryComponentHelper( rServiceManager, rImplementationName_, 0, 0, bOneInstance_ )
+ , xImplementationKey( xImplementationKey_ )
+ {}
+
+ // OSingleFactoryHelper
+ Reference<XInterface > createInstanceEveryTime()
+ 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);
+
+ // XServiceInfo
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
+ throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ Reference< XSingleServiceFactory > 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<XSingleServiceFactory > xModuleFactory;
+};
+
+Reference<XInterface > ORegistryFactoryHelper::createInstanceEveryTime()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( pCreateFunction )
+ // the create function is set, do not use the implementation loader.
+ return OFactoryComponentHelper::createInstanceEveryTime();
+
+ if( !xModuleFactory.is() )
+ xModuleFactory = createModuleFactory();
+
+ if( xModuleFactory.is() )
+ return xModuleFactory->createInstance();
+
+ return Reference<XInterface >();
+}
+
+// OSingleFactoryHelper
+Reference< XSingleServiceFactory > ORegistryFactoryHelper::createModuleFactory()
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ Reference<XSingleServiceFactory > xFactory;
+ try
+ {
+ MutexGuard aGuard( aMutex );
+
+ 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());
+ aActivatorName = tmpActivator.getToken(0, L':').getStr();
+
+ 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.search(
+ 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 );
+ }
+ }
+ }
+
+ if( aActivatorName.len() != 0 )
+ {
+ Reference<XInterface > x = xSMgr->createInstance( aActivatorName );
+ Reference<XImplementationLoader > xLoader( x, UNO_QUERY );
+ Reference<XInterface > xMF;
+ if (xLoader.is())
+ {
+ // JSC: This exception must not be catched if a concept for exception handling
+ // is specified, implemented and used.
+ try
+ {
+ xMF = xLoader->activate( aImplementationName, aActivatorUrl, aLocation, xImplementationKey );
+ }
+ catch( CannotActivateFactoryException& e)
+ {
+ OString msg( OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US) );
+ OSL_ENSHURE( !msg.getLength(), msg.getStr() );
+ }
+ }
+ xFactory = Reference<XSingleServiceFactory >( xMF, UNO_QUERY );
+ }
+ }
+ catch (InvalidRegistryException &)
+ {
+ }
+
+ return xFactory;
+}
+
+Reference<XInterface > SAL_CALL ORegistryFactoryHelper::createInstanceWithArguments(const Sequence<Any>& Arguments)
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ if( !xModuleFactory.is() )
+ xModuleFactory = createModuleFactory();
+
+ if( xModuleFactory.is() )
+ return xModuleFactory->createInstanceWithArguments( Arguments );
+
+ return Reference<XInterface >();
+}
+
+// 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().len() + 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;
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+
+class OFactoryProxyHelper : public WeakImplHelper2< XServiceInfo, XSingleServiceFactory >
+{
+ Reference<XSingleServiceFactory > xFactory;
+
+public:
+
+ OFactoryProxyHelper( const Reference<XMultiServiceFactory > & /*rServiceManager*/,
+ const Reference<XSingleServiceFactory > & rFactory )
+ : 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);
+};
+
+// 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 >();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createSingleFactory
+(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames
+)
+{
+ return new OFactoryComponentHelper( rServiceManager, rImplementationName,
+ pCreateFunction, &rServiceNames, sal_False );
+}
+
+// global function
+Reference<XSingleServiceFactory > SAL_CALL createFactoryProxy
+(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const Reference<XSingleServiceFactory > & rFactory
+)
+{
+ 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
+)
+{
+ return new OFactoryComponentHelper( rServiceManager, rImplementationName,
+ pCreateFunction, &rServiceNames, sal_True );
+}
+
+// global function
+SAL_DLLEXPORT Reference<XSingleServiceFactory > SAL_CALL createSingleRegistryFactory
+(
+ const Reference<XMultiServiceFactory > & rServiceManager,
+ const OUString & rImplementationName,
+ const Reference<XRegistryKey > & rImplementationKey
+)
+{
+ 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
+)
+{
+ return new ORegistryFactoryHelper( rServiceManager, rImplementationName,
+ rImplementationKey, sal_True );
+}
+
+}
+
+
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
new file mode 100644
index 000000000000..a01c12fde4e0
--- /dev/null
+++ b/cppuhelper/source/implbase.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * $RCSfile: implbase.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_IMPLBASE_HXX_
+#include <cppuhelper/implbase.hxx>
+#endif
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+using namespace osl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+namespace cppu
+{
+
+// ClassDataBase
+//__________________________________________________________________________________________________
+ClassDataBase::ClassDataBase()
+ : bOffsetsInit( sal_False )
+ , nType2Offset( 0 )
+ , nClassCode( 0 )
+ , pTypes( 0 )
+ , pId( 0 )
+{
+}
+//__________________________________________________________________________________________________
+ClassDataBase::ClassDataBase( sal_Int32 nClassCode_ )
+ : bOffsetsInit( sal_False )
+ , nType2Offset( 0 )
+ , nClassCode( nClassCode_ )
+ , pTypes( 0 )
+ , pId( 0 )
+{
+}
+//__________________________________________________________________________________________________
+ClassDataBase::~ClassDataBase()
+{
+ 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 )
+{
+ arType2Offset[nType2Offset].nOffset = nOffset;
+
+ arType2Offset[nType2Offset].pTD = 0;
+ typelib_typedescriptionreference_getDescription(
+ (typelib_TypeDescription **)&arType2Offset[nType2Offset].pTD, rType.getTypeLibType() );
+
+ if (arType2Offset[nType2Offset].pTD)
+ ++nType2Offset;
+#ifdef DEBUG
+ else
+ {
+ OString msg( "### cannot get type description for " );
+ msg += OUStringToOString( rType.getTypeName(), RTL_TEXTENCODING_ASCII_US );
+ OSL_ENSHURE( sal_False, msg.getStr() );
+ }
+#endif
+}
+//__________________________________________________________________________________________________
+void ClassData::initTypeProvider()
+{
+ ::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< XTypeProvider > *)0 );
+
+ // class code extra types: [[XComponent,] XWeak[, XAggregation]]
+ switch (nClassCode)
+ {
+ case 4:
+ pTypeAr[nType2Offset +2] = ::getCppuType( (const Reference< XComponent > *)0 );
+ pTypeAr[nType2Offset +1] = ::getCppuType( (const Reference< XWeak > *)0 );
+ break;
+ case 3:
+ pTypeAr[nType2Offset +3] = ::getCppuType( (const Reference< 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()
+{
+ if (! pTypes)
+ initTypeProvider();
+ return *pTypes;
+}
+//__________________________________________________________________________________________________
+Sequence< sal_Int8 > ClassData::getImplementationId()
+{
+ if (! pTypes)
+ initTypeProvider();
+ return *pId;
+}
+
+//--------------------------------------------------------------------------------------------------
+static inline sal_Bool td_equals( typelib_TypeDescription * pTD,
+ typelib_TypeDescriptionReference * pType )
+{
+ 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, XTypeProvider * pBase )
+{
+ 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< XTypeProvider > *)0 ))
+ return Any( &pBase, ::getCppuType( (const Reference< XTypeProvider > *)0 ) );
+
+ return Any();
+}
+
+}
+
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
new file mode 100644
index 000000000000..baf0d696249a
--- /dev/null
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * $RCSfile: interfacecontainer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+
+#include <hash_map>
+
+#include <assert.h>
+
+#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 )
+{
+ Sequence< Reference< XInterface > > aNewSeq( nNewLen );
+ Reference< XInterface > * pDest = aNewSeq.getArray();
+ // getArray on a const sequence is faster
+ const Reference< XInterface > * pSource = ((const Sequence< Reference< XInterface > > &)rSeq).getConstArray();
+ for( sal_Int32 i = (nNewLen < rSeq.getLength() ? nNewLen : rSeq.getLength()) -1; i >= 0; i-- )
+ pDest[i] = pSource[i];
+ rSeq = aNewSeq;
+}
+
+/**
+ * Remove an element from an interface sequence.
+ */
+static void sequenceRemoveElementAt( Sequence< Reference< XInterface > > & rSeq, sal_Int32 index )
+{
+ 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 SAL_WNT
+#pragma warning( disable: 4786 )
+#endif
+
+//===================================================================
+//===================================================================
+//===================================================================
+OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont_ )
+ : 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_Bool bShared;
+ {
+ MutexGuard aGuard( rCont.rMutex );
+ // bResetInUse protect the iterator against recursion
+ bShared = pData == rCont.pData && rCont.bIsList;
+ if( bShared )
+ {
+ OSL_ENSHURE( 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()
+{
+ 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;
+}
+
+//===================================================================
+//===================================================================
+//===================================================================
+
+
+OInterfaceContainerHelper::OInterfaceContainerHelper( Mutex & rMutex_ )
+ : rMutex( rMutex_ )
+ , bInUse( sal_False )
+ , bIsList( sal_False )
+ , pData( 0 )
+{
+}
+
+OInterfaceContainerHelper::~OInterfaceContainerHelper()
+{
+ OSL_ENSHURE( !bInUse, "~OInterfaceContainerHelper but is in use" );
+ if( bIsList )
+ delete (Sequence< Reference< XInterface > >*)pData;
+ else if( pData )
+ ((XInterface*)pData)->release();
+}
+
+sal_Int32 OInterfaceContainerHelper::getLength() const
+{
+ MutexGuard aGuard( rMutex );
+ if( bIsList )
+ return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ else if( pData )
+ return 1;
+ return 0;
+}
+
+Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const
+{
+ 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()
+{
+ OSL_ENSHURE( 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 )
+{
+ 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 )
+{
+ 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 * pL = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[0].get();
+ pL->acquire();
+ delete (Sequence< Reference< XInterface > >*)pData;
+ pData = pL;
+ bIsList = sal_False;
+ return 1;
+ }
+ else
+ return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ }
+ else if( Reference<XInterface>( (XInterface*)pData ) == rListener )
+ {
+ ((XInterface *)pData)->release();
+ pData = 0;
+ }
+ return pData ? 1 : 0;
+}
+
+void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt )
+{
+ ClearableMutexGuard aGuard( rMutex );
+ OInterfaceIteratorHelper aIt( *this );
+ // Container freigeben, falls im disposing neue Eintrge kommen
+ OSL_ENSHURE( !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() )
+ {
+ Reference<XEventListener > xLst( aIt.next(), UNO_QUERY );
+ if( xLst.is() )
+ xLst->disposing( rEvt );
+ }
+}
+
+
+void OInterfaceContainerHelper::clear( )
+{
+ ClearableMutexGuard aGuard( rMutex );
+ OInterfaceIteratorHelper aIt( *this );
+ // Container freigeben, falls im disposing neue Eintrge kommen
+ OSL_ENSHURE( !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();
+}
+
+
+}
+
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
new file mode 100644
index 000000000000..08c617b3fbf0
--- /dev/null
+++ b/cppuhelper/source/makefile.mk
@@ -0,0 +1,167 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME= cppuhelper
+TARGET= cppuhelper
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+
+USE_DEFFILE= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.INCLUDE : ..$/version.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc
+
+CPPUMAKERFLAGS =
+
+UNOTYPES= \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.container.XSet \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.reflection.XIdlReflection \
+ com.sun.star.reflection.XIdlClass \
+ com.sun.star.reflection.XIdlClassProvider \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.beans.XMultiPropertySet \
+ com.sun.star.beans.XFastPropertySet \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XComponent
+
+# LIB1TARGET= $(LB)$/a$(TARGET).lib
+# LIB1ARCHIV= $(LB)$/lib$(TARGET)$(CPPUHELPER_MAJOR)$(COM).a
+# LIB1FILES= $(LB)$/$(TARGET).lib
+
+SLOFILES= \
+ $(SLO)$/typeprovider.obj \
+ $(SLO)$/exc_thrower.obj \
+ $(SLO)$/servicefactory.obj \
+ $(SLO)$/implbase.obj \
+ $(SLO)$/propshlp.obj \
+ $(SLO)$/weak.obj \
+ $(SLO)$/interfacecontainer.obj \
+ $(SLO)$/stdidlclass.obj \
+ $(SLO)$/factory.obj \
+ $(SLO)$/component.obj
+
+# OBJFILES= \
+# $(OBJ)$/typeprovider.obj \
+# $(OBJ)$/exc_thrower.obj \
+# $(OBJ)$/servicefactory.obj \
+# $(OBJ)$/implbase.obj \
+# $(OBJ)$/propshlp.obj \
+# $(OBJ)$/weak.obj \
+# $(OBJ)$/interfacecontainer.obj \
+# $(OBJ)$/stdidlclass.obj \
+# $(OBJ)$/factory.obj \
+# $(OBJ)$/component.obj
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+SLOFILES+=$(SLO)$/staticmb.obj
+#OBJFILES+=$(OBJ)$/staticmb.obj
+.ENDIF
+
+SHL1TARGET= $(TARGET)$(CPPUHELPER_MAJOR)$(COM)
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME= $(TARGET)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/$(SHL1TARGET).flt : makefile.mk
+ +echo _TI2 >$@
+ +echo _TI1 >>$@
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
new file mode 100644
index 000000000000..1783d853908e
--- /dev/null
+++ b/cppuhelper/source/propshlp.cxx
@@ -0,0 +1,1106 @@
+/*************************************************************************
+ *
+ * $RCSfile: propshlp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#include <osl/diagnose.h>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.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( )
+{
+ return ::getCppuType( (Reference< XPropertyChangeListener > *)0 );
+}
+inline const ::com::sun::star::uno::Type & getPropertiesTypeIdentifier()
+{
+ return ::getCppuType( (Reference< XPropertiesChangeListener > *)0 );
+}
+inline const ::com::sun::star::uno::Type & getVetoableTypeIdentifier()
+{
+ return ::getCppuType( (Reference< XVetoableChangeListener > *)0 );
+}
+
+int SAL_CALL compare_OUString_Property_Impl( const void *arg1, const void *arg2 )
+{
+ 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_ );
+
+ // XPropertySetInfo-Methoden
+ virtual Sequence< Property > SAL_CALL getProperties(void);
+ virtual Property SAL_CALL getPropertyByName(const OUString& PropertyName);
+ virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& PropertyName);
+};
+
+
+/**
+ * Create an object that implements XPropertySetInfo IPropertyArrayHelper.
+ */
+OPropertySetHelperInfo_Impl::OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ )
+ :aInfos( rHelper_.getProperties() )
+{
+}
+
+/**
+ * Return the sequence of properties, which are provided throug the constructor.
+ */
+Sequence< Property > OPropertySetHelperInfo_Impl::getProperties(void)
+{
+ return aInfos;
+}
+
+/**
+ * Return the sequence of properties, which are provided throug the constructor.
+ */
+Property OPropertySetHelperInfo_Impl::getPropertyByName( const OUString & PropertyName )
+{
+ 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 )
+{
+ Property * pR;
+ pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
+ sizeof( Property ),
+ compare_OUString_Property_Impl );
+ return pR != NULL;
+}
+
+// ----------------------------------------------------
+// class PropertySetHelper
+// ----------------------------------------------------
+OPropertySetHelper::OPropertySetHelper(
+ OBroadcastHelper & rBHelper_ )
+ : rBHelper( rBHelper_ )
+ , aBoundLC( rBHelper_.rMutex )
+ , aVetoableLC( rBHelper_.rMutex )
+{
+}
+
+/**
+ * You must call disposing before.
+ */
+OPropertySetHelper::~OPropertySetHelper()
+{
+}
+
+/**
+ * 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 )
+{
+ return ::cppu::queryInterface( rType,
+ static_cast< XPropertySet * >( this ),
+ static_cast< XMultiPropertySet * >( this ),
+ static_cast< XFastPropertySet * >( this ) );
+}
+
+// ComponentHelper
+void OPropertySetHelper::disposing()
+{
+ // 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 )
+{
+ return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) );
+}
+
+// XPropertySet
+void OPropertySetHelper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+{
+ // 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 )
+{
+ // 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_ENSHURE( !rBHelper.bInDispose, "do not addPropertyChangeListener in the dispose call" );
+ OSL_ENSHURE( !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.len() )
+ {
+ // 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_ENSHURE( 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_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ if( rPropertyName.len() )
+ {
+ // 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_ENSHURE( !rBHelper.bInDispose, "do not addVetoableChangeListener in the dispose call" );
+ OSL_ENSHURE( !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.len() )
+ {
+ // 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_ENSHURE( 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_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ if( rPropertyName.len() )
+ {
+ // 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_ENSHURE( !rBHelper.bInDispose, "do not setFastPropertyValue in the dispose call" );
+ OSL_ENSHURE( !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 );
+ // set the property to the new value
+ setFastPropertyValue_NoBroadcast( nHandle, aConvertedVal );
+ // 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
+)
+{
+ // 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++;
+ }
+ }
+
+ // 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();
+ if( bVetoable ) // fire change Events?
+ ((XVetoableChangeListener *)pL)->vetoableChange( pEvts[i] );
+ else
+ ((XPropertyChangeListener *)pL)->propertyChange( pEvts[i] );
+ }
+ }
+ // 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();
+ if( bVetoable ) // fire change Events?
+ ((XVetoableChangeListener *)pL)->vetoableChange( pEvts[i] );
+ else
+ ((XPropertyChangeListener *)pL)->propertyChange( pEvts[i] );
+ }
+ }
+ }
+
+ // 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();
+ // fire the hole event sequence to the XPropertiesChangeListener's
+ pL->propertiesChange( aEvts );
+ }
+ }
+ }
+ }
+}
+
+// OPropertySetHelper
+void OPropertySetHelper::setFastPropertyValues
+(
+ sal_Int32 nSeqLen,
+ sal_Int32 * pHandles,
+ const Any * pValues,
+ sal_Int32 nHitCount
+)
+throw (Exception)
+{
+ OSL_ENSHURE( !rBHelper.bInDispose, "do not getFastPropertyValue in the dispose call" );
+ OSL_ENSHURE( !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 nHitCount = 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[ nHitCount ], pOldValues[nHitCount],
+ pHandles[i], pValues[i] ) )
+ {
+ // only increment if the property really change
+ pHandles[nHitCount] = pHandles[i];
+ nHitCount++;
+ }
+ }
+ }
+ // release guard to fire events
+ }
+
+ // fire vetoable events
+ fire( pHandles, pConvertedValues, pOldValues, nHitCount, sal_True );
+
+ {
+ // must lock the mutex outside the loop.
+ MutexGuard aGuard( rBHelper.rMutex );
+ // Loop over all changed properties
+ for( i = 0; i < nHitCount; i++ )
+ {
+ // Will the property change?
+ setFastPropertyValue_NoBroadcast( pHandles[i], pConvertedValues[i] );
+ }
+ // release guard to fire events
+ }
+
+ // fire change events
+ fire( pHandles, pConvertedValues, pOldValues, nHitCount, 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
+)
+{
+ 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 )
+{
+ 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();
+ const OUString * pNames = rPropertyNames.getConstArray();
+
+ 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
+ )
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSHURE( !rBHelper.bInDispose, "do not addPropertyChangeListener in the dispose call" );
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ // Listener wird zu allen Properties angemeldet, besser ist
+ // sie ueber die Namen anzumelden
+ rBHelper.aLC.addInterface(
+ getPropertiesTypeIdentifier( ),
+ rListener
+ );
+ }
+}
+
+// XMultiPropertySet
+void OPropertySetHelper::removePropertiesChangeListener
+ ( const Reference < XPropertiesChangeListener > & rxListener )
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+ OSL_ENSHURE( !rBHelper.bDisposed, "object is disposed" );
+ // all listeners are automaticly released in a dispose call
+ if( !rBHelper.bInDispose && !rBHelper.bDisposed )
+ {
+ rBHelper.aLC.removeInterface(
+ getPropertiesTypeIdentifier( ),
+ rxListener
+ );
+ }
+}
+
+// XMultiPropertySet
+void OPropertySetHelper::firePropertiesChangeEvent
+(
+ const Sequence<OUString>& rPropertyNames,
+ const Reference < XPropertiesChangeListener >& rListener
+)
+{
+ 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;
+// }
+
+int SAL_CALL compare_Property_Impl( const void *arg1, const void *arg2 )
+{
+ return ((Property *)arg1)->Name.compareTo( ((Property *)arg2)->Name );
+}
+
+void OPropertyArrayHelper::init( sal_Bool bSorted )
+{
+ 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 )
+ {
+ OSL_ENSHURE( !bSorted, "Property array is not sorted" );
+ // 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
+)
+ : aInfos(pProps, nEle)
+ , bRightOrdered( sal_False )
+{
+ init( bSorted );
+}
+
+OPropertyArrayHelper::OPropertyArrayHelper
+(
+ const Sequence< Property > & aProps,
+ sal_Bool bSorted
+)
+ : 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..3e0bebf9b55c
--- /dev/null
+++ b/cppuhelper/source/servicefactory.cxx
@@ -0,0 +1,507 @@
+/*************************************************************************
+ *
+ * $RCSfile: servicefactory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_MODULE_H_
+#include <osl/module.h>
+#endif
+#ifndef _RTL_STRING_HXX_
+#include <rtl/string.hxx>
+#endif
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _UNO_ENVIRONMENT_H_
+#include <uno/environment.h>
+#endif
+#ifndef _UNO_MAPPING_HXX_
+#include <uno/mapping.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+
+using namespace rtl;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::container;
+
+
+namespace cppu
+{
+
+//==================================================================================================
+static Reference< XSingleServiceFactory > loadLibComponentFactory(
+ const OUString & rLibName, const OUString & rImplName, const OUString & rBootstrapPath,
+ const Reference< XMultiServiceFactory > & xSF, const Reference< XRegistryKey > & xKey )
+{
+ Reference< XSingleServiceFactory > xRet;
+ sal_uInt32 bufLen = 32;
+
+ if ( rBootstrapPath.getLength() > 0 )
+ {
+ bufLen += rBootstrapPath.getLength() + 1;
+ }
+
+ OUStringBuffer aLibNameBuf( bufLen );
+ if ( bufLen > 32 )
+ {
+ aLibNameBuf.append( rBootstrapPath );
+ aLibNameBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
+ }
+
+#ifdef SAL_UNX
+ aLibNameBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM("lib") );
+ aLibNameBuf.append( rLibName );
+ aLibNameBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM(".so") );
+#else
+ aLibNameBuf.append( rLibName );
+ aLibNameBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM(".dll") );
+#endif
+ OUString aLibName( aLibNameBuf.makeStringAndClear() );
+ oslModule lib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+
+ if (lib)
+ {
+ void * pSym;
+
+ // ========================= LATEST VERSION =========================
+ OUString aGetEnvName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETENV) );
+ if (pSym = osl_getSymbol( lib, aGetEnvName.pData ))
+ {
+ uno_Environment * pCurrentEnv = 0;
+ uno_Environment * pEnv = 0;
+ const sal_Char * pEnvTypeName = 0;
+ (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv );
+
+ sal_Bool bNeedsMapping =
+ (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME ));
+
+ OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) );
+
+ if (bNeedsMapping)
+ {
+ if (! pEnv)
+ uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 );
+ if (pEnv)
+ {
+ OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 );
+ if (pCurrentEnv)
+ bNeedsMapping = (pEnv != pCurrentEnv);
+ }
+ }
+
+ OUString aGetFactoryName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY) );
+ if (pSym = osl_getSymbol( lib, aGetFactoryName.pData ))
+ {
+ OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
+
+ if (bNeedsMapping)
+ {
+ if (pEnv && pCurrentEnv)
+ {
+ Mapping aCurrent2Env( pCurrentEnv, pEnv );
+ Mapping aEnv2Current( pEnv, pCurrentEnv );
+
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xSF.get(), ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( (const Reference< XRegistryKey > *)0 ) );
+
+ void * pSSF = (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), pSMgr, pKey );
+
+ if (pKey)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey );
+ if (pSMgr)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr );
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ) );
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF );
+ }
+ }
+ }
+ }
+ else
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)
+ (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), xSF.get(), xKey.get() );
+ if (pRet)
+ {
+ xRet = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ if (pEnv)
+ (*pEnv->release)( pEnv );
+ if (pCurrentEnv)
+ (*pCurrentEnv->release)( pCurrentEnv );
+ }
+
+ if (! xRet.is())
+ osl_unloadModule( lib );
+ }
+
+ return xRet;
+}
+//==================================================================================================
+static Reference< ::com::sun::star::lang::XSingleServiceFactory> SAL_CALL createLoaderFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("cpld") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.DLLComponentLoader") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory > SAL_CALL createSimpleRegistryFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("simreg") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory> SAL_CALL createDefaultRegistryFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("defreg") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.DefaultRegistry") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory> SAL_CALL createNestedRegistryFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("defreg") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.NestedRegistry") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory> SAL_CALL createImplRegFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("impreg") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.ImplementationRegistration") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory> SAL_CALL createRegTDProviderFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("rdbtdp") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.RegistryTypeDescriptionProvider") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XSingleServiceFactory> SAL_CALL createTDManagerFactory(
+ const Reference< XMultiServiceFactory > & xSF, const OUString & rBootstrapPath )
+{
+ return loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tdmgr") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.TypeDescriptionManager") ),
+ rBootstrapPath, xSF, Reference< XRegistryKey >() );
+}
+//==================================================================================================
+static Reference< XMultiServiceFactory > createImplServiceFactory( const OUString & rWriteRegistry,
+ const OUString & rReadRegistry,
+ sal_Bool bReadOnly,
+ const OUString & rBootstrapPath )
+ throw( ::com::sun::star::uno::Exception )
+{
+ // mappings held to avoid binding unloading...
+ Mapping aCpp2Uno(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ) );
+ Mapping aUno2Cpp(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ) );
+
+ Reference< XSingleServiceFactory > xSMFac( loadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("smgr") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.ORegistryServiceManager") ),
+ rBootstrapPath, Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() ) );
+
+ // stop here if not at least a service manager is available
+ if ( !xSMFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("service manager component not available")),
+ Reference< XInterface >() );
+ }
+
+ Reference< XMultiServiceFactory > xSF( xSMFac->createInstance(), UNO_QUERY );
+ Reference< XInitialization > xInit( xSF, UNO_QUERY );
+
+ OSL_ENSHURE( xInit.is() && xSF.is(), "### failed loading servicemanager!" );
+ if (xInit.is() && xSF.is())
+ {
+ Reference< XSingleServiceFactory > xSimRegFac( createSimpleRegistryFactory( xSF, rBootstrapPath ) );
+ Reference< XSingleServiceFactory > xNesRegFac( createNestedRegistryFactory( xSF, rBootstrapPath ) );
+ OSL_ENSHURE( xSimRegFac.is() && xNesRegFac.is(), "### cannot get registry factories!" );
+
+ // write initial shared lib loader, simple registry, default registry, impl reg
+ Reference< XSet > xSet( xSF, UNO_QUERY );
+
+ // loader
+ {
+ Reference< XSingleServiceFactory > xFac( createLoaderFactory( xSF, rBootstrapPath ) );
+ if ( !xFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("shared library loader component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xFac ) ), "### failed registering loader!" );
+ }
+ // simple registry
+ {
+ if ( !xSimRegFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("simple registry component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xSimRegFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xSimRegFac ) ), "### failed registering simple registry!" );
+ }
+ // nested registry
+ {
+ if ( !xNesRegFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("nested registry component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xNesRegFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xNesRegFac ) ), "### failed registering default registry!" );
+ }
+ // implementation registration
+ {
+ Reference< XSingleServiceFactory > xFac( createImplRegFactory( xSF, rBootstrapPath ) );
+ if ( !xFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("implementation registration component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xFac ) ), "### failed registering impl reg!" );
+ }
+
+ Reference< XSimpleRegistry > xRegistry;
+
+ // open a registry
+ sal_Bool bRegistryShouldBeValid = sal_False;
+ if (rWriteRegistry.getLength() && !rReadRegistry.getLength())
+ {
+ bRegistryShouldBeValid = sal_True;
+ xRegistry = Reference< XSimpleRegistry >::query( xSimRegFac->createInstance() );
+ if (xRegistry.is())
+ {
+ if (bReadOnly)
+ {
+ xRegistry->open( rWriteRegistry, sal_True, sal_False );
+ } else
+ {
+ xRegistry->open( rWriteRegistry, sal_False, sal_True );
+ }
+ }
+ }
+ else // default registry
+ if (rWriteRegistry.getLength() && rReadRegistry.getLength() )
+ {
+ bRegistryShouldBeValid = sal_True;
+ xRegistry = Reference< XSimpleRegistry >::query( xNesRegFac->createInstance() );
+
+ Reference< XSimpleRegistry > xWriteReg = Reference< XSimpleRegistry >::query( xSimRegFac->createInstance() );
+ if ( xWriteReg.is() )
+ {
+ if (bReadOnly)
+ {
+ try
+ {
+ xWriteReg->open( rWriteRegistry, sal_True, sal_False );
+ }
+ catch(InvalidRegistryException&)
+ {
+ }
+
+ if (!xWriteReg->isValid())
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("specified first registry could not be open readonly")),
+ Reference< XInterface >() );
+ }
+ } else
+ {
+ xWriteReg->open( rWriteRegistry, sal_False, sal_True );
+ }
+ }
+
+ Reference< XSimpleRegistry > xReadReg = Reference< XSimpleRegistry >::query( xSimRegFac->createInstance() );
+ if ( xReadReg.is() )
+ {
+ xReadReg->open( rReadRegistry, sal_True, sal_False );
+ }
+
+ Reference< 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 Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("specified registry could not be initialized")),
+ Reference< XInterface >() );
+ }
+
+// OSL_ENSHURE( xRegistry.is(), "### got no registry!" );
+ Reference< XInterface > xInst;
+ if (xRegistry.is())
+ {
+ // init service factory with registry
+ Sequence< Any > aSeq( 1 );
+ // registry to work on
+ aSeq[0] = makeAny( xRegistry );
+ xInit->initialize( aSeq );
+
+ xInst = xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.TypeDescriptionManager")) );
+ }
+
+ // initial td manager held by service manager
+ if (! xInst.is())
+ {
+ // td registry provider registration
+ {
+ Reference< XSingleServiceFactory > xFac( createRegTDProviderFactory( xSF, rBootstrapPath ) );
+ if ( !xFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("type description provider component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xFac ) ), "### failed registering registry td provider!" );
+ }
+ // stoc td manager registration
+ {
+ Reference< XSingleServiceFactory > xFac( createTDManagerFactory( xSF, rBootstrapPath ) );
+ if ( !xFac.is() )
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("type description manager component not available")),
+ Reference< XInterface >() );
+ }
+ xSet->insert( makeAny( xFac ) );
+ OSL_ENSHURE( xSet->has( makeAny( xFac ) ), "### failed registering td manager!" );
+ }
+ xInst = xSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.TypeDescriptionManager")) );
+ }
+ if (xInst.is())
+ {
+ Reference< XInitialization > xTDMInit( xInst, UNO_QUERY );
+ if (xTDMInit.is())
+ xTDMInit->initialize( Sequence< Any >() );
+ } else
+ {
+ throw Exception( OUString(RTL_CONSTASCII_USTRINGPARAM("service \"com.sun.star.reflection.TypeDescriptionManager\" could not be initialized")),
+ Reference< XInterface >() );
+ }
+ return xSF;
+ }
+ return Reference< XMultiServiceFactory >();
+}
+
+//==================================================================================================
+Reference< XMultiServiceFactory > SAL_CALL createRegistryServiceFactory( const OUString & rWriteRegistry,
+ const OUString & rReadRegistry,
+ sal_Bool bReadOnly,
+ const OUString & rBootstrapPath )
+ throw( ::com::sun::star::uno::Exception )
+{
+ return createImplServiceFactory( rWriteRegistry, rReadRegistry, bReadOnly, rBootstrapPath );
+}
+
+}
+
diff --git a/cppuhelper/source/stdidlclass.cxx b/cppuhelper/source/stdidlclass.cxx
new file mode 100644
index 000000000000..139e1a8b53d1
--- /dev/null
+++ b/cppuhelper/source/stdidlclass.cxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdidlclass.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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>
+
+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
+ );
+
+ // XInterface
+ Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL acquire() { OWeakObject::acquire(); }
+ void SAL_CALL release() { OWeakObject::release(); }
+
+ // XIdlClassProvider
+ Sequence< Reference < XIdlClass > > SAL_CALL getIdlClasses(void);
+
+ // XIdlClass
+ virtual Sequence< Reference< XIdlClass > > SAL_CALL getClasses( ) throw(RuntimeException)
+ { return Sequence < Reference < XIdlClass > > (); }
+ virtual Reference< XIdlClass > SAL_CALL getClass( const ::rtl::OUString& aName ) 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& aName ) 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& aName ) 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& obj ) throw(RuntimeException) {}
+
+private:
+ OUString m_sImplementationName;
+ Sequence < OUString > m_seqSupportedInterface;
+ Sequence < Reference < XIdlClass > > m_seqSuperClasses;
+ Reference < XMultiServiceFactory > m_rSMgr;
+};
+
+
+OStdIdlClass::OStdIdlClass(
+ const Reference < XMultiServiceFactory > &rSMgr ,
+ const OUString & sImplementationName ,
+ const Reference < XIdlClass > & rSuperClass,
+ const Sequence < OUString > &seq
+ ) :
+ m_rSMgr( rSMgr ) ,
+ m_sImplementationName( sImplementationName ) ,
+ m_seqSupportedInterface( seq )
+{
+ 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();
+
+ if( m_rSMgr.is() ) {
+ Reference < XIdlReflection > rCoreRefl = Reference < XIdlReflection > (
+ m_rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection") ) ),
+ UNO_QUERY );
+
+ 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)
+{
+ // 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 )
+{
+ return SAL_STATIC_CAST(
+ XIdlClass * ,
+ new OStdIdlClass(
+ rSMgr ,
+ sImplementationName,
+ rSuperClass,
+ seqInterfaceNames
+ )
+ );
+}
+
+} //end namespace cppu
diff --git a/cppuhelper/source/typeprovider.cxx b/cppuhelper/source/typeprovider.cxx
new file mode 100644
index 000000000000..585c50a68071
--- /dev/null
+++ b/cppuhelper/source/typeprovider.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * $RCSfile: typeprovider.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/mutex.hxx>
+
+using namespace osl;
+using namespace com::sun::star::uno;
+
+namespace cppu
+{
+
+//__________________________________________________________________________________________________
+OImplementationId::~OImplementationId()
+{
+ delete _pSeq;
+}
+//__________________________________________________________________________________________________
+Sequence< sal_Int8 > OImplementationId::getImplementationId() const
+{
+ 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 )
+{
+ 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 )
+ : _aTypes( 1 + rAddTypes.getLength() )
+{
+ _aTypes[0] = rType1;
+ copy( _aTypes, rAddTypes, 1 );
+}
+//__________________________________________________________________________________________________
+OTypeCollection::OTypeCollection(
+ const Type & rType1,
+ const Type & rType2,
+ const Sequence< Type > & rAddTypes )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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 )
+ : _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/weak.cxx b/cppuhelper/source/weak.cxx
new file mode 100644
index 000000000000..3765fc5e7852
--- /dev/null
+++ b/cppuhelper/source/weak.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * $RCSfile: weak.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _CPPU_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+#ifndef _CPPU_HELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+
+using namespace osl;
+using namespace com::sun::star::uno;
+
+/** */ //for docpp
+namespace cppu
+{
+
+/**
+ The mutex to synchronize the the queryAdapted call throug the connection point
+ with the release call at the weak object.
+ */
+/*
+struct WeakMutexStatic
+{
+ Mutex aMutex;
+ sal_Bool bDestructed;
+
+ WeakMutexStatic()
+ : bDestructed( sal_False )
+ {}
+ ~WeakMutexStatic()
+ { bDestructed = sal_True; }
+};
+
+inline static Mutex & getWeakMutex() throw()
+{
+ static WeakMutexStatic s_wmstatic;
+ if (s_wmstatic.bDestructed)
+ return *Mutex::getGlobalMutex();
+ else
+ return s_wmstatic.aMutex;
+}
+*/
+
+// due to static Reflection destruction from usr, ther must be a mutex leak (#73272#)
+inline static Mutex & getWeakMutex() 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 ) 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);
+protected:
+ /// 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)
+{
+ OInterfaceIteratorHelper aIt( m_aReferences );
+ while( aIt.hasMoreElements() )
+ ((XReference *)aIt.next())->dispose();
+}
+
+// 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 -------------------------------------------------------
+//------------------------------------------------------------------------
+
+// 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)
+ {
+ if (m_pWeakConnectionPoint)
+ {
+ OWeakConnectionPoint * p = m_pWeakConnectionPoint;
+ m_pWeakConnectionPoint = 0;
+ p->dispose();
+ p->release();
+ }
+ delete this;
+ }
+}
+
+OWeakObject::~OWeakObject() throw(::com::sun::star::uno::RuntimeException)
+{
+}
+
+// XWeak
+Reference< XAdapter > SAL_CALL OWeakObject::queryAdapter(void) throw()
+{
+ 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()
+{
+}
+
+// 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();
+ OWeakRefListener(const OWeakRefListener& rRef);
+ OWeakRefListener(const Reference< XInterface >& xInt);
+ ~OWeakRefListener();
+
+ // XInterface
+ Any SAL_CALL queryInterface( const Type & rType ) throw();
+ 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);
+};
+
+OWeakRefListener::OWeakRefListener()
+ : m_aRefCount( 0 )
+{
+}
+
+OWeakRefListener::OWeakRefListener(const OWeakRefListener& rRef)
+ : m_aRefCount( 0 )
+{
+ m_XWeakConnectionPoint = rRef.m_XWeakConnectionPoint;
+
+ if (m_XWeakConnectionPoint.is())
+ m_XWeakConnectionPoint->addReference((XReference*)this);
+}
+
+OWeakRefListener::OWeakRefListener(const Reference< XInterface >& xInt)
+ : m_aRefCount( 0 )
+{
+ Reference< XWeak > xWeak( Reference< XWeak >::query( xInt ) );
+
+ if (xWeak.is())
+ {
+ m_XWeakConnectionPoint = xWeak->queryAdapter();
+
+ if (m_XWeakConnectionPoint.is())
+ {
+ m_XWeakConnectionPoint->addReference((XReference*)this);
+ }
+ }
+}
+
+OWeakRefListener::~OWeakRefListener()
+{
+ acquire(); // dont die again
+ if (m_XWeakConnectionPoint.is())
+ m_XWeakConnectionPoint->removeReference((XReference*)this);
+}
+
+// XInterface
+Any SAL_CALL OWeakRefListener::queryInterface( const Type & rType ) throw()
+{
+ 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)
+{
+ m_pImpl = new OWeakRefListener(xInt);
+ m_pImpl->acquire();
+}
+
+WeakReferenceHelper::WeakReferenceHelper(const WeakReferenceHelper& rWeakRef)
+{
+ m_pImpl = rWeakRef.m_pImpl;
+
+ if( m_pImpl )
+ m_pImpl->acquire();
+}
+
+WeakReferenceHelper& WeakReferenceHelper::operator=(const WeakReferenceHelper& rWeakRef)
+{
+ OWeakRefListener* pOldImpl;
+ {
+ // the weak reference is multithread save
+ MutexGuard guard(cppu::getWeakMutex());
+ if (m_pImpl == rWeakRef.m_pImpl)
+ return *this;
+
+ pOldImpl = m_pImpl;
+
+ m_pImpl = rWeakRef.m_pImpl;
+ if ( m_pImpl )
+ {
+ m_pImpl->acquire();
+ }
+ }
+
+ // maybe call the destructor. It is better to release the guard before this call.
+ if( pOldImpl )
+ pOldImpl->release();
+ return *this;
+}
+
+WeakReferenceHelper::~WeakReferenceHelper()
+{
+ if (m_pImpl)
+ m_pImpl->release();
+}
+
+Reference< XInterface > WeakReferenceHelper::get() const
+{
+ 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();
+
+ return Reference< XInterface >();
+}
+
+}
+}
+}
+}
+
diff --git a/cppuhelper/test/helpertest.idl b/cppuhelper/test/helpertest.idl
new file mode 100644
index 000000000000..eae610df7ab7
--- /dev/null
+++ b/cppuhelper/test/helpertest.idl
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: helpertest.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TEST_CPPUTEST_IDL_
+#define _TEST_CPPUTEST_IDL_
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/uno/TypeClass.idl>
+
+module test
+{
+
+
+[ uik(a6121273-3462-11d3-87A400A0-24494732), ident("A", 1.0) ]
+interface A : com::sun::star::uno::XInterface
+{
+ string a();
+};
+
+[ uik(b227a3A0-33d6-11d1-aabe02a0-249d5590), ident("BA", 1.0) ]
+interface BA : A
+{
+ string ba();
+};
+
+[ uik(ca27a3A0-33d6-11d1-aabe02a0-249d5590), ident("CA", 1.0) ]
+interface CA : A
+{
+ string ca();
+};
+
+[ uik(dba7a3A0-33d6-11d1-aabe02a0-249d5590), ident("DBA", 1.0) ]
+interface DBA : BA
+{
+ string dba();
+};
+
+[ uik(e227a3A0-33d6-11d1-aabe02a0-249d5590), ident("E", 1.0) ]
+interface E : com::sun::star::uno::XInterface
+{
+ string e();
+};
+
+[ uik(fe27a3A0-33d6-11d1-aabe02a0-249d5590), ident("FE", 1.0) ]
+interface FE : E
+{
+ string fe();
+};
+
+[ uik(0227a3A0-33d6-11d1-aabe02a0-249d5590), ident("G", 1.0) ]
+interface G : com::sun::star::uno::XInterface
+{
+ string g();
+ string a();
+};
+
+}; //module test
+
+#endif
diff --git a/cppuhelper/test/makefile.mk b/cppuhelper/test/makefile.mk
new file mode 100644
index 000000000000..1e3ca91a1071
--- /dev/null
+++ b/cppuhelper/test/makefile.mk
@@ -0,0 +1,133 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME= cppuhelper
+TARGET= testhelper
+LIBTARGET= NO
+TARGETTYPE= CUI
+ENABLE_EXCEPTIONS=TRUE
+NO_BSYMBOLIC= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT= $(OUT)$/inc$/test
+INCPRE+= $(OUT)$/inc$/test
+
+OBJFILES= \
+ $(OBJ)$/testhelper.obj \
+ $(OBJ)$/testpropshlp.obj \
+ $(OBJ)$/testidlclass.obj \
+ $(OBJ)$/testproptyphlp.obj \
+ $(OBJ)$/testimplhelper.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+
+APP1STDLIBS+= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+APP1DEF= $(MISC)$/$(APP1TARGET).def
+
+ALLIDLFILES:= helpertest.idl
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : $(BIN)$/cpputest.rdb \
+ unoheader \
+ ALLTAR
+
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+CPPUMAKERFLAGS =
+.IF "$(COM)" == "MSC"
+CPPUMAKERFLAGS = -L
+.ENDIF
+
+TYPES:=test.A;test.BA;test.CA;test.DBA;test.E;test.FE;test.G
+HELPERTYPES:=com.sun.star.uno.XReference;com.sun.star.uno.XAdapter;com.sun.star.uno.XAggregation;com.sun.star.uno.XWeak;com.sun.star.lang.XComponent;com.sun.star.lang.XTypeProvider;com.sun.star.lang.XEventListener;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.registry.XRegistryKey;com.sun.star.lang.XInitialization;com.sun.star.lang.XServiceInfo;com.sun.star.loader.XImplementationLoader;com.sun.star.lang.IllegalAccessException
+FACTORYTYPES:=com.sun.star.lang.XComponent;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;com.sun.star.lang.XMultiServiceFactory;com.sun.star.loader.XImplementationLoader;com.sun.star.registry.XImplementationRegistration;com.sun.star.container.XSet;com.sun.star.lang.XSingleServiceFactory
+
+$(BIN)$/cpputest.rdb: $(ALLIDLFILES)
+ +unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $?
+ +regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ +regmerge $@ / $(UNOUCRRDB)
+ touch $@
+
+unoheader: $(BIN)$/cpputest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TYPES);$(HELPERTYPES);$(FACTORYTYPES)" $(BIN)$/cpputest.rdb
+
diff --git a/cppuhelper/test/testhelper.cxx b/cppuhelper/test/testhelper.cxx
new file mode 100644
index 000000000000..b252daa08e8a
--- /dev/null
+++ b/cppuhelper/test/testhelper.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: testhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <rtl/ustrbuf.hxx>
+#include <osl/diagnose.h>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include "testhelper.hxx"
+
+using namespace rtl;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("cpputest.rdb") ) ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ),
+ UNO_QUERY );
+ OSL_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+#ifdef UNX
+#define REG_PREFIX "lib"
+#define DLL_POSTFIX ".so"
+#else
+#define REG_PREFIX ""
+#define DLL_POSTFIX ".dll"
+#endif
+ OString aLibName( REG_PREFIX );
+ aLibName += "corefl";
+#ifndef OS2
+ aLibName += DLL_POSTFIX;
+#endif
+ xImplReg->registerImplementation(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary") ),
+ OUString::createFromAscii( aLibName.getStr() ),
+ Reference< XSimpleRegistry >() );
+
+ testPropertyTypeHelper();
+ testidlclass( xMgr );
+ test_PropertySetHelper();
+ test_ImplHelper( xMgr );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+
+ printf( "Test finished\n" );
+ return 0;
+}
diff --git a/cppuhelper/test/testhelper.hxx b/cppuhelper/test/testhelper.hxx
new file mode 100644
index 000000000000..602fd19ca8e0
--- /dev/null
+++ b/cppuhelper/test/testhelper.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * $RCSfile: testhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+void testidlclass( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > &r);
+void testPropertyTypeHelper();
+void test_PropertySetHelper();
+void test_ImplHelper( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > & xSF );
diff --git a/cppuhelper/test/testidlclass.cxx b/cppuhelper/test/testidlclass.cxx
new file mode 100644
index 000000000000..bcf2cb8b9aa2
--- /dev/null
+++ b/cppuhelper/test/testidlclass.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * $RCSfile: testidlclass.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <assert.h>
+
+#include <cppuhelper/stdidlclass.hxx>
+
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include "testhelper.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::reflection;
+using namespace ::rtl;
+
+
+
+
+void testidlclass( const Reference < XMultiServiceFactory > &rSMgr)
+{
+ const OUString sImplName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.cpputest") ) );
+
+ // this reference is static to test behaviour during exiting application
+ static Reference < XIdlClass > r =
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+ assert( r.is() );
+
+
+ { // test the xidlclassprovider interface !
+ Reference< XIdlClassProvider > rProv( r , UNO_QUERY );
+ assert( rProv.is() );
+
+ {
+ Sequence < Reference < XIdlClass > > seq = rProv->getIdlClasses();
+
+ // is always one
+ assert( seq.getLength() == 1 );
+
+ // test the weak reference
+ rProv->getIdlClasses();
+
+ }
+
+ rProv->getIdlClasses();
+
+
+ }
+
+
+ assert( r->getName() == sImplName );
+
+ // test equals
+ Reference < XIdlClass > r2 =
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+ // test for implementation name
+ assert( r2->equals( r ) );
+
+ Sequence < Reference < XIdlClass > > seqIdlClass = r->getInterfaces();
+
+ //TODO !
+ // one idl class for one interface
+ // this test fails, if core reflection fails !
+// assert( 1 == seqIdlClass.getLength() );
+// Reference < XIdlClass > rIdlInterface = seqIdlClass.getArray()[0];
+
+ // check for IdlClass interface returned by Core Reflection
+// assert( rIdlInterface.is() );
+
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+
+
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+
+ // Test all ten templates
+ ::cppu::createStandardClass(
+ rSMgr ,
+ sImplName,
+ Reference < XIdlClass > () ,
+ (XMultiServiceFactory * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0 ,
+ (XServiceInfo * ) 0
+ );
+}
diff --git a/cppuhelper/test/testimplhelper.cxx b/cppuhelper/test/testimplhelper.cxx
new file mode 100644
index 000000000000..0a0f1c1e18ba
--- /dev/null
+++ b/cppuhelper/test/testimplhelper.cxx
@@ -0,0 +1,387 @@
+/*************************************************************************
+ *
+ * $RCSfile: testimplhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+
+#include <test/A.hpp>
+#include <test/BA.hpp>
+#include <test/CA.hpp>
+#include <test/DBA.hpp>
+#include <test/E.hpp>
+#include <test/FE.hpp>
+#include <test/G.hpp>
+
+#include <com/sun/star/lang/IllegalAccessException.hpp>
+
+using namespace test;
+using namespace rtl;
+using namespace osl;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+
+//==================================================================================================
+struct TestImpl : public ImplHelper4< CA, DBA, FE, G >
+{
+ sal_Int32 nRef;
+
+ virtual ~TestImpl()
+ { OSL_TRACE( "> TestImpl dtor called... <\n" ); }
+
+ virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+ { return ImplHelper4< CA, DBA, FE, G >::queryInterface( rType ); }
+ virtual void SAL_CALL acquire( ) throw(::com::sun::star::uno::RuntimeException)
+ { ++nRef; }
+ virtual void SAL_CALL release( ) throw(::com::sun::star::uno::RuntimeException)
+ { if (! --nRef) delete this; }
+
+ // A
+ virtual OUString SAL_CALL a() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
+ // BA
+ virtual OUString SAL_CALL ba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
+ // CA
+ virtual OUString SAL_CALL ca() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
+ // DBA
+ virtual OUString SAL_CALL dba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
+ // E
+ virtual OUString SAL_CALL e() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
+ // FE
+ virtual OUString SAL_CALL fe() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
+ // G
+ virtual OUString SAL_CALL g() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
+};
+
+//==================================================================================================
+struct TestWeakAggImpl : public WeakAggImplHelper4< CA, DBA, FE, G >
+{
+ virtual ~TestWeakAggImpl()
+ { OSL_TRACE( "> TestWeakAggImpl dtor called... <\n" ); }
+
+ // A
+ virtual OUString SAL_CALL a() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
+ // BA
+ virtual OUString SAL_CALL ba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
+ // CA
+ virtual OUString SAL_CALL ca() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
+ // DBA
+ virtual OUString SAL_CALL dba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
+ // E
+ virtual OUString SAL_CALL e() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
+ // FE
+ virtual OUString SAL_CALL fe() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
+ // G
+ virtual OUString SAL_CALL g() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
+};
+
+//==================================================================================================
+struct TestWeakImpl : public WeakImplHelper4< CA, DBA, FE, G >
+{
+ virtual ~TestWeakImpl()
+ { OSL_TRACE( "> TestWeakImpl dtor called... <\n" ); }
+
+ // A
+ virtual OUString SAL_CALL a() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
+ // BA
+ virtual OUString SAL_CALL ba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
+ // CA
+ virtual OUString SAL_CALL ca() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
+ // DBA
+ virtual OUString SAL_CALL dba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
+ // E
+ virtual OUString SAL_CALL e() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
+ // FE
+ virtual OUString SAL_CALL fe() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
+ // G
+ virtual OUString SAL_CALL g() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
+};
+
+//==================================================================================================
+struct TestWeakComponentImpl : public WeakComponentImplHelper4< CA, DBA, FE, G >
+{
+ Mutex m;
+ TestWeakComponentImpl()
+ : WeakComponentImplHelper4< CA, DBA, FE, G >( m )
+ {}
+ virtual ~TestWeakComponentImpl()
+ { OSL_TRACE( "> TestWeakComponentImpl dtor called... <\n" ); }
+
+ void SAL_CALL disposing()
+ { OSL_TRACE( "> TestWeakComponentImpl disposing called... <\n" ); }
+
+ // A
+ virtual OUString SAL_CALL a() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
+ // BA
+ virtual OUString SAL_CALL ba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
+ // CA
+ virtual OUString SAL_CALL ca() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
+ // DBA
+ virtual OUString SAL_CALL dba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
+ // E
+ virtual OUString SAL_CALL e() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
+ // FE
+ virtual OUString SAL_CALL fe() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
+ // G
+ virtual OUString SAL_CALL g() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
+};
+
+//==================================================================================================
+struct TestWeakAggComponentImpl : public WeakAggComponentImplHelper4< CA, DBA, FE, G >
+{
+ Mutex m;
+ TestWeakAggComponentImpl()
+ : WeakAggComponentImplHelper4< CA, DBA, FE, G >( m )
+ {}
+ virtual ~TestWeakAggComponentImpl()
+ { OSL_TRACE( "> TestWeakAggComponentImpl dtor called... <\n" ); }
+
+ void SAL_CALL disposing()
+ { OSL_TRACE( "> TestWeakAggComponentImpl disposing called... <\n" ); }
+
+ // A
+ virtual OUString SAL_CALL a() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
+ // BA
+ virtual OUString SAL_CALL ba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
+ // CA
+ virtual OUString SAL_CALL ca() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
+ // DBA
+ virtual OUString SAL_CALL dba() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
+ // E
+ virtual OUString SAL_CALL e() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
+ // FE
+ virtual OUString SAL_CALL fe() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
+ // G
+ virtual OUString SAL_CALL g() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
+};
+
+//==================================================================================================
+static void dotest( const Reference< XInterface > & xOriginal )
+{
+ Reference< A > xa( xOriginal, UNO_QUERY );
+ OSL_ENSHURE( xa->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### A failed!" );
+ Reference< BA > xba( xa, UNO_QUERY );
+ OSL_ENSHURE( xba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### BA failed!" );
+ OSL_ENSHURE( xba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### BA failed!" );
+ Reference< CA > xca( xba, UNO_QUERY );
+ OSL_ENSHURE( xca->ca().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ca") ), "### CA failed!" );
+ OSL_ENSHURE( xca->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### CA failed!" );
+ Reference< DBA > xdba( xca, UNO_QUERY );
+ OSL_ENSHURE( xdba->dba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dba") ), "### DBA failed!" );
+ OSL_ENSHURE( xdba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### DBA failed!" );
+ OSL_ENSHURE( xdba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### DBA failed!" );
+ Reference< E > xe( xdba, UNO_QUERY );
+ OSL_ENSHURE( xe->e().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("e") ), "### E failed!" );
+ Reference< FE > xfe( xe, UNO_QUERY );
+ OSL_ENSHURE( xfe->fe().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fe") ), "### FE failed!" );
+ Reference< G > xg( xfe, UNO_QUERY );
+ OSL_ENSHURE( xg->g().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("g") ), "### G failed!" );
+ OSL_ENSHURE( xg->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### G failed!" );
+
+ // type provider
+ Reference< XTypeProvider > xProv( xg, UNO_QUERY );
+ Sequence< Type > aTypes( xProv->getTypes() );
+
+ // CA, DBA, FE, G, XTypeProvider
+ OSL_ASSERT( aTypes[0].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.CA") ) );
+ OSL_ASSERT( aTypes[1].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.DBA") ) );
+ OSL_ASSERT( aTypes[2].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.FE") ) );
+ OSL_ASSERT( aTypes[3].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.G") ) );
+ OSL_ASSERT( aTypes[4].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XTypeProvider") ) );
+
+ Reference< XComponent > xComp( xg, UNO_QUERY );
+ Reference< XAggregation > xAgg( xg, UNO_QUERY );
+ if (xComp.is())
+ {
+ if (xAgg.is())
+ {
+ OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
+ OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XAggregation") ) );
+ OSL_ASSERT( aTypes[7].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XComponent") ) );
+ OSL_ASSERT( aTypes.getLength() == 8 );
+ }
+ else
+ {
+ OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
+ OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XComponent") ) );
+ OSL_ASSERT( aTypes.getLength() == 7 );
+ }
+ }
+ else
+ {
+ if (xAgg.is())
+ {
+ OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
+ OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XAggregation") ) );
+ OSL_ASSERT( aTypes.getLength() == 7 );
+ }
+ else
+ {
+ Reference< XWeak > xWeak( xg, UNO_QUERY );
+ if (xWeak.is())
+ {
+ OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
+ OSL_ASSERT( aTypes.getLength() == 6 );
+ }
+ else
+ {
+ OSL_ASSERT( aTypes.getLength() == 5 );
+ }
+ }
+ }
+
+ OSL_ENSHURE( Reference< XInterface >::query( xg ) == xOriginal, "### root!" );
+}
+
+//==================================================================================================
+void test_ImplHelper( const Reference< XMultiServiceFactory > & xSF )
+{
+ Reference< XInterface > xImpl( (XTypeProvider *)new TestImpl() );
+ Reference< XInterface > xWeakImpl( (OWeakObject *)new TestWeakImpl() );
+ Reference< XInterface > xWeakAggImpl( (OWeakObject *)new TestWeakAggImpl() );
+ Reference< XInterface > xWeakComponentImpl( (OWeakObject *)new TestWeakComponentImpl() );
+ Reference< XInterface > xWeakAggComponentImpl( (OWeakObject *)new TestWeakAggComponentImpl() );
+ dotest( xImpl );
+ dotest( xWeakImpl );
+ dotest( xWeakAggImpl );
+ dotest( xWeakComponentImpl );
+ dotest( xWeakAggComponentImpl );
+ //
+
+ // exception helper test
+ try
+ {
+ throwException( makeAny( RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("runtime exc") ), xImpl ) ) );
+ }
+ catch (RuntimeException & rExc)
+ {
+ OSL_ENSHURE( rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("runtime exc") ) && rExc.Context == xImpl,
+ "### unexpected exception content!" );
+ try
+ {
+ throwException( makeAny( Exception(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("exc") ), rExc.Context ) ) );
+ }
+ catch (IllegalAccessException &)
+ {
+ OSL_ENSHURE( sal_False, "### unexpected IllegalAccessException exception caught!" );
+ }
+ catch (Exception rExc)
+ {
+ OSL_ENSHURE( rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("exc") ) && rExc.Context == xImpl,
+ "### unexpected exception content!" );
+ try
+ {
+ throwException( makeAny( IllegalAccessException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("axxess exc") ), rExc.Context ) ) );
+ }
+ catch (IllegalAccessException & rExc)
+ {
+ OSL_ENSHURE( rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("axxess exc") ) && rExc.Context == xImpl,
+ "### unexpected exception content!" );
+ return;
+ }
+ }
+ }
+ catch (...)
+ {
+ }
+ OSL_ENSHURE( sal_False, "### exception test failed!" );
+}
+
diff --git a/cppuhelper/test/testpropshlp.cxx b/cppuhelper/test/testpropshlp.cxx
new file mode 100644
index 000000000000..0626375085c2
--- /dev/null
+++ b/cppuhelper/test/testpropshlp.cxx
@@ -0,0 +1,1198 @@
+/*************************************************************************
+ *
+ * $RCSfile: testpropshlp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <osl/mutex.hxx>
+#include <osl/diagnose.h>
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <cppuhelper/proptypehlp.hxx>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+using namespace ::cppu;
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+
+
+/**********************
+*
+**********************/
+static Property * getPropertyTable1()
+{
+ static Property *pTable = 0;
+
+ if( ! pTable ) {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pTable ) {
+ static Property aTable[] =
+ {
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("a") ), 0, getCppuType( (OUString *)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), //OUString
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("b") ), 1, getCppuCharType( ) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), //Char
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("c") ), 2, getCppuType( (sal_Int32*)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), //sal_Int32
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("d") ), 5, getCppuType( (double*)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), //double
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("e") ), 7, getCppuBooleanType() ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), //BOOL
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("f") ), 8, getCppuType( (Any*)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ) //Any
+ };
+ pTable = aTable;
+ }
+ }
+ return pTable;
+}
+
+
+static Property * getPropertyTable2()
+{
+ static Property *pTable = 0;
+
+ if( ! pTable ) {
+ MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if( ! pTable ) {
+ static Property aTable[] =
+ {
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("f") ), 8, getCppuType( (Any *)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // Any
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("b") ), 1, getCppuCharType( ),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // Char
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("a") ), 0, getCppuType( (OUString*)0),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // OUString
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("d") ), 5, getCppuType( (double*)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // Double
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("c") ), 2, getCppuType( (sal_Int32*)0),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // sal_Int32
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("e") ), 7, getCppuBooleanType() ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ) // Bool
+ };
+ pTable = aTable;
+ }
+ }
+ return pTable;
+}
+
+static Property * getPropertyTable3()
+{
+ static Property *pTable = 0;
+
+ if( ! pTable ) {
+ MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if( ! pTable ) {
+ static Property aTable[] =
+ {
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("b") ), 1, getCppuCharType( ),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // Char
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("f") ), 8, getCppuType( (Any *)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // any
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("a") ), 0, getCppuType( (OUString*)0),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ) // OUString
+ };
+ pTable = aTable;
+ }
+ }
+ return pTable;
+}
+
+
+static Property * getPropertyTable4()
+{
+ static Property *pTable = 0;
+
+ if( ! pTable ) {
+ MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if( ! pTable ) {
+ static Property aTable[] =
+ {
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("a") ), 0, getCppuType( (OUString*)0),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // OUString
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("b") ), 1, getCppuCharType( ),
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ), // Char
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("f") ), 2, getCppuType( (Any *)0) ,
+ PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID ) // Any
+ };
+ pTable = aTable;
+ }
+ }
+ return pTable;
+}
+
+
+
+/**********************
+*
+* Note : all Property names must be in the 127 ASCII subset !
+*
+**********************/
+
+
+void test_PropertyArrayHelper()
+{
+ // Test getProperties() and getCount()
+ {
+ OPropertyArrayHelper a1( getPropertyTable1(), 6 );
+ OSL_ENSHURE( 6 == a1.getCount(), "not all properties inserted" );
+ Sequence< Property > aProps = a1.getProperties();
+ Property * pP = aProps.getArray();
+ OSL_ENSHURE( 6 == aProps.getLength(), "getProperties() gives not all properties" );
+ for( int i = 0; i < 6; i++ )
+ {
+ OSL_ENSHURE( pP[i].Name == getPropertyTable1()[i].Name , "Name not correct" );
+ OSL_ENSHURE( pP[i].Handle == getPropertyTable1()[i].Handle, "Handle not correct" );
+ OSL_ENSHURE( pP[i].Attributes == getPropertyTable1()[i].Attributes, "Attributes not correct" );
+ OSL_ENSHURE( pP[i].Type == getPropertyTable1()[i].Type, "Type not correct" );
+ }
+ }
+
+ // Test sorting
+ {
+ OPropertyArrayHelper a1( getPropertyTable2(), 6, sal_False );
+ Sequence< Property > aProps = a1.getProperties();
+ Property * pP = aProps.getArray();
+ OSL_ENSHURE( 6 == aProps.getLength(), "getProperties() gives not all properties" );
+ for( int i = 0; i < 6; i++ )
+ {
+ OSL_ENSHURE( pP[i].Name == getPropertyTable2()[i].Name , "Name not correct" );
+ OSL_ENSHURE( pP[i].Handle == getPropertyTable2()[i].Handle, "Handle not correct" );
+ OSL_ENSHURE( pP[i].Attributes == getPropertyTable2()[i].Attributes, "Attributes not correct" );
+ OSL_ENSHURE( pP[i].Type == getPropertyTable2()[i].Type, "Type not correct" );
+ }
+ }
+
+ // Test sorting
+ {
+ OPropertyArrayHelper a1( getPropertyTable3(), 3, sal_False );
+ Sequence< Property > aProps = a1.getProperties();
+ Property * pP = aProps.getArray();
+ OSL_ENSHURE( 3 == aProps.getLength(), "getProperties() gives not all properties" );
+ for( int i = 0; i < 3; i++ )
+ {
+ OSL_ENSHURE( pP[i].Name == getPropertyTable3()[i].Name , "Name not correct" );
+ OSL_ENSHURE( pP[i].Handle == getPropertyTable3()[i].Handle, "Handle not correct" );
+ OSL_ENSHURE( pP[i].Attributes == getPropertyTable3()[i].Attributes, "Attributes not correct" );
+ OSL_ENSHURE( pP[i].Type == getPropertyTable3()[i].Type, "Type not correct" );
+ }
+ }
+
+ // Test getPropertyByName and hasPropertyByName
+ {
+ OPropertyArrayHelper a1( getPropertyTable1(), 6 );
+ for( int i = 0; i < 6; i++ )
+ {
+ OSL_ENSHURE( a1.hasPropertyByName( getPropertyTable1()[i].Name ), "hasPropertyByName not correct" );
+ Property aP = a1.getPropertyByName( getPropertyTable1()[i].Name );
+ OSL_ENSHURE( aP.Name == getPropertyTable1()[i].Name , "Name not correct" );
+ OSL_ENSHURE( aP.Handle == getPropertyTable1()[i].Handle, "Handle not correct" );
+ OSL_ENSHURE( aP.Attributes == getPropertyTable1()[i].Attributes, "Attributes not correct" );
+ OSL_ENSHURE( aP.Type == getPropertyTable1()[i].Type, "Type not correct" );
+ }
+
+ OSL_ENSHURE( !a1.hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM("never exist") ) ), "hasPropertyByName not correct" );
+ try
+ {
+ a1.getPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM("never exist") ) );
+ OSL_ENSHURE( sal_False, "exeption not thrown" );
+ }
+ catch( UnknownPropertyException & )
+ {
+ }
+ }
+
+ // Test getHandleByName
+ {
+ OPropertyArrayHelper a1( getPropertyTable1(), 6 );
+ for( int i = 0; i < 6; i++ )
+ {
+ sal_Int32 Handle = a1.getHandleByName( getPropertyTable1()[i].Name );
+ OSL_ENSHURE( Handle == getPropertyTable1()[i].Handle, "Handle not correct" );
+ }
+ sal_Int32 Handle = a1.getHandleByName( OUString( RTL_CONSTASCII_USTRINGPARAM("asdaf") ) );
+ OSL_ENSHURE( Handle == -1, "Handle not correct" );
+ }
+
+ // Test fillPropertyMembersByHandle
+ {
+ OPropertyArrayHelper a1( getPropertyTable1(), 6 );
+ int i;
+ for( i = 0; i < 6; i++ )
+ {
+ sal_Int16 nAttributes;
+ OUString aPropName;
+ sal_Bool b = a1.fillPropertyMembersByHandle( &aPropName, &nAttributes, getPropertyTable1()[i].Handle );
+ OSL_ENSHURE( b, "fillPropertyMembersByHandle: handle not found" );
+ OSL_ENSHURE( nAttributes == getPropertyTable1()[i].Attributes, "fillPropertyMembersByHandle: Attributes not correct" );
+ OSL_ENSHURE( aPropName == getPropertyTable1()[i].Name , "fillPropertyMembersByHandle: Name not correct" );
+ }
+ OSL_ENSHURE( !a1.fillPropertyMembersByHandle( NULL, NULL, 66666 ), "fillPropertyMembersByHandle: handle found" );
+ // optimized table
+ OPropertyArrayHelper a4( getPropertyTable4(), 3 );
+ for( i = 0; i < 3; i++ )
+ {
+ sal_Int16 nAttributes;
+ OUString aPropName;
+ sal_Bool b = a1.fillPropertyMembersByHandle( &aPropName, &nAttributes, getPropertyTable4()[i].Handle );
+ OSL_ENSHURE( b, "fillPropertyMembersByHandle: handle not found" );
+ OSL_ENSHURE( nAttributes == getPropertyTable1()[i].Attributes, "fillPropertyMembersByHandle: Attributes not correct" );
+ OSL_ENSHURE( aPropName == getPropertyTable1()[i].Name , "fillPropertyMembersByHandle: Name not correct" );
+ }
+ OSL_ENSHURE( !a4.fillPropertyMembersByHandle( NULL, NULL, 66666 ), "fillPropertyMembersByHandle: handle found" );
+ }
+
+ // Test fillHandles
+ {
+ OPropertyArrayHelper a1( getPropertyTable1(), 6 );
+ Sequence< OUString > aS( 4 );
+ sal_Int32 Handles[4];
+ // muss sortiert sein
+ aS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("a") );
+ aS.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("d") );
+ aS.getArray()[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("f") );
+ aS.getArray()[3] = OUString( RTL_CONSTASCII_USTRINGPARAM("t") );
+ sal_Int32 nHitCount = a1.fillHandles( Handles, aS );
+ OSL_ENSHURE( nHitCount == 3, "wrong number of hits " );
+ OSL_ENSHURE( Handles[0] == getPropertyTable1()[0].Handle, "Handle not correct" );
+ OSL_ENSHURE( Handles[1] == getPropertyTable1()[3].Handle, "Handle not correct" );
+ OSL_ENSHURE( Handles[2] == getPropertyTable1()[5].Handle, "Handle not correct" );
+ OSL_ENSHURE( Handles[3] == -1, "Handle not correct" );
+ }
+}
+
+
+
+
+//----------------------------------------------------
+// test_OPropertySetHelper
+//----------------------------------------------------
+struct MutexContainer
+{
+ Mutex aMutex;
+};
+class test_OPropertySetHelper :
+ public MutexContainer,
+ public OBroadcastHelper ,
+ public OPropertySetHelper,
+ public OWeakObject
+{
+public:
+
+ test_OPropertySetHelper( Property * p, sal_Int32 n )
+ : MutexContainer()
+ , OBroadcastHelper( ((MutexContainer *)this)->aMutex )
+// , OPropertySetHelper( *SAL_STATIC_CAST(OBroadcastHelper *,this))
+ // MSCI 4 bug ! :
+ // OBroadcastHelper == OBroadcastHelperVar<OMultiTypeInterfaceContainerHelper>
+ , OPropertySetHelper(
+ *SAL_STATIC_CAST(OBroadcastHelperVar<OMultiTypeInterfaceContainerHelper> *,this))
+ , bBOOL( sal_False )
+ , nINT16( 0 )
+ , nINT32( 0 )
+ , pBasicProps( p )
+ , nPropCount( n )
+ {
+ }
+
+
+ ~test_OPropertySetHelper()
+ {
+ }
+
+ void dispose()
+ {
+ // see comphlp.cxx
+ sal_Bool bDoDispose = sal_False;
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ if( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ rBHelper.bInDispose = sal_True;
+ bDoDispose = sal_True;
+ }
+ }
+ if( bDoDispose )
+ {
+ disposing();
+ EventObject aEvt;
+ aEvt.Source = Reference < XInterface > ( SAL_STATIC_CAST( OWeakObject * ,this) );
+
+ rBHelper.aLC.disposeAndClear( aEvt );
+ rBHelper.bDisposed = sal_True;
+ rBHelper.bInDispose = sal_False;
+ }
+ }
+
+ // XInterface
+ Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+ {
+ Any aRet( OPropertySetHelper::queryInterface( rType ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+ }
+ void SAL_CALL acquire()
+ { OWeakObject::acquire(); }
+ void SAL_CALL release()
+ { OWeakObject::release(); }
+
+ // XPropertySet
+ Reference < XPropertySetInfo > SAL_CALL getPropertySetInfo();
+
+ sal_Bool bBOOL;
+ sal_Int16 nINT16;
+ sal_Int32 nINT32;
+ Property * pBasicProps;
+ sal_Int32 nPropCount;
+protected:
+ IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue,
+ sal_Int32 nHandle, const Any& rValue );
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue );
+ void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const;
+};
+
+//----------------------------------------------------------------------
+//------ The Properties of this implementation -------------------------
+//----------------------------------------------------------------------
+// Id must be the index into the array
+#define PROPERTY_BOOL 0
+#define PROPERTY_INT16 1
+#define PROPERTY_INT32 2
+
+// Max number of properties
+#define PROPERTY_COUNT 4
+// Names of Properties
+/**
+ * All Properties of this implementation. Must be sorted by name.
+ */
+Property * getBasicProps()
+{
+ static Property *pTable = 0;
+
+ if( ! pTable ) {
+ MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
+ if( ! pTable ) {
+
+ static Property aBasicProps[PROPERTY_COUNT] =
+ {
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ) , PROPERTY_BOOL , getCppuBooleanType(), PropertyAttribute::READONLY ),
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ) , PROPERTY_INT16,
+ getCppuType( (sal_Int16*)0 ), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ) , PROPERTY_INT32, getCppuType( (sal_Int32*)0 ), PropertyAttribute::BOUND ),
+ Property( OUString( RTL_CONSTASCII_USTRINGPARAM("TEST") ) , 55 , getCppuType( (sal_Int32*)0), PropertyAttribute::BOUND )
+ };
+ pTable = aBasicProps;
+ }
+ }
+ return pTable;
+}
+
+
+//----------------------------------------------------
+// test_OPropertySetHelper_Listener
+//----------------------------------------------------
+class test_OPropertySetHelper_Listener
+ : public WeakImplHelper3< XPropertyChangeListener, XPropertiesChangeListener, XVetoableChangeListener >
+{
+public:
+ sal_Int32 nDisposing;
+ Mutex aMutex;
+ Any * pExceptedListenerValues;
+ sal_Int32 nCount;
+ sal_Int32 nCurrent;
+
+ test_OPropertySetHelper_Listener( Any * p = 0, sal_Int32 n = 0 )
+ : nDisposing( 0 )
+ , pExceptedListenerValues( p )
+ , nCount( n )
+ , nCurrent( 0 )
+ {
+ }
+ ~test_OPropertySetHelper_Listener()
+ {
+ }
+
+ sal_Int32 getRefCount()
+ { return m_refCount; }
+
+ // XEventListener
+ void SAL_CALL disposing(const EventObject& evt) throw ( RuntimeException)
+ {
+ MutexGuard aGuard( aMutex );
+ nDisposing++;
+ }
+
+ // XPropertyChangeListener
+ void SAL_CALL propertyChange(const PropertyChangeEvent& evt) throw (RuntimeException)
+ {
+ if( !pExceptedListenerValues )
+ return;
+ MutexGuard aGuard( aMutex );
+ OSL_ENSHURE( nCurrent +1 < nCount, "PropertySetHelper: too many listener calls" );
+
+ switch( evt.PropertyHandle )
+ {
+ case PROPERTY_BOOL:
+ {
+ OSL_ENSHURE( sal_False , "PropertySetHelper: BOOL cannot change" );
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ), "PropertySetHelper: wrong name" );
+ }
+ break;
+
+ case PROPERTY_INT16:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), "PropertySetHelper: wrong name" );
+
+ OSL_ENSHURE( pExceptedListenerValues[nCurrent].getValueType().getTypeClass() == TypeClass_SHORT ,
+ "PropertySetHelper: wrong data type" );
+
+ sal_Int16 nInt16, nOldInt16;
+ pExceptedListenerValues[nCurrent] >>= nInt16;
+ evt.OldValue >>= nOldInt16;
+ OSL_ENSHURE( nInt16 == nOldInt16, "PropertySetHelper: wrong old value" );
+
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt16;
+ evt.NewValue >>= nOldInt16;
+ OSL_ENSHURE( nInt16 == nOldInt16 , "PropertySetHelper: wrong new value" );
+ }
+ break;
+
+ case PROPERTY_INT32:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
+
+ sal_Int32 nInt32,nOldInt32;
+
+ pExceptedListenerValues[nCurrent] >>= nInt32;
+ evt.OldValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong old value" );
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt32;
+ evt.NewValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong new value" );
+ }
+ break;
+
+ default:
+ OSL_ENSHURE( sal_False, "XPropeSetHelper: invalid property handle" );
+ }
+ nCurrent += 2;
+ }
+
+ // XVetoableChangeListener
+ void SAL_CALL vetoableChange(const PropertyChangeEvent& evt) throw (PropertyVetoException, RuntimeException)
+ {
+ if( !pExceptedListenerValues )
+ return;
+ MutexGuard aGuard( aMutex );
+ OSL_ENSHURE( nCurrent +1 < nCount, "PropertySetHelper: too many listener calls" );
+
+ switch( evt.PropertyHandle )
+ {
+ case PROPERTY_BOOL:
+ {
+ OSL_ENSHURE( sal_False , "PropertySetHelper: BOOL cannot change" );
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ), "PropertySetHelper: wrong name" );
+ }
+ break;
+
+ case PROPERTY_INT16:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), "PropertySetHelper: wrong name" );
+
+ sal_Int16 nInt16, nOldInt16;
+ pExceptedListenerValues[nCurrent] >>= nInt16;
+ evt.OldValue >>= nOldInt16;
+
+ OSL_ENSHURE( nInt16 == nOldInt16,"PropertySetHelper: wrong old value" );
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt16;
+ evt.NewValue >>= nOldInt16;
+ OSL_ENSHURE( nInt16 == nOldInt16 , "PropertySetHelper: wrong new value" );
+
+ if( nOldInt16 == 100 )
+ {
+ nCurrent += 2;
+ throw PropertyVetoException();
+ }
+ }
+ break;
+
+ case PROPERTY_INT32:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
+
+ sal_Int32 nInt32,nOldInt32;
+ pExceptedListenerValues[nCurrent] >>= nInt32;
+ evt.OldValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong old value" );
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt32;
+ evt.NewValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong new value" );
+ }
+ break;
+
+ default:
+ OSL_ENSHURE( sal_False, "XPropeSetHelper: invalid property handle" );
+ }
+ nCurrent += 2;
+ }
+
+ // XPropertiesChangeListener
+ void SAL_CALL propertiesChange(const Sequence< PropertyChangeEvent >& evtSeq) throw (RuntimeException)
+ {
+ if( !pExceptedListenerValues )
+ return;
+ MutexGuard aGuard( aMutex );
+ for( sal_Int32 i = 0; i < evtSeq.getLength(); i++ )
+ {
+ const PropertyChangeEvent & evt = evtSeq.getConstArray()[i];
+ OSL_ENSHURE( nCurrent +1 < nCount, "PropertySetHelper: too many listener calls" );
+
+ switch( evt.PropertyHandle )
+ {
+ case PROPERTY_BOOL:
+ {
+ OSL_ENSHURE( sal_False, "PropertySetHelper: BOOL cannot change" );
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ), "PropertySetHelper: wrong name" );
+ }
+ break;
+
+ case PROPERTY_INT16:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), "PropertySetHelper: wrong name" );
+
+ sal_Int16 nInt16, nOldInt16;
+ pExceptedListenerValues[nCurrent] >>= nInt16;
+ evt.OldValue >>= nOldInt16;
+ OSL_ENSHURE( nInt16 == nOldInt16 , "PropertySetHelper: wrong old value" );
+
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt16;
+ evt.NewValue >>= nOldInt16;
+ OSL_ENSHURE( nInt16 == nOldInt16 , "PropertySetHelper: wrong new value" );
+ }
+ break;
+
+ case PROPERTY_INT32:
+ {
+ OSL_ENSHURE( evt.PropertyName == OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), "PropertySetHelper: wrong name" );
+
+
+ sal_Int32 nInt32,nOldInt32;
+ pExceptedListenerValues[nCurrent] >>= nInt32;
+ evt.OldValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong old value" );
+
+ pExceptedListenerValues[nCurrent+1] >>= nInt32;
+ evt.NewValue >>= nOldInt32;
+ OSL_ENSHURE( nInt32 == nOldInt32 , "PropertySetHelper: wrong new value" );
+ }
+ break;
+
+ default:
+ OSL_ENSHURE( sal_False, "XPropeSetHelper: invalid property handle" );
+ }
+ nCurrent += 2;
+ }
+ }
+};
+
+/**
+ * Create a table that map names to index values.
+ */
+IPropertyArrayHelper & test_OPropertySetHelper::getInfoHelper()
+{
+ // no multi thread protection
+ static OPropertyArrayHelper aInfo( pBasicProps, nPropCount );
+ return aInfo;
+}
+
+// XPropertySet
+Reference < XPropertySetInfo > test_OPropertySetHelper::getPropertySetInfo()
+{
+ // no multi thread protection
+ static Reference < XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// Return sal_True, value changed
+sal_Bool test_OPropertySetHelper::convertFastPropertyValue
+(
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue
+)
+{
+ switch( nHandle )
+ {
+ case PROPERTY_BOOL:
+ {
+ sal_Bool b;
+ convertPropertyValue( b , rValue );
+ if( b != bBOOL )
+ {
+
+ rConvertedValue.setValue( &b , ::getCppuBooleanType() );
+ rOldValue.setValue( & bBOOL , ::getCppuBooleanType() );
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ break;
+
+ case PROPERTY_INT16:
+ {
+ sal_Int16 n16;
+ convertPropertyValue( n16 , rValue );
+
+ if( n16 != nINT16 )
+ {
+ rConvertedValue <<= n16;
+ rOldValue <<= nINT16;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ break;
+
+ case PROPERTY_INT32:
+ {
+ sal_Int32 n32;
+ convertPropertyValue( n32 , rValue );
+ if( n32 != nINT32 )
+ {
+ rConvertedValue <<= n32;
+ rOldValue <<= nINT32;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ break;
+
+ default:
+ OSL_ENSHURE( nHandle == -1, "invalid property handle" );
+ return sal_False;
+ }
+}
+
+/**
+ * only set the value.
+ */
+void test_OPropertySetHelper::setFastPropertyValue_NoBroadcast
+(
+ sal_Int32 nHandle,
+ const Any& rValue
+)
+{
+ switch( nHandle )
+ {
+ case PROPERTY_BOOL:
+ OSL_ENSHURE( rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "invalid type" );
+ bBOOL = *((sal_Bool*)rValue.getValue());
+ break;
+
+ case PROPERTY_INT16:
+ OSL_ENSHURE( rValue.getValueType().getTypeClass() == TypeClass_SHORT, "invalid type" );
+ rValue >>= nINT16;
+ break;
+
+ case PROPERTY_INT32:
+ OSL_ENSHURE( rValue.getValueType().getTypeClass() == TypeClass_LONG, "invalid type" );
+ rValue >>= nINT32;
+ break;
+
+ default:
+ OSL_ENSHURE( nHandle == -1, "invalid property handle" );
+ }
+}
+
+//--------------------------
+void test_OPropertySetHelper::getFastPropertyValue( Any & rRet, sal_Int32 nHandle ) const
+{
+ switch( nHandle )
+ {
+ case PROPERTY_BOOL:
+ rRet.setValue( &bBOOL , getCppuBooleanType() );
+ break;
+
+ case PROPERTY_INT16:
+ rRet <<= nINT16;
+ break;
+
+ case PROPERTY_INT32:
+ rRet <<= nINT32;
+ break;
+
+ default:
+ OSL_ENSHURE( nHandle == -1, "invalid property handle" );
+ }
+}
+
+
+void test_PropertySetHelper()
+{
+ test_PropertyArrayHelper();
+
+ test_OPropertySetHelper * pPS;
+
+ Reference < XPropertySet > xPS;
+ Reference < XPropertyChangeListener > xPS_L;
+ test_OPropertySetHelper_Listener * pPS_L;
+
+ Reference < XInterface > x;
+
+ for( int z = 0; z < 2; z++ )
+ {
+ // first test aBasicProps Handles are { 0, 1, 2, 55 }
+ // first test getBasicProps() Handles are { 0, 1, 2 }
+ xPS = pPS = new test_OPropertySetHelper( getBasicProps(), PROPERTY_COUNT - z );
+ xPS_L = static_cast< XPropertyChangeListener * >( pPS_L = new test_OPropertySetHelper_Listener() );
+
+ // Test queryInterface
+ Reference < XPropertySet > rProp( xPS , UNO_QUERY );
+ OSL_ENSHURE( rProp.is() , "PropertySetHelper: XPropertySet nor supported" );
+
+ Reference < XMultiPropertySet > rMulti( xPS , UNO_QUERY );
+ OSL_ENSHURE( rMulti.is() , "PropertySetHelper: XMultiPropertySet nor supported" );
+
+ Reference < XFastPropertySet > rFast( xPS , UNO_QUERY );
+ OSL_ENSHURE( rFast.is() , "PropertySetHelper: XFastPropertySet nor supported" );
+
+ x = Reference < XInterface > ();
+
+ // Test add-remove listener
+ {
+ Reference < XPropertiesChangeListener > x1( xPS_L, UNO_QUERY );
+ Reference < XVetoableChangeListener > x2( xPS_L, UNO_QUERY );
+
+ xPS->addPropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), xPS_L );
+ Sequence<OUString> szPN( 3 );
+ szPN.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") );
+ szPN.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") );
+ szPN.getArray()[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ); // must ne ignored by the addPropertiesChangeListener method
+ pPS->addPropertiesChangeListener( szPN, x1 );
+
+ szPN = Sequence<OUString>();
+ pPS->addPropertiesChangeListener( szPN, x1 );
+ pPS->addVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+
+ xPS->removePropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), xPS_L );
+ pPS->removePropertiesChangeListener( x1 );
+ pPS->removePropertiesChangeListener( x1 );
+ pPS->removeVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+
+ // this exception must thrown
+ try
+ {
+ xPS->addPropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ), xPS_L );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+
+ }
+
+ try
+ {
+ xPS->addVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ), x2 );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+
+ }
+
+ }
+ OSL_ENSHURE( pPS_L->getRefCount() == 1, "PropertySetHelper: wrong reference count" );
+
+ // Test disposing
+ {
+ Reference < XPropertiesChangeListener > x1( xPS_L, UNO_QUERY );
+ Reference < XVetoableChangeListener > x2( xPS_L, UNO_QUERY );
+
+ xPS->addPropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), xPS_L );
+ Sequence<OUString> szPN( 2 );
+ szPN.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") );
+ szPN.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") );
+ pPS->addPropertiesChangeListener( szPN, x1 );
+ szPN = Sequence<OUString>();
+ pPS->addPropertiesChangeListener( szPN, x1 );
+ pPS->addVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+ pPS->dispose();
+ }
+ OSL_ENSHURE( pPS_L->nDisposing == 4 , "PropertySetHelper: wrong disposing count" );
+ OSL_ENSHURE( pPS_L->getRefCount() == 1 , "PropertySetHelper: wrong reference count" );
+ pPS_L->nDisposing = 0;
+ xPS = pPS = new test_OPropertySetHelper( getBasicProps(), PROPERTY_COUNT - z );
+
+ // Test set- and get- (Fast) propertyValue
+ {
+ // set read only property
+ try
+ {
+ // Readonly raises a vetoable exception
+ sal_Bool b = sal_True;
+ Any aBool;
+ aBool.setValue( &b , getCppuBooleanType() );
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ), aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( PropertyVetoException & e )
+ {
+ }
+
+ try
+ {
+ // Readonly raises a vetoable exception
+ sal_Bool b = sal_True;
+ Any aBool;
+ aBool.setValue( &b , getCppuBooleanType() );
+ // BOOL i s0
+ pPS->setFastPropertyValue( PROPERTY_BOOL, aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( PropertyVetoException & e )
+ {
+ }
+
+ // set unknown property
+ try
+ {
+ sal_Bool b = sal_True;
+ Any aBool;
+ aBool.setValue( &b , getCppuBooleanType() );
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ), aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+ }
+
+ try
+ {
+ sal_Bool b = sal_True;
+ Any aBool;
+ aBool.setValue( &b , getCppuBooleanType() );
+ pPS->setFastPropertyValue( 3, aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+ }
+
+ // get unknown property
+ try
+ {
+ Any aBool;
+ aBool = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ) );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+ }
+
+ try
+ {
+ Any aBool;
+ aBool = ((XFastPropertySet *)pPS)->getFastPropertyValue( 3 );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( UnknownPropertyException & e )
+ {
+ }
+
+ // set property with invalid type
+ try
+ {
+ Any aBool;
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( IllegalArgumentException & e )
+ {
+ }
+
+ try
+ {
+ Any aBool;
+ pPS->setFastPropertyValue( PROPERTY_INT32, aBool );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( IllegalArgumentException & e )
+ {
+ }
+
+ // narrowing conversion is not allowed!
+ try
+ {
+ Any aINT32;
+ aINT32 <<= (sal_Int32 ) 16;
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), aINT32 );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( IllegalArgumentException & e )
+ {
+ }
+
+
+ try
+ {
+ Any aINT32;
+ aINT32 <<= (sal_Int32) 16;
+ pPS->setFastPropertyValue( PROPERTY_INT16, aINT32 );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( IllegalArgumentException & e )
+ {
+ }
+
+
+ Any aValue;
+ aValue = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") ) );
+ sal_Bool b = *( (sal_Bool*)aValue.getValue());
+ OSL_ENSHURE( ! b, "PropertySetHelper: wrong BOOL value" );
+ aValue = ((XFastPropertySet *)pPS)->getFastPropertyValue( PROPERTY_BOOL );
+
+ b = *((sal_Bool*)aValue.getValue());
+ OSL_ENSHURE( !b, "PropertySetHelper: wrong BOOL value" );
+
+ sal_Int16 n16;
+ aValue <<=(sal_Int16)22;
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), aValue );
+ aValue = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ) );
+ aValue >>= n16;
+ OSL_ENSHURE( 22 == n16 , "PropertySetHelper: wrong INT16 value" );
+ aValue <<= (sal_Int16)44;
+ ((XFastPropertySet *)pPS)->setFastPropertyValue( PROPERTY_INT16, aValue );
+
+ aValue = ((XFastPropertySet *)pPS)->getFastPropertyValue( PROPERTY_INT16 );
+ aValue >>= n16;
+ OSL_ENSHURE( 44 == n16, "PropertySetHelper: wrong INT16 value" );
+
+ // widening conversion
+ aValue <<= (sal_Int16)55;
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ), aValue );
+ aValue = xPS->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") ) );
+ sal_Int32 n32;
+ aValue >>= n32;
+ OSL_ENSHURE( 55 == n32 , "PropertySetHelper: wrong INT32 value" );
+ aValue <<= (sal_Int16)66;
+ ((XFastPropertySet *)pPS)->setFastPropertyValue( PROPERTY_INT32, aValue );
+ aValue = ((XFastPropertySet *)pPS)->getFastPropertyValue( PROPERTY_INT32 );
+ aValue >>= n32;
+ OSL_ENSHURE( 66 == n32, "PropertySetHelper: wrong INT32 value" );
+
+ Sequence< OUString >valueNames = Sequence<OUString>( 3 );
+ valueNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") );
+ valueNames.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") );
+ valueNames.getArray()[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") );
+ Sequence< Any > aValues = pPS->getPropertyValues( valueNames );
+
+ b = *((sal_Bool*)aValues.getConstArray()[0].getValue());
+ aValues.getConstArray()[1] >>= n16;
+ aValues.getConstArray()[2] >>= n32;
+
+ OSL_ENSHURE( !b, "PropertySetHelper: wrong BOOL value" );
+ OSL_ENSHURE( 44 == n16, "PropertySetHelper: wrong INT16 value" );
+ OSL_ENSHURE( 66 == n32, "PropertySetHelper: wrong INT32 value" );
+ }
+ pPS->nINT32 = 0;
+ pPS->nINT16 = 0;
+
+ // Test add-remove listener
+ {
+ Reference < XVetoableChangeListener > x2( xPS_L, UNO_QUERY );
+
+ xPS->addPropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), xPS_L );
+ pPS->addVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+
+ pPS_L->nCount = 10;
+ Sequence< Any > aSeq( pPS_L->nCount );
+ pPS_L->nCurrent = 0;
+
+ pPS_L->pExceptedListenerValues = aSeq.getArray();
+
+ pPS_L->pExceptedListenerValues[0] <<= (sal_Int16) 0; // old value vetoable
+ pPS_L->pExceptedListenerValues[1] <<= (sal_Int16) 22; // new value vetoable
+ pPS_L->pExceptedListenerValues[2] <<= (sal_Int16) 0; // old value bound
+ pPS_L->pExceptedListenerValues[3] <<= (sal_Int16) 22; // new value bound
+ pPS_L->pExceptedListenerValues[4] <<= (sal_Int16) 22; // old value vetoable
+ pPS_L->pExceptedListenerValues[5] <<= (sal_Int16) 44; // new value vetoable
+ pPS_L->pExceptedListenerValues[6] <<= (sal_Int16) 22; // old value bound
+ pPS_L->pExceptedListenerValues[7] <<= (sal_Int16) 44; // new value bound
+ pPS_L->pExceptedListenerValues[8] <<= (sal_Int16) 44; // old value vetoable
+ pPS_L->pExceptedListenerValues[9] <<= (sal_Int16) 100; // new value vetoable exception
+
+ Any aValue;
+ aValue <<= (sal_Int16)22;
+ xPS->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), aValue );
+ aValue <<= (sal_Int16) 44;
+ ((XFastPropertySet *)pPS)->setFastPropertyValue( PROPERTY_INT16, aValue );
+ aValue <<= (sal_Int16)100;// exception
+
+ try
+ {
+ ((XFastPropertySet *)pPS)->setFastPropertyValue( PROPERTY_INT16, aValue );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch( PropertyVetoException & e )
+ {
+ }
+
+ OSL_ENSHURE( pPS_L->nCount == pPS_L->nCurrent, "not all listeners called" );
+ pPS->nINT32 = 0;
+ pPS->nINT16 = 0;
+ pPS_L->nCount = 0;
+ pPS_L->nCurrent = 0;
+ pPS_L->pExceptedListenerValues = NULL;
+ xPS->removePropertyChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), xPS_L );
+ pPS->removeVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+ }
+
+ // Test multi property set listener
+ {
+ Reference < XPropertiesChangeListener > x1( xPS_L, UNO_QUERY );
+ Reference < XVetoableChangeListener > x2( xPS_L, UNO_QUERY );
+
+ pPS->addVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ) , x2 );
+ Sequence<OUString> szPN( 4 );
+ szPN.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("BOOL") );
+ szPN.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") );
+ szPN.getArray()[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("Does not exist") ); // must ne ignored by the addPropertiesChangeListener method
+ szPN.getArray()[3] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") );
+ pPS->addPropertiesChangeListener( szPN, x1 );
+
+ pPS_L->nCount = 6;
+ Sequence< Any > aSeq( pPS_L->nCount );
+ pPS_L->nCurrent = 0;
+ pPS_L->pExceptedListenerValues = aSeq.getArray();
+ pPS_L->pExceptedListenerValues[0] <<= (sal_Int16) 0; // old value vetoable
+ pPS_L->pExceptedListenerValues[1] <<= (sal_Int16 ) 22; // new value vetoable
+ // INT32 is not constrained
+ pPS_L->pExceptedListenerValues[2] <<= (sal_Int16) 0; // old value bound
+ pPS_L->pExceptedListenerValues[3] <<= (sal_Int16) 22; // new value bound
+ pPS_L->pExceptedListenerValues[4] <<= (sal_Int32) 0; // old value bound
+ pPS_L->pExceptedListenerValues[5] <<= (sal_Int32) 44; // new value bound
+
+ szPN = Sequence<OUString>( 2 );
+ szPN.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") );
+ szPN.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT32") );
+ Sequence< Any > aValues( 2 );
+ aValues.getArray()[0] <<= (sal_Int16) 22;
+ aValues.getArray()[1] <<= (sal_Int16) 44;
+ pPS->setPropertyValues( szPN, aValues );
+ OSL_ENSHURE( pPS_L->nCount == pPS_L->nCurrent, "not all listeners called" );
+
+ //firePropertiesChangeEvent
+ pPS->nINT16 = 8;
+ pPS->nINT32 = 5;
+ pPS_L->nCount = 4;
+ pPS_L->nCurrent = 0;
+ pPS_L->pExceptedListenerValues[0] <<= (sal_Int16) 8; // old value
+ pPS_L->pExceptedListenerValues[1] <<= (sal_Int16) 8; // new value
+ pPS_L->pExceptedListenerValues[2] <<= (sal_Int32) 5; // old value
+ pPS_L->pExceptedListenerValues[3] <<= (sal_Int32) 5; // new value
+ pPS->firePropertiesChangeEvent( szPN, pPS_L );
+ OSL_ENSHURE( pPS_L->nCount == pPS_L->nCurrent, "not all listeners called" );
+
+
+ //vetoable exception with multible
+ szPN.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") );
+ szPN.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") );
+ pPS->nINT32 = 0;
+ pPS->nINT16 = 0;
+ pPS_L->nCount = 4;
+ pPS_L->nCurrent = 0;
+ pPS_L->pExceptedListenerValues[0] <<= (sal_Int16) 0; // old value vetoable
+ pPS_L->pExceptedListenerValues[1] <<= (sal_Int16) 44; // new value vetoable
+ pPS_L->pExceptedListenerValues[2] <<= (sal_Int16) 0; // old value vetoable
+ pPS_L->pExceptedListenerValues[3] <<= (sal_Int16) 100; // new value vetoable
+
+ try
+ {
+ aValues.getArray()[0] <<= (sal_Int16)44;
+ aValues.getArray()[1] <<= (sal_Int16)100;
+ pPS->setPropertyValues( szPN, aValues );
+ OSL_ENSHURE( sal_False, "PropertySetHelper: exeption not thrown" );
+ }
+ catch ( PropertyVetoException & e )
+ {
+ }
+
+ OSL_ENSHURE( pPS_L->nCount == pPS_L->nCurrent, "not all listeners called" );
+ pPS->removePropertiesChangeListener( x1 );
+ pPS->removeVetoableChangeListener( OUString( RTL_CONSTASCII_USTRINGPARAM("INT16") ), x2 );
+ }
+ }
+}
diff --git a/cppuhelper/test/testproptyphlp.cxx b/cppuhelper/test/testproptyphlp.cxx
new file mode 100644
index 000000000000..236d3686841a
--- /dev/null
+++ b/cppuhelper/test/testproptyphlp.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: testproptyphlp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:26:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <cppuhelper/proptypehlp.hxx>
+
+#include <com/sun/star/beans/Property.hpp>
+#include <assert.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::cppu;
+
+void testPropertyTypeHelper()
+{
+ Any a;
+
+ a <<= ( sal_Int8 ) 25;
+
+ sal_Int32 i;
+ convertPropertyValue( i , a );
+ assert( 25 == i );
+
+ sal_Int16 i16;
+ convertPropertyValue( i16 , a );
+ assert( 25 == i16 );
+
+ sal_Int8 i8;
+ convertPropertyValue( i8 , a );
+ assert( 25 == i8 );
+
+ sal_uInt32 i32;
+ convertPropertyValue( i32 , a );
+ assert( 25 == i32 );
+
+ double d;
+ convertPropertyValue( d , a );
+ assert( 25. == d );
+
+ float f;
+ convertPropertyValue( f , a );
+ assert( 25. == f );
+
+ ::com::sun::star::beans::Property prop;
+
+ prop.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Huhu") );
+ prop.Handle = 5;
+ prop.Attributes = 3;
+
+ a <<= prop;
+
+ ::com::sun::star::beans::Property prop2;
+ convertPropertyValue( prop2 , a );
+ assert( prop.Handle == prop2.Handle && prop.Name == prop2.Name && prop.Attributes == prop2.Attributes );
+
+
+ ::rtl::OUString ow;
+ a <<= prop.Name;
+ convertPropertyValue( ow , a );
+ assert( ow == prop.Name );
+}