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 :
20 : #ifndef INCLUDED_VCL_OUTDEVSTATE_HXX
21 : #define INCLUDED_VCL_OUTDEVSTATE_HXX
22 :
23 : #include <sal/types.h>
24 :
25 : #include <vcl/mapmod.hxx>
26 : #include <vcl/region.hxx>
27 : #include <vcl/font.hxx>
28 : #include <vcl/vclenum.hxx>
29 :
30 : #include <tools/gen.hxx>
31 : #include <tools/color.hxx>
32 : #include <tools/fontenum.hxx>
33 : #include <o3tl/typed_flags_set.hxx>
34 :
35 : // Flags for OutputDevice::Push() and OutDevState
36 : enum class PushFlags {
37 : NONE = 0x0000,
38 : LINECOLOR = 0x0001,
39 : FILLCOLOR = 0x0002,
40 : FONT = 0x0004,
41 : TEXTCOLOR = 0x0008,
42 : MAPMODE = 0x0010,
43 : CLIPREGION = 0x0020,
44 : RASTEROP = 0x0040,
45 : TEXTFILLCOLOR = 0x0080,
46 : TEXTALIGN = 0x0100,
47 : REFPOINT = 0x0200,
48 : TEXTLINECOLOR = 0x0400,
49 : TEXTLAYOUTMODE = 0x0800,
50 : TEXTLANGUAGE = 0x1000,
51 : OVERLINECOLOR = 0x2000,
52 : ALL = 0xFFFF
53 : };
54 :
55 : namespace o3tl
56 : {
57 : template<> struct typed_flags<PushFlags> : is_typed_flags<PushFlags, 0xFFFF> {};
58 : }
59 : #define PUSH_ALLTEXT (PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR | PushFlags::TEXTLINECOLOR | PushFlags::OVERLINECOLOR | PushFlags::TEXTALIGN | PushFlags::TEXTLAYOUTMODE | PushFlags::TEXTLANGUAGE)
60 : #define PUSH_ALLFONT (PUSH_ALLTEXT | PushFlags::FONT)
61 :
62 : // LayoutModes for Complex Text Layout
63 : // These are flag values, i.e they can be combined
64 : enum ComplexTextLayoutMode
65 : {
66 : TEXT_LAYOUT_DEFAULT = ((sal_uLong)0x00000000),
67 : TEXT_LAYOUT_BIDI_RTL = ((sal_uLong)0x00000001),
68 : TEXT_LAYOUT_BIDI_STRONG = ((sal_uLong)0x00000002),
69 : TEXT_LAYOUT_TEXTORIGIN_LEFT = ((sal_uLong)0x00000004),
70 : TEXT_LAYOUT_TEXTORIGIN_RIGHT = ((sal_uLong)0x00000008),
71 : TEXT_LAYOUT_COMPLEX_DISABLED = ((sal_uLong)0x00000100),
72 : TEXT_LAYOUT_ENABLE_LIGATURES = ((sal_uLong)0x00000200),
73 : TEXT_LAYOUT_SUBSTITUTE_DIGITS = ((sal_uLong)0x00000400)
74 : };
75 : // make combining these type-safe
76 228537 : inline ComplexTextLayoutMode operator| (ComplexTextLayoutMode lhs, ComplexTextLayoutMode rhs)
77 : {
78 228537 : return static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) | static_cast<sal_uLong>(rhs));
79 : }
80 16601200 : inline ComplexTextLayoutMode operator& (ComplexTextLayoutMode lhs, ComplexTextLayoutMode rhs)
81 : {
82 16601200 : return static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) & static_cast<sal_uLong>(rhs));
83 : }
84 250814 : inline ComplexTextLayoutMode operator~ (ComplexTextLayoutMode rhs)
85 : {
86 250814 : return static_cast<ComplexTextLayoutMode>(0x7ff & ~(static_cast<sal_uLong>(rhs)));
87 : }
88 222026 : inline ComplexTextLayoutMode& operator|= (ComplexTextLayoutMode& lhs, ComplexTextLayoutMode rhs)
89 : {
90 222026 : lhs = static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) | static_cast<sal_uLong>(rhs));
91 222026 : return lhs;
92 : }
93 225004 : inline ComplexTextLayoutMode& operator&= (ComplexTextLayoutMode& lhs, ComplexTextLayoutMode rhs)
94 : {
95 225004 : lhs = static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) & static_cast<sal_uLong>(rhs));
96 225004 : return lhs;
97 : }
98 :
99 :
100 :
101 :
102 : class OutDevState
103 : {
104 : public:
105 : ~OutDevState();
106 :
107 : MapMode* mpMapMode;
108 : bool mbMapActive;
109 : vcl::Region* mpClipRegion;
110 : Color* mpLineColor;
111 : Color* mpFillColor;
112 : vcl::Font* mpFont;
113 : Color* mpTextColor;
114 : Color* mpTextFillColor;
115 : Color* mpTextLineColor;
116 : Color* mpOverlineColor;
117 : Point* mpRefPoint;
118 : TextAlign meTextAlign;
119 : RasterOp meRasterOp;
120 : ComplexTextLayoutMode mnTextLayoutMode;
121 : LanguageType meTextLanguage;
122 : PushFlags mnFlags;
123 : };
124 :
125 : #endif // INCLUDED_VCL_OUTDEVSTATE_HXX
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|