spreadsheet_ods/style/
graphicstyle.rs1use crate::attrmap2::AttrMap2;
2use crate::style::units::{
3 FontSize, FontStyle, FontVariant, FontWeight, Hyphenation, HyphenationLadderCount, Indent,
4 LetterSpacing, LineBreak, LineHeight, LineMode, LineStyle, LineType, LineWidth, Margin,
5 PageBreak, PageNumber, ParaAlignVertical, Percent, PunctuationWrap, RotationScale, TextAlign,
6 TextAlignLast, TextAutoSpace, TextCombine, TextCondition, TextDisplay, TextEmphasize,
7 TextEmphasizePosition, TextKeep, TextPosition, TextRelief, TextTransform, WritingMode,
8};
9use crate::style::AnyStyleRef;
10use crate::style::{
11 border_line_width_string, border_string, color_string, shadow_string, text_position, Border,
12 Length, Rgb,
13};
14use crate::style::{StyleOrigin, StyleUse, TextStyleRef};
15use get_size2::GetSize;
16use icu_locale_core::Locale;
17use std::borrow::Borrow;
18
19style_ref2!(GraphicStyleRef);
20
21#[derive(Debug, Clone, GetSize)]
25pub struct GraphicStyle {
26 origin: StyleOrigin,
28 styleuse: StyleUse,
30 name: String,
32 attr: AttrMap2,
34 graphicstyle: AttrMap2,
36 paragraphstyle: AttrMap2,
38 textstyle: AttrMap2,
40}
41
42styles_styles2!(GraphicStyle, GraphicStyleRef);
43
44impl GraphicStyle {
45 pub fn new_empty() -> Self {
47 Self {
48 origin: Default::default(),
49 styleuse: Default::default(),
50 name: Default::default(),
51 attr: Default::default(),
52 graphicstyle: Default::default(),
53 paragraphstyle: Default::default(),
54 textstyle: Default::default(),
55 }
56 }
57
58 pub fn new<S: AsRef<str>>(name: S) -> Self {
60 Self {
61 origin: Default::default(),
62 styleuse: Default::default(),
63 name: name.as_ref().to_string(),
64 attr: Default::default(),
65 graphicstyle: Default::default(),
66 paragraphstyle: Default::default(),
67 textstyle: Default::default(),
68 }
69 }
70
71 pub fn attrmap(&self) -> &AttrMap2 {
73 &self.attr
74 }
75
76 pub fn attrmap_mut(&mut self) -> &mut AttrMap2 {
78 &mut self.attr
79 }
80
81 pub fn graphicstyle(&self) -> &AttrMap2 {
83 &self.graphicstyle
84 }
85
86 pub fn graphicstyle_mut(&mut self) -> &mut AttrMap2 {
88 &mut self.graphicstyle
89 }
90
91 pub fn paragraphstyle(&self) -> &AttrMap2 {
93 &self.paragraphstyle
94 }
95
96 pub fn paragraphstyle_mut(&mut self) -> &mut AttrMap2 {
98 &mut self.paragraphstyle
99 }
100
101 pub fn textstyle(&self) -> &AttrMap2 {
103 &self.textstyle
104 }
105
106 pub fn textstyle_mut(&mut self) -> &mut AttrMap2 {
108 &mut self.textstyle
109 }
110
111 fo_background_color!(paragraphstyle);
112 fo_border!(paragraphstyle);
113 fo_break!(paragraphstyle);
114 fo_hyphenation!(paragraphstyle);
115 fo_keep_together!(paragraphstyle);
116 fo_keep_with_next!(paragraphstyle);
117 fo_line_height!(paragraphstyle);
118 fo_margin!(paragraphstyle);
119 fo_orphans!(paragraphstyle);
120 fo_padding!(paragraphstyle);
121 fo_text_align!(paragraphstyle);
122 fo_text_align_last!(paragraphstyle);
123 fo_text_indent!(paragraphstyle);
124 fo_widows!(paragraphstyle);
125 style_auto_text_indent!(paragraphstyle);
126 style_background_transparency!(paragraphstyle);
127 fo_border_line_width!(paragraphstyle);
128 style_contextual_spacing!(paragraphstyle);
129 style_font_independent_line_spacing!(paragraphstyle);
130 style_join_border!(paragraphstyle);
131 style_justify_single_word!(paragraphstyle);
132 style_line_break!(paragraphstyle);
133 style_line_height_at_least!(paragraphstyle);
134 style_line_spacing!(paragraphstyle);
135 style_page_number!(paragraphstyle);
136 style_punctuation_wrap!(paragraphstyle);
137 style_register_true!(paragraphstyle);
138 style_shadow!(paragraphstyle);
139 style_snap_to_layout_grid!(paragraphstyle);
140 style_tab_stop_distance!(paragraphstyle);
141 style_text_autospace!(paragraphstyle);
142 style_vertical_align_para!(paragraphstyle);
143 style_writing_mode!(paragraphstyle);
144 style_writing_mode_automatic!(paragraphstyle);
145 style_line_number!(paragraphstyle);
146 style_number_lines!(paragraphstyle);
147
148 fo_color!(textstyle);
153 fo_locale!(textstyle);
154 style_font_name!(textstyle);
155 fo_font_size!(textstyle);
156 fo_font_size_rel!(textstyle);
157 fo_font_style!(textstyle);
158 fo_font_weight!(textstyle);
159 fo_font_variant!(textstyle);
160 fo_font_attr!(textstyle);
161 style_locale_asian!(textstyle);
162 style_font_name_asian!(textstyle);
163 style_font_size_asian!(textstyle);
164 style_font_size_rel_asian!(textstyle);
165 style_font_style_asian!(textstyle);
166 style_font_weight_asian!(textstyle);
167 style_font_attr_asian!(textstyle);
168 style_locale_complex!(textstyle);
169 style_font_name_complex!(textstyle);
170 style_font_size_complex!(textstyle);
171 style_font_size_rel_complex!(textstyle);
172 style_font_style_complex!(textstyle);
173 style_font_weight_complex!(textstyle);
174 style_font_attr_complex!(textstyle);
175 fo_hyphenate!(textstyle);
176 fo_hyphenation_push_char_count!(textstyle);
177 fo_hyphenation_remain_char_count!(textstyle);
178 fo_letter_spacing!(textstyle);
179 fo_text_shadow!(textstyle);
180 fo_text_transform!(textstyle);
181 style_font_relief!(textstyle);
182 style_text_position!(textstyle);
183 style_rotation_scale!(textstyle);
185 style_letter_kerning!(textstyle);
186 style_text_combine!(textstyle);
187 style_text_combine_start_char!(textstyle);
188 style_text_combine_end_char!(textstyle);
189 style_text_emphasize!(textstyle);
190 style_text_line_through!(textstyle);
191 style_text_outline!(textstyle);
192 style_text_overline!(textstyle);
193 style_text_underline!(textstyle);
194 style_use_window_font_color!(textstyle);
195 text_condition!(textstyle);
196 text_display!(textstyle);
197}