tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / svtools / colorcfg.hxx
blob5e4e774826d767c8e48dd4986d4a8e6e2e8fa44b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <svtools/svtdllapi.h>
22 #include <rtl/ustring.hxx>
23 #include <tools/color.hxx>
24 #include <com/sun/star/uno/Sequence.h>
25 #include <unotools/options.hxx>
26 #include <memory>
29 namespace svtools{
30 enum ColorConfigEntry : int
32 DOCCOLOR ,
33 DOCBOUNDARIES ,
34 APPBACKGROUND ,
35 TABLEBOUNDARIES ,
36 FONTCOLOR ,
37 LINKS ,
38 LINKSVISITED ,
39 SPELL ,
40 GRAMMAR ,
41 SMARTTAGS ,
42 SHADOWCOLOR ,
43 WRITERTEXTGRID ,
44 WRITERFIELDSHADINGS ,
45 WRITERIDXSHADINGS ,
46 WRITERDIRECTCURSOR , // unused
47 WRITERSCRIPTINDICATOR,
48 WRITERSECTIONBOUNDARIES,
49 WRITERHEADERFOOTERMARK,
50 WRITERPAGEBREAKS,
51 WRITERNONPRINTCHARS,
52 HTMLSGML ,
53 HTMLCOMMENT ,
54 HTMLKEYWORD ,
55 HTMLUNKNOWN ,
56 CALCGRID ,
57 CALCCELLFOCUS ,
58 CALCPAGEBREAK ,
59 CALCPAGEBREAKMANUAL,
60 CALCPAGEBREAKAUTOMATIC,
61 CALCHIDDENROWCOL ,
62 CALCTEXTOVERFLOW ,
63 CALCCOMMENTS ,
64 CALCDETECTIVE ,
65 CALCDETECTIVEERROR ,
66 CALCREFERENCE ,
67 CALCNOTESBACKGROUND ,
68 CALCVALUE,
69 CALCFORMULA,
70 CALCTEXT,
71 CALCPROTECTEDBACKGROUND,
72 DRAWGRID ,
73 AUTHOR1,
74 AUTHOR2,
75 AUTHOR3,
76 AUTHOR4,
77 AUTHOR5,
78 AUTHOR6,
79 AUTHOR7,
80 AUTHOR8,
81 AUTHOR9,
82 BASICEDITOR,
83 BASICIDENTIFIER,
84 BASICCOMMENT ,
85 BASICNUMBER ,
86 BASICSTRING ,
87 BASICOPERATOR ,
88 BASICKEYWORD ,
89 BASICERROR ,
90 SQLIDENTIFIER,
91 SQLNUMBER,
92 SQLSTRING,
93 SQLOPERATOR,
94 SQLKEYWORD,
95 SQLPARAMETER,
96 SQLCOMMENT,
98 // colors for Libreoffice Theme (Application)
99 WINDOWCOLOR ,
100 WINDOWTEXTCOLOR ,
101 BASECOLOR ,
102 BUTTONCOLOR ,
103 BUTTONTEXTCOLOR ,
104 ACCENTCOLOR ,
105 DISABLEDCOLOR ,
106 DISABLEDTEXTCOLOR ,
107 SHADECOLOR ,
108 SEPARATORCOLOR ,
109 FACECOLOR ,
110 ACTIVECOLOR ,
111 ACTIVETEXTCOLOR ,
112 ACTIVEBORDERCOLOR ,
113 FIELDCOLOR ,
114 MENUBARCOLOR ,
115 MENUBARTEXTCOLOR ,
116 MENUBARHIGHLIGHTCOLOR ,
117 MENUBARHIGHLIGHTTEXTCOLOR ,
118 MENUCOLOR ,
119 MENUTEXTCOLOR ,
120 MENUHIGHLIGHTCOLOR ,
121 MENUHIGHLIGHTTEXTCOLOR ,
122 MENUBORDERCOLOR ,
123 INACTIVECOLOR ,
124 INACTIVETEXTCOLOR ,
125 INACTIVEBORDERCOLOR ,
127 ColorConfigEntryCount
130 constexpr OUString AUTOMATIC_COLOR_SCHEME = u"COLOR_SCHEME_LIBREOFFICE_AUTOMATIC"_ustr;
131 constexpr size_t THEME_APPLICATION_COLORS_COUNT = ColorConfigEntryCount - WINDOWCOLOR;
133 class ColorConfig_Impl;
134 struct ColorConfigValue
137 bool bIsVisible; //validity depends on the element type
138 ::Color nColor;
139 ColorConfigValue() : bIsVisible(false), nColor(0) {}
140 ColorConfigValue(const Color& rColor, bool bVisible) : bIsVisible(bVisible), nColor(rColor) {}
141 bool operator !=(const ColorConfigValue& rCmp) const
142 { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
145 class SAL_WARN_UNUSED SVT_DLLPUBLIC ColorConfig final :
146 public utl::detail::Options
148 friend class ColorConfig_Impl;
149 private:
150 static ColorConfig_Impl* m_pImpl;
151 public:
152 ColorConfig();
153 virtual ~ColorConfig() override;
155 // get the configured value - if bSmart is set the default color setting is provided
156 // instead of the automatic color
157 ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart = true) const;
158 // -1 gets the default color on current mod.
159 // 0 gets the default color on light mod.
160 // 1 gets the default color on dark mod.
161 static Color GetDefaultColor(ColorConfigEntry eEntry, int nMod = -1);
162 static const OUString& GetCurrentSchemeName();
164 static void LoadThemeColorsFromRegistry();
165 static void SetupTheme();
168 class SVT_DLLPUBLIC EditableColorConfig
170 std::unique_ptr<ColorConfig_Impl> m_pImpl;
171 bool m_bModified;
172 public:
173 EditableColorConfig();
174 ~EditableColorConfig();
176 css::uno::Sequence< OUString > GetSchemeNames() const;
177 void DeleteScheme(const OUString& rScheme );
178 void AddScheme(const OUString& rScheme );
179 void LoadScheme(const OUString& rScheme );
180 const OUString& GetCurrentSchemeName() const;
181 void SetCurrentSchemeName(const OUString& rScheme);
183 const ColorConfigValue& GetColorValue(ColorConfigEntry eEntry) const;
184 void SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
185 void SetModified();
186 void ClearModified() {m_bModified = false;}
187 bool IsModified() const {return m_bModified;}
188 void Commit();
190 void DisableBroadcast();
191 void EnableBroadcast();
193 }//namespace svtools
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */