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 XMLOFF_COLORPROPERTYSET_HXX
24 #define XMLOFF_COLORPROPERTYSET_HXX
25 
26 #include <cppuhelper/implbase2.hxx>
27 
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/beans/XPropertyState.hpp>
30 
31 namespace xmloff
32 {
33 namespace chart
34 {
35 
36 class ColorPropertySet : public ::cppu::WeakImplHelper2<
37         ::com::sun::star::beans::XPropertySet,
38         ::com::sun::star::beans::XPropertyState >
39 {
40 public:
41     // if bFillColor == false, the color is a LineColor
42 	explicit ColorPropertySet( sal_Int32 nColor, bool bFillColor = true );
43 	virtual ~ColorPropertySet();
44 
45     void setColor( sal_Int32 nColor );
46     sal_Int32 getColor();
47 
48 protected:
49     // ____ XPropertySet ____
50     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
51         throw (::com::sun::star::uno::RuntimeException);
52     virtual void SAL_CALL setPropertyValue(
53         const ::rtl::OUString& aPropertyName,
54         const ::com::sun::star::uno::Any& aValue )
55         throw (::com::sun::star::beans::UnknownPropertyException,
56                ::com::sun::star::beans::PropertyVetoException,
57                ::com::sun::star::lang::IllegalArgumentException,
58                ::com::sun::star::lang::WrappedTargetException,
59                ::com::sun::star::uno::RuntimeException);
60     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
61         const ::rtl::OUString& PropertyName )
62         throw (::com::sun::star::beans::UnknownPropertyException,
63                ::com::sun::star::lang::WrappedTargetException,
64                ::com::sun::star::uno::RuntimeException);
65     virtual void SAL_CALL addPropertyChangeListener(
66         const ::rtl::OUString& aPropertyName,
67         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
68         throw (::com::sun::star::beans::UnknownPropertyException,
69                ::com::sun::star::lang::WrappedTargetException,
70                ::com::sun::star::uno::RuntimeException);
71     virtual void SAL_CALL removePropertyChangeListener(
72         const ::rtl::OUString& aPropertyName,
73         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
74         throw (::com::sun::star::beans::UnknownPropertyException,
75                ::com::sun::star::lang::WrappedTargetException,
76                ::com::sun::star::uno::RuntimeException);
77     virtual void SAL_CALL addVetoableChangeListener(
78         const ::rtl::OUString& PropertyName,
79         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
80         throw (::com::sun::star::beans::UnknownPropertyException,
81                ::com::sun::star::lang::WrappedTargetException,
82                ::com::sun::star::uno::RuntimeException);
83     virtual void SAL_CALL removeVetoableChangeListener(
84         const ::rtl::OUString& PropertyName,
85         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
86         throw (::com::sun::star::beans::UnknownPropertyException,
87                ::com::sun::star::lang::WrappedTargetException,
88                ::com::sun::star::uno::RuntimeException);
89 
90     // ____ XPropertyState ____
91     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
92         const ::rtl::OUString& PropertyName )
93         throw (::com::sun::star::beans::UnknownPropertyException,
94                ::com::sun::star::uno::RuntimeException);
95     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates(
96         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName )
97         throw (::com::sun::star::beans::UnknownPropertyException,
98                ::com::sun::star::uno::RuntimeException);
99     virtual void SAL_CALL setPropertyToDefault(
100         const ::rtl::OUString& PropertyName )
101         throw (::com::sun::star::beans::UnknownPropertyException,
102                ::com::sun::star::uno::RuntimeException);
103     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
104         const ::rtl::OUString& aPropertyName )
105         throw (::com::sun::star::beans::UnknownPropertyException,
106                ::com::sun::star::lang::WrappedTargetException,
107                ::com::sun::star::uno::RuntimeException);
108 
109 private:
110     ::com::sun::star::uno::Reference<
111             ::com::sun::star::beans::XPropertySetInfo > m_xInfo;
112     ::rtl::OUString  m_aColorPropName;
113     sal_Int32        m_nColor;
114     bool             m_bIsFillColor;
115     sal_Int32        m_nDefaultColor;
116 };
117 
118 } //  namespace chart
119 } //  namespace xmloff
120 
121 // XMLOFF_COLORPROPERTYSET_HXX
122 #endif
123