1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _FRM_INTERFACE_CONTAINER_HXX_
29*cdf0e10cSrcweir #define _FRM_INTERFACE_CONTAINER_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <hash_map>
32*cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
33*cdf0e10cSrcweir #include <comphelper/types.hxx>
34*cdf0e10cSrcweir #include <comphelper/uno3.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/lang/EventObject.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/io/XPersistObject.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/script/XEventAttacherManager.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/script/ScriptEvent.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
54*cdf0e10cSrcweir #include <osl/mutex.hxx>
55*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
56*cdf0e10cSrcweir #include <cppuhelper/component.hxx>
57*cdf0e10cSrcweir #include <cppuhelper/implbase8.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir using namespace comphelper;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir //.........................................................................
62*cdf0e10cSrcweir namespace frm
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir //.........................................................................
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir //==================================================================
68*cdf0e10cSrcweir 	struct ElementDescription
69*cdf0e10cSrcweir 	{
70*cdf0e10cSrcweir 	public:
71*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >		xInterface;
72*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >	xPropertySet;
73*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >		xChild;
74*cdf0e10cSrcweir 		::com::sun::star::uno::Any													aElementTypeInterface;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	public:
77*cdf0e10cSrcweir 		ElementDescription( );
78*cdf0e10cSrcweir 		virtual ~ElementDescription();
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 	private:
81*cdf0e10cSrcweir 		ElementDescription( const ElementDescription& );			// never implemented
82*cdf0e10cSrcweir 		ElementDescription& operator=( const ElementDescription& );	// never implemented
83*cdf0e10cSrcweir 	};
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir typedef ::std::vector<InterfaceRef> OInterfaceArray;
86*cdf0e10cSrcweir typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir //==================================================================
89*cdf0e10cSrcweir // OInterfaceContainer
90*cdf0e10cSrcweir // implements a container for form components
91*cdf0e10cSrcweir //==================================================================
92*cdf0e10cSrcweir typedef ::cppu::ImplHelper8 <   ::com::sun::star::container::XNameContainer
93*cdf0e10cSrcweir                             ,   ::com::sun::star::container::XIndexContainer
94*cdf0e10cSrcweir                             ,   ::com::sun::star::container::XContainer
95*cdf0e10cSrcweir                             ,   ::com::sun::star::container::XEnumerationAccess
96*cdf0e10cSrcweir                             ,   ::com::sun::star::script::XEventAttacherManager
97*cdf0e10cSrcweir                             ,   ::com::sun::star::beans::XPropertyChangeListener
98*cdf0e10cSrcweir                             ,   ::com::sun::star::io::XPersistObject
99*cdf0e10cSrcweir                             ,   ::com::sun::star::util::XCloneable
100*cdf0e10cSrcweir                             > OInterfaceContainer_BASE;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir class OInterfaceContainer :	public OInterfaceContainer_BASE
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir protected:
105*cdf0e10cSrcweir 	::osl::Mutex&							m_rMutex;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     OInterfaceArray							m_aItems;
108*cdf0e10cSrcweir     OInterfaceMap							m_aMap;
109*cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper		m_aContainerListeners;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     const ::com::sun::star::uno::Type       m_aElementType;
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>		m_xServiceFactory;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	// EventManager
117*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> 	m_xEventAttacher;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir public:
120*cdf0e10cSrcweir 	OInterfaceContainer(
121*cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
122*cdf0e10cSrcweir 		::osl::Mutex& _rMutex,
123*cdf0e10cSrcweir 		const ::com::sun::star::uno::Type& _rElementType);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     OInterfaceContainer( ::osl::Mutex& _rMutex, const OInterfaceContainer& _cloneSource );
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     // late constructor for cloning
128*cdf0e10cSrcweir     void clonedFrom( const OInterfaceContainer& _cloneSource );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir protected:
131*cdf0e10cSrcweir     virtual ~OInterfaceContainer();
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir public:
134*cdf0e10cSrcweir // ::com::sun::star::io::XPersistObject
135*cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw(::com::sun::star::uno::RuntimeException) = 0;
136*cdf0e10cSrcweir 	virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
137*cdf0e10cSrcweir 	virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener
140*cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyChangeListener
143*cdf0e10cSrcweir 	virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw (::com::sun::star::uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir // ::com::sun::star::container::XElementAccess
146*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException) ;
147*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir // ::com::sun::star::container::XEnumerationAccess
150*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir // ::com::sun::star::container::XNameAccess
153*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
154*cdf0e10cSrcweir 	virtual StringSequence SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException);
155*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir // ::com::sun::star::container::XNameReplace
158*cdf0e10cSrcweir 	virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir // ::com::sun::star::container::XNameContainer
161*cdf0e10cSrcweir 	virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
162*cdf0e10cSrcweir 	virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir // ::com::sun::star::container::XIndexAccess
165*cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
166*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir // ::com::sun::star::container::XIndexReplace
169*cdf0e10cSrcweir 	virtual void SAL_CALL replaceByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir // ::com::sun::star::container::XIndexContainer
172*cdf0e10cSrcweir 	virtual void SAL_CALL insertByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& Element) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
173*cdf0e10cSrcweir 	virtual void SAL_CALL removeByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir // ::com::sun::star::container::XContainer
176*cdf0e10cSrcweir 	virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
177*cdf0e10cSrcweir 	virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir // ::com::sun::star::script::XEventAttacherManager
180*cdf0e10cSrcweir     virtual void SAL_CALL registerScriptEvent( sal_Int32 nIndex, const ::com::sun::star::script::ScriptEventDescriptor& aScriptEvent ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
181*cdf0e10cSrcweir     virtual void SAL_CALL registerScriptEvents( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& aScriptEvents ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
182*cdf0e10cSrcweir     virtual void SAL_CALL revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
183*cdf0e10cSrcweir     virtual void SAL_CALL revokeScriptEvents( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
184*cdf0e10cSrcweir     virtual void SAL_CALL insertEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
185*cdf0e10cSrcweir     virtual void SAL_CALL removeEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
186*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > SAL_CALL getScriptEvents( sal_Int32 Index ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
187*cdf0e10cSrcweir     virtual void SAL_CALL attach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject, const ::com::sun::star::uno::Any& aHelper ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::ServiceNotRegisteredException, ::com::sun::star::uno::RuntimeException);
188*cdf0e10cSrcweir     virtual void SAL_CALL detach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
189*cdf0e10cSrcweir     virtual void SAL_CALL addScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
190*cdf0e10cSrcweir     virtual void SAL_CALL removeScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& Listener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir protected:
193*cdf0e10cSrcweir 	// helper
194*cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
195*cdf0e10cSrcweir 	virtual void removeElementsNoEvents(sal_Int32 nIndex);
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 	/** to be overridden if elements which are to be inserted into the container shall be checked
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 		<p>the ElementDescription given can be used to cache information about the object - it will be passed
200*cdf0e10cSrcweir 		later on to implInserted/implReplaced.</p>
201*cdf0e10cSrcweir 	*/
202*cdf0e10cSrcweir 	virtual void approveNewElement(
203*cdf0e10cSrcweir 					const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
204*cdf0e10cSrcweir 					ElementDescription* _pElement
205*cdf0e10cSrcweir 				);
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	virtual ElementDescription* createElementMetaData( );
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	/** inserts an object into our internal structures
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 		@param _nIndex
212*cdf0e10cSrcweir 			the index at which position it should be inserted
213*cdf0e10cSrcweir 		@param _bEvents
214*cdf0e10cSrcweir 			if <TRUE/>, event knittings will be done
215*cdf0e10cSrcweir 		@param _pApprovalResult
216*cdf0e10cSrcweir 			must contain the result of an approveNewElement call. Can be <NULL/>, in this case, the approval
217*cdf0e10cSrcweir 			is done within implInsert.
218*cdf0e10cSrcweir 		@param _bFire
219*cdf0e10cSrcweir 			if <TRUE/>, a notification about the insertion will be fired
220*cdf0e10cSrcweir 	*/
221*cdf0e10cSrcweir 			void implInsert(
222*cdf0e10cSrcweir 				sal_Int32 _nIndex,
223*cdf0e10cSrcweir 				const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
224*cdf0e10cSrcweir 				sal_Bool _bEvents /* = sal_True */,
225*cdf0e10cSrcweir 				ElementDescription* _pApprovalResult /* = NULL */ ,
226*cdf0e10cSrcweir 				sal_Bool _bFire /* = sal_True */
227*cdf0e10cSrcweir 			) throw(::com::sun::star::lang::IllegalArgumentException);
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	// called after the object is inserted, but before the "real listeners" are notified
230*cdf0e10cSrcweir 	virtual void implInserted( const ElementDescription* _pElement );
231*cdf0e10cSrcweir 	// called after the object is removed, but before the "real listeners" are notified
232*cdf0e10cSrcweir 	virtual void implRemoved(const InterfaceRef& _rxObject);
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir     /** called after an object was replaced. The default implementation notifies our listeners, after releasing
235*cdf0e10cSrcweir         the instance lock.
236*cdf0e10cSrcweir     */
237*cdf0e10cSrcweir 	virtual void impl_replacedElement(
238*cdf0e10cSrcweir                     const ::com::sun::star::container::ContainerEvent& _rEvent,
239*cdf0e10cSrcweir                     ::osl::ClearableMutexGuard& _rInstanceLock
240*cdf0e10cSrcweir                 );
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 	void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
243*cdf0e10cSrcweir 	void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 	/** replace an element, specified by position
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 		@precond <arg>_nIndex</arg> is a valid index
248*cdf0e10cSrcweir 		@precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg>
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	*/
251*cdf0e10cSrcweir 	void implReplaceByIndex(
252*cdf0e10cSrcweir 			const sal_Int32 _nIndex,
253*cdf0e10cSrcweir 			const ::com::sun::star::uno::Any& _rNewElement,
254*cdf0e10cSrcweir 			::osl::ClearableMutexGuard& _rClearBeforeNotify
255*cdf0e10cSrcweir 		);
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 	/** removes an element, specified by position
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 		@precond <arg>_nIndex</arg> is a valid index
260*cdf0e10cSrcweir 		@precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg>
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 	*/
263*cdf0e10cSrcweir 	void implRemoveByIndex(
264*cdf0e10cSrcweir 			const sal_Int32 _nIndex,
265*cdf0e10cSrcweir 			::osl::ClearableMutexGuard& _rClearBeforeNotify
266*cdf0e10cSrcweir 		);
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	/** validates the given index
269*cdf0e10cSrcweir 		@throws ::com::sun::star::lang::IndexOutOfBoundsException
270*cdf0e10cSrcweir 			if the given index does not denote a valid position in our childs array
271*cdf0e10cSrcweir 	*/
272*cdf0e10cSrcweir 	void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir private:
275*cdf0e10cSrcweir 	// hack for Vba Events
276*cdf0e10cSrcweir     void impl_addVbEvents_nolck_nothrow( const sal_Int32 i_nIndex );
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 	// the runtime event format has changed from version SO5.2 to OOo
279*cdf0e10cSrcweir 	enum EventFormat
280*cdf0e10cSrcweir 	{
281*cdf0e10cSrcweir 		efVersionSO5x,
282*cdf0e10cSrcweir 		efVersionSO6x
283*cdf0e10cSrcweir 	};
284*cdf0e10cSrcweir 	void	transformEvents( const EventFormat _eTargetFormat );
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir     void    impl_createEventAttacher_nothrow();
287*cdf0e10cSrcweir };
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir //==================================================================
290*cdf0e10cSrcweir //= OFormComponents
291*cdf0e10cSrcweir //==================================================================
292*cdf0e10cSrcweir typedef ::cppu::ImplHelper1< ::com::sun::star::form::XFormComponent> OFormComponents_BASE;
293*cdf0e10cSrcweir typedef ::cppu::OComponentHelper FormComponentsBase;
294*cdf0e10cSrcweir 	// else MSVC kills itself on some statements
295*cdf0e10cSrcweir class OFormComponents   :public FormComponentsBase
296*cdf0e10cSrcweir 						,public OInterfaceContainer
297*cdf0e10cSrcweir 						,public OFormComponents_BASE
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir protected:
300*cdf0e10cSrcweir 	::osl::Mutex				m_aMutex;
301*cdf0e10cSrcweir 	::comphelper::InterfaceRef 	m_xParent;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir public:
304*cdf0e10cSrcweir 	OFormComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
305*cdf0e10cSrcweir     OFormComponents( const OFormComponents& _cloneSource );
306*cdf0e10cSrcweir 	virtual ~OFormComponents();
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OFormComponents, FormComponentsBase);
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
311*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir // OComponentHelper
314*cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir // ::com::sun::star::form::XFormComponent
317*cdf0e10cSrcweir 	virtual ::comphelper::InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException);
318*cdf0e10cSrcweir 	virtual void SAL_CALL setParent(const ::comphelper::InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir     // XEventListener
321*cdf0e10cSrcweir     using OInterfaceContainer::disposing;
322*cdf0e10cSrcweir };
323*cdf0e10cSrcweir //.........................................................................
324*cdf0e10cSrcweir }	// namespace frm
325*cdf0e10cSrcweir //.........................................................................
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir #endif          // _FRM_INTERFACE_CONTAINER_HXX_
328*cdf0e10cSrcweir 
329