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 <string>
29 : :
30 : : #include <xlnt/xlnt_config.hpp>
31 : : #include <xlnt/utils/optional.hpp>
32 : :
33 : : namespace xlnt {
34 : :
35 : : /// <summary>
36 : : /// The properties of a row in a worksheet.
37 : : /// </summary>
38 : : class XLNT_API row_properties
39 : : {
40 : : public:
41 : : /// <summary>
42 : : /// Row height
43 : : /// </summary>
44 : : optional<double> height;
45 : :
46 : : /// <summary>
47 : : /// Distance in pixels from the bottom of the cell to the baseline of the cell content
48 : : /// </summary>
49 : : optional<double> dy_descent;
50 : :
51 : : /// <summary>
52 : : /// Whether or not the height is different from the default
53 : : /// </summary>
54 : : bool custom_height = false;
55 : :
56 : : /// <summary>
57 : : /// Whether or not the row should be hidden
58 : : /// </summary>
59 : : bool hidden = false;
60 : :
61 : : /// <summary>
62 : : /// True if row style should be applied
63 : : /// </summary>
64 : : optional<bool> custom_format;
65 : :
66 : : /// <summary>
67 : : /// The index to the style used by all cells in this row
68 : : /// </summary>
69 : : optional<std::size_t> style;
70 : :
71 : : /// <summary>
72 : : /// The row column span, used as part of the row block optimisation.
73 : : /// This used for loading this attribute from existing excel files mainly for inspecting
74 : : /// and not used when saving, it is calculated in the xlsx_producer.
75 : : /// </summary>
76 : : optional<std::string> spans;
77 : : };
78 : :
79 :CBC 6 : inline bool operator==(const row_properties &lhs, const row_properties &rhs)
80 : : {
81 : 6 : return lhs.height == rhs.height
82 [ + - ]: 6 : && lhs.dy_descent == rhs.dy_descent
83 [ + - ]: 6 : && lhs.custom_height == rhs.custom_height
84 [ + - ]: 6 : && lhs.hidden == rhs.hidden
85 [ + - ]: 6 : && lhs.custom_format == rhs.custom_format
86 [ + - ]: 6 : && lhs.style == rhs.style
87 [ + - + - ]: 12 : && lhs.spans == rhs.spans;
88 : : }
89 : :
90 : : inline bool operator!=(const row_properties &lhs, const row_properties &rhs)
91 : : {
92 : : return !(lhs == rhs);
93 : : }
94 : :
95 : : } // namespace xlnt
|