Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
20 : #define INCLUDED_SVTOOLS_COLORCFG_HXX
21 :
22 : #include <svtools/svtdllapi.h>
23 : #include <rtl/ustring.hxx>
24 : #include <tools/color.hxx>
25 : #include <com/sun/star/uno/Sequence.h>
26 : #include <unotools/options.hxx>
27 :
28 :
29 : namespace svtools{
30 : enum ColorConfigEntry
31 : {
32 : DOCCOLOR ,
33 : DOCBOUNDARIES ,
34 : APPBACKGROUND ,
35 : OBJECTBOUNDARIES ,
36 : TABLEBOUNDARIES ,
37 : FONTCOLOR ,
38 : LINKS ,
39 : LINKSVISITED ,
40 : SPELL ,
41 : SMARTTAGS ,
42 : SHADOWCOLOR ,
43 : WRITERTEXTGRID ,
44 : WRITERFIELDSHADINGS ,
45 : WRITERIDXSHADINGS ,
46 : WRITERDIRECTCURSOR ,
47 : WRITERSCRIPTINDICATOR,
48 : WRITERSECTIONBOUNDARIES,
49 : WRITERHEADERFOOTERMARK,
50 : WRITERPAGEBREAKS,
51 : HTMLSGML ,
52 : HTMLCOMMENT ,
53 : HTMLKEYWORD ,
54 : HTMLUNKNOWN ,
55 : CALCGRID ,
56 : CALCPAGEBREAK ,
57 : CALCPAGEBREAKMANUAL,
58 : CALCPAGEBREAKAUTOMATIC,
59 : CALCDETECTIVE ,
60 : CALCDETECTIVEERROR ,
61 : CALCREFERENCE ,
62 : CALCNOTESBACKGROUND ,
63 : DRAWGRID ,
64 : BASICIDENTIFIER,
65 : BASICCOMMENT ,
66 : BASICNUMBER ,
67 : BASICSTRING ,
68 : BASICOPERATOR ,
69 : BASICKEYWORD ,
70 : BASICERROR ,
71 : SQLIDENTIFIER,
72 : SQLNUMBER,
73 : SQLSTRING,
74 : SQLOPERATOR,
75 : SQLKEYWORD,
76 : SQLPARAMETER,
77 : SQLCOMMENT,
78 : ColorConfigEntryCount
79 : };
80 :
81 : class ColorConfig_Impl;
82 : struct ColorConfigValue
83 : {
84 :
85 : bool bIsVisible; //validity depends on the element type
86 : sal_Int32 nColor;
87 9568 : ColorConfigValue() : bIsVisible(false), nColor(0) {}
88 24 : bool operator !=(const ColorConfigValue& rCmp) const
89 24 : { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
90 : };
91 :
92 : class SVT_DLLPUBLIC ColorConfig:
93 : public utl::detail::Options
94 : {
95 : friend class ColorConfig_Impl;
96 : private:
97 : static ColorConfig_Impl* m_pImpl;
98 : public:
99 : ColorConfig();
100 : virtual ~ColorConfig();
101 :
102 : // get the configured value - if bSmart is set the default color setting is provided
103 : // instead of the automatic color
104 : ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart = true) const;
105 : static Color GetDefaultColor(ColorConfigEntry eEntry);
106 : void Reload();
107 : };
108 :
109 : class SVT_DLLPUBLIC EditableColorConfig
110 : {
111 : ColorConfig_Impl* m_pImpl;
112 : bool m_bModified;
113 : public:
114 : EditableColorConfig();
115 : ~EditableColorConfig();
116 :
117 : css::uno::Sequence< OUString > GetSchemeNames() const;
118 : void DeleteScheme(const OUString& rScheme );
119 : void AddScheme(const OUString& rScheme );
120 : bool LoadScheme(const OUString& rScheme );
121 : const OUString& GetCurrentSchemeName() const;
122 : void SetCurrentSchemeName(const OUString& rScheme);
123 :
124 : const ColorConfigValue& GetColorValue(ColorConfigEntry eEntry) const;
125 : void SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
126 : void SetModified();
127 0 : void ClearModified() {m_bModified = false;}
128 0 : bool IsModified() const {return m_bModified;}
129 : void Commit();
130 :
131 : void DisableBroadcast();
132 : void EnableBroadcast();
133 : };
134 : }//namespace svtools
135 : #endif
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|