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 #ifndef CHART_IMPLOPROPERTYSET_HXX
24 #define CHART_IMPLOPROPERTYSET_HXX
25 
26 #include <com/sun/star/beans/PropertyState.hpp>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/style/XStyle.hpp>
29 
30 #include <map>
31 #include <vector>
32 
33 namespace property
34 {
35 namespace impl
36 {
37 
38 class ImplOPropertySet
39 {
40 public:
41 	ImplOPropertySet();
42 	explicit ImplOPropertySet( const ImplOPropertySet & rOther );
43 
44     /** supports states DIRECT_VALUE and DEFAULT_VALUE
45      */
46     ::com::sun::star::beans::PropertyState
47         GetPropertyStateByHandle( sal_Int32 nHandle ) const;
48 
49     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState >
50         GetPropertyStatesByHandle( const ::std::vector< sal_Int32 > & aHandles ) const;
51 
52     void SetPropertyToDefault( sal_Int32 nHandle );
53     void SetPropertiesToDefault( const ::std::vector< sal_Int32 > & aHandles );
54     void SetAllPropertiesToDefault();
55 
56     /** @param rValue is set to the value for the property given in nHandle.  If
57                the property is not set, the style chain is searched for any
58                instance set there.  If there was no value found either in the
59                property set itself or any of its styles, rValue remains
60                unchanged and false is returned.
61 
62         @return false if the property is default, true otherwise.
63      */
64     bool GetPropertyValueByHandle(
65         ::com::sun::star::uno::Any & rValue,
66         sal_Int32 nHandle ) const;
67 
68     void SetPropertyValueByHandle( sal_Int32 nHandle,
69                                    const ::com::sun::star::uno::Any & rValue,
70                                    ::com::sun::star::uno::Any * pOldValue = NULL );
71 
72     bool SetStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & xStyle );
73     ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
74         GetStyle() const;
75 
76     typedef
77         ::std::map< sal_Int32, ::com::sun::star::uno::Any >
78         tPropertyMap;
79 
80 private:
81     void cloneInterfaceProperties();
82 
83     tPropertyMap    m_aProperties;
84     ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
85         m_xStyle;
86 };
87 
88 } //  namespace impl
89 } //  namespace chart
90 
91 // CHART_IMPLOPROPERTYSET_HXX
92 #endif
93