Skip to main content

text_document_formatting/
dtos.rs

1// Generated by Qleany v1.8.0 from feature_dtos.tera
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
6pub struct SetTextFormatDto {
7    pub position: i64,
8    pub anchor: i64,
9    pub font_family: Option<String>,
10    pub font_point_size: Option<i64>,
11    pub font_weight: Option<i64>,
12    pub font_bold: Option<bool>,
13    pub font_italic: Option<bool>,
14    pub font_underline: Option<bool>,
15    pub font_overline: Option<bool>,
16    pub font_strikeout: Option<bool>,
17    pub letter_spacing: Option<i64>,
18    pub word_spacing: Option<i64>,
19    pub underline_style: Option<UnderlineStyle>,
20    pub vertical_alignment: Option<CharVerticalAlignment>,
21    /// Hyperlink destination for the range.
22    ///
23    /// `is_anchor` is deliberately not a field of its own: every importer sets
24    /// it to `Some(true)` exactly when a destination is present and never
25    /// independently, so the use case derives it here rather than trusting two
26    /// fields to stay in step. `anchor_names` and `tooltip` are absent for a
27    /// blunter reason — neither the Djot writer nor the reader touches them, so
28    /// a value set through here would not survive a save and reload.
29    pub anchor_href: Option<String>,
30    /// Remove the range's link.
31    ///
32    /// Every other field here *merges* — `None` means "leave this property
33    /// alone" — so there is otherwise no way to express "take the link off
34    /// again", only "point it somewhere else". Takes precedence over
35    /// `anchor_href` when both are given.
36    pub clear_link: bool,
37}
38
39#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
40pub enum UnderlineStyle {
41    #[default]
42    NoUnderline,
43    SingleUnderline,
44    DashUnderline,
45    DotLine,
46    DashDotLine,
47    DashDotDotLine,
48    WaveUnderline,
49    SpellCheckUnderline,
50}
51
52#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
53pub enum CharVerticalAlignment {
54    #[default]
55    Normal,
56    SuperScript,
57    SubScript,
58    Middle,
59    Bottom,
60    Top,
61    Baseline,
62}
63#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
64pub struct MergeTextFormatDto {
65    pub position: i64,
66    pub anchor: i64,
67    pub font_family: Option<String>,
68    pub font_bold: Option<bool>,
69    pub font_italic: Option<bool>,
70    pub font_underline: Option<bool>,
71    pub font_strikeout: Option<bool>,
72    pub vertical_alignment: Option<CharVerticalAlignment>,
73    /// The link. This is the copy that matters: as with `vertical_alignment`,
74    /// `merge_char_format` is the path every toolbar takes, so a destination
75    /// only [`SetTextFormatDto`] could carry would be silently discarded on the
76    /// way through. See that type for why `is_anchor` is derived rather than
77    /// carried.
78    pub anchor_href: Option<String>,
79    /// Remove the range's link. Takes precedence over `anchor_href`.
80    pub clear_link: bool,
81}
82#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
83pub struct SetBlockFormatDto {
84    pub position: i64,
85    pub anchor: i64,
86    pub alignment: Option<Alignment>,
87    pub heading_level: Option<i64>,
88    pub indent: Option<i64>,
89    pub marker: Option<MarkerType>,
90    pub line_height: Option<i64>,
91    pub non_breakable_lines: Option<bool>,
92    pub page_break_before: Option<bool>,
93    pub direction: Option<TextDirection>,
94    /// Unset the block's stored direction, handing the paragraph back to
95    /// the bidi algorithm's first-strong-character detection.
96    ///
97    /// Every other field here *merges* — `None` means "leave this
98    /// property alone" — so there is otherwise no way to express
99    /// "remove the direction I set earlier", only "set a different one".
100    /// Takes precedence over `direction` when both are given.
101    pub clear_direction: bool,
102    pub background_color: Option<String>,
103    pub is_code_block: Option<bool>,
104    pub code_language: Option<String>,
105    pub hyphenate: Option<bool>,
106    pub language: Option<String>,
107    pub top_margin: Option<i64>,
108    pub bottom_margin: Option<i64>,
109    pub left_margin: Option<i64>,
110    pub right_margin: Option<i64>,
111    pub text_indent: Option<i64>,
112}
113
114#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
115pub enum Alignment {
116    #[default]
117    Left,
118    Right,
119    Center,
120    Justify,
121}
122
123#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
124pub enum MarkerType {
125    #[default]
126    NoMarker,
127    Unchecked,
128    Checked,
129}
130
131#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
132pub enum TextDirection {
133    #[default]
134    LeftToRight,
135    RightToLeft,
136}
137#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
138pub struct SetFrameFormatDto {
139    pub position: i64,
140    pub anchor: i64,
141    pub frame_id: i64,
142    pub height: Option<i64>,
143    pub width: Option<i64>,
144    pub top_margin: Option<i64>,
145    pub bottom_margin: Option<i64>,
146    pub left_margin: Option<i64>,
147    pub right_margin: Option<i64>,
148    pub padding: Option<i64>,
149    pub border: Option<i64>,
150    pub is_blockquote: Option<bool>,
151}
152#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
153pub struct SetTableFormatDto {
154    pub table_id: i64,
155    pub border: Option<i64>,
156    pub cell_spacing: Option<i64>,
157    pub cell_padding: Option<i64>,
158    pub width: Option<i64>,
159    pub alignment: Option<Alignment>,
160}
161#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
162pub struct SetTableCellFormatDto {
163    pub cell_id: i64,
164    pub padding: Option<i64>,
165    pub border: Option<i64>,
166    pub vertical_alignment: Option<CellVerticalAlignment>,
167    pub background_color: Option<String>,
168}
169
170#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
171pub enum CellVerticalAlignment {
172    #[default]
173    Top,
174    Middle,
175    Bottom,
176}
177#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
178pub struct SetListFormatDto {
179    pub list_id: i64,
180    pub style: Option<ListStyle>,
181    pub indent: Option<i64>,
182    pub prefix: Option<String>,
183    pub suffix: Option<String>,
184}
185
186#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, Eq)]
187pub enum ListStyle {
188    #[default]
189    Disc,
190    Circle,
191    Square,
192    Decimal,
193    LowerAlpha,
194    UpperAlpha,
195    LowerRoman,
196    UpperRoman,
197}