fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / scripting / source / dlgprov / dlgevtatt.cxx
blobcedfc188e44cc9ef483b8bedd6f82a81dc5ce1e7
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 #include "dlgevtatt.hxx"
22 #include "dlgprov.hxx"
24 #include <sfx2/sfx.hrc>
25 #include <sfx2/app.hxx>
26 #include <vcl/layout.hxx>
27 #include <tools/diagnose_ex.h>
29 #include <com/sun/star/awt/XControl.hpp>
30 #include <com/sun/star/awt/XControlContainer.hpp>
31 #include <com/sun/star/awt/XDialogEventHandler.hpp>
32 #include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
35 #include <com/sun/star/script/XScriptEventsSupplier.hpp>
36 #include <com/sun/star/script/provider/XScriptProvider.hpp>
37 #include <com/sun/star/script/provider/theMasterScriptProviderFactory.hpp>
38 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
39 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
40 #include <com/sun/star/lang/NoSuchMethodException.hpp>
41 #include <com/sun/star/reflection/XIdlMethod.hpp>
42 #include <com/sun/star/beans/MethodConcept.hpp>
43 #include <com/sun/star/beans/XMaterialHolder.hpp>
45 #include <ooo/vba/XVBAToOOEventDescGen.hpp>
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::awt;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::script;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::reflection;
57 namespace dlgprov
60 class DialogSFScriptListenerImpl : public DialogScriptListenerImpl
62 protected:
63 Reference< frame::XModel > m_xModel;
64 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) SAL_OVERRIDE;
65 public:
66 DialogSFScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel ) : DialogScriptListenerImpl( rxContext ), m_xModel( rxModel ) {}
69 class DialogLegacyScriptListenerImpl : public DialogSFScriptListenerImpl
71 protected:
72 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) SAL_OVERRIDE;
73 public:
74 DialogLegacyScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel ) : DialogSFScriptListenerImpl( rxContext, rxModel ){}
77 class DialogUnoScriptListenerImpl : public DialogSFScriptListenerImpl
79 Reference< awt::XControl > m_xControl;
80 Reference< XInterface > m_xHandler;
81 Reference< beans::XIntrospectionAccess > m_xIntrospectionAccess;
82 bool m_bDialogProviderMode;
84 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) SAL_OVERRIDE;
86 public:
87 DialogUnoScriptListenerImpl( const Reference< XComponentContext >& rxContext,
88 const Reference< frame::XModel >& rxModel,
89 const Reference< awt::XControl >& rxControl,
90 const Reference< XInterface >& rxHandler,
91 const Reference< beans::XIntrospectionAccess >& rxIntrospectionAccess,
92 bool bDialogProviderMode ); // false: ContainerWindowProvider mode
96 class DialogVBAScriptListenerImpl : public DialogScriptListenerImpl
98 protected:
99 OUString msDialogCodeName;
100 OUString msDialogLibName;
101 Reference< script::XScriptListener > mxListener;
102 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ) SAL_OVERRIDE;
103 public:
104 DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const OUString& sDialogLibName );
107 DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName )
109 Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
110 Sequence< Any > args(1);
111 if ( xSMgr.is() )
113 args[0] <<= xModel;
114 mxListener = Reference< XScriptListener >( xSMgr->createInstanceWithArgumentsAndContext( OUString( "ooo.vba.EventListener" ), args, m_xContext ), UNO_QUERY );
116 if ( rxControl.is() )
120 Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY_THROW );
121 xProps->getPropertyValue("Name") >>= msDialogCodeName;
122 xProps.set( mxListener, UNO_QUERY_THROW );
123 xProps->setPropertyValue("Model", args[ 0 ] );
125 catch( const Exception& )
127 DBG_UNHANDLED_EXCEPTION();
133 void DialogVBAScriptListenerImpl::firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* )
135 if ( aScriptEvent.ScriptType == "VBAInterop" && mxListener.is() )
137 ScriptEvent aScriptEventCopy( aScriptEvent );
138 aScriptEventCopy.ScriptCode = msDialogLibName.concat( OUString( "." ) ).concat( msDialogCodeName );
141 mxListener->firing( aScriptEventCopy );
143 catch( const Exception& )
145 DBG_UNHANDLED_EXCEPTION();
153 // DialogEventsAttacherImpl
156 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 )
157 :mbUseFakeVBAEvents( false ), m_xContext( rxContext )
159 // key listeners by protocol when ScriptType = 'Script'
160 // otherwise key is the ScriptType e.g. StarBasic
161 if ( rxRTLListener.is() ) // set up handler for RTL_BASIC
162 listernersForTypes[ OUString("StarBasic") ] = rxRTLListener;
163 else
164 listernersForTypes[ OUString("StarBasic") ] = new DialogLegacyScriptListenerImpl( rxContext, rxModel );
165 // handler for Script & OUString("vnd.sun.star.UNO:")
166 listernersForTypes[ OUString("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode );
167 listernersForTypes[ OUString("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel );
169 // determine the VBA compatibility mode from the Basic library container
172 uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW );
173 uno::Reference< script::vba::XVBACompatibility > xVBACompat(
174 xModelProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW );
175 mbUseFakeVBAEvents = xVBACompat->getVBACompatibilityMode();
177 catch( uno::Exception& )
180 if ( mbUseFakeVBAEvents )
181 listernersForTypes[ OUString("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
186 DialogEventsAttacherImpl::~DialogEventsAttacherImpl()
191 Reference< script::XScriptListener >
192 DialogEventsAttacherImpl::getScriptListenerForKey( const OUString& sKey ) throw ( RuntimeException )
194 ListenerHash::iterator it = listernersForTypes.find( sKey );
195 if ( it == listernersForTypes.end() )
196 throw RuntimeException(); // more text info here please
197 return it->second;
199 Reference< XScriptEventsSupplier > DialogEventsAttacherImpl::getFakeVbaEventsSupplier( const Reference< XControl >& xControl, OUString& sControlName )
201 Reference< XScriptEventsSupplier > xEventsSupplier;
202 Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
203 if ( xSMgr.is() )
205 Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext("ooo.vba.VBAToOOEventDesc", m_xContext ), UNO_QUERY );
206 if ( xVBAToOOEvtDesc.is() )
207 xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
210 return xEventsSupplier;
214 void DialogEventsAttacherImpl::attachEventsToControl( const Reference< XControl>& xControl, const Reference< XScriptEventsSupplier >& xEventsSupplier, const Any& Helper )
216 if ( xEventsSupplier.is() )
218 Reference< container::XNameContainer > xEventCont = xEventsSupplier->getEvents();
220 Reference< XControlModel > xControlModel = xControl->getModel();
221 Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
222 OUString sName;
223 xProps->getPropertyValue("Name") >>= sName;
224 if ( xEventCont.is() )
226 Sequence< OUString > aNames = xEventCont->getElementNames();
227 const OUString* pNames = aNames.getConstArray();
228 sal_Int32 nNameCount = aNames.getLength();
230 for ( sal_Int32 j = 0; j < nNameCount; ++j )
232 ScriptEventDescriptor aDesc;
234 Any aElement = xEventCont->getByName( pNames[ j ] );
235 aElement >>= aDesc;
236 OUString sKey = aDesc.ScriptType;
237 if ( aDesc.ScriptType == "Script" || aDesc.ScriptType == "UNO" )
239 sal_Int32 nIndex = aDesc.ScriptCode.indexOf( ':' );
240 sKey = aDesc.ScriptCode.copy( 0, nIndex );
242 Reference< XAllListener > xAllListener =
243 new DialogAllListenerImpl( getScriptListenerForKey( sKey ), aDesc.ScriptType, aDesc.ScriptCode );
245 // try first to attach event to the ControlModel
246 bool bSuccess = false;
249 Reference< XEventListener > xListener_ = m_xEventAttacher->attachSingleEventListener(
250 xControlModel, xAllListener, Helper, aDesc.ListenerType,
251 aDesc.AddListenerParam, aDesc.EventMethod );
253 if ( xListener_.is() )
254 bSuccess = true;
256 catch ( const Exception& )
258 DBG_UNHANDLED_EXCEPTION();
263 // if we had no success, try to attach to the control
264 if ( !bSuccess )
266 Reference< XEventListener > xListener_ = m_xEventAttacher->attachSingleEventListener(
267 xControl, xAllListener, Helper, aDesc.ListenerType,
268 aDesc.AddListenerParam, aDesc.EventMethod );
271 catch ( const Exception& )
273 DBG_UNHANDLED_EXCEPTION();
281 void DialogEventsAttacherImpl::nestedAttachEvents( const Sequence< Reference< XInterface > >& Objects, const Any& Helper, OUString& sDialogCodeName )
283 const Reference< XInterface >* pObjects = Objects.getConstArray();
284 sal_Int32 nObjCount = Objects.getLength();
286 for ( sal_Int32 i = 0; i < nObjCount; ++i )
288 // We know that we have to do with instances of XControl.
289 // Otherwise this is not the right implementation for
290 // XScriptEventsAttacher and we have to give up.
291 Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
292 Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
293 Reference< XDialog > xDialog( xControl, UNO_QUERY );
294 if ( !xControl.is() )
295 throw IllegalArgumentException();
297 // get XEventsSupplier from control model
298 Reference< XControlModel > xControlModel = xControl->getModel();
299 Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
300 attachEventsToControl( xControl, xEventsSupplier, Helper );
301 if ( mbUseFakeVBAEvents )
303 xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
304 Any newHelper(xControl );
305 attachEventsToControl( xControl, xEventsSupplier, newHelper );
307 if ( xControlContainer.is() && !xDialog.is() )
309 Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
310 sal_Int32 nControlCount = aControls.getLength();
312 Sequence< Reference< XInterface > > aObjects( nControlCount );
313 Reference< XInterface >* pObjects2 = aObjects.getArray();
314 const Reference< XControl >* pControls = aControls.getConstArray();
316 for ( sal_Int32 i2 = 0; i2 < nControlCount; ++i2 )
318 pObjects2[i2] = Reference< XInterface >( pControls[i2], UNO_QUERY );
320 nestedAttachEvents( aObjects, Helper, sDialogCodeName );
326 // XScriptEventsAttacher
329 void SAL_CALL DialogEventsAttacherImpl::attachEvents( const Sequence< Reference< XInterface > >& Objects,
330 const com::sun::star::uno::Reference<com::sun::star::script::XScriptListener>&,
331 const Any& Helper )
332 throw (IllegalArgumentException, IntrospectionException, CannotCreateAdapterException,
333 ServiceNotRegisteredException, RuntimeException, std::exception)
335 // get EventAttacher
337 ::osl::MutexGuard aGuard( getMutex() );
339 if ( !m_xEventAttacher.is() )
341 Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
342 if ( xSMgr.is() )
344 m_xEventAttacher = Reference< XEventAttacher >( xSMgr->createInstanceWithContext(
345 OUString( "com.sun.star.script.EventAttacher" ), m_xContext ), UNO_QUERY );
347 if ( !m_xEventAttacher.is() )
348 throw ServiceNotRegisteredException();
350 else
352 throw RuntimeException();
357 OUString sDialogCodeName;
358 sal_Int32 nObjCount = Objects.getLength();
359 Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
360 if ( xDlgControl.is() )
362 Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
365 xProps->getPropertyValue("Name") >>= sDialogCodeName;
367 catch( Exception& ){}
369 // go over all objects
370 nestedAttachEvents( Objects, Helper, sDialogCodeName );
375 // DialogAllListenerImpl
378 DialogAllListenerImpl::DialogAllListenerImpl( const Reference< XScriptListener >& rxListener,
379 const OUString& rScriptType, const OUString& rScriptCode )
380 :m_xScriptListener( rxListener )
381 ,m_sScriptType( rScriptType )
382 ,m_sScriptCode( rScriptCode )
388 DialogAllListenerImpl::~DialogAllListenerImpl()
394 void DialogAllListenerImpl::firing_impl( const AllEventObject& Event, Any* pRet )
396 ScriptEvent aScriptEvent;
397 aScriptEvent.Source = (OWeakObject *)this; // get correct XInterface
398 aScriptEvent.ListenerType = Event.ListenerType;
399 aScriptEvent.MethodName = Event.MethodName;
400 aScriptEvent.Arguments = Event.Arguments;
401 aScriptEvent.Helper = Event.Helper;
402 aScriptEvent.ScriptType = m_sScriptType;
403 aScriptEvent.ScriptCode = m_sScriptCode;
405 if ( m_xScriptListener.is() )
407 if ( pRet )
408 *pRet = m_xScriptListener->approveFiring( aScriptEvent );
409 else
410 m_xScriptListener->firing( aScriptEvent );
415 // XEventListener
418 void DialogAllListenerImpl::disposing(const EventObject& ) throw ( RuntimeException, std::exception )
423 // XAllListener
426 void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException, std::exception )
428 //::osl::MutexGuard aGuard( getMutex() );
430 firing_impl( Event, NULL );
435 Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
436 throw ( reflection::InvocationTargetException, RuntimeException, std::exception )
438 //::osl::MutexGuard aGuard( getMutex() );
440 Any aReturn;
441 firing_impl( Event, &aReturn );
442 return aReturn;
447 // DialogScriptListenerImpl
450 DialogUnoScriptListenerImpl::DialogUnoScriptListenerImpl( const Reference< XComponentContext >& rxContext,
451 const Reference< ::com::sun::star::frame::XModel >& rxModel,
452 const Reference< ::com::sun::star::awt::XControl >& rxControl,
453 const Reference< ::com::sun::star::uno::XInterface >& rxHandler,
454 const Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
455 bool bDialogProviderMode )
456 : DialogSFScriptListenerImpl( rxContext, rxModel )
457 ,m_xControl( rxControl )
458 ,m_xHandler( rxHandler )
459 ,m_xIntrospectionAccess( rxIntrospectionAccess )
460 ,m_bDialogProviderMode( bDialogProviderMode )
466 DialogScriptListenerImpl::~DialogScriptListenerImpl()
471 void DialogSFScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
475 Reference< provider::XScriptProvider > xScriptProvider;
476 if ( m_xModel.is() )
478 Reference< provider::XScriptProviderSupplier > xSupplier( m_xModel, UNO_QUERY );
479 OSL_ENSURE( xSupplier.is(), "DialogScriptListenerImpl::firing_impl: failed to get script provider supplier" );
480 if ( xSupplier.is() )
481 xScriptProvider.set( xSupplier->getScriptProvider() );
483 else
485 OSL_ASSERT( m_xContext.is() );
486 if ( m_xContext.is() )
488 Reference< provider::XScriptProviderFactory > xFactory =
489 provider::theMasterScriptProviderFactory::get( m_xContext );
491 Any aCtx;
492 aCtx <<= OUString("user");
493 xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
497 OSL_ENSURE( xScriptProvider.is(), "DialogScriptListenerImpl::firing_impl: failed to get script provider" );
499 if ( xScriptProvider.is() )
501 Reference< provider::XScript > xScript = xScriptProvider->getScript( aScriptEvent.ScriptCode );
502 OSL_ENSURE( xScript.is(), "DialogScriptListenerImpl::firing_impl: failed to get script" );
504 if ( xScript.is() )
506 Sequence< Any > aInParams;
507 Sequence< sal_Int16 > aOutParamsIndex;
508 Sequence< Any > aOutParams;
510 // get arguments for script
511 aInParams = aScriptEvent.Arguments;
513 Any aResult = xScript->invoke( aInParams, aOutParamsIndex, aOutParams );
514 if ( pRet )
515 *pRet = aResult;
519 catch ( const Exception& )
521 DBG_UNHANDLED_EXCEPTION();
525 void DialogLegacyScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
527 OUString sScriptURL;
528 OUString sScriptCode( aScriptEvent.ScriptCode );
530 if ( aScriptEvent.ScriptType == "StarBasic" )
532 // StarBasic script: convert ScriptCode to scriptURL
533 sal_Int32 nIndex = sScriptCode.indexOf( ':' );
534 if ( nIndex >= 0 && nIndex < sScriptCode.getLength() )
536 sScriptURL = "vnd.sun.star.script:";
537 sScriptURL += sScriptCode.copy( nIndex + 1 );
538 sScriptURL += "?language=Basic&location=";
539 sScriptURL += sScriptCode.copy( 0, nIndex );
541 ScriptEvent aSFScriptEvent( aScriptEvent );
542 aSFScriptEvent.ScriptCode = sScriptURL;
543 DialogSFScriptListenerImpl::firing_impl( aSFScriptEvent, pRet );
547 void DialogUnoScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
549 static const char sUnoURLScheme[] = "vnd.sun.star.UNO:";
551 OUString aMethodName = aScriptEvent.ScriptCode.copy( strlen(sUnoURLScheme) );
553 const Any* pArguments = aScriptEvent.Arguments.getConstArray();
554 Any aEventObject = pArguments[0];
556 bool bHandled = false;
557 if( m_xHandler.is() )
559 if( m_bDialogProviderMode )
561 Reference< XDialogEventHandler > xDialogEventHandler( m_xHandler, UNO_QUERY );
562 if( xDialogEventHandler.is() )
564 Reference< XDialog > xDialog( m_xControl, UNO_QUERY );
565 bHandled = xDialogEventHandler->callHandlerMethod( xDialog, aEventObject, aMethodName );
568 else
570 Reference< XContainerWindowEventHandler > xContainerWindowEventHandler( m_xHandler, UNO_QUERY );
571 if( xContainerWindowEventHandler.is() )
573 Reference< XWindow > xWindow( m_xControl, UNO_QUERY );
574 bHandled = xContainerWindowEventHandler->callHandlerMethod( xWindow, aEventObject, aMethodName );
579 Any aRet;
580 if( !bHandled && m_xIntrospectionAccess.is() )
584 // Methode ansprechen
585 const Reference< XIdlMethod >& rxMethod = m_xIntrospectionAccess->
586 getMethod( aMethodName, MethodConcept::ALL - MethodConcept::DANGEROUS );
588 Reference< XMaterialHolder > xMaterialHolder =
589 Reference< XMaterialHolder >::query( m_xIntrospectionAccess );
590 Any aHandlerObject = xMaterialHolder->getMaterial();
592 Sequence< Reference< XIdlClass > > aParamTypeSeq = rxMethod->getParameterTypes();
593 sal_Int32 nParamCount = aParamTypeSeq.getLength();
594 if( nParamCount == 0 )
596 Sequence<Any> args;
597 rxMethod->invoke( aHandlerObject, args );
598 bHandled = true;
600 else if( nParamCount == 2 )
602 // Signature check automatically done by reflection
603 Sequence<Any> Args(2);
604 Any* pArgs = Args.getArray();
605 if( m_bDialogProviderMode )
607 Reference< XDialog > xDialog( m_xControl, UNO_QUERY );
608 pArgs[0] <<= xDialog;
610 else
612 Reference< XWindow > xWindow( m_xControl, UNO_QUERY );
613 pArgs[0] <<= xWindow;
615 pArgs[1] = aEventObject;
616 aRet = rxMethod->invoke( aHandlerObject, Args );
617 bHandled = true;
620 catch( const Exception& )
622 DBG_UNHANDLED_EXCEPTION();
626 if( bHandled )
628 if( pRet )
629 *pRet = aRet;
631 else
633 ResMgr* pResMgr = SfxApplication::GetSfxResManager();
634 if( pResMgr )
636 OUString aRes( ResId(STR_ERRUNOEVENTBINDUNG, *pResMgr) );
637 OUString aQuoteChar( "\"" );
639 OUString aOURes = aRes;
640 sal_Int32 nIndex = aOURes.indexOf( '%' );
642 OUString aOUFinal;
643 aOUFinal += aOURes.copy( 0, nIndex );
644 aOUFinal += aQuoteChar;
645 aOUFinal += aMethodName;
646 aOUFinal += aQuoteChar;
647 aOUFinal += aOURes.copy( nIndex + 2 );
649 ScopedVclPtrInstance<MessageDialog>::Create(nullptr, aOUFinal)->Execute();
655 // XEventListener
658 void DialogScriptListenerImpl::disposing(const EventObject& ) throw ( RuntimeException, std::exception )
663 // XScriptListener
666 void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException, std::exception )
668 //::osl::MutexGuard aGuard( getMutex() );
670 firing_impl( aScriptEvent, NULL );
675 Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
676 throw ( reflection::InvocationTargetException, RuntimeException, std::exception )
678 //::osl::MutexGuard aGuard( getMutex() );
680 Any aReturn;
681 firing_impl( aScriptEvent, &aReturn );
682 return aReturn;
688 } // namespace dlgprov
691 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */