Branch data TLA Line data Source code
1 : : // Copyright (c) 2014-2022 Thomas Fussell
2 : : // Copyright (c) 2010-2015 openpyxl
3 : : // Copyright (c) 2024-2025 xlnt-community
4 : : //
5 : : // Permission is hereby granted, free of charge, to any person obtaining a copy
6 : : // of this software and associated documentation files (the "Software"), to deal
7 : : // in the Software without restriction, including without limitation the rights
8 : : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 : : // copies of the Software, and to permit persons to whom the Software is
10 : : // furnished to do so, subject to the following conditions:
11 : : //
12 : : // The above copyright notice and this permission notice shall be included in
13 : : // all copies or substantial portions of the Software.
14 : : //
15 : : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 : : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 : : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 : : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 : : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 : : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 : : // THE SOFTWARE
22 : : //
23 : : // @license: http://www.opensource.org/licenses/mit-license.php
24 : : // @author: see AUTHORS file
25 : :
26 : : #pragma once
27 : :
28 : : #include <xlnt/xlnt_config.hpp>
29 : : #include <xlnt/cell/cell_reference.hpp>
30 : : #include <xlnt/cell/index_types.hpp>
31 : : #include <xlnt/utils/optional.hpp>
32 : :
33 : : namespace xlnt {
34 : :
35 : : /// <summary>
36 : : /// Enumeration of possible states of a pane
37 : : /// </summary>
38 : : enum class pane_state
39 : : {
40 : : frozen,
41 : : frozen_split,
42 : : split
43 : : };
44 : :
45 : : /// <summary>
46 : : /// Enumeration of the four quadrants of a worksheet
47 : : /// </summary>
48 : : enum class pane_corner
49 : : {
50 : : top_left,
51 : : top_right,
52 : : bottom_left,
53 : : bottom_right
54 : : };
55 : :
56 : : /// <summary>
57 : : /// A fixed portion of a worksheet.
58 : : /// </summary>
59 : : struct XLNT_API pane
60 : : {
61 : : /// <summary>
62 : : /// The optional top left cell
63 : : /// </summary>
64 : : optional<cell_reference> top_left_cell;
65 : :
66 : : /// <summary>
67 : : /// The state of the pane
68 : : /// </summary>
69 : : pane_state state = pane_state::split;
70 : :
71 : : /// <summary>
72 : : /// The pane which contains the active cell
73 : : /// </summary>
74 : : pane_corner active_pane = pane_corner::top_left;
75 : :
76 : : /// <summary>
77 : : /// The row where the split should take place
78 : : /// </summary>
79 : : row_t y_split = 1;
80 : :
81 : : /// <summary>
82 : : /// The column where the split should take place
83 : : /// </summary>
84 : : column_t x_split = 1;
85 : :
86 : : /// <summary>
87 : : /// Returns true if this pane is equal to rhs based on its top-left cell, state,
88 : : /// active pane, and x/y split location.
89 : : /// </summary>
90 :UBC 0 : bool operator==(const pane &rhs) const
91 : : {
92 : 0 : return top_left_cell == rhs.top_left_cell
93 [ # # ]: 0 : && state == rhs.state
94 [ # # ]: 0 : && active_pane == rhs.active_pane
95 [ # # ]: 0 : && y_split == rhs.y_split
96 [ # # # # ]: 0 : && x_split == rhs.x_split;
97 : : }
98 : :
99 : : /// <summary>
100 : : /// Returns the negation of the equality operator.
101 : : /// </summary>
102 : : bool operator!=(const pane &rhs) const
103 : : {
104 : : return !(*this == rhs);
105 : : }
106 : : };
107 : :
108 : : } // namespace xlnt
|