Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
29 : : #define INCLUDED_SVTOOLS_COLORCFG_HXX
30 : :
31 : : #include "svtools/svtdllapi.h"
32 : : #include <rtl/ustring.hxx>
33 : : #include <tools/color.hxx>
34 : : #include <com/sun/star/uno/Sequence.h>
35 : : #include <svl/brdcst.hxx>
36 : : #include <svl/lstner.hxx>
37 : : #include <unotools/options.hxx>
38 : :
39 : : //-----------------------------------------------------------------------------
40 : : namespace svtools{
41 : : enum ColorConfigEntry
42 : : {
43 : : DOCCOLOR ,
44 : : DOCBOUNDARIES ,
45 : : APPBACKGROUND ,
46 : : OBJECTBOUNDARIES ,
47 : : TABLEBOUNDARIES ,
48 : : FONTCOLOR ,
49 : : LINKS ,
50 : : LINKSVISITED ,
51 : : SPELL ,
52 : : SMARTTAGS ,
53 : : SHADOWCOLOR ,
54 : : WRITERTEXTGRID ,
55 : : WRITERFIELDSHADINGS ,
56 : : WRITERIDXSHADINGS ,
57 : : WRITERDIRECTCURSOR ,
58 : : WRITERSCRIPTINDICATOR,
59 : : WRITERSECTIONBOUNDARIES,
60 : : WRITERHEADERFOOTERMARK,
61 : : WRITERPAGEBREAKS,
62 : : HTMLSGML ,
63 : : HTMLCOMMENT ,
64 : : HTMLKEYWORD ,
65 : : HTMLUNKNOWN ,
66 : : CALCGRID ,
67 : : CALCPAGEBREAK ,
68 : : CALCPAGEBREAKMANUAL,
69 : : CALCPAGEBREAKAUTOMATIC,
70 : : CALCDETECTIVE ,
71 : : CALCDETECTIVEERROR ,
72 : : CALCREFERENCE ,
73 : : CALCNOTESBACKGROUND ,
74 : : DRAWGRID ,
75 : : BASICIDENTIFIER,
76 : : BASICCOMMENT ,
77 : : BASICNUMBER ,
78 : : BASICSTRING ,
79 : : BASICOPERATOR ,
80 : : BASICKEYWORD ,
81 : : BASICERROR ,
82 : : SQLIDENTIFIER,
83 : : SQLNUMBER,
84 : : SQLSTRING,
85 : : SQLOPERATOR,
86 : : SQLKEYWORD,
87 : : SQLPARAMETER,
88 : : SQLCOMMENT,
89 : : ColorConfigEntryCount
90 : : };
91 : :
92 : : class ColorConfig_Impl;
93 : : struct ColorConfigValue
94 : : {
95 : :
96 : : sal_Bool bIsVisible; //validity depends on the element type
97 : : sal_Int32 nColor;
98 : 7130 : ColorConfigValue() : bIsVisible(sal_False), nColor(0) {}
99 : 24 : sal_Bool operator !=(const ColorConfigValue& rCmp) const
100 [ + - ][ + - ]: 24 : { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
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 : :
119 : : class SVT_DLLPUBLIC EditableColorConfig
120 : : {
121 : : ColorConfig_Impl* m_pImpl;
122 : : sal_Bool m_bModified;
123 : : public:
124 : : EditableColorConfig();
125 : : ~EditableColorConfig();
126 : :
127 : : ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSchemeNames() const;
128 : : void DeleteScheme(const ::rtl::OUString& rScheme );
129 : : void AddScheme(const ::rtl::OUString& rScheme );
130 : : sal_Bool LoadScheme(const ::rtl::OUString& rScheme );
131 : : const ::rtl::OUString& GetCurrentSchemeName()const;
132 : : void SetCurrentSchemeName(const ::rtl::OUString& rScheme);
133 : :
134 : : const ColorConfigValue& GetColorValue(ColorConfigEntry eEntry)const;
135 : : void SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
136 : : void SetModified();
137 : 0 : void ClearModified(){m_bModified = sal_False;}
138 : 0 : sal_Bool IsModified()const{return m_bModified;}
139 : : void Commit();
140 : :
141 : : void DisableBroadcast();
142 : : void EnableBroadcast();
143 : : };
144 : : }//namespace svtools
145 : : #endif
146 : :
147 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|