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