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_framework.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <classes/actiontriggerpropertyset.hxx> 32*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 33*cdf0e10cSrcweir #include <cppuhelper/proptypehlp.hxx> 34*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 35*cdf0e10cSrcweir #include <vcl/svapp.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir using namespace cppu; 39*cdf0e10cSrcweir using namespace com::sun::star::uno; 40*cdf0e10cSrcweir using namespace com::sun::star::beans; 41*cdf0e10cSrcweir using namespace com::sun::star::lang; 42*cdf0e10cSrcweir using namespace com::sun::star::awt; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir //struct SAL_DLLPUBLIC_IMPORT ::cppu::OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper, OMultiTypeInterfaceContainerHelper::keyType >; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir // Handles for properties 47*cdf0e10cSrcweir // (PLEASE SORT THIS FIELD, IF YOU ADD NEW PROPERTIES!) 48*cdf0e10cSrcweir // We use an enum to define these handles, to use all numbers from 0 to nn and 49*cdf0e10cSrcweir // if you add someone, you don't must control this! 50*cdf0e10cSrcweir // But don't forget to change values of follow defines, if you do something with this enum! 51*cdf0e10cSrcweir enum EPROPERTIES 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir HANDLE_COMMANDURL, 54*cdf0e10cSrcweir HANDLE_HELPURL, 55*cdf0e10cSrcweir HANDLE_IMAGE, 56*cdf0e10cSrcweir HANDLE_SUBCONTAINER, 57*cdf0e10cSrcweir HANDLE_TEXT, 58*cdf0e10cSrcweir PROPERTYCOUNT 59*cdf0e10cSrcweir }; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir namespace framework 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir ActionTriggerPropertySet::ActionTriggerPropertySet( const Reference< XMultiServiceFactory >& /*xServiceManager*/ ) 65*cdf0e10cSrcweir : ThreadHelpBase ( &Application::GetSolarMutex() ) 66*cdf0e10cSrcweir , OBroadcastHelper ( m_aLock.getShareableOslMutex() ) 67*cdf0e10cSrcweir , OPropertySetHelper ( *SAL_STATIC_CAST( OBroadcastHelper *, this )) 68*cdf0e10cSrcweir , OWeakObject () 69*cdf0e10cSrcweir , m_xBitmap ( 0 ) 70*cdf0e10cSrcweir , m_xActionTriggerContainer( 0 ) 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir ActionTriggerPropertySet::~ActionTriggerPropertySet() 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir // XInterface 79*cdf0e10cSrcweir Any SAL_CALL ActionTriggerPropertySet::queryInterface( const Type& aType ) 80*cdf0e10cSrcweir throw ( RuntimeException ) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir Any a = ::cppu::queryInterface( 83*cdf0e10cSrcweir aType , 84*cdf0e10cSrcweir SAL_STATIC_CAST( XServiceInfo*, this )); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir if( a.hasValue() ) 87*cdf0e10cSrcweir return a; 88*cdf0e10cSrcweir else 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir a = OPropertySetHelper::queryInterface( aType ); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir if( a.hasValue() ) 93*cdf0e10cSrcweir return a; 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir return OWeakObject::queryInterface( aType ); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir void SAL_CALL ActionTriggerPropertySet::acquire() throw () 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir OWeakObject::acquire(); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir void SAL_CALL ActionTriggerPropertySet::release() throw () 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir OWeakObject::release(); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // XServiceInfo 111*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ActionTriggerPropertySet::getImplementationName() 112*cdf0e10cSrcweir throw ( RuntimeException ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_ACTIONTRIGGER )); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir sal_Bool SAL_CALL ActionTriggerPropertySet::supportsService( const ::rtl::OUString& ServiceName ) 118*cdf0e10cSrcweir throw ( RuntimeException ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir if ( ServiceName.equalsAscii( SERVICENAME_ACTIONTRIGGER )) 121*cdf0e10cSrcweir return sal_True; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir return sal_False; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL ActionTriggerPropertySet::getSupportedServiceNames() 127*cdf0e10cSrcweir throw ( RuntimeException ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir Sequence< ::rtl::OUString > seqServiceNames( 1 ); 130*cdf0e10cSrcweir seqServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGER )); 131*cdf0e10cSrcweir return seqServiceNames; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // XTypeProvider 135*cdf0e10cSrcweir Sequence< Type > SAL_CALL ActionTriggerPropertySet::getTypes() throw ( RuntimeException ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir // Optimize this method ! 138*cdf0e10cSrcweir // We initialize a static variable only one time. And we don't must use a mutex at every call! 139*cdf0e10cSrcweir // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! 140*cdf0e10cSrcweir static ::cppu::OTypeCollection* pTypeCollection = NULL ; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if ( pTypeCollection == NULL ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // Ready for multithreading; get global mutex for first call of this method only! see before 145*cdf0e10cSrcweir osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // Control these pointer again ... it can be, that another instance will be faster then these! 148*cdf0e10cSrcweir if ( pTypeCollection == NULL ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir // Create a static typecollection ... 151*cdf0e10cSrcweir static ::cppu::OTypeCollection aTypeCollection( 152*cdf0e10cSrcweir ::getCppuType(( const Reference< XPropertySet >*)NULL ) , 153*cdf0e10cSrcweir ::getCppuType(( const Reference< XFastPropertySet >*)NULL ) , 154*cdf0e10cSrcweir ::getCppuType(( const Reference< XMultiPropertySet >*)NULL ) , 155*cdf0e10cSrcweir ::getCppuType(( const Reference< XServiceInfo >*)NULL ) , 156*cdf0e10cSrcweir ::getCppuType(( const Reference< XTypeProvider >*)NULL ) ) ; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // ... and set his address to static pointer! 159*cdf0e10cSrcweir pTypeCollection = &aTypeCollection ; 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir return pTypeCollection->getTypes() ; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL ActionTriggerPropertySet::getImplementationId() throw ( RuntimeException ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir // Create one Id for all instances of this class. 169*cdf0e10cSrcweir // Use ethernet address to do this! (sal_True) 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // Optimize this method 172*cdf0e10cSrcweir // We initialize a static variable only one time. And we don't must use a mutex at every call! 173*cdf0e10cSrcweir // For the first call; pID is NULL - for the second call pID is different from NULL! 174*cdf0e10cSrcweir static ::cppu::OImplementationId* pID = NULL ; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir if ( pID == NULL ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir // Ready for multithreading; get global mutex for first call of this method only! see before 179*cdf0e10cSrcweir osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir // Control these pointer again ... it can be, that another instance will be faster then these! 182*cdf0e10cSrcweir if ( pID == NULL ) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir // Create a new static ID ... 185*cdf0e10cSrcweir static ::cppu::OImplementationId aID( sal_False ) ; 186*cdf0e10cSrcweir // ... and set his address to static pointer! 187*cdf0e10cSrcweir pID = &aID ; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir return pID->getImplementationId() ; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 195*cdf0e10cSrcweir // OPropertySetHelper implementation 196*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir sal_Bool SAL_CALL ActionTriggerPropertySet::convertFastPropertyValue( 199*cdf0e10cSrcweir Any& aConvertedValue, 200*cdf0e10cSrcweir Any& aOldValue, 201*cdf0e10cSrcweir sal_Int32 nHandle, 202*cdf0e10cSrcweir const Any& aValue ) 203*cdf0e10cSrcweir throw( IllegalArgumentException ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir // Check, if value of property will changed in method "setFastPropertyValue_NoBroadcast()". 206*cdf0e10cSrcweir // Return sal_True, if changed - else return sal_False. 207*cdf0e10cSrcweir // Attention: Method "impl_tryToChangeProperty()" can throw the IllegalArgumentException !!! 208*cdf0e10cSrcweir // Initialize return value with sal_False !!! 209*cdf0e10cSrcweir // (Handle can be invalid) 210*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir switch( nHandle ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir case HANDLE_COMMANDURL: 215*cdf0e10cSrcweir bReturn = impl_tryToChangeProperty( m_aCommandURL, aValue, aOldValue, aConvertedValue ); 216*cdf0e10cSrcweir break; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir case HANDLE_HELPURL: 219*cdf0e10cSrcweir bReturn = impl_tryToChangeProperty( m_aHelpURL, aValue, aOldValue, aConvertedValue ) ; 220*cdf0e10cSrcweir break; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir case HANDLE_IMAGE: 223*cdf0e10cSrcweir bReturn = impl_tryToChangeProperty( m_xBitmap, aValue, aOldValue, aConvertedValue ) ; 224*cdf0e10cSrcweir break; 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir case HANDLE_SUBCONTAINER: 227*cdf0e10cSrcweir bReturn = impl_tryToChangeProperty( m_xActionTriggerContainer, aValue, aOldValue, aConvertedValue ); 228*cdf0e10cSrcweir break; 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir case HANDLE_TEXT: 231*cdf0e10cSrcweir bReturn = impl_tryToChangeProperty( m_aText, aValue, aOldValue, aConvertedValue ) ; 232*cdf0e10cSrcweir break; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir // Return state of operation. 236*cdf0e10cSrcweir return bReturn; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir void SAL_CALL ActionTriggerPropertySet::setFastPropertyValue_NoBroadcast( 241*cdf0e10cSrcweir sal_Int32 nHandle, const Any& aValue ) 242*cdf0e10cSrcweir throw( Exception ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() ); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // Search for right handle ... and try to set property value. 247*cdf0e10cSrcweir switch( nHandle ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir case HANDLE_COMMANDURL: 250*cdf0e10cSrcweir aValue >>= m_aCommandURL; 251*cdf0e10cSrcweir break; 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir case HANDLE_HELPURL: 254*cdf0e10cSrcweir aValue >>= m_aHelpURL; 255*cdf0e10cSrcweir break; 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir case HANDLE_IMAGE: 258*cdf0e10cSrcweir aValue >>= m_xBitmap; 259*cdf0e10cSrcweir break; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir case HANDLE_SUBCONTAINER: 262*cdf0e10cSrcweir aValue >>= m_xActionTriggerContainer; 263*cdf0e10cSrcweir break; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir case HANDLE_TEXT: 266*cdf0e10cSrcweir aValue >>= m_aText; 267*cdf0e10cSrcweir break; 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir void SAL_CALL ActionTriggerPropertySet::getFastPropertyValue( 272*cdf0e10cSrcweir Any& aValue, sal_Int32 nHandle ) const 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() ); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir // Search for right handle ... and try to get property value. 277*cdf0e10cSrcweir switch( nHandle ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir case HANDLE_COMMANDURL: 280*cdf0e10cSrcweir aValue <<= m_aCommandURL; 281*cdf0e10cSrcweir break; 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir case HANDLE_HELPURL: 284*cdf0e10cSrcweir aValue <<= m_aHelpURL; 285*cdf0e10cSrcweir break; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir case HANDLE_IMAGE: 288*cdf0e10cSrcweir aValue <<= m_xBitmap; 289*cdf0e10cSrcweir break; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir case HANDLE_SUBCONTAINER: 292*cdf0e10cSrcweir aValue <<= m_xActionTriggerContainer; 293*cdf0e10cSrcweir break; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir case HANDLE_TEXT: 296*cdf0e10cSrcweir aValue <<= m_aText; 297*cdf0e10cSrcweir break; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL ActionTriggerPropertySet::getInfoHelper() 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir // Optimize this method ! 304*cdf0e10cSrcweir // We initialize a static variable only one time. And we don't must use a mutex at every call! 305*cdf0e10cSrcweir // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL! 306*cdf0e10cSrcweir static OPropertyArrayHelper* pInfoHelper = NULL; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir if( pInfoHelper == NULL ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir // Ready for multithreading 311*cdf0e10cSrcweir ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() ); 312*cdf0e10cSrcweir // Control this pointer again, another instance can be faster then these! 313*cdf0e10cSrcweir if( pInfoHelper == NULL ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir // Define static member to give structure of properties to baseclass "OPropertySetHelper". 316*cdf0e10cSrcweir // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable. 317*cdf0e10cSrcweir // "sal_True" say: Table is sorted by name. 318*cdf0e10cSrcweir static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True ); 319*cdf0e10cSrcweir pInfoHelper = &aInfoHelper; 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir return (*pInfoHelper); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL ActionTriggerPropertySet::getPropertySetInfo() 327*cdf0e10cSrcweir throw ( RuntimeException ) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir // Optimize this method ! 330*cdf0e10cSrcweir // We initialize a static variable only one time. And we don't must use a mutex at every call! 331*cdf0e10cSrcweir // For the first call; pInfo is NULL - for the second call pInfo is different from NULL! 332*cdf0e10cSrcweir static Reference< XPropertySetInfo >* pInfo = NULL ; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir if( pInfo == NULL ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir // Ready for multithreading 337*cdf0e10cSrcweir ::osl::MutexGuard aGuard( LockHelper::getGlobalLock().getShareableOslMutex() ); 338*cdf0e10cSrcweir // Control this pointer again, another instance can be faster then these! 339*cdf0e10cSrcweir if( pInfo == NULL ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir // Create structure of propertysetinfo for baseclass "OPropertySetHelper". 342*cdf0e10cSrcweir // (Use method "getInfoHelper()".) 343*cdf0e10cSrcweir static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 344*cdf0e10cSrcweir pInfo = &xInfo; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir return (*pInfo); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir const Sequence< Property > ActionTriggerPropertySet::impl_getStaticPropertyDescriptor() 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir static const Property pActionTriggerPropertys[] = 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )), HANDLE_COMMANDURL , ::getCppuType((::rtl::OUString*)0) , PropertyAttribute::TRANSIENT ), 356*cdf0e10cSrcweir Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" )), HANDLE_HELPURL , ::getCppuType((::rtl::OUString*)0) , PropertyAttribute::TRANSIENT ), 357*cdf0e10cSrcweir Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Image" )), HANDLE_IMAGE , ::getCppuType((Reference<XBitmap>*)0) , PropertyAttribute::TRANSIENT ), 358*cdf0e10cSrcweir Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubContainer" )), HANDLE_SUBCONTAINER , ::getCppuType((::rtl::OUString*)0) , PropertyAttribute::TRANSIENT ), 359*cdf0e10cSrcweir Property( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" )), HANDLE_TEXT , ::getCppuType((Reference<XInterface>*)0) , PropertyAttribute::TRANSIENT ) 360*cdf0e10cSrcweir }; 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir // Use it to initialize sequence! 363*cdf0e10cSrcweir static const Sequence< Property > seqActionTriggerPropertyDescriptor( pActionTriggerPropertys, PROPERTYCOUNT ); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir // Return static "PropertyDescriptor" 366*cdf0e10cSrcweir return seqActionTriggerPropertyDescriptor ; 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir //****************************************************************************************************************************** 371*cdf0e10cSrcweir // private method 372*cdf0e10cSrcweir //****************************************************************************************************************************** 373*cdf0e10cSrcweir sal_Bool ActionTriggerPropertySet::impl_tryToChangeProperty( 374*cdf0e10cSrcweir const ::rtl::OUString& sCurrentValue , 375*cdf0e10cSrcweir const Any& aNewValue , 376*cdf0e10cSrcweir Any& aOldValue , 377*cdf0e10cSrcweir Any& aConvertedValue ) 378*cdf0e10cSrcweir throw( IllegalArgumentException ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir // Set default return value if method failed. 381*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 382*cdf0e10cSrcweir // Get new value from any. 383*cdf0e10cSrcweir // IllegalArgumentException() can be thrown! 384*cdf0e10cSrcweir ::rtl::OUString sValue ; 385*cdf0e10cSrcweir convertPropertyValue( sValue, aNewValue ); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir // If value change ... 388*cdf0e10cSrcweir if( sValue != sCurrentValue ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir // ... set information of change. 391*cdf0e10cSrcweir aOldValue <<= sCurrentValue ; 392*cdf0e10cSrcweir aConvertedValue <<= sValue ; 393*cdf0e10cSrcweir // Return OK - "value will be change ..." 394*cdf0e10cSrcweir bReturn = sal_True; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir else 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir // ... clear information of return parameter! 399*cdf0e10cSrcweir aOldValue.clear () ; 400*cdf0e10cSrcweir aConvertedValue.clear () ; 401*cdf0e10cSrcweir // Return NOTHING - "value will not be change ..." 402*cdf0e10cSrcweir bReturn = sal_False; 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir return bReturn; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir sal_Bool ActionTriggerPropertySet::impl_tryToChangeProperty( 410*cdf0e10cSrcweir const Reference< XBitmap > aCurrentValue , 411*cdf0e10cSrcweir const Any& aNewValue , 412*cdf0e10cSrcweir Any& aOldValue , 413*cdf0e10cSrcweir Any& aConvertedValue ) 414*cdf0e10cSrcweir throw( IllegalArgumentException ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir // Set default return value if method failed. 417*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 418*cdf0e10cSrcweir // Get new value from any. 419*cdf0e10cSrcweir // IllegalArgumentException() can be thrown! 420*cdf0e10cSrcweir Reference< XBitmap > aValue ; 421*cdf0e10cSrcweir convertPropertyValue( aValue, aNewValue ); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir // If value change ... 424*cdf0e10cSrcweir if( aValue != aCurrentValue ) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir // ... set information of change. 427*cdf0e10cSrcweir aOldValue <<= aCurrentValue ; 428*cdf0e10cSrcweir aConvertedValue <<= aValue ; 429*cdf0e10cSrcweir // Return OK - "value will be change ..." 430*cdf0e10cSrcweir bReturn = sal_True; 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir else 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir // ... clear information of return parameter! 435*cdf0e10cSrcweir aOldValue.clear () ; 436*cdf0e10cSrcweir aConvertedValue.clear () ; 437*cdf0e10cSrcweir // Return NOTHING - "value will not be change ..." 438*cdf0e10cSrcweir bReturn = sal_False; 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir return bReturn; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir sal_Bool ActionTriggerPropertySet::impl_tryToChangeProperty( 445*cdf0e10cSrcweir const Reference< XInterface > aCurrentValue , 446*cdf0e10cSrcweir const Any& aNewValue , 447*cdf0e10cSrcweir Any& aOldValue , 448*cdf0e10cSrcweir Any& aConvertedValue ) 449*cdf0e10cSrcweir throw( IllegalArgumentException ) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir // Set default return value if method failed. 452*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 453*cdf0e10cSrcweir // Get new value from any. 454*cdf0e10cSrcweir // IllegalArgumentException() can be thrown! 455*cdf0e10cSrcweir Reference< XInterface > aValue ; 456*cdf0e10cSrcweir convertPropertyValue( aValue, aNewValue ); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir // If value change ... 459*cdf0e10cSrcweir if( aValue != aCurrentValue ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir // ... set information of change. 462*cdf0e10cSrcweir aOldValue <<= aCurrentValue ; 463*cdf0e10cSrcweir aConvertedValue <<= aValue ; 464*cdf0e10cSrcweir // Return OK - "value will be change ..." 465*cdf0e10cSrcweir bReturn = sal_True; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir else 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir // ... clear information of return parameter! 470*cdf0e10cSrcweir aOldValue.clear () ; 471*cdf0e10cSrcweir aConvertedValue.clear () ; 472*cdf0e10cSrcweir // Return NOTHING - "value will not be change ..." 473*cdf0e10cSrcweir bReturn = sal_False; 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir return bReturn; 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir 481