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