1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 25 #define __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 26 27 #include <threadhelp/threadhelpbase.hxx> 28 #include <cppuhelper/propshlp.hxx> 29 #include <cppuhelper/weak.hxx> 30 #include <osl/mutex.hxx> 31 #include <rtl/ustring.hxx> 32 33 #ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP_ 34 #include <com/sun/star/awt/XBitmap.hpp> 35 #endif 36 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37 #include <com/sun/star/lang/XServiceInfo.hpp> 38 #include <com/sun/star/lang/XTypeProvider.hpp> 39 #include <com/sun/star/lang/IllegalArgumentException.hpp> 40 #include <framework/fwedllapi.h> 41 42 #define SERVICENAME_ACTIONTRIGGER "com.sun.star.ui.ActionTrigger" 43 #define IMPLEMENTATIONNAME_ACTIONTRIGGER "com.sun.star.comp.ui.ActionTrigger" 44 45 namespace framework 46 { 47 48 class ActionTriggerPropertySet : public ThreadHelpBase , // Struct for right initialization of mutex member! Must be first of baseclasses. 49 public ::com::sun::star::lang::XServiceInfo , 50 public ::com::sun::star::lang::XTypeProvider, 51 public ::cppu::OBroadcastHelper , 52 public ::cppu::OPropertySetHelper , // -> XPropertySet, XFastPropertySet, XMultiPropertySet 53 public ::cppu::OWeakObject 54 { 55 public: 56 FWE_DLLPUBLIC ActionTriggerPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 57 FWE_DLLPUBLIC virtual ~ActionTriggerPropertySet(); 58 59 // XInterface 60 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ); 61 virtual FWE_DLLPUBLIC void SAL_CALL acquire() throw (); 62 virtual FWE_DLLPUBLIC void SAL_CALL release() throw (); 63 64 // XServiceInfo 65 virtual FWE_DLLPUBLIC ::rtl::OUString SAL_CALL getImplementationName( ); 66 virtual FWE_DLLPUBLIC sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 67 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 68 69 // XTypeProvider 70 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 71 virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 72 73 private: 74 //--------------------------------------------------------------------------------------------------------- 75 // OPropertySetHelper 76 //--------------------------------------------------------------------------------------------------------- 77 virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue, 78 com::sun::star::uno::Any& aOldValue, 79 sal_Int32 nHandle, 80 const com::sun::star::uno::Any& aValue ); 81 82 83 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ); 84 85 using cppu::OPropertySetHelper::getFastPropertyValue; 86 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue, sal_Int32 nHandle ) const; 87 88 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 89 90 virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(); 91 92 static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 93 94 //--------------------------------------------------------------------------------------------------------- 95 // helper 96 //--------------------------------------------------------------------------------------------------------- 97 98 sal_Bool impl_tryToChangeProperty( const rtl::OUString& aCurrentValue , 99 const com::sun::star::uno::Any& aNewValue , 100 com::sun::star::uno::Any& aOldValue , 101 com::sun::star::uno::Any& aConvertedValue ); 102 103 sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::awt::XBitmap > xBitmap, 104 const com::sun::star::uno::Any& aNewValue , 105 com::sun::star::uno::Any& aOldValue , 106 com::sun::star::uno::Any& aConvertedValue ); 107 108 sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xInterface, 109 const com::sun::star::uno::Any& aNewValue , 110 com::sun::star::uno::Any& aOldValue , 111 com::sun::star::uno::Any& aConvertedValue ); 112 113 //--------------------------------------------------------------------------------------------------------- 114 // members 115 //--------------------------------------------------------------------------------------------------------- 116 117 rtl::OUString m_aCommandURL; 118 rtl::OUString m_aHelpURL; 119 rtl::OUString m_aText; 120 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > m_xBitmap; 121 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xActionTriggerContainer; 122 }; 123 124 } 125 126 #endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ 127