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 INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
24 #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
25 
26 #include "svtools/svtdllapi.h"
27 #include <rtl/ustring.hxx>
28 #include <tools/color.hxx>
29 #include <com/sun/star/uno/Sequence.h>
30 #include <svl/brdcst.hxx>
31 #include <svl/lstner.hxx>
32 
33 //-----------------------------------------------------------------------------
34 namespace svtools{
35 /* -----------------------------22.03.2002 15:36------------------------------
36 
37  ---------------------------------------------------------------------------*/
38 class ExtendedColorConfig_Impl;
39 class ExtendedColorConfigValue
40 {
41 	::rtl::OUString m_sName;
42 	::rtl::OUString m_sDisplayName;
43     sal_Int32		m_nColor;
44     sal_Int32		m_nDefaultColor;
45 public:
ExtendedColorConfigValue()46     ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
ExtendedColorConfigValue(const::rtl::OUString & _sName,const::rtl::OUString & _sDisplayName,sal_Int32 _nColor,sal_Int32 _nDefaultColor)47     ExtendedColorConfigValue(const ::rtl::OUString& _sName
48 	                        ,const ::rtl::OUString& _sDisplayName
49                             ,sal_Int32		_nColor
50                             ,sal_Int32		_nDefaultColor)
51     : m_sName(_sName)
52     ,m_sDisplayName(_sDisplayName)
53     ,m_nColor(_nColor)
54     ,m_nDefaultColor(_nDefaultColor)
55     {}
56 
getName() const57     inline ::rtl::OUString getName()         const { return m_sName; }
getDisplayName() const58     inline ::rtl::OUString getDisplayName()  const { return m_sDisplayName; }
getColor() const59     inline sal_Int32	   getColor()        const { return m_nColor; }
getDefaultColor() const60     inline sal_Int32	   getDefaultColor() const { return m_nDefaultColor; }
61 
setColor(sal_Int32 _nColor)62     inline void	setColor(sal_Int32 _nColor) { m_nColor = _nColor; }
63 
operator !=(const ExtendedColorConfigValue & rCmp) const64     sal_Bool operator !=(const ExtendedColorConfigValue& rCmp) const
65         { return m_nColor != rCmp.m_nColor;}
66 };
67 /* -----------------------------22.03.2002 15:36------------------------------
68 
69  ---------------------------------------------------------------------------*/
70 class SVT_DLLPUBLIC ExtendedColorConfig : public SfxBroadcaster, public SfxListener
71 {
72     friend class ExtendedColorConfig_Impl;
73 private:
74     static ExtendedColorConfig_Impl* m_pImpl;
75 public:
76     ExtendedColorConfig();
77     ~ExtendedColorConfig();
78 
79     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
80 
81     // get the configured value
82 	ExtendedColorConfigValue        GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const;
83 	sal_Int32						GetComponentCount() const;
84 	::rtl::OUString					GetComponentName(sal_uInt32 _nPos) const;
85 	::rtl::OUString					GetComponentDisplayName(const ::rtl::OUString& _sComponentName) const;
86 	sal_Int32						GetComponentColorCount(const ::rtl::OUString& _sName) const;
87 	ExtendedColorConfigValue		GetComponentColorConfigValue(const ::rtl::OUString& _sComponentName,sal_uInt32 _nPos) const;
88 };
89 /* -----------------------------22.03.2002 15:31------------------------------
90 
91  ---------------------------------------------------------------------------*/
92 class SVT_DLLPUBLIC EditableExtendedColorConfig
93 {
94     ExtendedColorConfig_Impl*   m_pImpl;
95     sal_Bool            m_bModified;
96 public:
97     EditableExtendedColorConfig();
98     ~EditableExtendedColorConfig();
99 
100     ::com::sun::star::uno::Sequence< ::rtl::OUString >  GetSchemeNames() const;
101     void                                                DeleteScheme(const ::rtl::OUString& rScheme );
102     void                                                AddScheme(const ::rtl::OUString& rScheme );
103     sal_Bool                                            LoadScheme(const ::rtl::OUString& rScheme );
104     const ::rtl::OUString&                              GetCurrentSchemeName()const;
105     void                        SetCurrentSchemeName(const ::rtl::OUString& rScheme);
106 
107     ExtendedColorConfigValue    GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const;
108 	sal_Int32					GetComponentCount() const;
109 	::rtl::OUString				GetComponentName(sal_uInt32 _nPos) const;
110 	::rtl::OUString				GetComponentDisplayName(const ::rtl::OUString& _sComponentName) const;
111 	sal_Int32					GetComponentColorCount(const ::rtl::OUString& _sName) const;
112 	ExtendedColorConfigValue	GetComponentColorConfigValue(const ::rtl::OUString& _sName,sal_uInt32 _nPos) const;
113     void                        SetColorValue(const ::rtl::OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
114     void                        SetModified();
ClearModified()115     void                        ClearModified(){m_bModified = sal_False;}
IsModified() const116     sal_Bool                    IsModified()const{return m_bModified;}
117     void                        Commit();
118 
119 	void						DisableBroadcast();
120 	void						EnableBroadcast();
121 };
122 }//namespace svtools
123 #endif
124 
125