umya_spreadsheet/structs/
anchor.rs1#[derive(Default, Debug, Clone)]
2pub struct Anchor {
3 left_column: u32,
4 left_offset: u32,
5 top_row: u32,
6 top_offset: u32,
7 right_column: u32,
8 right_offset: u32,
9 bottom_row: u32,
10 bottom_offset: u32,
11}
12
13impl Anchor {
14 #[inline]
15 pub fn get_left_column(&self) -> &u32 {
16 &self.left_column
17 }
18
19 #[inline]
20 pub fn set_left_column(&mut self, value: u32) {
21 self.left_column = value;
22 }
23
24 #[inline]
25 pub fn get_left_offset(&self) -> &u32 {
26 &self.left_offset
27 }
28
29 #[inline]
30 pub fn set_left_offset(&mut self, value: u32) {
31 self.left_offset = value;
32 }
33
34 #[inline]
35 pub fn get_top_row(&self) -> &u32 {
36 &self.top_row
37 }
38
39 #[inline]
40 pub fn set_top_row(&mut self, value: u32) {
41 self.top_row = value;
42 }
43
44 #[inline]
45 pub fn get_top_offset(&self) -> &u32 {
46 &self.top_offset
47 }
48
49 #[inline]
50 pub fn set_top_offset(&mut self, value: u32) {
51 self.top_offset = value;
52 }
53
54 #[inline]
55 pub fn get_right_column(&self) -> &u32 {
56 &self.right_column
57 }
58
59 #[inline]
60 pub fn set_right_column(&mut self, value: u32) {
61 self.right_column = value;
62 }
63
64 #[inline]
65 pub fn get_right_offset(&self) -> &u32 {
66 &self.right_offset
67 }
68
69 #[inline]
70 pub fn set_right_offset(&mut self, value: u32) {
71 self.right_offset = value;
72 }
73
74 #[inline]
75 pub fn get_bottom_row(&self) -> &u32 {
76 &self.bottom_row
77 }
78
79 #[inline]
80 pub fn set_bottom_row(&mut self, value: u32) {
81 self.bottom_row = value;
82 }
83
84 #[inline]
85 pub fn get_bottom_offset(&self) -> &u32 {
86 &self.bottom_offset
87 }
88
89 #[inline]
90 pub fn set_bottom_offset(&mut self, value: u32) {
91 self.bottom_offset = value;
92 }
93
94 #[inline]
95 pub(crate) fn _adjustment_insert_row(&mut self, num_rows: &u32) {
96 self.top_row += num_rows;
97 self.bottom_row += num_rows;
98 }
99
100 #[inline]
101 pub(crate) fn _adjustment_insert_column(&mut self, num_cols: &u32) {
102 self.left_column += num_cols;
103 self.right_column += num_cols;
104 }
105
106 #[inline]
107 pub(crate) fn _adjustment_remove_row(&mut self, num_rows: &u32) {
108 self.top_row = self.top_row.saturating_sub(*num_rows).max(1);
109 self.bottom_row = self.bottom_row.saturating_sub(*num_rows).max(1);
110 }
111
112 #[inline]
113 pub(crate) fn _adjustment_remove_column(&mut self, num_cols: &u32) {
114 self.left_column = self.left_column.saturating_sub(*num_cols).max(1);
115 self.right_column = self.right_column.saturating_sub(*num_cols).max(1);
116 }
117}