bump product version to 6.3.0.0.beta1
[LibreOffice.git] / scripting / source / dlgprov / dlgevtatt.hxx
blobf2e33d811c00ee74932762711ccdec325b60a6e6
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/implbase.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 css::uno::Reference< css::script::XScriptListener > > ListenerHash;
43 typedef ::cppu::WeakImplHelper<
44 css::script::XScriptEventsAttacher > DialogEventsAttacherImpl_BASE;
47 class DialogEventsAttacherImpl : public DialogEventsAttacherImpl_BASE
49 private:
50 bool mbUseFakeVBAEvents;
51 ListenerHash listenersForTypes;
52 css::uno::Reference< css::uno::XComponentContext > m_xContext;
53 css::uno::Reference< css::script::XEventAttacher > m_xEventAttacher;
54 /// @throws css::uno::RuntimeException
55 css::uno::Reference< css::script::XScriptListener > const & getScriptListenerForKey( const OUString& sScriptName );
56 css::uno::Reference< css::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const css::uno::Reference< css::awt::XControl>& xControl, OUString const & sCodeName );
57 void nestedAttachEvents( const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& Objects, const css::uno::Any& Helper, OUString& sDialogCodeName );
58 void attachEventsToControl( const css::uno::Reference< css::awt::XControl>& xControl, const css::uno::Reference< css::script::XScriptEventsSupplier >& events, const css::uno::Any& Helper );
59 public:
60 DialogEventsAttacherImpl( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
61 const css::uno::Reference< css::frame::XModel >& xModel,
62 const css::uno::Reference< css::awt::XControl >& xControl,
63 const css::uno::Reference< css::uno::XInterface >& xHandler,
64 const css::uno::Reference< css::beans::XIntrospectionAccess >& xIntrospect,
65 bool bProviderMode,
66 const css::uno::Reference< css::script::XScriptListener >& xRTLListener ,const OUString& sDialogLibName );
67 virtual ~DialogEventsAttacherImpl() override;
69 // XScriptEventsAttacher
70 virtual void SAL_CALL attachEvents( const css::uno::Sequence<
71 css::uno::Reference< css::uno::XInterface > >& Objects,
72 const css::uno::Reference<css::script::XScriptListener>&,
73 const css::uno::Any& Helper ) override;
77 // class DialogAllListenerImpl
80 typedef ::cppu::WeakImplHelper<
81 css::script::XAllListener > DialogAllListenerImpl_BASE;
84 class DialogAllListenerImpl : public DialogAllListenerImpl_BASE
86 private:
87 css::uno::Reference< css::script::XScriptListener > m_xScriptListener;
88 OUString const m_sScriptType;
89 OUString const m_sScriptCode;
91 void firing_impl( const css::script::AllEventObject& Event, css::uno::Any* pRet );
93 public:
94 DialogAllListenerImpl( const css::uno::Reference< css::script::XScriptListener >& rxListener,
95 const OUString& rScriptType, const OUString& rScriptCode );
96 virtual ~DialogAllListenerImpl() override;
98 // XEventListener
99 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
101 // XAllListener
102 virtual void SAL_CALL firing( const css::script::AllEventObject& Event ) override;
103 virtual css::uno::Any SAL_CALL approveFiring( const css::script::AllEventObject& Event ) override;
107 // class DialogScriptListenerImpl
110 typedef ::cppu::WeakImplHelper<
111 css::script::XScriptListener > DialogScriptListenerImpl_BASE;
114 class DialogScriptListenerImpl : public DialogScriptListenerImpl_BASE
116 protected:
117 css::uno::Reference< css::uno::XComponentContext > m_xContext;
118 virtual void firing_impl( const css::script::ScriptEvent& aScriptEvent, css::uno::Any* pRet ) = 0;
119 public:
120 explicit DialogScriptListenerImpl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : m_xContext( rxContext ) {}
121 virtual ~DialogScriptListenerImpl() override;
123 // XEventListener
124 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
126 // XScriptListener
127 virtual void SAL_CALL firing( const css::script::ScriptEvent& aScriptEvent ) override;
128 virtual css::uno::Any SAL_CALL approveFiring( const css::script::ScriptEvent& aScriptEvent ) override;
132 } // namespace dlgprov
135 #endif // SCRIPTING_DLGEVT_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */