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