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 _COMPHELPER_PROPERTYCONTAINER_HXX_
25 #define _COMPHELPER_PROPERTYCONTAINER_HXX_
26 
27 #include <comphelper/propertycontainerhelper.hxx>
28 #include <cppuhelper/propshlp.hxx>
29 #include <com/sun/star/uno/Type.hxx>
30 #include "comphelper/comphelperdllapi.h"
31 
32 //.........................................................................
33 namespace comphelper
34 {
35 //.........................................................................
36 
37 //==========================================================================
38 //= OPropertyContainer
39 //==========================================================================
40 typedef ::cppu::OPropertySetHelper OPropertyContainer_Base;
41 /** a OPropertySetHelper implementation which is just a simple container for properties represented
42 	by class members, usually in a derived class.
43 	<BR>
44 	A restriction of this class is that no value conversions are made on a setPropertyValue call. Though
45 	the base class supports this with the convertFastPropertyValue method, the OPropertyContainer accepts only
46 	values which already have the correct type, it's unable to convert, for instance, a long to a short.
47 */
48 class COMPHELPER_DLLPUBLIC OPropertyContainer
49             :public OPropertyContainer_Base
50             ,public OPropertyContainerHelper
51 {
52 public:
53 	// this dtor is needed otherwise we can get a wrong delete operator
54 	virtual ~OPropertyContainer();
55 
56 protected:
57 	OPropertyContainer(::cppu::OBroadcastHelper& _rBHelper);
58 
59 	/// for scripting : the types of the interfaces supported by this class
60 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
61 
62 // OPropertySetHelper overridables
63 	virtual sal_Bool SAL_CALL convertFastPropertyValue(
64 							::com::sun::star::uno::Any & rConvertedValue,
65 							::com::sun::star::uno::Any & rOldValue,
66 							sal_Int32 nHandle,
67 							const ::com::sun::star::uno::Any& rValue )
68 								throw (::com::sun::star::lang::IllegalArgumentException);
69 
70 	virtual void SAL_CALL   setFastPropertyValue_NoBroadcast(
71 							    sal_Int32 nHandle,
72 							    const ::com::sun::star::uno::Any& rValue
73                             )
74                             throw (::com::sun::star::uno::Exception);
75 
76     using OPropertyContainer_Base::getFastPropertyValue;
77 	virtual void SAL_CALL getFastPropertyValue(
78 								::com::sun::star::uno::Any& rValue,
79 								sal_Int32 nHandle
80 									 ) const;
81 
82     // disambiguate a base class method (XFastPropertySet)
83 	virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
84 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
85 };
86 
87 //.........................................................................
88 }	// namespace comphelper
89 //.........................................................................
90 
91 #endif // _COMPHELPER_PROPERTYCONTAINER_HXX_
92 
93 
94