1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 29 #define __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 30 31 #include <threadhelp/threadhelpbase.hxx> 32 #include <cppuhelper/propshlp.hxx> 33 #include <cppuhelper/weak.hxx> 34 #include <osl/mutex.hxx> 35 #include <rtl/ustring.hxx> 36 37 #ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP_ 38 #include <com/sun/star/awt/XBitmap.hpp> 39 #endif 40 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 41 #include <com/sun/star/lang/XServiceInfo.hpp> 42 #include <com/sun/star/lang/XTypeProvider.hpp> 43 #include <com/sun/star/lang/IllegalArgumentException.hpp> 44 #include <framework/fwedllapi.h> 45 46 #define SERVICENAME_ACTIONTRIGGER "com.sun.star.ui.ActionTrigger" 47 #define IMPLEMENTATIONNAME_ACTIONTRIGGER "com.sun.star.comp.ui.ActionTrigger" 48 49 namespace framework 50 { 51 52 class ActionTriggerPropertySet : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. 53 public ::com::sun::star::lang::XServiceInfo , 54 public ::com::sun::star::lang::XTypeProvider, 55 public ::cppu::OBroadcastHelper , 56 public ::cppu::OPropertySetHelper , // -> XPropertySet, XFastPropertySet, XMultiPropertySet 57 public ::cppu::OWeakObject 58 { 59 public: 60 FWE_DLLPUBLIC ActionTriggerPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 61 FWE_DLLPUBLIC virtual ~ActionTriggerPropertySet(); 62 63 // XInterface 64 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) 65 throw (::com::sun::star::uno::RuntimeException); 66 virtual FWE_DLLPUBLIC void SAL_CALL acquire() throw (); 67 virtual FWE_DLLPUBLIC void SAL_CALL release() throw (); 68 69 // XServiceInfo 70 virtual FWE_DLLPUBLIC ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 71 virtual FWE_DLLPUBLIC sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 72 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 73 74 // XTypeProvider 75 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); 76 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); 77 78 private: 79 //--------------------------------------------------------------------------------------------------------- 80 // OPropertySetHelper 81 //--------------------------------------------------------------------------------------------------------- 82 virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue, 83 com::sun::star::uno::Any& aOldValue, 84 sal_Int32 nHandle, 85 const com::sun::star::uno::Any& aValue ) 86 throw( com::sun::star::lang::IllegalArgumentException ); 87 88 89 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) 90 throw( com::sun::star::uno::Exception ); 91 92 using cppu::OPropertySetHelper::getFastPropertyValue; 93 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue, sal_Int32 nHandle ) const; 94 95 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 96 97 virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() 98 throw (::com::sun::star::uno::RuntimeException); 99 100 static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 101 102 //--------------------------------------------------------------------------------------------------------- 103 // helper 104 //--------------------------------------------------------------------------------------------------------- 105 106 sal_Bool impl_tryToChangeProperty( const rtl::OUString& aCurrentValue , 107 const com::sun::star::uno::Any& aNewValue , 108 com::sun::star::uno::Any& aOldValue , 109 com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); 110 111 sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::awt::XBitmap > xBitmap, 112 const com::sun::star::uno::Any& aNewValue , 113 com::sun::star::uno::Any& aOldValue , 114 com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); 115 116 sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xInterface, 117 const com::sun::star::uno::Any& aNewValue , 118 com::sun::star::uno::Any& aOldValue , 119 com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); 120 121 //--------------------------------------------------------------------------------------------------------- 122 // members 123 //--------------------------------------------------------------------------------------------------------- 124 125 rtl::OUString m_aCommandURL; 126 rtl::OUString m_aHelpURL; 127 rtl::OUString m_aText; 128 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > m_xBitmap; 129 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xActionTriggerContainer; 130 }; 131 132 } 133 134 #endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 135