LibreOffice Module vcl (master)  1
State.hxx
Go to the documentation of this file.
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 
20 #pragma once
21 
22 #include <tools/color.hxx>
23 #include <tools/gen.hxx>
24 #include <tools/fontenum.hxx>
25 #include <i18nlangtag/lang.h>
26 #include <o3tl/typed_flags_set.hxx>
27 
29 #include <vcl/font.hxx>
30 #include <vcl/mapmod.hxx>
31 #include <vcl/region.hxx>
32 #include <vcl/vclenum.hxx>
33 
34 #include <memory>
35 #include <optional>
36 
37 namespace vcl
38 {
39 // Flags for OutputDevice::Push() and State
40 enum class PushFlags
41 {
42  NONE = 0x0000,
43  LINECOLOR = 0x0001,
44  FILLCOLOR = 0x0002,
45  FONT = 0x0004,
46  TEXTCOLOR = 0x0008,
47  MAPMODE = 0x0010,
48  CLIPREGION = 0x0020,
49  RASTEROP = 0x0040,
50  TEXTFILLCOLOR = 0x0080,
51  TEXTALIGN = 0x0100,
52  REFPOINT = 0x0200,
53  TEXTLINECOLOR = 0x0400,
54  TEXTLAYOUTMODE = 0x0800,
55  TEXTLANGUAGE = 0x1000,
56  OVERLINECOLOR = 0x2000,
57  ALL = 0xFFFF
58 };
59 }
60 
61 namespace o3tl
62 {
63 template <> struct typed_flags<vcl::PushFlags> : is_typed_flags<vcl::PushFlags, 0xFFFF>
64 {
65 };
66 }
67 #define PUSH_ALLFONT \
68  (vcl::PushFlags::TEXTCOLOR | vcl::PushFlags::TEXTFILLCOLOR | vcl::PushFlags::TEXTLINECOLOR \
69  | vcl::PushFlags::OVERLINECOLOR | vcl::PushFlags::TEXTALIGN | vcl::PushFlags::TEXTLAYOUTMODE \
70  | vcl::PushFlags::TEXTLANGUAGE | vcl::PushFlags::FONT)
71 
72 namespace vcl::text
73 {
74 // Layout flags for Complex Text Layout
75 // These are flag values, i.e they can be combined
77 {
78  Default = 0x0000,
79  BiDiRtl = 0x0001,
80  BiDiStrong = 0x0002,
81  TextOriginLeft = 0x0004,
82  TextOriginRight = 0x0008
83 };
84 }
85 
86 namespace o3tl
87 {
88 template <>
90  : is_typed_flags<vcl::text::ComplexTextLayoutFlags, 0x000f>
91 {
92 };
93 }
94 
95 namespace vcl
96 {
97 struct State
98 {
99  State() = default;
100  State(State&&) = default;
101 
102  std::unique_ptr<vcl::Region> mpClipRegion;
103  std::optional<MapMode> mpMapMode;
104  std::optional<vcl::Font> mpFont;
105  std::optional<Point> mpRefPoint;
106  std::optional<Color> mpLineColor;
107  std::optional<Color> mpFillColor;
108  std::optional<Color> mpTextColor;
109  std::optional<Color> mpTextFillColor;
110  std::optional<Color> mpTextLineColor;
111  std::optional<Color> mpOverlineColor;
117  bool mbMapActive = false;
118 };
119 }
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LanguageType meTextLanguage
Definition: State.hxx:115
std::optional< MapMode > mpMapMode
Definition: State.hxx:103
text::ComplexTextLayoutFlags mnTextLayoutMode
Definition: State.hxx:114
std::optional< Color > mpTextColor
Definition: State.hxx:108
std::optional< vcl::Font > mpFont
Definition: State.hxx:104
State()=default
RasterOp meRasterOp
Definition: State.hxx:113
ComplexTextLayoutFlags
Definition: State.hxx:76
std::optional< Color > mpFillColor
Definition: State.hxx:107
#define LANGUAGE_SYSTEM
PushFlags mnFlags
Definition: State.hxx:116
PushFlags
Definition: State.hxx:40
RasterOp
Definition: RasterOp.hxx:22
TextAlign
std::unique_ptr< vcl::Region > mpClipRegion
Definition: State.hxx:102
std::optional< Point > mpRefPoint
Definition: State.hxx:105
std::optional< Color > mpOverlineColor
Definition: State.hxx:111
ALIGN_TOP
std::optional< Color > mpTextLineColor
Definition: State.hxx:110
std::optional< Color > mpTextFillColor
Definition: State.hxx:109
bool mbMapActive
Definition: State.hxx:117
TextAlign meTextAlign
Definition: State.hxx:112
std::optional< Color > mpLineColor
Definition: State.hxx:106