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