differential code coverage report with master
Current view: top level - source/worksheet - page_setup.cpp (source / functions) Coverage Total Hit UBC CBC
Current: coverage.info Lines: 92.3 % 65 60 5 60
Current Date: 2025-12-07 02:01:22 Functions: 90.9 % 22 20 2 20
Baseline: coverage_master.info Branches: 50.0 % 18 9 18 18
Baseline Date: 2025-12-07 02:01:21

             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_setup.hpp>
      27                 :                : 
      28                 :                : namespace xlnt {
      29                 :                : 
      30                 :CBC          38 : page_setup::page_setup()
      31                 :             38 :     : break_(xlnt::page_break::none),
      32                 :             38 :       sheet_state_(xlnt::sheet_state::visible),
      33                 :             38 :       fit_to_page_(false),
      34                 :             38 :       fit_to_height_(false),
      35                 :             38 :       fit_to_width_(false)
      36                 :                : {
      37                 :             38 : }
      38                 :                : 
      39                 :              1 : page_break page_setup::page_break() const
      40                 :                : {
      41                 :              1 :     return break_;
      42                 :                : }
      43                 :                : 
      44                 :              1 : void page_setup::page_break(xlnt::page_break b)
      45                 :                : {
      46                 :              1 :     break_ = b;
      47                 :              1 : }
      48                 :                : 
      49                 :             16 : sheet_state page_setup::sheet_state() const
      50                 :                : {
      51                 :             16 :     return sheet_state_;
      52                 :                : }
      53                 :                : 
      54                 :UBC           0 : void page_setup::sheet_state(xlnt::sheet_state sheet_state)
      55                 :                : {
      56                 :              0 :     sheet_state_ = sheet_state;
      57                 :              0 : }
      58                 :                : 
      59                 :CBC           4 : paper_size page_setup::paper_size() const
      60                 :                : {
      61                 :              4 :     return paper_size_.get();
      62                 :                : }
      63                 :                : 
      64                 :             29 : void page_setup::paper_size(xlnt::paper_size paper_size)
      65                 :                : {
      66                 :             29 :     paper_size_ = paper_size;
      67                 :             29 : }
      68                 :                : 
      69                 :              9 : bool page_setup::has_paper_size() const
      70                 :                : {
      71                 :              9 :     return this->paper_size_.is_set();
      72                 :                : }
      73                 :                : 
      74                 :              6 : bool page_setup::fit_to_page() const
      75                 :                : {
      76                 :              6 :     return fit_to_page_;
      77                 :                : }
      78                 :                : 
      79                 :              1 : void page_setup::fit_to_page(bool fit_to_page)
      80                 :                : {
      81                 :              1 :     fit_to_page_ = fit_to_page;
      82                 :              1 : }
      83                 :                : 
      84                 :              2 : bool page_setup::fit_to_height() const
      85                 :                : {
      86                 :              2 :     return fit_to_height_;
      87                 :                : }
      88                 :                : 
      89                 :              1 : void page_setup::fit_to_height(bool fit_to_height)
      90                 :                : {
      91                 :              1 :     fit_to_height_ = fit_to_height;
      92                 :              1 : }
      93                 :                : 
      94                 :              2 : bool page_setup::fit_to_width() const
      95                 :                : {
      96                 :              2 :     return fit_to_width_;
      97                 :                : }
      98                 :                : 
      99                 :              1 : void page_setup::fit_to_width(bool fit_to_width)
     100                 :                : {
     101                 :              1 :     fit_to_width_ = fit_to_width;
     102                 :              1 : }
     103                 :                : 
     104                 :             25 : void page_setup::scale(double scale)
     105                 :                : {
     106                 :             25 :     scale_ = scale;
     107                 :             25 : }
     108                 :                : 
     109                 :              3 : double page_setup::scale() const
     110                 :                : {
     111                 :              3 :     return scale_.get();
     112                 :                : }
     113                 :                : 
     114                 :              8 : bool page_setup::has_scale() const
     115                 :                : {
     116                 :              8 :     return this->scale_.is_set();
     117                 :                : }
     118                 :                : 
     119                 :              1 : const std::string& page_setup::rel_id() const
     120                 :                : {
     121                 :              1 :     return this->rel_id_;
     122                 :                : }
     123                 :                : 
     124                 :              5 : void page_setup::rel_id(const std::string& val)
     125                 :                : {
     126                 :              5 :     this->rel_id_ = val;
     127                 :              5 : }
     128                 :                : 
     129                 :              8 : bool page_setup::has_rel_id() const
     130                 :                : {
     131                 :              8 :     return !rel_id_.empty();
     132                 :                : }
     133                 :                : 
     134                 :              6 : bool page_setup::operator==(const page_setup &rhs) const
     135                 :                : {
     136                 :              6 :     return break_ == rhs.break_
     137         [ +  - ]:              6 :         && sheet_state_ == rhs.sheet_state_
     138         [ +  - ]:              6 :         && paper_size_ == rhs.paper_size_
     139         [ +  - ]:              6 :         && fit_to_page_ == rhs.fit_to_page_
     140         [ +  - ]:              6 :         && fit_to_height_ == rhs.fit_to_height_
     141         [ +  - ]:              6 :         && fit_to_width_ == rhs.fit_to_width_
     142         [ +  - ]:              6 :         && scale_ == rhs.scale_
     143         [ +  - ]:              6 :         && paper_size_ == rhs.paper_size_
     144   [ +  -  +  - ]:             12 :         && rel_id_ == rhs.rel_id_;
     145                 :                : }
     146                 :                : 
     147                 :UBC           0 : bool page_setup::operator!=(const page_setup &rhs) const
     148                 :                : {
     149                 :              0 :     return !(*this == rhs);
     150                 :                : }
     151                 :                : 
     152                 :                : } // namespace xlnt
        

Generated by: LCOV version 2.3.1-beta