page_margins.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Copyright (c) 2014-2021 Thomas Fussell
  2. // Copyright (c) 2010-2015 openpyxl
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE
  21. //
  22. // @license: http://www.opensource.org/licenses/mit-license.php
  23. // @author: see AUTHORS file
  24. #include <xlnt/utils/numeric.hpp>
  25. #include <xlnt/worksheet/page_margins.hpp>
  26. namespace xlnt {
  27. page_margins::page_margins()
  28. {
  29. }
  30. double page_margins::top() const
  31. {
  32. return top_;
  33. }
  34. void page_margins::top(double top)
  35. {
  36. top_ = top;
  37. }
  38. double page_margins::left() const
  39. {
  40. return left_;
  41. }
  42. void page_margins::left(double left)
  43. {
  44. left_ = left;
  45. }
  46. double page_margins::bottom() const
  47. {
  48. return bottom_;
  49. }
  50. void page_margins::bottom(double bottom)
  51. {
  52. bottom_ = bottom;
  53. }
  54. double page_margins::right() const
  55. {
  56. return right_;
  57. }
  58. void page_margins::right(double right)
  59. {
  60. right_ = right;
  61. }
  62. double page_margins::header() const
  63. {
  64. return header_;
  65. }
  66. void page_margins::header(double header)
  67. {
  68. header_ = header;
  69. }
  70. double page_margins::footer() const
  71. {
  72. return footer_;
  73. }
  74. void page_margins::footer(double footer)
  75. {
  76. footer_ = footer;
  77. }
  78. bool page_margins::operator==(const page_margins &rhs) const
  79. {
  80. return detail::float_equals(top_, rhs.top_)
  81. && detail::float_equals(left_, rhs.left_)
  82. && detail::float_equals(right_, rhs.right_)
  83. && detail::float_equals(header_, rhs.header_)
  84. && detail::float_equals(footer_, rhs.footer_);
  85. }
  86. } // namespace xlnt