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