1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::{
processed::drawing::common_types::adjust_coordinate::AdjustCoordinate,
raw::drawing::{
shape::shape_guide::XlsxShapeGuide, text::shape_text_rectangle::XlsxShapeTextRectangle,
},
};
/// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.drawing.rectangle?view=openxml-3.0.1
///
/// This element specifies the rectangular bounding box for text within a `custGeom` shape.
/// The default for this rectangle is the bounding box for the shape.
/// This can be modified using this elements four attributes to inset or extend the text bounding box.
///
/// Example:
/// ```
/// <a:rect l="0" t="0" r="0" b="0"/>
/// ```
/// rect (Shape Text Rectangle)
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct ShapeTextRectangle {
/// t (Top)
///
/// Specifies the y coordinate in points of the top edge for a shape text rectangle.
pub top: AdjustCoordinate,
/// b (Bottom Position)
///
/// Specifies the y coordinate in points of the bottom edge for a shape text rectangle.
pub bottom: AdjustCoordinate,
/// l (Left)
///
/// Specifies the x coordinate in points of the left edge for a shape text rectangle.
pub left: AdjustCoordinate,
/// r (Right)
///
/// Specifies the x coordinate in points of the right edge for a shape text rectangle.
pub right: AdjustCoordinate,
}
impl ShapeTextRectangle {
pub(crate) fn default() -> Self {
Self {
top: AdjustCoordinate::default(),
bottom: AdjustCoordinate::default(),
left: AdjustCoordinate::default(),
right: AdjustCoordinate::default(),
}
}
pub(crate) fn from_raw(
raw: Option<XlsxShapeTextRectangle>,
guide_list: Option<Vec<XlsxShapeGuide>>,
) -> Self {
let Some(raw) = raw else {
return Self::default();
};
return Self {
top: AdjustCoordinate::from_raw(raw.t, guide_list.clone()),
bottom: AdjustCoordinate::from_raw(raw.b, guide_list.clone()),
left: AdjustCoordinate::from_raw(raw.l, guide_list.clone()),
right: AdjustCoordinate::from_raw(raw.r, guide_list.clone()),
};
}
}