xref: /aoo4110/main/svtools/inc/svtools/colorcfg.hxx (revision b1cdbd2c)
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_COLORCFG_HXX
24 #define INCLUDED_SVTOOLS_COLORCFG_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 #include <unotools/options.hxx>
33 
34 //-----------------------------------------------------------------------------
35 namespace svtools{
36 enum ColorConfigEntry
37 {
38     DOCCOLOR            ,
39     DOCBOUNDARIES       ,
40     APPBACKGROUND       ,
41     OBJECTBOUNDARIES    ,
42     TABLEBOUNDARIES     ,
43 	FONTCOLOR			,
44     LINKS               ,
45     LINKSVISITED        ,
46     ANCHOR              ,
47     SPELL         ,
48     SMARTTAGS     ,
49     WRITERTEXTGRID      ,
50     WRITERFIELDSHADINGS ,
51     WRITERIDXSHADINGS         ,
52     WRITERDIRECTCURSOR        ,
53     WRITERSCRIPTINDICATOR,
54     WRITERSECTIONBOUNDARIES,
55     WRITERPAGEBREAKS,
56     HTMLSGML            ,
57     HTMLCOMMENT         ,
58     HTMLKEYWORD         ,
59     HTMLUNKNOWN         ,
60     CALCGRID            ,
61     CALCPAGEBREAK       ,
62     CALCPAGEBREAKMANUAL,
63     CALCPAGEBREAKAUTOMATIC,
64     CALCDETECTIVE       ,
65     CALCDETECTIVEERROR       ,
66     CALCREFERENCE       ,
67     CALCNOTESBACKGROUND     ,
68     DRAWGRID            ,
69     DRAWDRAWING         ,
70     DRAWFILL            ,
71     BASICIDENTIFIER,
72     BASICCOMMENT   ,
73     BASICNUMBER    ,
74     BASICSTRING    ,
75     BASICOPERATOR  ,
76     BASICKEYWORD   ,
77     BASICERROR   ,
78 	SQLIDENTIFIER,
79 	SQLNUMBER,
80 	SQLSTRING,
81 	SQLOPERATOR,
82 	SQLKEYWORD,
83 	SQLPARAMETER,
84 	SQLCOMMENT,
85     ColorConfigEntryCount
86 };
87 /* -----------------------------22.03.2002 15:36------------------------------
88 
89  ---------------------------------------------------------------------------*/
90 class ColorConfig_Impl;
91 struct ColorConfigValue
92 {
93 
94     sal_Bool    bIsVisible; //validity depends on the element type
95     sal_Int32   nColor;
ColorConfigValuesvtools::ColorConfigValue96     ColorConfigValue() : bIsVisible(sal_False), nColor(0) {}
operator !=svtools::ColorConfigValue97     sal_Bool operator !=(const ColorConfigValue& rCmp) const
98         { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
99 };
100 /* -----------------------------22.03.2002 15:36------------------------------
101 
102  ---------------------------------------------------------------------------*/
103 class SVT_DLLPUBLIC ColorConfig:
104     public utl::detail::Options
105 {
106     friend class ColorConfig_Impl;
107 private:
108     static ColorConfig_Impl* m_pImpl;
109 public:
110     ColorConfig();
111     virtual ~ColorConfig();
112 
113     // get the configured value - if bSmart is set the default color setting is provided
114     // instead of the automatic color
115     ColorConfigValue        GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart = sal_True)const;
116     static Color            GetDefaultColor(ColorConfigEntry eEntry);
117 };
118 /* -----------------------------22.03.2002 15:31------------------------------
119 
120  ---------------------------------------------------------------------------*/
121 class SVT_DLLPUBLIC EditableColorConfig
122 {
123     ColorConfig_Impl*   m_pImpl;
124     sal_Bool            m_bModified;
125 public:
126     EditableColorConfig();
127     ~EditableColorConfig();
128 
129     ::com::sun::star::uno::Sequence< ::rtl::OUString >  GetSchemeNames() const;
130     void                                                DeleteScheme(const ::rtl::OUString& rScheme );
131     void                                                AddScheme(const ::rtl::OUString& rScheme );
132     sal_Bool                                            LoadScheme(const ::rtl::OUString& rScheme );
133     const ::rtl::OUString&                              GetCurrentSchemeName()const;
134     void                        SetCurrentSchemeName(const ::rtl::OUString& rScheme);
135 
136     const ColorConfigValue&     GetColorValue(ColorConfigEntry eEntry)const;
137     void                        SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
138     void                        SetModified();
ClearModified()139     void                        ClearModified(){m_bModified = sal_False;}
IsModified() const140     sal_Bool                    IsModified()const{return m_bModified;}
141     void                        Commit();
142 
143 	void						DisableBroadcast();
144 	void						EnableBroadcast();
145 };
146 }//namespace svtools
147 #endif
148 
149