xref: /trunk/main/xmloff/source/forms/eventimport.hxx (revision 86e1cf34)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
25 #define _XMLOFF_FORMS_EVENTIMPORT_HXX_
26 
27 #include <xmloff/XMLEventsImportContext.hxx>
28 #include "callbacks.hxx"
29 #include "ifacecompare.hxx"
30 #include <com/sun/star/container/XIndexAccess.hpp>
31 
32 class SvXMLImport;
33 //.........................................................................
34 namespace xmloff
35 {
36 //.........................................................................
37 
38 	//=====================================================================
39 	//= OFormEventsImportContext
40 	//=====================================================================
41 	class OFormEventsImportContext : public XMLEventsImportContext
42 	{
43 	protected:
44 		IEventAttacher&	m_rEventAttacher;
45 
46 	public:
47 		OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
48 			IEventAttacher& _rEventAttacher);
49 
50 	protected:
51 		virtual void EndElement();
52 	};
53 
54 	//=====================================================================
55 	//= ODefaultEventAttacherManager
56 	//=====================================================================
57 	class ODefaultEventAttacherManager : public IEventAttacherManager
58 	{
59 	protected:
60 		DECLARE_STL_MAP(
61 			::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >,				// map from
62 			::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >,		// map to
63 			OPropertySetCompare,																	// compare method
64 			MapPropertySet2ScriptSequence);															// class name
65 		// usually an event attacher manager will need to collect all script events registered, 'cause
66 		// the _real_ XEventAttacherManager handles it's events by index, but out indices are not fixed
67 		// until _all_ controls have been inserted.
68 
69 		MapPropertySet2ScriptSequence	m_aEvents;
70 
71 	public:
72 		// IEventAttacherManager
73 		virtual void registerEvents(
74 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement,
75 			const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
76 			);
77 
78 	protected:
79 		void setEvents(
80 			const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer
81 			);
82 
83         virtual ~ODefaultEventAttacherManager();
84 	};
85 
86 //.........................................................................
87 }	// namespace xmloff
88 //.........................................................................
89 
90 #endif // _XMLOFF_FORMS_EVENTIMPORT_HXX_
91 
92