1*ecfe53c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ecfe53c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ecfe53c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ecfe53c5SAndrew Rist * distributed with this work for additional information 6*ecfe53c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ecfe53c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ecfe53c5SAndrew Rist * "License"); you may not use this file except in compliance 9*ecfe53c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*ecfe53c5SAndrew Rist * 11*ecfe53c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ecfe53c5SAndrew Rist * 13*ecfe53c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ecfe53c5SAndrew Rist * software distributed under the License is distributed on an 15*ecfe53c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ecfe53c5SAndrew Rist * KIND, either express or implied. See the License for the 17*ecfe53c5SAndrew Rist * specific language governing permissions and limitations 18*ecfe53c5SAndrew Rist * under the License. 19*ecfe53c5SAndrew Rist * 20*ecfe53c5SAndrew Rist *************************************************************/ 21*ecfe53c5SAndrew Rist 22*ecfe53c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _XMLOFF_FORMS_EVENTEXPORT_HXX_ 25cdf0e10cSrcweir #define _XMLOFF_FORMS_EVENTEXPORT_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp> 28cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 30cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 31cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 32cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir //......................................................................... 35cdf0e10cSrcweir namespace xmloff 36cdf0e10cSrcweir { 37cdf0e10cSrcweir //......................................................................... 38cdf0e10cSrcweir 39cdf0e10cSrcweir //===================================================================== 40cdf0e10cSrcweir //= OEventDescriptorMapper 41cdf0e10cSrcweir //===================================================================== 42cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1 < ::com::sun::star::container::XNameReplace 43cdf0e10cSrcweir > OEventDescriptorMapper_Base; 44cdf0e10cSrcweir /** helper class wrapping different script event representations 45cdf0e10cSrcweir 46cdf0e10cSrcweir <p>In the form layer, the script events are represented by <type scope="com.sun.star.script">ScriptEventDescriptor</type> 47cdf0e10cSrcweir instances. The office applications, on the other hand, represent their a single script event as sequence 48cdf0e10cSrcweir of <type scope="com.sun.star.beans">PropertyValue</type>s, where all events of a given object are 49cdf0e10cSrcweir accessible through a <type scope="com.sun.star.container">XNameReplace</type> interface.</p> 50cdf0e10cSrcweir <p>This class maps the first representation of events of a single object to the second one.</p> 51cdf0e10cSrcweir <p>This way, we can use the helper classes here in the project.</p> 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir class OEventDescriptorMapper : public OEventDescriptorMapper_Base 54cdf0e10cSrcweir { 55cdf0e10cSrcweir protected: 56cdf0e10cSrcweir DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >, MapString2PropertyValueSequence ); 57cdf0e10cSrcweir MapString2PropertyValueSequence m_aMappedEvents; 58cdf0e10cSrcweir 59cdf0e10cSrcweir public: 60cdf0e10cSrcweir OEventDescriptorMapper( 61cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents); 62cdf0e10cSrcweir 63cdf0e10cSrcweir // XNameReplace 64cdf0e10cSrcweir 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); 65cdf0e10cSrcweir 66cdf0e10cSrcweir // XNameAccess 67cdf0e10cSrcweir 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); 68cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); 69cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 70cdf0e10cSrcweir 71cdf0e10cSrcweir // XElementAccess 72cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); 73cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir }; 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir //......................................................................... 78cdf0e10cSrcweir } // namespace xmloff 79cdf0e10cSrcweir //......................................................................... 80cdf0e10cSrcweir 81cdf0e10cSrcweir #endif // _XMLOFF_FORMS_EVENTEXPORT_HXX_ 82cdf0e10cSrcweir 83