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_EVENTEXPORT_HXX_
25 #define _XMLOFF_FORMS_EVENTEXPORT_HXX_
26 
27 #include <com/sun/star/container/XNameReplace.hpp>
28 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/uno/Sequence.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 #include <comphelper/stl_types.hxx>
33 
34 //.........................................................................
35 namespace xmloff
36 {
37 //.........................................................................
38 
39 	//=====================================================================
40 	//= OEventDescriptorMapper
41 	//=====================================================================
42 	typedef ::cppu::WeakImplHelper1	<	::com::sun::star::container::XNameReplace
43 									>	OEventDescriptorMapper_Base;
44 	/** helper class wrapping different script event representations
45 
46 		<p>In the form layer, the script events are represented by <type scope="com.sun.star.script">ScriptEventDescriptor</type>
47 		instances. The office applications, on the other hand, represent their a single script event as sequence
48 		of <type scope="com.sun.star.beans">PropertyValue</type>s, where all events of a given object are
49 		accessible through a <type scope="com.sun.star.container">XNameReplace</type> interface.</p>
50 		<p>This class maps the first representation of events of a single object to the second one.</p>
51 		<p>This way, we can use the helper classes here in the project.</p>
52 	*/
53 	class OEventDescriptorMapper : public OEventDescriptorMapper_Base
54 	{
55 	protected:
56 		DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >, MapString2PropertyValueSequence );
57 		MapString2PropertyValueSequence	m_aMappedEvents;
58 
59 	public:
60 		OEventDescriptorMapper(
61 			const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents);
62 
63 		// XNameReplace
64 	    virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
65 
66 		// XNameAccess
67 		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);
68 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException);
69 		virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
70 
71 		// XElementAccess
72 		virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
73 		virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
74 	};
75 
76 
77 //.........................................................................
78 }	// namespace xmloff
79 //.........................................................................
80 
81 #endif // _XMLOFF_FORMS_EVENTEXPORT_HXX_
82 
83