LibreOffice Module scripting (master) 1
dlgevtatt.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "dlgevtatt.hxx"
21
22#include "dlgprov.hxx"
23
24#include <sfx2/strings.hrc>
25#include <sfx2/sfxresid.hxx>
26#include <utility>
27#include <vcl/svapp.hxx>
28#include <vcl/weld.hxx>
30
31#include <com/sun/star/awt/XControl.hpp>
32#include <com/sun/star/awt/XControlContainer.hpp>
33#include <com/sun/star/awt/XDialogEventHandler.hpp>
34#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
35#include <com/sun/star/beans/XPropertySet.hpp>
36#include <com/sun/star/script/ScriptEventDescriptor.hpp>
37#include <com/sun/star/script/XScriptEventsSupplier.hpp>
38#include <com/sun/star/script/provider/XScriptProvider.hpp>
39#include <com/sun/star/script/provider/theMasterScriptProviderFactory.hpp>
40#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
41#include <com/sun/star/script/vba/XVBACompatibility.hpp>
42#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
43#include <com/sun/star/reflection/XIdlMethod.hpp>
44#include <com/sun/star/beans/MethodConcept.hpp>
45#include <com/sun/star/beans/XMaterialHolder.hpp>
46
47#include <ooo/vba/XVBAToOOEventDescGen.hpp>
48
49using namespace ::com::sun::star;
50using namespace ::com::sun::star::awt;
51using namespace ::com::sun::star::beans;
52using namespace ::com::sun::star::lang;
53using namespace ::com::sun::star::script;
54using namespace ::com::sun::star::uno;
55using namespace ::com::sun::star::reflection;
56
57
58namespace dlgprov
59{
60 namespace {
61
62 class DialogSFScriptListenerImpl : public DialogScriptListenerImpl
63 {
64 protected:
66 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) override;
67 public:
68 DialogSFScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel ) : DialogScriptListenerImpl( rxContext ), m_xModel( rxModel ) {}
69 };
70
71 class DialogLegacyScriptListenerImpl : public DialogSFScriptListenerImpl
72 {
73 protected:
74 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) override;
75 public:
76 DialogLegacyScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel ) : DialogSFScriptListenerImpl( rxContext, rxModel ){}
77 };
78
79 class DialogUnoScriptListenerImpl : public DialogSFScriptListenerImpl
80 {
81 Reference< awt::XControl > m_xControl;
82 Reference< XInterface > m_xHandler;
83 Reference< beans::XIntrospectionAccess > m_xIntrospectionAccess;
85
86 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) override;
87
88 public:
89 DialogUnoScriptListenerImpl( const Reference< XComponentContext >& rxContext,
90 const Reference< frame::XModel >& rxModel,
91 const Reference< awt::XControl >& rxControl,
92 const Reference< XInterface >& rxHandler,
93 const Reference< beans::XIntrospectionAccess >& rxIntrospectionAccess,
94 bool bDialogProviderMode ); // false: ContainerWindowProvider mode
95
96 };
97
98 class DialogVBAScriptListenerImpl : public DialogScriptListenerImpl
99 {
100 protected:
103 Reference< script::XScriptListener > mxListener;
104 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) override;
105 public:
106 DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, OUString sDialogLibName );
107 };
108
109 }
110
111 DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, OUString sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName(std::move( sDialogLibName ))
112 {
113 Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
114 Sequence< Any > args(1);
115 if ( xSMgr.is() )
116 {
117 args.getArray()[0] <<= xModel;
118 mxListener.set( xSMgr->createInstanceWithArgumentsAndContext( "ooo.vba.EventListener", args, m_xContext ), UNO_QUERY );
119 }
120 if ( !rxControl.is() )
121 return;
122
123 try
124 {
125 Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY_THROW );
126 xProps->getPropertyValue("Name") >>= msDialogCodeName;
127 xProps.set( mxListener, UNO_QUERY_THROW );
128 xProps->setPropertyValue("Model", args[ 0 ] );
129 }
130 catch( const Exception& )
131 {
132 DBG_UNHANDLED_EXCEPTION("scripting");
133 }
134
135 }
136
137 void DialogVBAScriptListenerImpl::firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* )
138 {
139 if ( !(aScriptEvent.ScriptType == "VBAInterop" && mxListener.is()) )
140 return;
141
142 ScriptEvent aScriptEventCopy( aScriptEvent );
143 aScriptEventCopy.ScriptCode = msDialogLibName + "." + msDialogCodeName;
144 try
145 {
146 mxListener->firing( aScriptEventCopy );
147 }
148 catch( const Exception& )
149 {
150 DBG_UNHANDLED_EXCEPTION("scripting");
151 }
152 }
153
154
155 // DialogEventsAttacherImpl
156
157
158 DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const OUString& sDialogLibName )
159 :mbUseFakeVBAEvents( false ), m_xContext( rxContext )
160 {
161 // key listeners by protocol when ScriptType = 'Script'
162 // otherwise key is the ScriptType e.g. StarBasic
163 if ( rxRTLListener.is() ) // set up handler for RTL_BASIC
164 listenersForTypes[ OUString("StarBasic") ] = rxRTLListener;
165 else
166 listenersForTypes[ OUString("StarBasic") ] = new DialogLegacyScriptListenerImpl( rxContext, rxModel );
167 // handler for Script & OUString("vnd.sun.star.UNO:")
168 listenersForTypes[ OUString("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode );
169 listenersForTypes[ OUString("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel );
170
171 // determine the VBA compatibility mode from the Basic library container
172 try
173 {
174 uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
176 xModelProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
177 mbUseFakeVBAEvents = xVBACompat->getVBACompatibilityMode();
178 }
179 catch( uno::Exception& )
180 {
181 }
182 if ( mbUseFakeVBAEvents )
183 listenersForTypes[ OUString("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
184 }
185
186
188 {
189 }
190
191
194 {
195 ListenerHash::iterator it = listenersForTypes.find( sKey );
196 if ( it == listenersForTypes.end() )
197 throw RuntimeException(); // more text info here please
198 return it->second;
199 }
201 {
204 if ( xSMgr.is() )
205 {
206 Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext("ooo.vba.VBAToOOEventDesc", m_xContext ), UNO_QUERY );
207 if ( xVBAToOOEvtDesc.is() )
208 xEventsSupplier = xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName );
209
210 }
211 return xEventsSupplier;
212 }
213
214
215 void DialogEventsAttacherImpl::attachEventsToControl( const Reference< XControl>& xControl, const Reference< XScriptEventsSupplier >& xEventsSupplier, const Any& Helper )
216 {
217 if ( !xEventsSupplier.is() )
218 return;
219
220 Reference< container::XNameContainer > xEventCont = xEventsSupplier->getEvents();
221
222 Reference< XControlModel > xControlModel = xControl->getModel();
223 if ( !xEventCont.is() )
224 return;
225
226 const Sequence< OUString > aNames = xEventCont->getElementNames();
227
228 for ( const OUString& rName : aNames )
229 {
230 ScriptEventDescriptor aDesc;
231
232 Any aElement = xEventCont->getByName( rName );
233 aElement >>= aDesc;
234 OUString sKey = aDesc.ScriptType;
235 if ( aDesc.ScriptType == "Script" || aDesc.ScriptType == "UNO" )
236 {
237 sal_Int32 nIndex = aDesc.ScriptCode.indexOf( ':' );
238 sKey = aDesc.ScriptCode.copy( 0, nIndex );
239 }
240 Reference< XAllListener > xAllListener =
241 new DialogAllListenerImpl( getScriptListenerForKey( sKey ), aDesc.ScriptType, aDesc.ScriptCode );
242
243 // try first to attach event to the ControlModel
244 bool bSuccess = false;
245 try
246 {
247 Reference< XEventListener > xListener_ = m_xEventAttacher->attachSingleEventListener(
248 xControlModel, xAllListener, Helper, aDesc.ListenerType,
249 aDesc.AddListenerParam, aDesc.EventMethod );
250
251 if ( xListener_.is() )
252 bSuccess = true;
253 }
254 catch ( const Exception& )
255 {
256 DBG_UNHANDLED_EXCEPTION("scripting");
257 }
258
259 try
260 {
261 // if we had no success, try to attach to the control
262 if ( !bSuccess )
263 {
264 m_xEventAttacher->attachSingleEventListener(
265 xControl, xAllListener, Helper, aDesc.ListenerType,
266 aDesc.AddListenerParam, aDesc.EventMethod );
267 }
268 }
269 catch ( const Exception& )
270 {
271 DBG_UNHANDLED_EXCEPTION("scripting");
272 }
273 }
274 }
275
276
277 void DialogEventsAttacherImpl::nestedAttachEvents( const Sequence< Reference< XInterface > >& Objects, const Any& Helper, OUString& sDialogCodeName )
278 {
279 for ( const Reference< XInterface >& rObject : Objects )
280 {
281 // We know that we have to do with instances of XControl.
282 // Otherwise this is not the right implementation for
283 // XScriptEventsAttacher and we have to give up.
284 Reference< XControl > xControl( rObject, UNO_QUERY );
285 Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
286 Reference< XDialog > xDialog( xControl, UNO_QUERY );
287 if ( !xControl.is() )
288 throw IllegalArgumentException();
289
290 // get XEventsSupplier from control model
291 Reference< XControlModel > xControlModel = xControl->getModel();
292 Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
293 attachEventsToControl( xControl, xEventsSupplier, Helper );
294 if ( mbUseFakeVBAEvents )
295 {
296 xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
297 Any newHelper(xControl );
298 attachEventsToControl( xControl, xEventsSupplier, newHelper );
299 }
300 if ( xControlContainer.is() && !xDialog.is() )
301 {
302 Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
303 sal_Int32 nControlCount = aControls.getLength();
304
305 Sequence< Reference< XInterface > > aObjects( nControlCount );
306 Reference< XInterface >* pObjects2 = aObjects.getArray();
307 const Reference< XControl >* pControls = aControls.getConstArray();
308
309 for ( sal_Int32 i2 = 0; i2 < nControlCount; ++i2 )
310 {
311 pObjects2[i2].set( pControls[i2], UNO_QUERY );
312 }
313 nestedAttachEvents( aObjects, Helper, sDialogCodeName );
314 }
315 }
316 }
317
318
319 // XScriptEventsAttacher
320
321
323 const css::uno::Reference<css::script::XScriptListener>&,
324 const Any& Helper )
325 {
326 // get EventAttacher
327 {
328 ::osl::MutexGuard aGuard( getMutex() );
329
330 if ( !m_xEventAttacher.is() )
331 {
333 if ( !xSMgr.is() )
334 throw RuntimeException();
335
336 m_xEventAttacher.set( xSMgr->createInstanceWithContext(
337 "com.sun.star.script.EventAttacher", m_xContext ), UNO_QUERY );
338
339 if ( !m_xEventAttacher.is() )
340 throw ServiceNotRegisteredException();
341 }
342 }
343 OUString sDialogCodeName;
344 sal_Int32 nObjCount = Objects.getLength();
345 Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
346 if ( xDlgControl.is() )
347 {
348 Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
349 try
350 {
351 xProps->getPropertyValue("Name") >>= sDialogCodeName;
352 }
353 catch( Exception& ){}
354 }
355 // go over all objects
356 nestedAttachEvents( Objects, Helper, sDialogCodeName );
357 }
358
359
360 // DialogAllListenerImpl
361
362
364 OUString sScriptType, OUString sScriptCode )
365 :m_xScriptListener( rxListener )
366 ,m_sScriptType(std::move( sScriptType ))
367 ,m_sScriptCode(std::move( sScriptCode ))
368 {
369 }
370
371
373 {
374 }
375
376
377 void DialogAllListenerImpl::firing_impl( const AllEventObject& Event, Any* pRet )
378 {
379 ScriptEvent aScriptEvent;
380 aScriptEvent.Source = getXWeak(); // get correct XInterface
381 aScriptEvent.ListenerType = Event.ListenerType;
382 aScriptEvent.MethodName = Event.MethodName;
383 aScriptEvent.Arguments = Event.Arguments;
384 aScriptEvent.Helper = Event.Helper;
385 aScriptEvent.ScriptType = m_sScriptType;
386 aScriptEvent.ScriptCode = m_sScriptCode;
387
388 if ( m_xScriptListener.is() )
389 {
390 if ( pRet )
391 *pRet = m_xScriptListener->approveFiring( aScriptEvent );
392 else
393 m_xScriptListener->firing( aScriptEvent );
394 }
395 }
396
397
398 // XEventListener
399
400
401 void DialogAllListenerImpl::disposing(const EventObject& )
402 {
403 }
404
405
406 // XAllListener
407
408
409 void DialogAllListenerImpl::firing( const AllEventObject& Event )
410 {
411 //::osl::MutexGuard aGuard( getMutex() );
412
413 firing_impl( Event, nullptr );
414 }
415
416
417 Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
418 {
419 //::osl::MutexGuard aGuard( getMutex() );
420
421 Any aReturn;
422 firing_impl( Event, &aReturn );
423 return aReturn;
424 }
425
426
427 // DialogScriptListenerImpl
428
429
430 DialogUnoScriptListenerImpl::DialogUnoScriptListenerImpl( const Reference< XComponentContext >& rxContext,
431 const Reference< css::frame::XModel >& rxModel,
432 const Reference< css::awt::XControl >& rxControl,
433 const Reference< css::uno::XInterface >& rxHandler,
434 const Reference< css::beans::XIntrospectionAccess >& rxIntrospectionAccess,
435 bool bDialogProviderMode )
436 : DialogSFScriptListenerImpl( rxContext, rxModel )
437 ,m_xControl( rxControl )
438 ,m_xHandler( rxHandler )
439 ,m_xIntrospectionAccess( rxIntrospectionAccess )
440 ,m_bDialogProviderMode( bDialogProviderMode )
441 {
442 }
443
444
446 {
447 }
448
449
450 void DialogSFScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
451 {
452 try
453 {
455 if ( m_xModel.is() )
456 {
458 OSL_ENSURE( xSupplier.is(), "DialogScriptListenerImpl::firing_impl: failed to get script provider supplier" );
459 if ( xSupplier.is() )
460 xScriptProvider.set( xSupplier->getScriptProvider() );
461 }
462 else
463 {
464 OSL_ASSERT( m_xContext.is() );
465 if ( m_xContext.is() )
466 {
467 Reference< provider::XScriptProviderFactory > xFactory =
468 provider::theMasterScriptProviderFactory::get( m_xContext );
469
470 Any aCtx;
471 aCtx <<= OUString("user");
472 xScriptProvider = xFactory->createScriptProvider( aCtx );
473 }
474 }
475
476 OSL_ENSURE( xScriptProvider.is(), "DialogScriptListenerImpl::firing_impl: failed to get script provider" );
477
478 if ( xScriptProvider.is() )
479 {
480 Reference< provider::XScript > xScript = xScriptProvider->getScript( aScriptEvent.ScriptCode );
481 OSL_ENSURE( xScript.is(), "DialogScriptListenerImpl::firing_impl: failed to get script" );
482
483 if ( xScript.is() )
484 {
485 Sequence< Any > aInParams;
486 Sequence< sal_Int16 > aOutParamsIndex;
487 Sequence< Any > aOutParams;
488
489 // get arguments for script
490 aInParams = aScriptEvent.Arguments;
491
492 Any aResult = xScript->invoke( aInParams, aOutParamsIndex, aOutParams );
493 if ( pRet )
494 *pRet = aResult;
495 }
496 }
497 }
498 catch ( const Exception& )
499 {
500 DBG_UNHANDLED_EXCEPTION("scripting");
501 }
502 }
503
504 void DialogLegacyScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
505 {
506 OUString sScriptURL;
507 OUString sScriptCode( aScriptEvent.ScriptCode );
508
509 if ( aScriptEvent.ScriptType != "StarBasic" )
510 return;
511
512 // StarBasic script: convert ScriptCode to scriptURL
513 sal_Int32 nIndex = sScriptCode.indexOf( ':' );
514 if ( nIndex >= 0 && nIndex < sScriptCode.getLength() )
515 {
516 sScriptURL = OUString::Concat("vnd.sun.star.script:") +
517 sScriptCode.subView( nIndex + 1 ) +
518 "?language=Basic&location=" +
519 sScriptCode.subView( 0, nIndex );
520 }
521 ScriptEvent aSFScriptEvent( aScriptEvent );
522 aSFScriptEvent.ScriptCode = sScriptURL;
523 DialogSFScriptListenerImpl::firing_impl( aSFScriptEvent, pRet );
524 }
525
526 void DialogUnoScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
527 {
528 OUString aMethodName = aScriptEvent.ScriptCode.copy( strlen("vnd.sun.star.UNO:") );
529
530 const Any* pArguments = aScriptEvent.Arguments.getConstArray();
531 Any aEventObject = pArguments[0];
532
533 bool bHandled = false;
534 if( m_xHandler.is() )
535 {
537 {
538 Reference< XDialogEventHandler > xDialogEventHandler( m_xHandler, UNO_QUERY );
539 if( xDialogEventHandler.is() )
540 {
541 Reference< XDialog > xDialog( m_xControl, UNO_QUERY );
542 bHandled = xDialogEventHandler->callHandlerMethod( xDialog, aEventObject, aMethodName );
543 }
544 }
545 else
546 {
547 Reference< XContainerWindowEventHandler > xContainerWindowEventHandler( m_xHandler, UNO_QUERY );
548 if( xContainerWindowEventHandler.is() )
549 {
550 Reference< XWindow > xWindow( m_xControl, UNO_QUERY );
551 bHandled = xContainerWindowEventHandler->callHandlerMethod( xWindow, aEventObject, aMethodName );
552 }
553 }
554 }
555
556 Any aRet;
557 if( !bHandled && m_xIntrospectionAccess.is() )
558 {
559 try
560 {
561 // call method
562 const Reference< XIdlMethod >& rxMethod = m_xIntrospectionAccess->
563 getMethod( aMethodName, MethodConcept::ALL - MethodConcept::DANGEROUS );
564
565 Reference< XMaterialHolder > xMaterialHolder =
566 Reference< XMaterialHolder >::query( m_xIntrospectionAccess );
567 Any aHandlerObject = xMaterialHolder->getMaterial();
568
569 Sequence< Reference< XIdlClass > > aParamTypeSeq = rxMethod->getParameterTypes();
570 sal_Int32 nParamCount = aParamTypeSeq.getLength();
571 if( nParamCount == 0 )
572 {
573 Sequence<Any> args;
574 rxMethod->invoke( aHandlerObject, args );
575 bHandled = true;
576 }
577 else if( nParamCount == 2 )
578 {
579 // Signature check automatically done by reflection
580 Sequence<Any> Args(2);
581 Any* pArgs = Args.getArray();
583 {
584 Reference< XDialog > xDialog( m_xControl, UNO_QUERY );
585 pArgs[0] <<= xDialog;
586 }
587 else
588 {
589 Reference< XWindow > xWindow( m_xControl, UNO_QUERY );
590 pArgs[0] <<= xWindow;
591 }
592 pArgs[1] = aEventObject;
593 aRet = rxMethod->invoke( aHandlerObject, Args );
594 bHandled = true;
595 }
596 }
597 catch( const Exception& )
598 {
599 DBG_UNHANDLED_EXCEPTION("scripting");
600 }
601 }
602
603 if( bHandled )
604 {
605 if( pRet )
606 *pRet = aRet;
607 }
608 else
609 {
610 OUString aRes(SfxResId(STR_ERRUNOEVENTBINDUNG));
611 OUString aQuoteChar( "\"" );
612
613 sal_Int32 nIndex = aRes.indexOf( '%' );
614
615 OUString aOUFinal =
616 aRes.subView( 0, nIndex ) +
617 aQuoteChar + aMethodName + aQuoteChar +
618 aRes.subView( nIndex + 2 );
619
620 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
621 VclMessageType::Warning, VclButtonsType::Ok, aOUFinal));
622 xBox->run();
623 }
624 }
625
626
627 // XEventListener
628
629
630 void DialogScriptListenerImpl::disposing(const EventObject& )
631 {
632 }
633
634
635 // XScriptListener
636
637
638 void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent )
639 {
640 //::osl::MutexGuard aGuard( getMutex() );
641
642 firing_impl( aScriptEvent, nullptr );
643 }
644
645
646 Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
647 {
648 //::osl::MutexGuard aGuard( getMutex() );
649
650 Any aReturn;
651 firing_impl( aScriptEvent, &aReturn );
652 return aReturn;
653 }
654
655
656} // namespace dlgprov
657
658
659/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: dlgevtatt.cxx:401
css::uno::Reference< css::script::XScriptListener > m_xScriptListener
Definition: dlgevtatt.hxx:85
DialogAllListenerImpl(const css::uno::Reference< css::script::XScriptListener > &rxListener, OUString sScriptType, OUString sScriptCode)
Definition: dlgevtatt.cxx:363
virtual ~DialogAllListenerImpl() override
Definition: dlgevtatt.cxx:372
virtual css::uno::Any SAL_CALL approveFiring(const css::script::AllEventObject &Event) override
Definition: dlgevtatt.cxx:417
void firing_impl(const css::script::AllEventObject &Event, css::uno::Any *pRet)
Definition: dlgevtatt.cxx:377
virtual void SAL_CALL firing(const css::script::AllEventObject &Event) override
Definition: dlgevtatt.cxx:409
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: dlgevtatt.hxx:51
css::uno::Reference< css::script::XEventAttacher > m_xEventAttacher
Definition: dlgevtatt.hxx:52
virtual void SAL_CALL attachEvents(const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > &Objects, const css::uno::Reference< css::script::XScriptListener > &, const css::uno::Any &Helper) override
Definition: dlgevtatt.cxx:322
virtual ~DialogEventsAttacherImpl() override
Definition: dlgevtatt.cxx:187
css::uno::Reference< css::script::XScriptEventsSupplier > getFakeVbaEventsSupplier(const css::uno::Reference< css::awt::XControl > &xControl, OUString const &sCodeName)
Definition: dlgevtatt.cxx:200
css::uno::Reference< css::script::XScriptListener > const & getScriptListenerForKey(const OUString &sScriptName)
Definition: dlgevtatt.cxx:193
void nestedAttachEvents(const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > &Objects, const css::uno::Any &Helper, OUString &sDialogCodeName)
Definition: dlgevtatt.cxx:277
void attachEventsToControl(const css::uno::Reference< css::awt::XControl > &xControl, const css::uno::Reference< css::script::XScriptEventsSupplier > &events, const css::uno::Any &Helper)
Definition: dlgevtatt.cxx:215
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: dlgevtatt.cxx:630
virtual void SAL_CALL firing(const css::script::ScriptEvent &aScriptEvent) override
Definition: dlgevtatt.cxx:638
virtual css::uno::Any SAL_CALL approveFiring(const css::script::ScriptEvent &aScriptEvent) override
Definition: dlgevtatt.cxx:646
virtual ~DialogScriptListenerImpl() override
Definition: dlgevtatt.cxx:445
virtual void firing_impl(const css::script::ScriptEvent &aScriptEvent, css::uno::Any *pRet)=0
#define DBG_UNHANDLED_EXCEPTION(...)
OUString msDialogCodeName
Definition: dlgevtatt.cxx:101
OUString msDialogLibName
Definition: dlgevtatt.cxx:102
Reference< script::XScriptListener > mxListener
Definition: dlgevtatt.cxx:103
Reference< frame::XModel > m_xModel
Definition: dlgevtatt.cxx:65
Reference< awt::XControl > m_xControl
Definition: dlgevtatt.cxx:81
Reference< XInterface > m_xHandler
Definition: dlgevtatt.cxx:82
Reference< beans::XIntrospectionAccess > m_xIntrospectionAccess
Definition: dlgevtatt.cxx:83
bool m_bDialogProviderMode
Definition: dlgevtatt.cxx:84
Reference< XMultiServiceFactory > xSMgr
Reference< XSingleServiceFactory > xFactory
sal_Int32 nIndex
@ Exception
anonymous implementation namespace
::osl::Mutex & getMutex()
Definition: dlgprov.cxx:137
args
SFX2_DLLPUBLIC OUString SfxResId(TranslateId aId)
Reference< XModel > xModel