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