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