xref: /AOO41X/main/svtools/inc/svtools/extcolorcfg.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
24cdf0e10cSrcweir #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "svtools/svtdllapi.h"
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <tools/color.hxx>
29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
30cdf0e10cSrcweir #include <svl/brdcst.hxx>
31cdf0e10cSrcweir #include <svl/lstner.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //-----------------------------------------------------------------------------
34cdf0e10cSrcweir namespace svtools{
35cdf0e10cSrcweir /* -----------------------------22.03.2002 15:36------------------------------
36cdf0e10cSrcweir 
37cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
38cdf0e10cSrcweir class ExtendedColorConfig_Impl;
39cdf0e10cSrcweir class ExtendedColorConfigValue
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	::rtl::OUString m_sName;
42cdf0e10cSrcweir 	::rtl::OUString m_sDisplayName;
43cdf0e10cSrcweir     sal_Int32		m_nColor;
44cdf0e10cSrcweir     sal_Int32		m_nDefaultColor;
45cdf0e10cSrcweir public:
ExtendedColorConfigValue()46cdf0e10cSrcweir     ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
ExtendedColorConfigValue(const::rtl::OUString & _sName,const::rtl::OUString & _sDisplayName,sal_Int32 _nColor,sal_Int32 _nDefaultColor)47cdf0e10cSrcweir     ExtendedColorConfigValue(const ::rtl::OUString& _sName
48cdf0e10cSrcweir 	                        ,const ::rtl::OUString& _sDisplayName
49cdf0e10cSrcweir                             ,sal_Int32		_nColor
50cdf0e10cSrcweir                             ,sal_Int32		_nDefaultColor)
51cdf0e10cSrcweir     : m_sName(_sName)
52cdf0e10cSrcweir     ,m_sDisplayName(_sDisplayName)
53cdf0e10cSrcweir     ,m_nColor(_nColor)
54cdf0e10cSrcweir     ,m_nDefaultColor(_nDefaultColor)
55cdf0e10cSrcweir     {}
56cdf0e10cSrcweir 
getName() const57cdf0e10cSrcweir     inline ::rtl::OUString getName()         const { return m_sName; }
getDisplayName() const58cdf0e10cSrcweir     inline ::rtl::OUString getDisplayName()  const { return m_sDisplayName; }
getColor() const59cdf0e10cSrcweir     inline sal_Int32	   getColor()        const { return m_nColor; }
getDefaultColor() const60cdf0e10cSrcweir     inline sal_Int32	   getDefaultColor() const { return m_nDefaultColor; }
61cdf0e10cSrcweir 
setColor(sal_Int32 _nColor)62cdf0e10cSrcweir     inline void	setColor(sal_Int32 _nColor) { m_nColor = _nColor; }
63cdf0e10cSrcweir 
operator !=(const ExtendedColorConfigValue & rCmp) const64cdf0e10cSrcweir     sal_Bool operator !=(const ExtendedColorConfigValue& rCmp) const
65cdf0e10cSrcweir         { return m_nColor != rCmp.m_nColor;}
66cdf0e10cSrcweir };
67cdf0e10cSrcweir /* -----------------------------22.03.2002 15:36------------------------------
68cdf0e10cSrcweir 
69cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
70cdf0e10cSrcweir class SVT_DLLPUBLIC ExtendedColorConfig : public SfxBroadcaster, public SfxListener
71cdf0e10cSrcweir {
72cdf0e10cSrcweir     friend class ExtendedColorConfig_Impl;
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir     static ExtendedColorConfig_Impl* m_pImpl;
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir     ExtendedColorConfig();
77cdf0e10cSrcweir     ~ExtendedColorConfig();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     // get the configured value
82cdf0e10cSrcweir 	ExtendedColorConfigValue        GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const;
83cdf0e10cSrcweir 	sal_Int32						GetComponentCount() const;
84cdf0e10cSrcweir 	::rtl::OUString					GetComponentName(sal_uInt32 _nPos) const;
85cdf0e10cSrcweir 	::rtl::OUString					GetComponentDisplayName(const ::rtl::OUString& _sComponentName) const;
86cdf0e10cSrcweir 	sal_Int32						GetComponentColorCount(const ::rtl::OUString& _sName) const;
87cdf0e10cSrcweir 	ExtendedColorConfigValue		GetComponentColorConfigValue(const ::rtl::OUString& _sComponentName,sal_uInt32 _nPos) const;
88cdf0e10cSrcweir };
89cdf0e10cSrcweir /* -----------------------------22.03.2002 15:31------------------------------
90cdf0e10cSrcweir 
91cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
92cdf0e10cSrcweir class SVT_DLLPUBLIC EditableExtendedColorConfig
93cdf0e10cSrcweir {
94cdf0e10cSrcweir     ExtendedColorConfig_Impl*   m_pImpl;
95cdf0e10cSrcweir     sal_Bool            m_bModified;
96cdf0e10cSrcweir public:
97cdf0e10cSrcweir     EditableExtendedColorConfig();
98cdf0e10cSrcweir     ~EditableExtendedColorConfig();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString >  GetSchemeNames() const;
101cdf0e10cSrcweir     void                                                DeleteScheme(const ::rtl::OUString& rScheme );
102cdf0e10cSrcweir     void                                                AddScheme(const ::rtl::OUString& rScheme );
103cdf0e10cSrcweir     sal_Bool                                            LoadScheme(const ::rtl::OUString& rScheme );
104cdf0e10cSrcweir     const ::rtl::OUString&                              GetCurrentSchemeName()const;
105cdf0e10cSrcweir     void                        SetCurrentSchemeName(const ::rtl::OUString& rScheme);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     ExtendedColorConfigValue    GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const;
108cdf0e10cSrcweir 	sal_Int32					GetComponentCount() const;
109cdf0e10cSrcweir 	::rtl::OUString				GetComponentName(sal_uInt32 _nPos) const;
110cdf0e10cSrcweir 	::rtl::OUString				GetComponentDisplayName(const ::rtl::OUString& _sComponentName) const;
111cdf0e10cSrcweir 	sal_Int32					GetComponentColorCount(const ::rtl::OUString& _sName) const;
112cdf0e10cSrcweir 	ExtendedColorConfigValue	GetComponentColorConfigValue(const ::rtl::OUString& _sName,sal_uInt32 _nPos) const;
113cdf0e10cSrcweir     void                        SetColorValue(const ::rtl::OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
114cdf0e10cSrcweir     void                        SetModified();
ClearModified()115cdf0e10cSrcweir     void                        ClearModified(){m_bModified = sal_False;}
IsModified() const116cdf0e10cSrcweir     sal_Bool                    IsModified()const{return m_bModified;}
117cdf0e10cSrcweir     void                        Commit();
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	void						DisableBroadcast();
120cdf0e10cSrcweir 	void						EnableBroadcast();
121cdf0e10cSrcweir };
122cdf0e10cSrcweir }//namespace svtools
123cdf0e10cSrcweir #endif
124cdf0e10cSrcweir 
125