docx_reader/documents/elements/wp_anchor.rs
1use super::*;
2use serde::Serialize;
3
4#[derive(Debug, Clone, Serialize, PartialEq)]
5#[serde(rename_all = "camelCase")]
6pub struct WpAnchor {
7 pub children: Vec<AGraphic>,
8}
9
10/*
11 20.4.2.3
12 anchor (WpAnchor for Floating DrawingML Object)
13 This element specifies that the DrawingML object located at this position in the document is a floating object.
14 Within a WordprocessingML document, drawing objects can exist in two states:
15 - Inline - The drawing object is in line with the text, and affects the line height and layout of its line (like a
16 - character glyph of similar size).
17 Floating - The drawing object is anchored within the text, but can be absolutely positioned in the
18 document relative to the page.
19 When this element encapsulates the DrawingML object's i
20*/
21impl WpAnchor {
22 pub fn new() -> WpAnchor {
23 Default::default()
24 }
25
26 pub fn add_graphic(mut self, g: AGraphic) -> WpAnchor {
27 self.children.push(g);
28 self
29 }
30}
31
32impl Default for WpAnchor {
33 fn default() -> Self {
34 WpAnchor { children: vec![] }
35 }
36}