fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / scripting / source / dlgprov / dlgevtatt.hxx
blob3f12f257c3d713354ee8da7d9f73cfce91371766
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGEVTATT_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGEVTATT_HXX
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <com/sun/star/script/XAllListener.hpp>
25 #include <com/sun/star/script/XEventAttacher.hpp>
26 #include <com/sun/star/script/XScriptEventsAttacher.hpp>
27 #include <com/sun/star/script/XScriptListener.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <com/sun/star/awt/XControl.hpp>
30 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
31 #include <cppuhelper/implbase1.hxx>
33 #include <com/sun/star/script/XScriptEventsSupplier.hpp>
35 #include <unordered_map>
37 namespace dlgprov
39 // class DialogEventsAttacherImpl
40 typedef std::unordered_map< OUString,
41 ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >,
42 OUStringHash,
43 std::equal_to< OUString > > ListenerHash;
45 typedef ::cppu::WeakImplHelper1<
46 ::com::sun::star::script::XScriptEventsAttacher > DialogEventsAttacherImpl_BASE;
49 class DialogEventsAttacherImpl : public DialogEventsAttacherImpl_BASE
51 private:
52 bool mbUseFakeVBAEvents;
53 ListenerHash listernersForTypes;
54 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
55 ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacher > m_xEventAttacher;
56 ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > getScriptListenerForKey( const OUString& sScriptName ) throw ( ::com::sun::star::uno::RuntimeException );
57 ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, OUString& sCodeName );
58 void nestedAttachEvents( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects, const ::com::sun::star::uno::Any& Helper, OUString& sDialogCodeName );
59 void attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper );
60 public:
61 DialogEventsAttacherImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
62 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel,
63 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl,
64 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
65 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect,
66 bool bProviderMode,
67 const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const OUString& sDialogLibName );
68 virtual ~DialogEventsAttacherImpl();
70 // XScriptEventsAttacher
71 virtual void SAL_CALL attachEvents( const ::com::sun::star::uno::Sequence<
72 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects,
73 const com::sun::star::uno::Reference<com::sun::star::script::XScriptListener>&,
74 const ::com::sun::star::uno::Any& Helper )
75 throw (::com::sun::star::lang::IllegalArgumentException,
76 ::com::sun::star::beans::IntrospectionException,
77 ::com::sun::star::script::CannotCreateAdapterException,
78 ::com::sun::star::lang::ServiceNotRegisteredException,
79 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 // class DialogAllListenerImpl
87 typedef ::cppu::WeakImplHelper1<
88 ::com::sun::star::script::XAllListener > DialogAllListenerImpl_BASE;
91 class DialogAllListenerImpl : public DialogAllListenerImpl_BASE
93 private:
94 ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > m_xScriptListener;
95 OUString m_sScriptType;
96 OUString m_sScriptCode;
98 void firing_impl( const ::com::sun::star::script::AllEventObject& Event, ::com::sun::star::uno::Any* pRet );
100 public:
101 DialogAllListenerImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& rxListener,
102 const OUString& rScriptType, const OUString& rScriptCode );
103 virtual ~DialogAllListenerImpl();
105 // XEventListener
106 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
107 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 // XAllListener
110 virtual void SAL_CALL firing( const ::com::sun::star::script::AllEventObject& Event )
111 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 virtual ::com::sun::star::uno::Any SAL_CALL approveFiring( const ::com::sun::star::script::AllEventObject& Event )
113 throw (::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // class DialogScriptListenerImpl
121 typedef ::cppu::WeakImplHelper1<
122 ::com::sun::star::script::XScriptListener > DialogScriptListenerImpl_BASE;
125 class DialogScriptListenerImpl : public DialogScriptListenerImpl_BASE
127 protected:
128 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
129 virtual void firing_impl( const ::com::sun::star::script::ScriptEvent& aScriptEvent, ::com::sun::star::uno::Any* pRet ) = 0;
130 public:
131 DialogScriptListenerImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) : m_xContext( rxContext ) {}
132 virtual ~DialogScriptListenerImpl();
134 // XEventListener
135 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
136 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 // XScriptListener
139 virtual void SAL_CALL firing( const ::com::sun::star::script::ScriptEvent& aScriptEvent )
140 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 virtual ::com::sun::star::uno::Any SAL_CALL approveFiring( const ::com::sun::star::script::ScriptEvent& aScriptEvent )
142 throw (::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 } // namespace dlgprov
150 #endif // SCRIPTING_DLGEVT_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */