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 			throw (::com::sun::star::uno::RuntimeException);
62         virtual FWE_DLLPUBLIC void SAL_CALL acquire() throw ();
63         virtual FWE_DLLPUBLIC void SAL_CALL release() throw ();
64 
65 		// XServiceInfo
66         virtual FWE_DLLPUBLIC ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
67         virtual FWE_DLLPUBLIC sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
68         virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
69 
70 		// XTypeProvider
71         virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException);
72         virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException);
73 
74 	private:
75 		//---------------------------------------------------------------------------------------------------------
76 		//	OPropertySetHelper
77 		//---------------------------------------------------------------------------------------------------------
78 		virtual sal_Bool SAL_CALL convertFastPropertyValue(	com::sun::star::uno::Any&		aConvertedValue,
79 															com::sun::star::uno::Any&		aOldValue,
80 															sal_Int32						nHandle,
81 															const com::sun::star::uno::Any&	aValue			)
82 			throw( com::sun::star::lang::IllegalArgumentException );
83 
84 
85 		virtual void SAL_CALL setFastPropertyValue_NoBroadcast(	sal_Int32 nHandle, const com::sun::star::uno::Any& aValue )
86 			throw( com::sun::star::uno::Exception );
87 
88         using cppu::OPropertySetHelper::getFastPropertyValue;
89 		virtual void SAL_CALL getFastPropertyValue(	com::sun::star::uno::Any& aValue, sal_Int32	nHandle	) const;
90 
91 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
92 
93 		virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
94 			throw (::com::sun::star::uno::RuntimeException);
95 
96 		static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
97 
98 		//---------------------------------------------------------------------------------------------------------
99 		//	helper
100 		//---------------------------------------------------------------------------------------------------------
101 
102 		sal_Bool impl_tryToChangeProperty(	const	rtl::OUString&				aCurrentValue	,
103 											const	com::sun::star::uno::Any&	aNewValue		,
104 											com::sun::star::uno::Any&			aOldValue		,
105 											com::sun::star::uno::Any&			aConvertedValue	) throw( com::sun::star::lang::IllegalArgumentException );
106 
107 		sal_Bool impl_tryToChangeProperty(	const	com::sun::star::uno::Reference< com::sun::star::awt::XBitmap >	xBitmap,
108 											const	com::sun::star::uno::Any&	aNewValue		,
109 											com::sun::star::uno::Any&			aOldValue		,
110 											com::sun::star::uno::Any&			aConvertedValue	) throw( com::sun::star::lang::IllegalArgumentException );
111 
112 		sal_Bool impl_tryToChangeProperty(	const	com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xInterface,
113 											const	com::sun::star::uno::Any&	aNewValue		,
114 											com::sun::star::uno::Any&			aOldValue		,
115 											com::sun::star::uno::Any&			aConvertedValue	) throw( com::sun::star::lang::IllegalArgumentException );
116 
117 		//---------------------------------------------------------------------------------------------------------
118 		//	members
119 		//---------------------------------------------------------------------------------------------------------
120 
121 		rtl::OUString                                                         m_aCommandURL;
122 		rtl::OUString                                                         m_aHelpURL;
123 		rtl::OUString                                                         m_aText;
124 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >    m_xBitmap;
125 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xActionTriggerContainer;
126 };
127 
128 }
129 
130 #endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_
131