xref: /trunk/main/xmloff/source/forms/eventimport.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
29 #define _XMLOFF_FORMS_EVENTIMPORT_HXX_
30 
31 #include <xmloff/XMLEventsImportContext.hxx>
32 #include "callbacks.hxx"
33 #include "ifacecompare.hxx"
34 #include <com/sun/star/container/XIndexAccess.hpp>
35 
36 class SvXMLImport;
37 //.........................................................................
38 namespace xmloff
39 {
40 //.........................................................................
41 
42 	//=====================================================================
43 	//= OFormEventsImportContext
44 	//=====================================================================
45 	class OFormEventsImportContext : public XMLEventsImportContext
46 	{
47 	protected:
48 		IEventAttacher&	m_rEventAttacher;
49 
50 	public:
51 		OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
52 			IEventAttacher& _rEventAttacher);
53 
54 	protected:
55 		virtual void EndElement();
56 	};
57 
58 	//=====================================================================
59 	//= ODefaultEventAttacherManager
60 	//=====================================================================
61 	class ODefaultEventAttacherManager : public IEventAttacherManager
62 	{
63 	protected:
64 		DECLARE_STL_MAP(
65 			::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >,				// map from
66 			::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >,		// map to
67 			OPropertySetCompare,																	// compare method
68 			MapPropertySet2ScriptSequence);															// class name
69 		// usually an event attacher manager will need to collect all script events registered, 'cause
70 		// the _real_ XEventAttacherManager handles it's events by index, but out indicies are not fixed
71 		// until _all_ controls have been inserted.
72 
73 		MapPropertySet2ScriptSequence	m_aEvents;
74 
75 	public:
76 		// IEventAttacherManager
77 		virtual void registerEvents(
78 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement,
79 			const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
80 			);
81 
82 	protected:
83 		void setEvents(
84 			const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer
85 			);
86 
87         virtual ~ODefaultEventAttacherManager();
88 	};
89 
90 //.........................................................................
91 }	// namespace xmloff
92 //.........................................................................
93 
94 #endif // _XMLOFF_FORMS_EVENTIMPORT_HXX_
95 
96