umya_spreadsheet/structs/drawing/
preset_geometry.rs1use super::adjust_value_list::AdjustValueList;
3use crate::reader::driver::*;
4use crate::writer::driver::*;
5use quick_xml::events::{BytesStart, Event};
6use quick_xml::Reader;
7use quick_xml::Writer;
8use std::io::Cursor;
9
10#[derive(Clone, Default, Debug)]
11pub struct PresetGeometry {
12 geometry: Box<str>,
13 adjust_value_list: AdjustValueList,
14}
15
16impl PresetGeometry {
17 pub const GEOMETRY_ACCENTBORDERCALLOUT1: &'static str = "accentBorderCallout1";
19 pub const GEOMETRY_ACCENTBORDERCALLOUT2: &'static str = "accentBorderCallout2";
20 pub const GEOMETRY_ACCENTBORDERCALLOUT3: &'static str = "accentBorderCallout3";
21 pub const GEOMETRY_ACCENTCALLOUT1: &'static str = "accentCallout1";
22 pub const GEOMETRY_ACCENTCALLOUT2: &'static str = "accentCallout2";
23 pub const GEOMETRY_ACCENTCALLOUT3: &'static str = "accentCallout3";
24 pub const GEOMETRY_ACTIONBUTTONBACKPREVIOUS: &'static str = "actionButtonBackPrevious";
25 pub const GEOMETRY_ACTIONBUTTONBEGINNING: &'static str = "actionButtonBeginning";
26 pub const GEOMETRY_ACTIONBUTTONBLANK: &'static str = "actionButtonBlank";
27 pub const GEOMETRY_ACTIONBUTTONDOCUMENT: &'static str = "actionButtonDocument";
28 pub const GEOMETRY_ACTIONBUTTONEND: &'static str = "actionButtonEnd";
29 pub const GEOMETRY_ACTIONBUTTONFORWARDNEXT: &'static str = "actionButtonForwardNext";
30 pub const GEOMETRY_ACTIONBUTTONHELP: &'static str = "actionButtonHelp";
31 pub const GEOMETRY_ACTIONBUTTONHOME: &'static str = "actionButtonHome";
32 pub const GEOMETRY_ACTIONBUTTONINFORMATION: &'static str = "actionButtonInformation";
33 pub const GEOMETRY_ACTIONBUTTONMOVIE: &'static str = "actionButtonMovie";
34 pub const GEOMETRY_ACTIONBUTTONRETURN: &'static str = "actionButtonReturn";
35 pub const GEOMETRY_ACTIONBUTTONSOUND: &'static str = "actionButtonSound";
36 pub const GEOMETRY_ARC: &'static str = "arc";
37 pub const GEOMETRY_BENTARROW: &'static str = "bentArrow";
38 pub const GEOMETRY_BENTCONNECTOR2: &'static str = "bentConnector2";
39 pub const GEOMETRY_BENTCONNECTOR3: &'static str = "bentConnector3";
40 pub const GEOMETRY_BENTCONNECTOR4: &'static str = "bentConnector4";
41 pub const GEOMETRY_BENTCONNECTOR5: &'static str = "bentConnector5";
42 pub const GEOMETRY_BENTUPARROW: &'static str = "bentUpArrow";
43 pub const GEOMETRY_BEVEL: &'static str = "bevel";
44 pub const GEOMETRY_BLOCKARC: &'static str = "blockArc";
45 pub const GEOMETRY_BORDERCALLOUT1: &'static str = "borderCallout1";
46 pub const GEOMETRY_BORDERCALLOUT2: &'static str = "borderCallout2";
47 pub const GEOMETRY_BORDERCALLOUT3: &'static str = "borderCallout3";
48 pub const GEOMETRY_BRACEPAIR: &'static str = "bracePair";
49 pub const GEOMETRY_BRACKETPAIR: &'static str = "bracketPair";
50 pub const GEOMETRY_CALLOUT1: &'static str = "callout1";
51 pub const GEOMETRY_CALLOUT2: &'static str = "callout2";
52 pub const GEOMETRY_CALLOUT3: &'static str = "callout3";
53 pub const GEOMETRY_CAN: &'static str = "can";
54 pub const GEOMETRY_CHARTPLUS: &'static str = "chartPlus";
55 pub const GEOMETRY_CHARTSTAR: &'static str = "chartStar";
56 pub const GEOMETRY_CHARTX: &'static str = "chartX";
57 pub const GEOMETRY_CHEVRON: &'static str = "chevron";
58 pub const GEOMETRY_CHORD: &'static str = "chord";
59 pub const GEOMETRY_CIRCULARARROW: &'static str = "circularArrow";
60 pub const GEOMETRY_CLOUD: &'static str = "cloud";
61 pub const GEOMETRY_CLOUDCALLOUT: &'static str = "cloudCallout";
62 pub const GEOMETRY_CORNER: &'static str = "corner";
63 pub const GEOMETRY_CORNERTABS: &'static str = "cornerTabs";
64 pub const GEOMETRY_CUBE: &'static str = "cube";
65 pub const GEOMETRY_CURVEDCONNECTOR2: &'static str = "curvedConnector2";
66 pub const GEOMETRY_CURVEDCONNECTOR3: &'static str = "curvedConnector3";
67 pub const GEOMETRY_CURVEDCONNECTOR4: &'static str = "curvedConnector4";
68 pub const GEOMETRY_CURVEDCONNECTOR5: &'static str = "curvedConnector5";
69 pub const GEOMETRY_CURVEDDOWNARROW: &'static str = "curvedDownArrow";
70 pub const GEOMETRY_CURVEDLEFTARROW: &'static str = "curvedLeftArrow";
71 pub const GEOMETRY_CURVEDRIGHTARROW: &'static str = "curvedRightArrow";
72 pub const GEOMETRY_CURVEDUPARROW: &'static str = "curvedUpArrow";
73 pub const GEOMETRY_DECAGON: &'static str = "decagon";
74 pub const GEOMETRY_DIAGSTRIPE: &'static str = "diagStripe";
75 pub const GEOMETRY_DIAMOND: &'static str = "diamond";
76 pub const GEOMETRY_DODECAGON: &'static str = "dodecagon";
77 pub const GEOMETRY_DONUT: &'static str = "donut";
78 pub const GEOMETRY_DOUBLEWAVE: &'static str = "doubleWave";
79 pub const GEOMETRY_DOWNARROW: &'static str = "downArrow";
80 pub const GEOMETRY_DOWNARROWCALLOUT: &'static str = "downArrowCallout";
81 pub const GEOMETRY_ELLIPSE: &'static str = "ellipse";
82 pub const GEOMETRY_ELLIPSERIBBON: &'static str = "ellipseRibbon";
83 pub const GEOMETRY_ELLIPSERIBBON2: &'static str = "ellipseRibbon2";
84 pub const GEOMETRY_FLOWCHARTALTERNATEPROCESS: &'static str = "flowChartAlternateProcess";
85 pub const GEOMETRY_FLOWCHARTCOLLATE: &'static str = "flowChartCollate";
86 pub const GEOMETRY_FLOWCHARTCONNECTOR: &'static str = "flowChartConnector";
87 pub const GEOMETRY_FLOWCHARTDECISION: &'static str = "flowChartDecision";
88 pub const GEOMETRY_FLOWCHARTDELAY: &'static str = "flowChartDelay";
89 pub const GEOMETRY_FLOWCHARTDISPLAY: &'static str = "flowChartDisplay";
90 pub const GEOMETRY_FLOWCHARTDOCUMENT: &'static str = "flowChartDocument";
91 pub const GEOMETRY_FLOWCHARTEXTRACT: &'static str = "flowChartExtract";
92 pub const GEOMETRY_FLOWCHARTINPUTOUTPUT: &'static str = "flowChartInputOutput";
93 pub const GEOMETRY_FLOWCHARTINTERNALSTORAGE: &'static str = "flowChartInternalStorage";
94 pub const GEOMETRY_FLOWCHARTMAGNETICDISK: &'static str = "flowChartMagneticDisk";
95 pub const GEOMETRY_FLOWCHARTMAGNETICDRUM: &'static str = "flowChartMagneticDrum";
96 pub const GEOMETRY_FLOWCHARTMAGNETICTAPE: &'static str = "flowChartMagneticTape";
97 pub const GEOMETRY_FLOWCHARTMANUALINPUT: &'static str = "flowChartManualInput";
98 pub const GEOMETRY_FLOWCHARTMANUALOPERATION: &'static str = "flowChartManualOperation";
99 pub const GEOMETRY_FLOWCHARTMERGE: &'static str = "flowChartMerge";
100 pub const GEOMETRY_FLOWCHARTMULTIDOCUMENT: &'static str = "flowChartMultidocument";
101 pub const GEOMETRY_FLOWCHARTOFFLINESTORAGE: &'static str = "flowChartOfflineStorage";
102 pub const GEOMETRY_FLOWCHARTOFFPAGECONNECTOR: &'static str = "flowChartOffpageConnector";
103 pub const GEOMETRY_FLOWCHARTONLINESTORAGE: &'static str = "flowChartOnlineStorage";
104 pub const GEOMETRY_FLOWCHARTOR: &'static str = "flowChartOr";
105 pub const GEOMETRY_FLOWCHARTPREDEFINEDPROCESS: &'static str = "flowChartPredefinedProcess";
106 pub const GEOMETRY_FLOWCHARTPREPARATION: &'static str = "flowChartPreparation";
107 pub const GEOMETRY_FLOWCHARTPROCESS: &'static str = "flowChartProcess";
108 pub const GEOMETRY_FLOWCHARTPUNCHEDCARD: &'static str = "flowChartPunchedCard";
109 pub const GEOMETRY_FLOWCHARTPUNCHEDTAPE: &'static str = "flowChartPunchedTape";
110 pub const GEOMETRY_FLOWCHARTSORT: &'static str = "flowChartSort";
111 pub const GEOMETRY_FLOWCHARTSUMMINGJUNCTION: &'static str = "flowChartSummingJunction";
112 pub const GEOMETRY_FLOWCHARTTERMINATOR: &'static str = "flowChartTerminator";
113 pub const GEOMETRY_FOLDERCORNER: &'static str = "folderCorner";
114 pub const GEOMETRY_FRAME: &'static str = "frame";
115 pub const GEOMETRY_FUNNEL: &'static str = "funnel";
116 pub const GEOMETRY_GEAR6: &'static str = "gear6";
117 pub const GEOMETRY_GEAR9: &'static str = "gear9";
118 pub const GEOMETRY_HALFFRAME: &'static str = "halfFrame";
119 pub const GEOMETRY_HEART: &'static str = "heart";
120 pub const GEOMETRY_HEPTAGON: &'static str = "heptagon";
121 pub const GEOMETRY_HEXAGON: &'static str = "hexagon";
122 pub const GEOMETRY_HOMEPLATE: &'static str = "homePlate";
123 pub const GEOMETRY_HORIZONTALSCROLL: &'static str = "horizontalScroll";
124 pub const GEOMETRY_IRREGULARSEAL1: &'static str = "irregularSeal1";
125 pub const GEOMETRY_IRREGULARSEAL2: &'static str = "irregularSeal2";
126 pub const GEOMETRY_LEFTARROW: &'static str = "leftArrow";
127 pub const GEOMETRY_LEFTARROWCALLOUT: &'static str = "leftArrowCallout";
128 pub const GEOMETRY_LEFTBRACE: &'static str = "leftBrace";
129 pub const GEOMETRY_LEFTBRACKET: &'static str = "leftBracket";
130 pub const GEOMETRY_LEFTCIRCULARARROW: &'static str = "leftCircularArrow";
131 pub const GEOMETRY_LEFTRIGHTARROW: &'static str = "leftRightArrow";
132 pub const GEOMETRY_LEFTRIGHTARROWCALLOUT: &'static str = "leftRightArrowCallout";
133 pub const GEOMETRY_LEFTRIGHTCIRCULARARROW: &'static str = "leftRightCircularArrow";
134 pub const GEOMETRY_LEFTRIGHTRIBBON: &'static str = "leftRightRibbon";
135 pub const GEOMETRY_LEFTRIGHTUPARROW: &'static str = "leftRightUpArrow";
136 pub const GEOMETRY_LEFTUPARROW: &'static str = "leftUpArrow";
137 pub const GEOMETRY_LIGHTNINGBOLT: &'static str = "lightningBolt";
138 pub const GEOMETRY_LINE: &'static str = "line";
139 pub const GEOMETRY_LINEINV: &'static str = "lineInv";
140 pub const GEOMETRY_MATHDIVIDE: &'static str = "mathDivide";
141 pub const GEOMETRY_MATHEQUAL: &'static str = "mathEqual";
142 pub const GEOMETRY_MATHMINUS: &'static str = "mathMinus";
143 pub const GEOMETRY_MATHMULTIPLY: &'static str = "mathMultiply";
144 pub const GEOMETRY_MATHNOTEQUAL: &'static str = "mathNotEqual";
145 pub const GEOMETRY_MATHPLUS: &'static str = "mathPlus";
146 pub const GEOMETRY_MOON: &'static str = "moon";
147 pub const GEOMETRY_NONISOSCELESTRAPEZOID: &'static str = "nonIsoscelesTrapezoid";
148 pub const GEOMETRY_NOSMOKING: &'static str = "noSmoking";
149 pub const GEOMETRY_NOTCHEDRIGHTARROW: &'static str = "notchedRightArrow";
150 pub const GEOMETRY_OCTAGON: &'static str = "octagon";
151 pub const GEOMETRY_PARALLELOGRAM: &'static str = "parallelogram";
152 pub const GEOMETRY_PENTAGON: &'static str = "pentagon";
153 pub const GEOMETRY_PIE: &'static str = "pie";
154 pub const GEOMETRY_PIEWEDGE: &'static str = "pieWedge";
155 pub const GEOMETRY_PLAQUE: &'static str = "plaque";
156 pub const GEOMETRY_PLAQUETABS: &'static str = "plaqueTabs";
157 pub const GEOMETRY_PLUS: &'static str = "plus";
158 pub const GEOMETRY_QUADARROW: &'static str = "quadArrow";
159 pub const GEOMETRY_QUADARROWCALLOUT: &'static str = "quadArrowCallout";
160 pub const GEOMETRY_RECT: &'static str = "rect";
161 pub const GEOMETRY_RIBBON: &'static str = "ribbon";
162 pub const GEOMETRY_RIBBON2: &'static str = "ribbon2";
163 pub const GEOMETRY_RIGHTARROW: &'static str = "rightArrow";
164 pub const GEOMETRY_RIGHTARROWCALLOUT: &'static str = "rightArrowCallout";
165 pub const GEOMETRY_RIGHTBRACE: &'static str = "rightBrace";
166 pub const GEOMETRY_RIGHTBRACKET: &'static str = "rightBracket";
167 pub const GEOMETRY_ROUND1RECT: &'static str = "round1Rect";
168 pub const GEOMETRY_ROUND2DIAGRECT: &'static str = "round2DiagRect";
169 pub const GEOMETRY_ROUND2SAMERECT: &'static str = "round2SameRect";
170 pub const GEOMETRY_ROUNDRECT: &'static str = "roundRect";
171 pub const GEOMETRY_RTTRIANGLE: &'static str = "rtTriangle";
172 pub const GEOMETRY_SMILEYFACE: &'static str = "smileyFace";
173 pub const GEOMETRY_SNIP1RECT: &'static str = "snip1Rect";
174 pub const GEOMETRY_SNIP2DIAGRECT: &'static str = "snip2DiagRect";
175 pub const GEOMETRY_SNIP2SAMERECT: &'static str = "snip2SameRect";
176 pub const GEOMETRY_SNIPROUNDRECT: &'static str = "snipRoundRect";
177 pub const GEOMETRY_SQUARETABS: &'static str = "squareTabs";
178 pub const GEOMETRY_STAR10: &'static str = "star10";
179 pub const GEOMETRY_STAR12: &'static str = "star12";
180 pub const GEOMETRY_STAR16: &'static str = "star16";
181 pub const GEOMETRY_STAR24: &'static str = "star24";
182 pub const GEOMETRY_STAR32: &'static str = "star32";
183 pub const GEOMETRY_STAR4: &'static str = "star4";
184 pub const GEOMETRY_STAR5: &'static str = "star5";
185 pub const GEOMETRY_STAR6: &'static str = "star6";
186 pub const GEOMETRY_STAR7: &'static str = "star7";
187 pub const GEOMETRY_STAR8: &'static str = "star8";
188 pub const GEOMETRY_STRAIGHTCONNECTOR1: &'static str = "straightConnector1";
189 pub const GEOMETRY_STRIPEDRIGHTARROW: &'static str = "stripedRightArrow";
190 pub const GEOMETRY_SUN: &'static str = "sun";
191 pub const GEOMETRY_SWOOSHARROW: &'static str = "swooshArrow";
192 pub const GEOMETRY_TEARDROP: &'static str = "teardrop";
193 pub const GEOMETRY_TRAPEZOID: &'static str = "trapezoid";
194 pub const GEOMETRY_TRIANGLE: &'static str = "triangle";
195 pub const GEOMETRY_UPARROW: &'static str = "upArrow";
196 pub const GEOMETRY_UPARROWCALLOUT: &'static str = "upArrowCallout";
197 pub const GEOMETRY_UPDOWNARROW: &'static str = "upDownArrow";
198 pub const GEOMETRY_UPDOWNARROWCALLOUT: &'static str = "upDownArrowCallout";
199 pub const GEOMETRY_UTURNARROW: &'static str = "uturnArrow";
200 pub const GEOMETRY_VERTICALSCROLL: &'static str = "verticalScroll";
201 pub const GEOMETRY_WAVE: &'static str = "wave";
202 pub const GEOMETRY_WEDGEELLIPSECALLOUT: &'static str = "wedgeEllipseCallout";
203 pub const GEOMETRY_WEDGERECTCALLOUT: &'static str = "wedgeRectCallout";
204 pub const GEOMETRY_WEDGEROUNDRECTCALLOUT: &'static str = "wedgeRoundRectCallout";
205
206 #[inline]
207 pub fn get_geometry(&self) -> &str {
208 &self.geometry
209 }
210
211 #[inline]
212 pub fn set_geometry<S: Into<String>>(&mut self, value: S) {
213 self.geometry = value.into().into_boxed_str();
214 }
215
216 #[inline]
217 pub fn get_adjust_value_list(&self) -> &AdjustValueList {
218 &self.adjust_value_list
219 }
220
221 #[inline]
222 pub fn get_adjust_value_list_mut(&mut self) -> &mut AdjustValueList {
223 &mut self.adjust_value_list
224 }
225
226 #[inline]
227 pub fn set_adjust_value_list(&mut self, value: AdjustValueList) {
228 self.adjust_value_list = value;
229 }
230
231 pub(crate) fn set_attributes<R: std::io::BufRead>(
232 &mut self,
233 reader: &mut Reader<R>,
234 e: &BytesStart,
235 ) {
236 self.set_geometry(get_attribute(e, b"prst").unwrap());
237
238 xml_read_loop!(
239 reader,
240 Event::Start(ref e) => {
241 if e.name().into_inner() == b"a:avLst" {
242 self.get_adjust_value_list_mut().set_attributes(reader, e);
243 }
244 },
245 Event::End(ref e) => {
246 if e.name().into_inner() == b"a:prstGeom" {
247 return;
248 }
249 },
250 Event::Eof => panic!("Error: Could not find {} end element", "a:prstGeom")
251 );
252 }
253
254 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
255 write_start_tag(writer, "a:prstGeom", vec![("prst", &self.geometry)], false);
257
258 self.adjust_value_list.write_to(writer);
260
261 write_end_tag(writer, "a:prstGeom");
262 }
263}