Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / outdevstate.hxx
blob06255171ffd3d414335344dd25a7dc750424c581
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 .
20 #ifndef INCLUDED_VCL_OUTDEVSTATE_HXX
21 #define INCLUDED_VCL_OUTDEVSTATE_HXX
23 #include <vcl/mapmod.hxx>
24 #include <vcl/region.hxx>
25 #include <vcl/font.hxx>
26 #include <vcl/vclenum.hxx>
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>
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
54 namespace o3tl
56 template<> struct typed_flags<PushFlags> : is_typed_flags<PushFlags, 0xFFFF> {};
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)
61 // LayoutModes for Complex Text Layout
62 // These are flag values, i.e they can be combined
63 enum ComplexTextLayoutMode
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)
74 // make combining these type-safe
75 inline ComplexTextLayoutMode operator| (ComplexTextLayoutMode lhs, ComplexTextLayoutMode rhs)
77 return static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) | static_cast<sal_uLong>(rhs));
79 inline ComplexTextLayoutMode operator& (ComplexTextLayoutMode lhs, ComplexTextLayoutMode rhs)
81 return static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) & static_cast<sal_uLong>(rhs));
83 inline ComplexTextLayoutMode operator~ (ComplexTextLayoutMode rhs)
85 return static_cast<ComplexTextLayoutMode>(0x7ff & ~(static_cast<sal_uLong>(rhs)));
87 inline ComplexTextLayoutMode& operator|= (ComplexTextLayoutMode& lhs, ComplexTextLayoutMode rhs)
89 lhs = static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) | static_cast<sal_uLong>(rhs));
90 return lhs;
92 inline ComplexTextLayoutMode& operator&= (ComplexTextLayoutMode& lhs, ComplexTextLayoutMode rhs)
94 lhs = static_cast<ComplexTextLayoutMode>(static_cast<sal_uLong>(lhs) & static_cast<sal_uLong>(rhs));
95 return lhs;
98 class OutDevState
100 public:
101 OutDevState();
102 ~OutDevState();
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;
122 #endif // INCLUDED_VCL_OUTDEVSTATE_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */