docx_reader/documents/elements/
wps_text_box.rs

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
use super::*;
use serde::Serialize;

#[derive(Debug, Clone, Serialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct WpsTextBox {
	pub children: Vec<TextBoxContent>,
	pub has_numbering: bool,
}

impl WpsTextBox {
	pub fn new() -> WpsTextBox {
		Default::default()
	}

	pub fn add_content(mut self, c: TextBoxContent) -> Self {
		if c.has_numbering {
			self.has_numbering = true
		}
		self.children.push(c);
		self
	}
}

impl Default for WpsTextBox {
	fn default() -> Self {
		WpsTextBox {
			children: vec![],
			has_numbering: false,
		}
	}
}