1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_extensions.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "eventhandler.hxx" 32*cdf0e10cSrcweir #include "propctrlr.hrc" 33*cdf0e10cSrcweir #include "formbrowsertools.hxx" 34*cdf0e10cSrcweir #include "formresid.hrc" 35*cdf0e10cSrcweir #include "formstrings.hxx" 36*cdf0e10cSrcweir #include "handlerhelper.hxx" 37*cdf0e10cSrcweir #include "modulepcr.hxx" 38*cdf0e10cSrcweir #include "pcrcommon.hxx" 39*cdf0e10cSrcweir #include "pcrstrings.hxx" 40*cdf0e10cSrcweir #include "propertycontrolextender.hxx" 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir /** === begin UNO includes === **/ 43*cdf0e10cSrcweir #include <com/sun/star/awt/XTabControllerModel.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/beans/UnknownPropertyException.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospection.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospectionAccess.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/container/NoSuchElementException.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/form/runtime/XFormController.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/inspection/PropertyControlType.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/lang/NullPointerException.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/script/XEventAttacherManager.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/script/XScriptEventsSupplier.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/util/XModifiable.hpp> 61*cdf0e10cSrcweir #include <com/sun/star/uri/UriReferenceFactory.hpp> 62*cdf0e10cSrcweir #include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp> 63*cdf0e10cSrcweir /** === end UNO includes === **/ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx> 66*cdf0e10cSrcweir #include <comphelper/evtmethodhelper.hxx> 67*cdf0e10cSrcweir #include <comphelper/types.hxx> 68*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 69*cdf0e10cSrcweir #include <rtl/ref.hxx> 70*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 71*cdf0e10cSrcweir #include <sfx2/app.hxx> 72*cdf0e10cSrcweir #include <svl/eitem.hxx> 73*cdf0e10cSrcweir #include <svl/itemset.hxx> 74*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 75*cdf0e10cSrcweir #include <svx/svxids.hrc> 76*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 77*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir #include <map> 80*cdf0e10cSrcweir #include <algorithm> 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir //------------------------------------------------------------------------ 83*cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_EventHandler() 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir ::pcr::OAutoRegistration< ::pcr::EventHandler > aAutoRegistration; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir //........................................................................ 89*cdf0e10cSrcweir namespace pcr 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir //........................................................................ 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir /** === begin UNO using === **/ 94*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 95*cdf0e10cSrcweir using ::com::sun::star::uno::XComponentContext; 96*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet; 97*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 98*cdf0e10cSrcweir using ::com::sun::star::uno::TypeClass_STRING; 99*cdf0e10cSrcweir using ::com::sun::star::uno::Type; 100*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertyChangeListener; 101*cdf0e10cSrcweir using ::com::sun::star::beans::Property; 102*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyState; 103*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyState_DIRECT_VALUE; 104*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 105*cdf0e10cSrcweir using ::com::sun::star::script::ScriptEventDescriptor; 106*cdf0e10cSrcweir using ::com::sun::star::script::XScriptEventsSupplier; 107*cdf0e10cSrcweir using ::com::sun::star::lang::NullPointerException; 108*cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 109*cdf0e10cSrcweir using ::com::sun::star::container::XChild; 110*cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess; 111*cdf0e10cSrcweir using ::com::sun::star::script::XEventAttacherManager; 112*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 113*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 114*cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 115*cdf0e10cSrcweir using ::com::sun::star::beans::XIntrospection; 116*cdf0e10cSrcweir using ::com::sun::star::beans::XIntrospectionAccess; 117*cdf0e10cSrcweir using ::com::sun::star::container::XNameContainer; 118*cdf0e10cSrcweir using ::com::sun::star::awt::XTabControllerModel; 119*cdf0e10cSrcweir using ::com::sun::star::form::XForm; 120*cdf0e10cSrcweir using ::com::sun::star::form::runtime::XFormController; 121*cdf0e10cSrcweir using ::com::sun::star::beans::UnknownPropertyException; 122*cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 123*cdf0e10cSrcweir using ::com::sun::star::container::NoSuchElementException; 124*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySetInfo; 125*cdf0e10cSrcweir using ::com::sun::star::container::XNameReplace; 126*cdf0e10cSrcweir using ::com::sun::star::lang::IllegalArgumentException; 127*cdf0e10cSrcweir using ::com::sun::star::lang::WrappedTargetException; 128*cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 129*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyValue; 130*cdf0e10cSrcweir using ::com::sun::star::inspection::LineDescriptor; 131*cdf0e10cSrcweir using ::com::sun::star::inspection::XPropertyControlFactory; 132*cdf0e10cSrcweir using ::com::sun::star::inspection::InteractiveSelectionResult; 133*cdf0e10cSrcweir using ::com::sun::star::inspection::InteractiveSelectionResult_Cancelled; 134*cdf0e10cSrcweir using ::com::sun::star::inspection::InteractiveSelectionResult_Success; 135*cdf0e10cSrcweir using ::com::sun::star::inspection::XObjectInspectorUI; 136*cdf0e10cSrcweir using ::com::sun::star::util::XModifiable; 137*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyChangeEvent; 138*cdf0e10cSrcweir using ::com::sun::star::frame::XFrame; 139*cdf0e10cSrcweir using ::com::sun::star::frame::XModel; 140*cdf0e10cSrcweir using ::com::sun::star::frame::XController; 141*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 142*cdf0e10cSrcweir using com::sun::star::uri::UriReferenceFactory; 143*cdf0e10cSrcweir using com::sun::star::uri::XUriReferenceFactory; 144*cdf0e10cSrcweir using com::sun::star::uri::XVndSunStarScriptUrlReference; 145*cdf0e10cSrcweir using ::com::sun::star::lang::XEventListener; 146*cdf0e10cSrcweir /** === end UNO using === **/ 147*cdf0e10cSrcweir namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; 148*cdf0e10cSrcweir namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; 149*cdf0e10cSrcweir namespace FormComponentType = ::com::sun::star::form::FormComponentType; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir //==================================================================== 152*cdf0e10cSrcweir //= EventDescription 153*cdf0e10cSrcweir //==================================================================== 154*cdf0e10cSrcweir EventDescription::EventDescription( EventId _nId, const sal_Char* _pListenerNamespaceAscii, const sal_Char* _pListenerClassAsciiName, 155*cdf0e10cSrcweir const sal_Char* _pListenerMethodAsciiName, sal_uInt16 _nDisplayNameResId, const rtl::OString& _sHelpId, const rtl::OString& _sUniqueBrowseId ) 156*cdf0e10cSrcweir :sDisplayName( String( PcrRes( _nDisplayNameResId ) ) ) 157*cdf0e10cSrcweir ,sListenerMethodName( ::rtl::OUString::createFromAscii( _pListenerMethodAsciiName ) ) 158*cdf0e10cSrcweir ,sHelpId( _sHelpId ) 159*cdf0e10cSrcweir ,sUniqueBrowseId( _sUniqueBrowseId ) 160*cdf0e10cSrcweir ,nId( _nId ) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir ::rtl::OUStringBuffer aQualifiedListenerClass; 163*cdf0e10cSrcweir aQualifiedListenerClass.appendAscii( "com.sun.star." ); 164*cdf0e10cSrcweir aQualifiedListenerClass.appendAscii( _pListenerNamespaceAscii ); 165*cdf0e10cSrcweir aQualifiedListenerClass.appendAscii( "." ); 166*cdf0e10cSrcweir aQualifiedListenerClass.appendAscii( _pListenerClassAsciiName ); 167*cdf0e10cSrcweir sListenerClassName = aQualifiedListenerClass.makeStringAndClear(); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir //======================================================================== 171*cdf0e10cSrcweir //= helper 172*cdf0e10cSrcweir //======================================================================== 173*cdf0e10cSrcweir namespace 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir //.................................................................... 176*cdf0e10cSrcweir #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \ 177*cdf0e10cSrcweir s_aKnownEvents.insert( EventMap::value_type( \ 178*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( asciimethod ), \ 179*cdf0e10cSrcweir EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) ) 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir //.................................................................... 182*cdf0e10cSrcweir bool lcl_getEventDescriptionForMethod( const ::rtl::OUString& _rMethodName, EventDescription& _out_rDescription ) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir static EventMap s_aKnownEvents; 185*cdf0e10cSrcweir if ( s_aKnownEvents.empty() ) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 188*cdf0e10cSrcweir if ( s_aKnownEvents.empty() ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir static sal_Int32 nEventId = 0; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED ); 193*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED ); 194*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XChangeListener", "changed", CHANGED ); 195*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XTextListener", "textChanged", TEXTCHANGED ); 196*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED ); 197*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XFocusListener", "focusGained", FOCUSGAINED ); 198*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XFocusListener", "focusLost", FOCUSLOST ); 199*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XKeyListener", "keyPressed", KEYTYPED ); 200*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XKeyListener", "keyReleased", KEYUP ); 201*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseListener", "mouseEntered", MOUSEENTERED ); 202*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED ); 203*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED ); 204*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseListener", "mousePressed", MOUSEPRESSED ); 205*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseListener", "mouseReleased", MOUSERELEASED ); 206*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XMouseListener", "mouseExited", MOUSEEXITED ); 207*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XResetListener", "approveReset", APPROVERESETTED ); 208*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XResetListener", "resetted", RESETTED ); 209*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XSubmitListener", "approveSubmit", SUBMITTED ); 210*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE ); 211*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XUpdateListener", "updated", AFTERUPDATE ); 212*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XLoadListener", "loaded", LOADED ); 213*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XLoadListener", "reloading", RELOADING ); 214*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XLoadListener", "reloaded", RELOADED ); 215*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XLoadListener", "unloading", UNLOADING ); 216*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XLoadListener", "unloaded", UNLOADED ); 217*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE ); 218*cdf0e10cSrcweir DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE ); 219*cdf0e10cSrcweir DESCRIBE_EVENT( "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE ); 220*cdf0e10cSrcweir DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING ); 221*cdf0e10cSrcweir DESCRIBE_EVENT( "sdbc", "XRowSetListener", "cursorMoved", POSITIONED ); 222*cdf0e10cSrcweir DESCRIBE_EVENT( "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER ); 223*cdf0e10cSrcweir DESCRIBE_EVENT( "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURED ); 224*cdf0e10cSrcweir DESCRIBE_EVENT( "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED ); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir EventMap::const_iterator pos = s_aKnownEvents.find( _rMethodName ); 229*cdf0e10cSrcweir if ( pos == s_aKnownEvents.end() ) 230*cdf0e10cSrcweir return false; 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir _out_rDescription = pos->second; 233*cdf0e10cSrcweir return true; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir //.................................................................... 237*cdf0e10cSrcweir ::rtl::OUString lcl_getEventPropertyName( const ::rtl::OUString& _rListenerClassName, const ::rtl::OUString& _rMethodName ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir ::rtl::OUStringBuffer aPropertyName; 240*cdf0e10cSrcweir aPropertyName.append( _rListenerClassName ); 241*cdf0e10cSrcweir aPropertyName.append( (sal_Unicode)';' ); 242*cdf0e10cSrcweir aPropertyName.append( _rMethodName.getStr() ); 243*cdf0e10cSrcweir return aPropertyName.makeStringAndClear(); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir //................................................................ 247*cdf0e10cSrcweir ScriptEventDescriptor lcl_getAssignedScriptEvent( const EventDescription& _rEvent, const Sequence< ScriptEventDescriptor >& _rAllAssignedMacros ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir ScriptEventDescriptor aScriptEvent; 250*cdf0e10cSrcweir // for the case there is actually no event assigned, initialize at least ListenerType and MethodName, 251*cdf0e10cSrcweir // so this ScriptEventDescriptor properly describes the given event 252*cdf0e10cSrcweir aScriptEvent.ListenerType = _rEvent.sListenerClassName; 253*cdf0e10cSrcweir aScriptEvent.EventMethod = _rEvent.sListenerMethodName; 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir const ScriptEventDescriptor* pAssignedEvent = _rAllAssignedMacros.getConstArray(); 256*cdf0e10cSrcweir sal_Int32 assignedEventCount( _rAllAssignedMacros.getLength() ); 257*cdf0e10cSrcweir for ( sal_Int32 assignedEvent = 0; assignedEvent < assignedEventCount; ++assignedEvent, ++pAssignedEvent ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir if ( ( pAssignedEvent->ListenerType != _rEvent.sListenerClassName ) 260*cdf0e10cSrcweir || ( pAssignedEvent->EventMethod != _rEvent.sListenerMethodName ) 261*cdf0e10cSrcweir ) 262*cdf0e10cSrcweir continue; 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir if ( ( pAssignedEvent->ScriptCode.getLength() == 0 ) 265*cdf0e10cSrcweir || ( pAssignedEvent->ScriptType.getLength() == 0 ) 266*cdf0e10cSrcweir ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir DBG_ERROR( "lcl_getAssignedScriptEvent: me thinks this should not happen!" ); 269*cdf0e10cSrcweir continue; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir aScriptEvent = *pAssignedEvent; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir if ( !aScriptEvent.ScriptType.equalsAscii( "StarBasic" ) ) 275*cdf0e10cSrcweir continue; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir // this is an old-style macro specification: 278*cdf0e10cSrcweir // [document|application]:Library.Module.Function 279*cdf0e10cSrcweir // we need to translate this to the new-style macro specification 280*cdf0e10cSrcweir // vnd.sun.star.script:Library.Module.Function?language=Basic&location=[document|application] 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' ); 283*cdf0e10cSrcweir OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" ); 284*cdf0e10cSrcweir ::rtl::OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen ); 285*cdf0e10cSrcweir ::rtl::OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 ); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir ::rtl::OUStringBuffer aNewStyleSpec; 288*cdf0e10cSrcweir aNewStyleSpec.appendAscii( "vnd.sun.star.script:" ); 289*cdf0e10cSrcweir aNewStyleSpec.append ( sMacroPath ); 290*cdf0e10cSrcweir aNewStyleSpec.appendAscii( "?language=Basic&location=" ); 291*cdf0e10cSrcweir aNewStyleSpec.append ( sLocation ); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir aScriptEvent.ScriptCode = aNewStyleSpec.makeStringAndClear(); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir // also, this new-style spec requires the script code to be "Script" instead of "StarBasic" 296*cdf0e10cSrcweir aScriptEvent.ScriptType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir return aScriptEvent; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir //................................................................ 302*cdf0e10cSrcweir ::rtl::OUString lcl_getQualifiedKnownListenerName( const ScriptEventDescriptor& _rFormComponentEventDescriptor ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir EventDescription aKnownEvent; 305*cdf0e10cSrcweir if ( lcl_getEventDescriptionForMethod( _rFormComponentEventDescriptor.EventMethod, aKnownEvent ) ) 306*cdf0e10cSrcweir return aKnownEvent.sListenerClassName; 307*cdf0e10cSrcweir DBG_ERROR( "lcl_getQualifiedKnownListenerName: unknown method name!" ); 308*cdf0e10cSrcweir // somebody assigned an script to a form component event which we don't know 309*cdf0e10cSrcweir // Speaking strictly, this is not really an error - it is possible to do 310*cdf0e10cSrcweir // this programmatically -, but it should rarely happen, since it's not possible 311*cdf0e10cSrcweir // via UI 312*cdf0e10cSrcweir return _rFormComponentEventDescriptor.ListenerType; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir //................................................................ 316*cdf0e10cSrcweir typedef ::std::set< Type, TypeLessByName > TypeBag; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir //................................................................ 319*cdf0e10cSrcweir void lcl_addListenerTypesFor_throw( const Reference< XInterface >& _rxComponent, 320*cdf0e10cSrcweir const Reference< XIntrospection >& _rxIntrospection, TypeBag& _out_rTypes ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir if ( !_rxComponent.is() ) 323*cdf0e10cSrcweir return; 324*cdf0e10cSrcweir OSL_PRECOND( _rxIntrospection.is(), "lcl_addListenerTypesFor_throw: this will crash!" ); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir Reference< XIntrospectionAccess > xIntrospectionAccess( 327*cdf0e10cSrcweir _rxIntrospection->inspect( makeAny( _rxComponent ) ), UNO_QUERY_THROW ); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir Sequence< Type > aListeners( xIntrospectionAccess->getSupportedListeners() ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir ::std::copy( aListeners.getConstArray(), aListeners.getConstArray() + aListeners.getLength(), 332*cdf0e10cSrcweir ::std::insert_iterator< TypeBag >( _out_rTypes, _out_rTypes.begin() ) ); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir //................................................................ 336*cdf0e10cSrcweir bool operator ==( const ScriptEventDescriptor _lhs, const ScriptEventDescriptor _rhs ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir return ( ( _lhs.ListenerType == _rhs.ListenerType ) 339*cdf0e10cSrcweir && ( _lhs.EventMethod == _rhs.EventMethod ) 340*cdf0e10cSrcweir && ( _lhs.AddListenerParam == _rhs.AddListenerParam ) 341*cdf0e10cSrcweir && ( _lhs.ScriptType == _rhs.ScriptType ) 342*cdf0e10cSrcweir && ( _lhs.ScriptCode == _rhs.ScriptCode ) 343*cdf0e10cSrcweir ); 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir //==================================================================== 348*cdf0e10cSrcweir //= EventHandler 349*cdf0e10cSrcweir //==================================================================== 350*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1 < ::com::sun::star::container::XNameReplace 351*cdf0e10cSrcweir > EventHolder_Base; 352*cdf0e10cSrcweir /** a UNO component holding assigned event descriptions, for use with a SvxMacroAssignDlg 353*cdf0e10cSrcweir */ 354*cdf0e10cSrcweir class EventHolder : public EventHolder_Base 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir private: 357*cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, ScriptEventDescriptor, ::rtl::OUStringHash > EventMap; 358*cdf0e10cSrcweir typedef ::std::map< EventId, EventMap::iterator > EventMapIndexAccess; 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir EventMap m_aEventNameAccess; 361*cdf0e10cSrcweir EventMapIndexAccess m_aEventIndexAccess; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir public: 364*cdf0e10cSrcweir EventHolder( ); 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir void addEvent( EventId _nId, const ::rtl::OUString& _rEventName, const ScriptEventDescriptor& _rScriptEvent ); 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir /** effectively the same as getByName, but instead of converting the ScriptEventDescriptor to the weird 369*cdf0e10cSrcweir format used by the macro assignment dialog, it is returned directly 370*cdf0e10cSrcweir */ 371*cdf0e10cSrcweir ScriptEventDescriptor getNormalizedDescriptorByName( const ::rtl::OUString& _rEventName ) const; 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // XNameReplace 374*cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& _rName, const Any& aElement ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException); 375*cdf0e10cSrcweir virtual Any SAL_CALL getByName( const ::rtl::OUString& _rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException); 376*cdf0e10cSrcweir virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException); 377*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& _rName ) throw (RuntimeException); 378*cdf0e10cSrcweir virtual Type SAL_CALL getElementType( ) throw (RuntimeException); 379*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir protected: 382*cdf0e10cSrcweir ~EventHolder( ); 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir private: 385*cdf0e10cSrcweir ScriptEventDescriptor impl_getDescriptor_throw( const ::rtl::OUString& _rEventName ) const; 386*cdf0e10cSrcweir }; 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir DBG_NAME( EventHolder ) 389*cdf0e10cSrcweir //------------------------------------------------------------------------ 390*cdf0e10cSrcweir EventHolder::EventHolder() 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir DBG_CTOR( EventHolder, NULL ); 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir //------------------------------------------------------------------------ 396*cdf0e10cSrcweir EventHolder::~EventHolder() 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir m_aEventNameAccess.clear(); 399*cdf0e10cSrcweir m_aEventIndexAccess.clear(); 400*cdf0e10cSrcweir DBG_DTOR( EventHolder, NULL ); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir //------------------------------------------------------------------------ 404*cdf0e10cSrcweir void EventHolder::addEvent( EventId _nId, const ::rtl::OUString& _rEventName, const ScriptEventDescriptor& _rScriptEvent ) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir ::std::pair< EventMap::iterator, bool > insertionResult = 407*cdf0e10cSrcweir m_aEventNameAccess.insert( EventMap::value_type( _rEventName, _rScriptEvent ) ); 408*cdf0e10cSrcweir OSL_ENSURE( insertionResult.second, "EventHolder::addEvent: there already was a MacroURL for this event!" ); 409*cdf0e10cSrcweir m_aEventIndexAccess[ _nId ] = insertionResult.first; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir //------------------------------------------------------------------------ 413*cdf0e10cSrcweir ScriptEventDescriptor EventHolder::getNormalizedDescriptorByName( const ::rtl::OUString& _rEventName ) const 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir return impl_getDescriptor_throw( _rEventName ); 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir //------------------------------------------------------------------------ 419*cdf0e10cSrcweir ScriptEventDescriptor EventHolder::impl_getDescriptor_throw( const ::rtl::OUString& _rEventName ) const 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir EventMap::const_iterator pos = m_aEventNameAccess.find( _rEventName ); 422*cdf0e10cSrcweir if ( pos == m_aEventNameAccess.end() ) 423*cdf0e10cSrcweir throw NoSuchElementException( ::rtl::OUString(), *const_cast< EventHolder* >( this ) ); 424*cdf0e10cSrcweir return pos->second; 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir //------------------------------------------------------------------------ 428*cdf0e10cSrcweir void SAL_CALL EventHolder::replaceByName( const ::rtl::OUString& _rName, const Any& _rElement ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir EventMap::iterator pos = m_aEventNameAccess.find( _rName ); 431*cdf0e10cSrcweir if ( pos == m_aEventNameAccess.end() ) 432*cdf0e10cSrcweir throw NoSuchElementException( ::rtl::OUString(), *this ); 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir Sequence< PropertyValue > aScriptDescriptor; 435*cdf0e10cSrcweir OSL_VERIFY( _rElement >>= aScriptDescriptor ); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir ::comphelper::NamedValueCollection aExtractor( aScriptDescriptor ); 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir pos->second.ScriptType = aExtractor.getOrDefault( "EventType", ::rtl::OUString() ); 440*cdf0e10cSrcweir pos->second.ScriptCode = aExtractor.getOrDefault( "Script", ::rtl::OUString() ); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir //------------------------------------------------------------------------ 444*cdf0e10cSrcweir Any SAL_CALL EventHolder::getByName( const ::rtl::OUString& _rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir ScriptEventDescriptor aDescriptor( impl_getDescriptor_throw( _rName ) ); 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir Any aRet; 449*cdf0e10cSrcweir Sequence< PropertyValue > aScriptDescriptor( 2 ); 450*cdf0e10cSrcweir aScriptDescriptor[0].Name = ::rtl::OUString::createFromAscii( "EventType" ); 451*cdf0e10cSrcweir aScriptDescriptor[0].Value <<= aDescriptor.ScriptType; 452*cdf0e10cSrcweir aScriptDescriptor[1].Name = ::rtl::OUString::createFromAscii( "Script" ); 453*cdf0e10cSrcweir aScriptDescriptor[1].Value <<= aDescriptor.ScriptCode; 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir return makeAny( aScriptDescriptor ); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir //------------------------------------------------------------------------ 459*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL EventHolder::getElementNames( ) throw (RuntimeException) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir Sequence< ::rtl::OUString > aReturn( m_aEventIndexAccess.size() ); 462*cdf0e10cSrcweir ::rtl::OUString* pReturn = aReturn.getArray(); 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir // SvxMacroAssignDlg has a weird API: It expects a XNameReplace, means a container whose 465*cdf0e10cSrcweir // main access method is by name. In it's UI, it shows the possible events in exactly the 466*cdf0e10cSrcweir // order in which XNameAccess::getElementNames returns them. 467*cdf0e10cSrcweir // However, SvxMacroAssignDlg *also* takes an index for the initial selection, which is 468*cdf0e10cSrcweir // relative to the sequence returned by XNameAccess::getElementNames. 469*cdf0e10cSrcweir // This is IMO weird, since it mixes index access with name access, which decreases efficiency 470*cdf0e10cSrcweir // of the implementation. 471*cdf0e10cSrcweir // Well, it means we're forced to return the events in getElementNames in exactly the same as they 472*cdf0e10cSrcweir // appear in the property browser UI. 473*cdf0e10cSrcweir for ( EventMapIndexAccess::const_iterator loop = m_aEventIndexAccess.begin(); 474*cdf0e10cSrcweir loop != m_aEventIndexAccess.end(); 475*cdf0e10cSrcweir ++loop, ++pReturn 476*cdf0e10cSrcweir ) 477*cdf0e10cSrcweir *pReturn = loop->second->first; 478*cdf0e10cSrcweir return aReturn; 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir //------------------------------------------------------------------------ 482*cdf0e10cSrcweir sal_Bool SAL_CALL EventHolder::hasByName( const ::rtl::OUString& _rName ) throw (RuntimeException) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir EventMap::const_iterator pos = m_aEventNameAccess.find( _rName ); 485*cdf0e10cSrcweir return pos != m_aEventNameAccess.end(); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir //------------------------------------------------------------------------ 489*cdf0e10cSrcweir Type SAL_CALL EventHolder::getElementType( ) throw (RuntimeException) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir return ::getCppuType( static_cast< Sequence< PropertyValue >* >( NULL ) ); 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir //------------------------------------------------------------------------ 495*cdf0e10cSrcweir sal_Bool SAL_CALL EventHolder::hasElements( ) throw (RuntimeException) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir return !m_aEventNameAccess.empty(); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir //==================================================================== 502*cdf0e10cSrcweir //= EventHandler 503*cdf0e10cSrcweir //==================================================================== 504*cdf0e10cSrcweir DBG_NAME( EventHandler ) 505*cdf0e10cSrcweir //-------------------------------------------------------------------- 506*cdf0e10cSrcweir EventHandler::EventHandler( const Reference< XComponentContext >& _rxContext ) 507*cdf0e10cSrcweir :EventHandler_Base( m_aMutex ) 508*cdf0e10cSrcweir ,m_aContext( _rxContext ) 509*cdf0e10cSrcweir ,m_aPropertyListeners( m_aMutex ) 510*cdf0e10cSrcweir ,m_bEventsMapInitialized( false ) 511*cdf0e10cSrcweir ,m_bIsDialogElement( false ) 512*cdf0e10cSrcweir ,m_nGridColumnType( -1 ) 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir DBG_CTOR( EventHandler, NULL ); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir //-------------------------------------------------------------------- 518*cdf0e10cSrcweir EventHandler::~EventHandler() 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir DBG_DTOR( EventHandler, NULL ); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir //-------------------------------------------------------------------- 524*cdf0e10cSrcweir ::rtl::OUString SAL_CALL EventHandler::getImplementationName( ) throw (RuntimeException) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir return getImplementationName_static(); 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir //-------------------------------------------------------------------- 530*cdf0e10cSrcweir ::sal_Bool SAL_CALL EventHandler::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() ); 533*cdf0e10cSrcweir return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end(); 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir //-------------------------------------------------------------------- 537*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupportedServiceNames( ) throw (RuntimeException) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir return getSupportedServiceNames_static(); 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir //-------------------------------------------------------------------- 543*cdf0e10cSrcweir ::rtl::OUString SAL_CALL EventHandler::getImplementationName_static( ) throw (RuntimeException) 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EventHandler" ) ); 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir //-------------------------------------------------------------------- 549*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupportedServiceNames_static( ) throw (RuntimeException) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir Sequence< ::rtl::OUString > aSupported( 1 ); 552*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.EventHandler" ) ); 553*cdf0e10cSrcweir return aSupported; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir //-------------------------------------------------------------------- 557*cdf0e10cSrcweir Reference< XInterface > SAL_CALL EventHandler::Create( const Reference< XComponentContext >& _rxContext ) 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir return *( new EventHandler( _rxContext ) ); 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir //-------------------------------------------------------------------- 563*cdf0e10cSrcweir void SAL_CALL EventHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir if ( !_rxIntrospectee.is() ) 568*cdf0e10cSrcweir throw NullPointerException(); 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir m_xComponent = Reference< XPropertySet >( _rxIntrospectee, UNO_QUERY_THROW ); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir m_bEventsMapInitialized = false; 573*cdf0e10cSrcweir EventMap aEmpty; 574*cdf0e10cSrcweir m_aEvents.swap( aEmpty ); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir m_bIsDialogElement = false; 577*cdf0e10cSrcweir m_nGridColumnType = -1; 578*cdf0e10cSrcweir try 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir Reference< XPropertySetInfo > xPSI( m_xComponent->getPropertySetInfo() ); 581*cdf0e10cSrcweir m_bIsDialogElement = xPSI.is() 582*cdf0e10cSrcweir && xPSI->hasPropertyByName( PROPERTY_WIDTH ) 583*cdf0e10cSrcweir && xPSI->hasPropertyByName( PROPERTY_HEIGHT ) 584*cdf0e10cSrcweir && xPSI->hasPropertyByName( PROPERTY_POSITIONX ) 585*cdf0e10cSrcweir && xPSI->hasPropertyByName( PROPERTY_POSITIONY ); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir Reference< XChild > xAsChild( _rxIntrospectee, UNO_QUERY ); 588*cdf0e10cSrcweir if ( xAsChild.is() && !Reference< XForm >( _rxIntrospectee, UNO_QUERY ).is() ) 589*cdf0e10cSrcweir { 590*cdf0e10cSrcweir if ( FormComponentType::GRIDCONTROL == classifyComponent( xAsChild->getParent() ) ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir m_nGridColumnType = classifyComponent( _rxIntrospectee ); 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir catch( const Exception& ) 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir //-------------------------------------------------------------------- 603*cdf0e10cSrcweir Any SAL_CALL EventHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir Sequence< ScriptEventDescriptor > aEvents; 610*cdf0e10cSrcweir impl_getComponentScriptEvents_nothrow( aEvents ); 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir sal_Int32 nEventCount = aEvents.getLength(); 613*cdf0e10cSrcweir const ScriptEventDescriptor* pEvents = aEvents.getConstArray(); 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir ScriptEventDescriptor aPropertyValue; 616*cdf0e10cSrcweir for ( sal_Int32 event = 0; event < nEventCount; ++event, ++pEvents ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir if ( rEvent.sListenerClassName == pEvents->ListenerType 619*cdf0e10cSrcweir && rEvent.sListenerMethodName == pEvents->EventMethod 620*cdf0e10cSrcweir ) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir aPropertyValue = *pEvents; 623*cdf0e10cSrcweir break; 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir return makeAny( aPropertyValue ); 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir //-------------------------------------------------------------------- 631*cdf0e10cSrcweir void SAL_CALL EventHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir ScriptEventDescriptor aNewScriptEvent; 638*cdf0e10cSrcweir OSL_VERIFY( _rValue >>= aNewScriptEvent ); 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir ScriptEventDescriptor aOldScriptEvent; 641*cdf0e10cSrcweir OSL_VERIFY( getPropertyValue( _rPropertyName ) >>= aOldScriptEvent ); 642*cdf0e10cSrcweir if ( aOldScriptEvent == aNewScriptEvent ) 643*cdf0e10cSrcweir return; 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir if ( m_bIsDialogElement ) 646*cdf0e10cSrcweir impl_setDialogElementScriptEvent_nothrow( aNewScriptEvent ); 647*cdf0e10cSrcweir else 648*cdf0e10cSrcweir impl_setFormComponentScriptEvent_nothrow( aNewScriptEvent ); 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir Reference< XModifiable > xDoc( m_aContext.getContextValueByAsciiName( "ContextDocument" ), UNO_QUERY ); 651*cdf0e10cSrcweir if ( xDoc.is() ) 652*cdf0e10cSrcweir xDoc->setModified( sal_True ); 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir PropertyChangeEvent aEvent; 655*cdf0e10cSrcweir aEvent.Source = m_xComponent; 656*cdf0e10cSrcweir aEvent.PropertyHandle = rEvent.nId; 657*cdf0e10cSrcweir aEvent.PropertyName = _rPropertyName; 658*cdf0e10cSrcweir aEvent.OldValue <<= aOldScriptEvent; 659*cdf0e10cSrcweir aEvent.NewValue <<= aNewScriptEvent; 660*cdf0e10cSrcweir m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir //-------------------------------------------------------------------- 664*cdf0e10cSrcweir Any SAL_CALL EventHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir ::rtl::OUString sNewScriptCode; 669*cdf0e10cSrcweir OSL_VERIFY( _rControlValue >>= sNewScriptCode ); 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir Sequence< ScriptEventDescriptor > aAllAssignedEvents; 672*cdf0e10cSrcweir impl_getComponentScriptEvents_nothrow( aAllAssignedEvents ); 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); 675*cdf0e10cSrcweir ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent( rEvent, aAllAssignedEvents ); 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir OSL_ENSURE( !sNewScriptCode.getLength(), "EventHandler::convertToPropertyValue: cannot convert a non-empty display name!" ); 678*cdf0e10cSrcweir // Usually, there is no possibility for the user to change the content of an event binding directly in the 679*cdf0e10cSrcweir // input field, this instead is done with the macro assignment dialog. 680*cdf0e10cSrcweir // The only exception is the user pressing "DEL" while the control has the focus, in this case, we reset the 681*cdf0e10cSrcweir // control content to an empty string. So this is the only scenario where this method is allowed to be called. 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir // Striclty, we would be able to convert the display value to a property value, 684*cdf0e10cSrcweir // using the "name (location, language)" format we used in convertToControlValue. However, 685*cdf0e10cSrcweir // there is no need for this code ... 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir aAssignedScript.ScriptCode = sNewScriptCode; 688*cdf0e10cSrcweir return makeAny( aAssignedScript ); 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir //-------------------------------------------------------------------- 692*cdf0e10cSrcweir Any SAL_CALL EventHandler::convertToControlValue( const ::rtl::OUString& /*_rPropertyName*/, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir ScriptEventDescriptor aScriptEvent; 697*cdf0e10cSrcweir OSL_VERIFY( _rPropertyValue >>= aScriptEvent ); 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, 700*cdf0e10cSrcweir "EventHandler::convertToControlValue: unexpected ControlValue type class!" ); 701*cdf0e10cSrcweir (void)_rControlValueType; 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir ::rtl::OUString sScript( aScriptEvent.ScriptCode ); 704*cdf0e10cSrcweir if ( sScript.getLength() ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir // format is: "name (location, language)" 707*cdf0e10cSrcweir try 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir // parse 710*cdf0e10cSrcweir Reference< XUriReferenceFactory > xUriRefFac = UriReferenceFactory::create( m_aContext.getUNOContext() ); 711*cdf0e10cSrcweir Reference< XVndSunStarScriptUrlReference > xScriptUri( xUriRefFac->parse( sScript ), UNO_QUERY_THROW ); 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir ::rtl::OUStringBuffer aComposeBuffer; 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir // name 716*cdf0e10cSrcweir aComposeBuffer.append( xScriptUri->getName() ); 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir // location 719*cdf0e10cSrcweir const ::rtl::OUString sLocationParamName( RTL_CONSTASCII_USTRINGPARAM( "location" ) ); 720*cdf0e10cSrcweir const ::rtl::OUString sLocation = xScriptUri->getParameter( sLocationParamName ); 721*cdf0e10cSrcweir const ::rtl::OUString sLangParamName( RTL_CONSTASCII_USTRINGPARAM( "language" ) ); 722*cdf0e10cSrcweir const ::rtl::OUString sLanguage = xScriptUri->getParameter( sLangParamName ); 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir if ( sLocation.getLength() || sLanguage.getLength() ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir aComposeBuffer.appendAscii( " (" ); 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir // location 729*cdf0e10cSrcweir OSL_ENSURE( sLocation.getLength(), "EventHandler::convertToControlValue: unexpected: no location!" ); 730*cdf0e10cSrcweir if ( sLocation.getLength() ) 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir aComposeBuffer.append( sLocation ); 733*cdf0e10cSrcweir aComposeBuffer.appendAscii( ", " ); 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir // language 737*cdf0e10cSrcweir if ( sLanguage.getLength() ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir aComposeBuffer.append( sLanguage ); 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir aComposeBuffer.append( sal_Unicode( ')' ) ); 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir sScript = aComposeBuffer.makeStringAndClear(); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir catch( const Exception& ) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir return makeAny( sScript ); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir //-------------------------------------------------------------------- 757*cdf0e10cSrcweir PropertyState SAL_CALL EventHandler::getPropertyState( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir return PropertyState_DIRECT_VALUE; 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir //-------------------------------------------------------------------- 763*cdf0e10cSrcweir void SAL_CALL EventHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 766*cdf0e10cSrcweir if ( !_rxListener.is() ) 767*cdf0e10cSrcweir throw NullPointerException(); 768*cdf0e10cSrcweir m_aPropertyListeners.addListener( _rxListener ); 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir //-------------------------------------------------------------------- 772*cdf0e10cSrcweir void SAL_CALL EventHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) 773*cdf0e10cSrcweir { 774*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 775*cdf0e10cSrcweir m_aPropertyListeners.removeListener( _rxListener ); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir //-------------------------------------------------------------------- 779*cdf0e10cSrcweir Sequence< Property > SAL_CALL EventHandler::getSupportedProperties() throw (RuntimeException) 780*cdf0e10cSrcweir { 781*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 782*cdf0e10cSrcweir if ( !m_bEventsMapInitialized ) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir const_cast< EventHandler* >( this )->m_bEventsMapInitialized = true; 785*cdf0e10cSrcweir try 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir Sequence< Type > aListeners; 788*cdf0e10cSrcweir impl_getCopmonentListenerTypes_nothrow( aListeners ); 789*cdf0e10cSrcweir sal_Int32 listenerCount = aListeners.getLength(); 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir Property aCurrentProperty; 792*cdf0e10cSrcweir ::rtl::OUString sListenerClassName; 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir // loop through all listeners and all methods, and see which we can present at the UI 795*cdf0e10cSrcweir const Type* pListeners = aListeners.getConstArray(); 796*cdf0e10cSrcweir for ( sal_Int32 listener = 0; listener < listenerCount; ++listener, ++pListeners ) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir aCurrentProperty = Property(); 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir // the programmatic name of the listener, to be used as "property" name 801*cdf0e10cSrcweir sListenerClassName = pListeners->getTypeName(); 802*cdf0e10cSrcweir OSL_ENSURE( sListenerClassName.getLength(), "EventHandler::getSupportedProperties: strange - no listener name ..." ); 803*cdf0e10cSrcweir if ( !sListenerClassName.getLength() ) 804*cdf0e10cSrcweir continue; 805*cdf0e10cSrcweir 806*cdf0e10cSrcweir // loop through all methods 807*cdf0e10cSrcweir Sequence< ::rtl::OUString > aMethods( comphelper::getEventMethodsForType( *pListeners ) ); 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir const ::rtl::OUString* pMethods = aMethods.getConstArray(); 810*cdf0e10cSrcweir sal_uInt32 methodCount = aMethods.getLength(); 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir for (sal_uInt32 method = 0 ; method < methodCount ; ++method, ++pMethods ) 813*cdf0e10cSrcweir { 814*cdf0e10cSrcweir EventDescription aEvent; 815*cdf0e10cSrcweir if ( !lcl_getEventDescriptionForMethod( *pMethods, aEvent ) ) 816*cdf0e10cSrcweir continue; 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir if ( !impl_filterMethod_nothrow( aEvent ) ) 819*cdf0e10cSrcweir continue; 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir const_cast< EventHandler* >( this )->m_aEvents.insert( EventMap::value_type( 822*cdf0e10cSrcweir lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) ); 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir } 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir } 827*cdf0e10cSrcweir catch( const Exception& ) 828*cdf0e10cSrcweir { 829*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir 833*cdf0e10cSrcweir // sort them by ID - this is the relative ordering in the UI 834*cdf0e10cSrcweir ::std::map< EventId, Property > aOrderedProperties; 835*cdf0e10cSrcweir for ( EventMap::const_iterator loop = m_aEvents.begin(); 836*cdf0e10cSrcweir loop != m_aEvents.end(); 837*cdf0e10cSrcweir ++loop 838*cdf0e10cSrcweir ) 839*cdf0e10cSrcweir { 840*cdf0e10cSrcweir aOrderedProperties[ loop->second.nId ] = Property( 841*cdf0e10cSrcweir loop->first, loop->second.nId, 842*cdf0e10cSrcweir ::getCppuType( static_cast< const ::rtl::OUString* >( NULL ) ), 843*cdf0e10cSrcweir PropertyAttribute::BOUND ); 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() ); 847*cdf0e10cSrcweir ::std::transform( aOrderedProperties.begin(), aOrderedProperties.end(), aReturn.begin(), 848*cdf0e10cSrcweir ::std::select2nd< ::std::map< EventId, Property >::value_type >() ); 849*cdf0e10cSrcweir return aReturn; 850*cdf0e10cSrcweir } 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir //-------------------------------------------------------------------- 853*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupersededProperties( ) throw (RuntimeException) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir // none 856*cdf0e10cSrcweir return Sequence< ::rtl::OUString >( ); 857*cdf0e10cSrcweir } 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir //-------------------------------------------------------------------- 860*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL EventHandler::getActuatingProperties( ) throw (RuntimeException) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir // none 863*cdf0e10cSrcweir return Sequence< ::rtl::OUString >( ); 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir //-------------------------------------------------------------------- 867*cdf0e10cSrcweir LineDescriptor SAL_CALL EventHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, 868*cdf0e10cSrcweir const Reference< XPropertyControlFactory >& _rxControlFactory ) 869*cdf0e10cSrcweir throw (UnknownPropertyException, NullPointerException, RuntimeException) 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir if ( !_rxControlFactory.is() ) 872*cdf0e10cSrcweir throw NullPointerException(); 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 875*cdf0e10cSrcweir 876*cdf0e10cSrcweir LineDescriptor aDescriptor; 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir aDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::TextField, sal_True ); 879*cdf0e10cSrcweir Reference< XEventListener > xControlExtender = new PropertyControlExtender( aDescriptor.Control ); 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); 882*cdf0e10cSrcweir aDescriptor.DisplayName = rEvent.sDisplayName; 883*cdf0e10cSrcweir aDescriptor.HelpURL = HelpIdUrl::getHelpURL( rEvent.sHelpId ); 884*cdf0e10cSrcweir aDescriptor.PrimaryButtonId = rtl::OStringToOUString(rEvent.sUniqueBrowseId, RTL_TEXTENCODING_UTF8); 885*cdf0e10cSrcweir aDescriptor.HasPrimaryButton = sal_True; 886*cdf0e10cSrcweir aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Events" ) ); 887*cdf0e10cSrcweir return aDescriptor; 888*cdf0e10cSrcweir } 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir //-------------------------------------------------------------------- 891*cdf0e10cSrcweir ::sal_Bool SAL_CALL EventHandler::isComposable( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir return sal_False; 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir //-------------------------------------------------------------------- 897*cdf0e10cSrcweir InteractiveSelectionResult SAL_CALL EventHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir if ( !_rxInspectorUI.is() ) 900*cdf0e10cSrcweir throw NullPointerException(); 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 903*cdf0e10cSrcweir const EventDescription& rForEvent = impl_getEventForName_throw( _rPropertyName ); 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir Sequence< ScriptEventDescriptor > aAllAssignedEvents; 906*cdf0e10cSrcweir impl_getComponentScriptEvents_nothrow( aAllAssignedEvents ); 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir // SvxMacroAssignDlg-compatible structure holding all event/assignments 909*cdf0e10cSrcweir ::rtl::Reference< EventHolder > pEventHolder( new EventHolder ); 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir for ( EventMap::const_iterator event = m_aEvents.begin(); 912*cdf0e10cSrcweir event != m_aEvents.end(); 913*cdf0e10cSrcweir ++event 914*cdf0e10cSrcweir ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir // the script which is assigned to the current event (if any) 917*cdf0e10cSrcweir ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent( event->second, aAllAssignedEvents ); 918*cdf0e10cSrcweir pEventHolder->addEvent( event->second.nId, event->second.sListenerMethodName, aAssignedScript ); 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir // the inital selection in the dialog 922*cdf0e10cSrcweir Sequence< ::rtl::OUString > aNames( pEventHolder->getElementNames() ); 923*cdf0e10cSrcweir const ::rtl::OUString* pChosenEvent = ::std::find( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength(), rForEvent.sListenerMethodName ); 924*cdf0e10cSrcweir sal_uInt16 nInitialSelection = (sal_uInt16)( pChosenEvent - aNames.getConstArray() ); 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir // the dialog 927*cdf0e10cSrcweir SvxAbstractDialogFactory* pFactory = SvxAbstractDialogFactory::Create(); 928*cdf0e10cSrcweir if ( !pFactory ) 929*cdf0e10cSrcweir return InteractiveSelectionResult_Cancelled; 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir ::std::auto_ptr< VclAbstractDialog > pDialog( pFactory->CreateSvxMacroAssignDlg( 932*cdf0e10cSrcweir PropertyHandlerHelper::getDialogParentWindow( m_aContext ), 933*cdf0e10cSrcweir impl_getContextFrame_nothrow(), 934*cdf0e10cSrcweir m_bIsDialogElement, 935*cdf0e10cSrcweir pEventHolder.get(), 936*cdf0e10cSrcweir nInitialSelection 937*cdf0e10cSrcweir ) ); 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir if ( !pDialog.get() ) 940*cdf0e10cSrcweir return InteractiveSelectionResult_Cancelled; 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir // DF definite problem here 943*cdf0e10cSrcweir // OK & Cancel seem to be both returning 0 944*cdf0e10cSrcweir if ( pDialog->Execute() == RET_CANCEL ) 945*cdf0e10cSrcweir return InteractiveSelectionResult_Cancelled; 946*cdf0e10cSrcweir 947*cdf0e10cSrcweir try 948*cdf0e10cSrcweir { 949*cdf0e10cSrcweir for ( EventMap::const_iterator event = m_aEvents.begin(); 950*cdf0e10cSrcweir event != m_aEvents.end(); 951*cdf0e10cSrcweir ++event 952*cdf0e10cSrcweir ) 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir ScriptEventDescriptor aScriptDescriptor( pEventHolder->getNormalizedDescriptorByName( event->second.sListenerMethodName ) ); 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir // set the new "property value" 957*cdf0e10cSrcweir setPropertyValue( 958*cdf0e10cSrcweir lcl_getEventPropertyName( event->second.sListenerClassName, event->second.sListenerMethodName ), 959*cdf0e10cSrcweir makeAny( aScriptDescriptor ) 960*cdf0e10cSrcweir ); 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir } 963*cdf0e10cSrcweir catch( const Exception& ) 964*cdf0e10cSrcweir { 965*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir return InteractiveSelectionResult_Success; 969*cdf0e10cSrcweir } 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir //-------------------------------------------------------------------- 972*cdf0e10cSrcweir void SAL_CALL EventHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir DBG_ERROR( "EventHandler::actuatingPropertyChanged: no actuating properties -> no callback (well, this is how it *should* be!)" ); 975*cdf0e10cSrcweir } 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir //-------------------------------------------------------------------- 978*cdf0e10cSrcweir IMPLEMENT_FORWARD_XCOMPONENT( EventHandler, EventHandler_Base ) 979*cdf0e10cSrcweir 980*cdf0e10cSrcweir //-------------------------------------------------------------------- 981*cdf0e10cSrcweir void SAL_CALL EventHandler::disposing() 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir EventMap aEmpty; 984*cdf0e10cSrcweir m_aEvents.swap( aEmpty ); 985*cdf0e10cSrcweir m_xComponent.clear(); 986*cdf0e10cSrcweir } 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir //-------------------------------------------------------------------- 989*cdf0e10cSrcweir sal_Bool SAL_CALL EventHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir return sal_True; 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir //------------------------------------------------------------------------ 995*cdf0e10cSrcweir Reference< XFrame > EventHandler::impl_getContextFrame_nothrow() const 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir Reference< XFrame > xContextFrame; 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir try 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir Reference< XModel > xContextDocument( m_aContext.getContextValueByAsciiName( "ContextDocument" ), UNO_QUERY_THROW ); 1002*cdf0e10cSrcweir Reference< XController > xController( xContextDocument->getCurrentController(), UNO_SET_THROW ); 1003*cdf0e10cSrcweir xContextFrame.set( xController->getFrame(), UNO_SET_THROW ); 1004*cdf0e10cSrcweir } 1005*cdf0e10cSrcweir catch( const Exception& ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1008*cdf0e10cSrcweir } 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir return xContextFrame; 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir //-------------------------------------------------------------------- 1014*cdf0e10cSrcweir sal_Int32 EventHandler::impl_getComponentIndexInParent_throw() const 1015*cdf0e10cSrcweir { 1016*cdf0e10cSrcweir Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); 1017*cdf0e10cSrcweir Reference< XIndexAccess > xParentAsIndexAccess( xChild->getParent(), UNO_QUERY_THROW ); 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir // get the index of the inspected object within it's parent container 1020*cdf0e10cSrcweir sal_Int32 nElements = xParentAsIndexAccess->getCount(); 1021*cdf0e10cSrcweir for ( sal_Int32 i=0; i<nElements; ++i ) 1022*cdf0e10cSrcweir { 1023*cdf0e10cSrcweir Reference< XInterface > xElement( xParentAsIndexAccess->getByIndex( i ), UNO_QUERY_THROW ); 1024*cdf0e10cSrcweir if ( xElement == m_xComponent ) 1025*cdf0e10cSrcweir return i; 1026*cdf0e10cSrcweir } 1027*cdf0e10cSrcweir throw NoSuchElementException(); 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir //-------------------------------------------------------------------- 1031*cdf0e10cSrcweir void EventHandler::impl_getFormComponentScriptEvents_nothrow( Sequence < ScriptEventDescriptor >& _out_rEvents ) const 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir _out_rEvents = Sequence < ScriptEventDescriptor >(); 1034*cdf0e10cSrcweir try 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); 1037*cdf0e10cSrcweir Reference< XEventAttacherManager > xEventManager( xChild->getParent(), UNO_QUERY_THROW ); 1038*cdf0e10cSrcweir _out_rEvents = xEventManager->getScriptEvents( impl_getComponentIndexInParent_throw() ); 1039*cdf0e10cSrcweir 1040*cdf0e10cSrcweir // the form component script API has unqualified listener names, but for normalization 1041*cdf0e10cSrcweir // purpose, we want fully qualified ones 1042*cdf0e10cSrcweir ScriptEventDescriptor* pEvents = _out_rEvents.getArray(); 1043*cdf0e10cSrcweir ScriptEventDescriptor* pEventsEnd = _out_rEvents.getArray() + _out_rEvents.getLength(); 1044*cdf0e10cSrcweir while ( pEvents != pEventsEnd ) 1045*cdf0e10cSrcweir { 1046*cdf0e10cSrcweir pEvents->ListenerType = lcl_getQualifiedKnownListenerName( *pEvents ); 1047*cdf0e10cSrcweir ++pEvents; 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir catch( const Exception& ) 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir //-------------------------------------------------------------------- 1057*cdf0e10cSrcweir void EventHandler::impl_getCopmonentListenerTypes_nothrow( Sequence< Type >& _out_rTypes ) const 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir _out_rTypes.realloc( 0 ); 1060*cdf0e10cSrcweir try 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir // we use a set to avoid duplicates 1063*cdf0e10cSrcweir TypeBag aListeners; 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir Reference< XIntrospection > xIntrospection( m_aContext.createComponent( "com.sun.star.beans.Introspection" ), UNO_QUERY_THROW ); 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir // --- model listeners 1068*cdf0e10cSrcweir lcl_addListenerTypesFor_throw( 1069*cdf0e10cSrcweir m_xComponent, xIntrospection, aListeners ); 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir // --- "secondary component" (usually: "control" listeners) 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir Reference< XInterface > xSecondaryComponent( impl_getSecondaryComponentForEventInspection_throw() ); 1074*cdf0e10cSrcweir lcl_addListenerTypesFor_throw( xSecondaryComponent, xIntrospection, aListeners ); 1075*cdf0e10cSrcweir ::comphelper::disposeComponent( xSecondaryComponent ); 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir // now that they're disambiguated, copy these types into our member 1079*cdf0e10cSrcweir _out_rTypes.realloc( aListeners.size() ); 1080*cdf0e10cSrcweir ::std::copy( aListeners.begin(), aListeners.end(), _out_rTypes.getArray() ); 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir catch( const Exception& ) 1083*cdf0e10cSrcweir { 1084*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1085*cdf0e10cSrcweir } 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir //-------------------------------------------------------------------- 1089*cdf0e10cSrcweir void EventHandler::impl_getDialogElementScriptEvents_nothrow( Sequence < ScriptEventDescriptor >& _out_rEvents ) const 1090*cdf0e10cSrcweir { 1091*cdf0e10cSrcweir _out_rEvents = Sequence < ScriptEventDescriptor >(); 1092*cdf0e10cSrcweir try 1093*cdf0e10cSrcweir { 1094*cdf0e10cSrcweir Reference< XScriptEventsSupplier > xEventsSupplier( m_xComponent, UNO_QUERY_THROW ); 1095*cdf0e10cSrcweir Reference< XNameContainer > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); 1096*cdf0e10cSrcweir Sequence< ::rtl::OUString > aEventNames( xEvents->getElementNames() ); 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir sal_Int32 nEventCount = aEventNames.getLength(); 1099*cdf0e10cSrcweir _out_rEvents.realloc( nEventCount ); 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir const ::rtl::OUString* pNames = aEventNames.getConstArray(); 1102*cdf0e10cSrcweir ScriptEventDescriptor* pDescs = _out_rEvents.getArray(); 1103*cdf0e10cSrcweir 1104*cdf0e10cSrcweir for( sal_Int32 i = 0 ; i < nEventCount ; ++i, ++pNames, ++pDescs ) 1105*cdf0e10cSrcweir OSL_VERIFY( xEvents->getByName( *pNames ) >>= *pDescs ); 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir catch( const Exception& ) 1108*cdf0e10cSrcweir { 1109*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1110*cdf0e10cSrcweir } 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir 1113*cdf0e10cSrcweir //-------------------------------------------------------------------- 1114*cdf0e10cSrcweir Reference< XInterface > EventHandler::impl_getSecondaryComponentForEventInspection_throw( ) const 1115*cdf0e10cSrcweir { 1116*cdf0e10cSrcweir Reference< XInterface > xReturn; 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir // if it's a form, create a form controller for the additional events 1119*cdf0e10cSrcweir Reference< XForm > xComponentAsForm( m_xComponent, UNO_QUERY ); 1120*cdf0e10cSrcweir if ( xComponentAsForm.is() ) 1121*cdf0e10cSrcweir { 1122*cdf0e10cSrcweir Reference< XTabControllerModel > xComponentAsTCModel( m_xComponent, UNO_QUERY_THROW ); 1123*cdf0e10cSrcweir Reference< XFormController > xController( 1124*cdf0e10cSrcweir m_aContext.createComponent( "com.sun.star.form.runtime.FormController" ), UNO_QUERY_THROW ); 1125*cdf0e10cSrcweir xController->setModel( xComponentAsTCModel ); 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir xReturn = xController; 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir else 1130*cdf0e10cSrcweir { 1131*cdf0e10cSrcweir ::rtl::OUString sControlService; 1132*cdf0e10cSrcweir OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_DEFAULTCONTROL ) >>= sControlService ); 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir xReturn = m_aContext.createComponent( sControlService ); 1135*cdf0e10cSrcweir } 1136*cdf0e10cSrcweir return xReturn; 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir //-------------------------------------------------------------------- 1140*cdf0e10cSrcweir const EventDescription& EventHandler::impl_getEventForName_throw( const ::rtl::OUString& _rPropertyName ) const 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir EventMap::const_iterator pos = m_aEvents.find( _rPropertyName ); 1143*cdf0e10cSrcweir if ( pos == m_aEvents.end() ) 1144*cdf0e10cSrcweir throw UnknownPropertyException(); 1145*cdf0e10cSrcweir return pos->second; 1146*cdf0e10cSrcweir } 1147*cdf0e10cSrcweir 1148*cdf0e10cSrcweir //-------------------------------------------------------------------- 1149*cdf0e10cSrcweir namespace 1150*cdf0e10cSrcweir { 1151*cdf0e10cSrcweir static bool lcl_endsWith( const ::rtl::OUString& _rText, const ::rtl::OUString& _rCheck ) 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir sal_Int32 nTextLen = _rText.getLength(); 1154*cdf0e10cSrcweir sal_Int32 nCheckLen = _rCheck.getLength(); 1155*cdf0e10cSrcweir if ( nCheckLen > nTextLen ) 1156*cdf0e10cSrcweir return false; 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir return _rText.indexOf( _rCheck ) == ( nTextLen - nCheckLen ); 1159*cdf0e10cSrcweir } 1160*cdf0e10cSrcweir } 1161*cdf0e10cSrcweir //-------------------------------------------------------------------- 1162*cdf0e10cSrcweir void EventHandler::impl_setFormComponentScriptEvent_nothrow( const ScriptEventDescriptor& _rScriptEvent ) 1163*cdf0e10cSrcweir { 1164*cdf0e10cSrcweir try 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir ::rtl::OUString sScriptCode( _rScriptEvent.ScriptCode ); 1167*cdf0e10cSrcweir ::rtl::OUString sScriptType( _rScriptEvent.ScriptType ); 1168*cdf0e10cSrcweir bool bResetScript = ( sScriptCode.getLength() == 0 ); 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir sal_Int32 nObjectIndex = impl_getComponentIndexInParent_throw(); 1171*cdf0e10cSrcweir Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); 1172*cdf0e10cSrcweir Reference< XEventAttacherManager > xEventManager( xChild->getParent(), UNO_QUERY_THROW ); 1173*cdf0e10cSrcweir Sequence< ScriptEventDescriptor > aEvents( xEventManager->getScriptEvents( nObjectIndex ) ); 1174*cdf0e10cSrcweir 1175*cdf0e10cSrcweir // is there already a registered script for this event? 1176*cdf0e10cSrcweir ScriptEventDescriptor* pEvent = aEvents.getArray(); 1177*cdf0e10cSrcweir sal_Int32 eventCount = aEvents.getLength(), event = 0; 1178*cdf0e10cSrcweir for ( event = 0; event < eventCount; ++event, ++pEvent ) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir if ( ( pEvent->EventMethod == _rScriptEvent.EventMethod ) 1181*cdf0e10cSrcweir && ( lcl_endsWith( _rScriptEvent.ListenerType, pEvent->ListenerType ) ) 1182*cdf0e10cSrcweir // (strange enough, the events we get from getScriptEvents are not fully qualified) 1183*cdf0e10cSrcweir ) 1184*cdf0e10cSrcweir { 1185*cdf0e10cSrcweir // yes 1186*cdf0e10cSrcweir if ( !bResetScript ) 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir // set to something non-empty -> overwrite 1189*cdf0e10cSrcweir pEvent->ScriptCode = sScriptCode; 1190*cdf0e10cSrcweir pEvent->ScriptType = sScriptType; 1191*cdf0e10cSrcweir } 1192*cdf0e10cSrcweir else 1193*cdf0e10cSrcweir { 1194*cdf0e10cSrcweir // set to empty -> remove from sequence 1195*cdf0e10cSrcweir ::std::copy( pEvent + 1, aEvents.getArray() + eventCount, pEvent ); 1196*cdf0e10cSrcweir aEvents.realloc( eventCount - 1 ); 1197*cdf0e10cSrcweir --eventCount; 1198*cdf0e10cSrcweir } 1199*cdf0e10cSrcweir break; 1200*cdf0e10cSrcweir } 1201*cdf0e10cSrcweir } 1202*cdf0e10cSrcweir if ( ( event >= eventCount ) && !bResetScript ) 1203*cdf0e10cSrcweir { 1204*cdf0e10cSrcweir // no, did not find it -> append 1205*cdf0e10cSrcweir aEvents.realloc( eventCount + 1 ); 1206*cdf0e10cSrcweir aEvents[ eventCount ] = _rScriptEvent; 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir xEventManager->revokeScriptEvents( nObjectIndex ); 1210*cdf0e10cSrcweir xEventManager->registerScriptEvents( nObjectIndex, aEvents ); 1211*cdf0e10cSrcweir 1212*cdf0e10cSrcweir PropertyHandlerHelper::setContextDocumentModified( m_aContext ); 1213*cdf0e10cSrcweir } 1214*cdf0e10cSrcweir catch( const Exception& ) 1215*cdf0e10cSrcweir { 1216*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir } 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir //-------------------------------------------------------------------- 1221*cdf0e10cSrcweir void EventHandler::impl_setDialogElementScriptEvent_nothrow( const ScriptEventDescriptor& _rScriptEvent ) 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir try 1224*cdf0e10cSrcweir { 1225*cdf0e10cSrcweir ::rtl::OUString sScriptCode( _rScriptEvent.ScriptCode ); 1226*cdf0e10cSrcweir bool bResetScript = ( sScriptCode.getLength() == 0 ); 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir Reference< XScriptEventsSupplier > xEventsSupplier( m_xComponent, UNO_QUERY_THROW ); 1229*cdf0e10cSrcweir Reference< XNameContainer > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir ::rtl::OUStringBuffer aCompleteName; 1232*cdf0e10cSrcweir aCompleteName.append( _rScriptEvent.ListenerType ); 1233*cdf0e10cSrcweir aCompleteName.appendAscii( "::" ); 1234*cdf0e10cSrcweir aCompleteName.append( _rScriptEvent.EventMethod ); 1235*cdf0e10cSrcweir ::rtl::OUString sCompleteName( aCompleteName.makeStringAndClear() ); 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir bool bExists = xEvents->hasByName( sCompleteName ); 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir if ( bResetScript ) 1240*cdf0e10cSrcweir { 1241*cdf0e10cSrcweir if ( bExists ) 1242*cdf0e10cSrcweir xEvents->removeByName( sCompleteName ); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir else 1245*cdf0e10cSrcweir { 1246*cdf0e10cSrcweir Any aNewValue; aNewValue <<= _rScriptEvent; 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir if ( bExists ) 1249*cdf0e10cSrcweir xEvents->replaceByName( sCompleteName, aNewValue ); 1250*cdf0e10cSrcweir else 1251*cdf0e10cSrcweir xEvents->insertByName( sCompleteName, aNewValue ); 1252*cdf0e10cSrcweir } 1253*cdf0e10cSrcweir } 1254*cdf0e10cSrcweir catch( const Exception& ) 1255*cdf0e10cSrcweir { 1256*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1257*cdf0e10cSrcweir } 1258*cdf0e10cSrcweir } 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir //-------------------------------------------------------------------- 1261*cdf0e10cSrcweir bool EventHandler::impl_filterMethod_nothrow( const EventDescription& _rEvent ) const 1262*cdf0e10cSrcweir { 1263*cdf0e10cSrcweir // some (control-triggered) events do not make sense for certain grid control columns. However, 1264*cdf0e10cSrcweir // our mechnism to retrieve control-triggered events does not know about this, so we do some 1265*cdf0e10cSrcweir // late filtering here. 1266*cdf0e10cSrcweir switch ( m_nGridColumnType ) 1267*cdf0e10cSrcweir { 1268*cdf0e10cSrcweir case FormComponentType::COMBOBOX: 1269*cdf0e10cSrcweir if ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId ) 1270*cdf0e10cSrcweir return false; 1271*cdf0e10cSrcweir break; 1272*cdf0e10cSrcweir case FormComponentType::LISTBOX: 1273*cdf0e10cSrcweir if ( ( UID_BRWEVT_CHANGED == _rEvent.sUniqueBrowseId ) 1274*cdf0e10cSrcweir || ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId ) 1275*cdf0e10cSrcweir ) 1276*cdf0e10cSrcweir return false; 1277*cdf0e10cSrcweir break; 1278*cdf0e10cSrcweir } 1279*cdf0e10cSrcweir 1280*cdf0e10cSrcweir return true; 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir //........................................................................ 1284*cdf0e10cSrcweir } // namespace pcr 1285*cdf0e10cSrcweir //........................................................................ 1286*cdf0e10cSrcweir 1287