bump product version to 7.6.3.2-android
[LibreOffice.git] / include / vcl / windowstate.hxx
blob527e3661e9cea6acfc9dba36d7f88ba8fa2e3369
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_WINDOWSTATE_HXX
21 #define INCLUDED_VCL_WINDOWSTATE_HXX
23 #include <vcl/WindowPosSize.hxx>
25 namespace vcl
27 enum class WindowState
29 NONE = 0x0000,
30 Normal = 0x0001,
31 Minimized = 0x0002,
32 Maximized = 0x0004,
33 // Rollup is no longer used, but the bit is retained because WindowData is serialized
34 // from/to strings describing window state that are stored in a users config
35 // Rollup = 0x0008,
36 MaximizedHorz = 0x0010,
37 MaximizedVert = 0x0020,
38 FullScreen = 0x0040,
39 SystemMask = 0xffff
42 enum class WindowDataMask
44 NONE = 0x0000,
45 X = 0x0001,
46 Y = 0x0002,
47 Width = 0x0004,
48 Height = 0x0008,
49 State = 0x0010,
50 Minimized = 0x0020,
51 MaximizedX = 0x0100,
52 MaximizedY = 0x0200,
53 MaximizedWidth = 0x0400,
54 MaximizedHeight = 0x0800,
55 Pos = X | Y,
56 Size = Width | Height,
57 PosSize = Pos | Size,
58 PosSizeState = Pos | Size | State,
59 All = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight
60 | State | Minimized
63 class VCL_PLUGIN_PUBLIC WindowData final : public WindowPosSize
65 WindowState m_nState;
66 WindowDataMask m_nMask;
68 int mnMaximizedX;
69 int mnMaximizedY;
70 unsigned int mnMaximizedWidth;
71 unsigned int mnMaximizedHeight;
73 public:
74 WindowData()
75 : m_nState(WindowState::NONE)
76 , m_nMask(WindowDataMask::NONE)
77 , mnMaximizedX(0)
78 , mnMaximizedY(0)
79 , mnMaximizedWidth(0)
80 , mnMaximizedHeight(0)
83 WindowData(std::u16string_view rStr);
85 // serialize values to a string (the original WindowState representation)
86 OUString toStr() const;
88 void setState(WindowState nState) { m_nState = nState; }
89 WindowState state() const { return m_nState; }
90 WindowState& rState() { return m_nState; }
92 void setMask(WindowDataMask nMask) { m_nMask = nMask; }
93 WindowDataMask mask() const { return m_nMask; }
94 WindowDataMask& rMask() { return m_nMask; }
96 void SetMaximizedX(int nRX) { mnMaximizedX = nRX; }
97 int GetMaximizedX() const { return mnMaximizedX; }
98 void SetMaximizedY(int nRY) { mnMaximizedY = nRY; }
99 int GetMaximizedY() const { return mnMaximizedY; }
100 void SetMaximizedWidth(unsigned int nRWidth) { mnMaximizedWidth = nRWidth; }
101 unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
102 void SetMaximizedHeight(unsigned int nRHeight) { mnMaximizedHeight = nRHeight; }
103 unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
106 } // namespace vcl
108 namespace o3tl
110 template <> struct typed_flags<vcl::WindowState> : is_typed_flags<vcl::WindowState, 0xffff>
113 template <> struct typed_flags<vcl::WindowDataMask> : is_typed_flags<vcl::WindowDataMask, 0x0f3f>
118 namespace vcl
120 inline std::ostream& operator<<(std::ostream& s, const WindowData& rData)
122 if (rData.mask() & WindowDataMask::Width)
123 s << rData.width() << "x";
124 else
125 s << "?x";
126 if (rData.mask() & WindowDataMask::Height)
127 s << rData.height() << "@(";
128 else
129 s << "?@(";
130 if (rData.mask() & WindowDataMask::X)
131 s << rData.x() << ",";
132 else
133 s << "?,";
134 if (rData.mask() & WindowDataMask::Y)
135 s << rData.y() << ")^";
136 else
137 s << "?)^";
138 if (rData.mask() & WindowDataMask::State)
139 s << "0x" << std::hex << static_cast<unsigned>(rData.state()) << std::dec;
140 else
141 s << "?";
142 return s;
145 } // namespace vcl
147 #endif // INCLUDED_VCL_WINDOWSTATE_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */