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 : : #include <xlnt/utils/numeric.hpp>
26 : : #include <xlnt/worksheet/page_margins.hpp>
27 : :
28 : : namespace xlnt {
29 : :
30 :CBC 364 : page_margins::page_margins()
31 : : {
32 : 364 : }
33 : :
34 : 47 : double page_margins::top() const
35 : : {
36 : 47 : return top_;
37 : : }
38 : :
39 : 365 : void page_margins::top(double top)
40 : : {
41 : 365 : top_ = top;
42 : 365 : }
43 : :
44 : 47 : double page_margins::left() const
45 : : {
46 : 47 : return left_;
47 : : }
48 : :
49 : 365 : void page_margins::left(double left)
50 : : {
51 : 365 : left_ = left;
52 : 365 : }
53 : :
54 : 47 : double page_margins::bottom() const
55 : : {
56 : 47 : return bottom_;
57 : : }
58 : :
59 : 365 : void page_margins::bottom(double bottom)
60 : : {
61 : 365 : bottom_ = bottom;
62 : 365 : }
63 : :
64 : 47 : double page_margins::right() const
65 : : {
66 : 47 : return right_;
67 : : }
68 : :
69 : 365 : void page_margins::right(double right)
70 : : {
71 : 365 : right_ = right;
72 : 365 : }
73 : :
74 : 47 : double page_margins::header() const
75 : : {
76 : 47 : return header_;
77 : : }
78 : :
79 : 365 : void page_margins::header(double header)
80 : : {
81 : 365 : header_ = header;
82 : 365 : }
83 : :
84 : 47 : double page_margins::footer() const
85 : : {
86 : 47 : return footer_;
87 : : }
88 : :
89 : 365 : void page_margins::footer(double footer)
90 : : {
91 : 365 : footer_ = footer;
92 : 365 : }
93 : :
94 : 8 : bool page_margins::operator==(const page_margins &rhs) const
95 : : {
96 : 8 : return detail::float_equals(top_, rhs.top_)
97 [ + - ]: 8 : && detail::float_equals(left_, rhs.left_)
98 [ + - ]: 8 : && detail::float_equals(right_, rhs.right_)
99 [ + - ]: 8 : && detail::float_equals(header_, rhs.header_)
100 [ + - + - ]: 16 : && detail::float_equals(footer_, rhs.footer_);
101 : : }
102 : :
103 :UBC 0 : bool page_margins::operator!=(const page_margins &rhs) const
104 : : {
105 : 0 : return !(*this == rhs);
106 : : }
107 : :
108 : : } // namespace xlnt
|