• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xlnt-community / xlnt / 796b5d63-faf9-48e9-946d-5f649cf3d172

05 Mar 2025 05:11AM UTC coverage: 82.27% (+0.4%) from 81.87%
796b5d63-faf9-48e9-946d-5f649cf3d172

push

circleci

web-flow
Fix workbook comparisons, cleanup of included headers (#59)

This PR does the following:
1. Fixes issue https://github.com/xlnt-community/xlnt/issues/58. Please
read the issue for detailed infos.
2. Changes / removes a few definitions of `XLNT_API(_INTERNAL)` which
were defined in the wrong places (e.g. `.cpp` file, or in the header
although the function was implemented in the header too).
3. Cleans up many unnecessary or missing headers which I found along the
way.
4. Added `operator!=` to many classes to ease such comparisons and
improve programming experience.

103 of 143 new or added lines in 20 files covered. (72.03%)

3 existing lines in 2 files now uncovered.

11554 of 14044 relevant lines covered (82.27%)

1176465.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
./source/worksheet/page_setup.cpp
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_setup.hpp>
27

28
namespace xlnt {
29

30
page_setup::page_setup()
27✔
31
    : break_(xlnt::page_break::none),
27✔
32
      sheet_state_(xlnt::sheet_state::visible),
27✔
33
      fit_to_page_(false),
27✔
34
      fit_to_height_(false),
27✔
35
      fit_to_width_(false)
27✔
36
{
37
}
27✔
38

39
page_break page_setup::page_break() const
1✔
40
{
41
    return break_;
1✔
42
}
43

44
void page_setup::page_break(xlnt::page_break b)
1✔
45
{
46
    break_ = b;
1✔
47
}
1✔
48

49
sheet_state page_setup::sheet_state() const
16✔
50
{
51
    return sheet_state_;
16✔
52
}
53

54
void page_setup::sheet_state(xlnt::sheet_state sheet_state)
×
55
{
56
    sheet_state_ = sheet_state;
×
57
}
×
58

59
paper_size page_setup::paper_size() const
4✔
60
{
61
    return paper_size_.get();
4✔
62
}
63

64
void page_setup::paper_size(xlnt::paper_size paper_size)
18✔
65
{
66
    paper_size_ = paper_size;
18✔
67
}
18✔
68

69
bool page_setup::has_paper_size() const
9✔
70
{
71
    return this->paper_size_.is_set();
9✔
72
}
73

74
bool page_setup::fit_to_page() const
6✔
75
{
76
    return fit_to_page_;
6✔
77
}
78

79
void page_setup::fit_to_page(bool fit_to_page)
1✔
80
{
81
    fit_to_page_ = fit_to_page;
1✔
82
}
1✔
83

84
bool page_setup::fit_to_height() const
2✔
85
{
86
    return fit_to_height_;
2✔
87
}
88

89
void page_setup::fit_to_height(bool fit_to_height)
1✔
90
{
91
    fit_to_height_ = fit_to_height;
1✔
92
}
1✔
93

94
bool page_setup::fit_to_width() const
2✔
95
{
96
    return fit_to_width_;
2✔
97
}
98

99
void page_setup::fit_to_width(bool fit_to_width)
1✔
100
{
101
    fit_to_width_ = fit_to_width;
1✔
102
}
1✔
103

104
void page_setup::scale(double scale)
14✔
105
{
106
    scale_ = scale;
14✔
107
}
14✔
108

109
double page_setup::scale() const
3✔
110
{
111
    return scale_.get();
3✔
112
}
113

114
bool page_setup::has_scale() const
8✔
115
{
116
    return this->scale_.is_set();
8✔
117
}
118

119
const std::string& page_setup::rel_id() const
1✔
120
{
121
    return this->rel_id_;
1✔
122
}
123

124
void page_setup::rel_id(const std::string& val)
5✔
125
{
126
    this->rel_id_ = val;
5✔
127
}
5✔
128

129
bool page_setup::has_rel_id() const
8✔
130
{
131
    return !rel_id_.empty();
8✔
132
}
133

134
bool page_setup::operator==(const page_setup &rhs) const
6✔
135
{
136
    return break_ == rhs.break_
6✔
137
        && sheet_state_ == rhs.sheet_state_
6✔
138
        && paper_size_ == rhs.paper_size_
6✔
139
        && fit_to_page_ == rhs.fit_to_page_
6✔
140
        && fit_to_height_ == rhs.fit_to_height_
6✔
141
        && fit_to_width_ == rhs.fit_to_width_
6✔
142
        && scale_ == rhs.scale_
6✔
143
        && paper_size_ == rhs.paper_size_
6✔
144
        && rel_id_ == rhs.rel_id_;
12✔
145
}
146

NEW
147
bool page_setup::operator!=(const page_setup &rhs) const
×
148
{
NEW
149
    return !(*this == rhs);
×
150
}
151

152
} // namespace xlnt
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc