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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
//! Settings part
//!
//! The corresponding ZIP item is `/word/settings.xml`.
//!

use std::borrow::Cow;
use std::io::Write;
use strong_xml::{XmlRead, XmlResult, XmlWrite, XmlWriter};

use crate::schema::{SCHEMA_MAIN, SCHEMA_WORDML_14};
use crate::{__string_enum, __xml_test_suites, write_attr};

/// The root element of the main document part.
#[derive(Debug, Default, XmlRead, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:settings")]
pub struct Settings<'a> {
    ///  Write Protection
    #[xml(child = "w:writeProtection")]
    pub write_protection: Option<WriteProtection>,
    ///  Document View Setting
    #[xml(child = "w:view")]
    pub view: Option<View>,
    ///  Magnification Setting
    #[xml(child = "w:zoom")]
    pub zoom: Option<Zoom>,
    ///  Remove Personal Information from Document Properties
    #[xml(child = "w:removePersonalInformation")]
    pub remove_personal_information: Option<RemovePersonalInformation>,
    ///  Remove Date and Time from Annotations
    #[xml(child = "w:removeDateAndTime")]
    pub remove_date_and_time: Option<RemoveDateAndTime>,
    ///  Do Not Display Visual Boundary For Header/Footer or Between Pages
    #[xml(child = "w:doNotDisplayPageBoundaries")]
    pub do_not_display_page_boundaries: Option<DoNotDisplayPageBoundaries>,
    ///  Display Background Objects When Displaying Document
    #[xml(child = "w:displayBackgroundShape")]
    pub display_background_shape: Option<DisplayBackgroundShape>,
    ///  Print PostScript Codes With Document Text
    #[xml(child = "w:printPostScriptOverText")]
    pub print_post_script_over_text: Option<PrintPostScriptOverText>,
    ///  Print Fractional Character Widths
    #[xml(child = "w:printFractionalCharacterWidth")]
    pub print_fractional_character_width: Option<PrintFractionalCharacterWidth>,
    ///  Only Print Form Field Content
    #[xml(child = "w:printFormsData")]
    pub print_forms_data: Option<PrintFormsData>,
    ///  Embed TrueType Fonts
    #[xml(child = "w:embedTrueTypeFonts")]
    pub embed_true_type_fonts: Option<EmbedTrueTypeFonts>,
    ///  Embed Common System Fonts
    #[xml(child = "w:embedSystemFonts")]
    pub embed_system_fonts: Option<EmbedSystemFonts>,
    ///  Subset Fonts When Embedding
    #[xml(child = "w:saveSubsetFonts")]
    pub save_subset_fonts: Option<SaveSubsetFonts>,
    ///  Only Save Form Field Content
    #[xml(child = "w:saveFormsData")]
    pub save_forms_data: Option<SaveFormsData>,
    ///  Mirror Page Margins
    #[xml(child = "w:mirrorMargins")]
    pub mirror_margins: Option<MirrorMargins>,
    ///  Align Paragraph and Table Borders with Page Border
    #[xml(child = "w:alignBordersAndEdges")]
    pub align_borders_and_edges: Option<AlignBordersAndEdges>,
    ///  Page Border Excludes Header
    #[xml(child = "w:bordersDoNotSurroundHeader")]
    pub borders_do_not_surround_header: Option<BordersDoNotSurroundHeader>,
    ///  Page Border Excludes Footer
    #[xml(child = "w:bordersDoNotSurroundFooter")]
    pub borders_do_not_surround_footer: Option<BordersDoNotSurroundFooter>,
    ///  Position Gutter At Top of Page
    #[xml(child = "w:gutterAtTop")]
    pub gutter_at_top: Option<GutterAtTop>,
    ///  Do Not Display Visual Indication of Spelling Errors
    #[xml(child = "w:hideSpellingErrors")]
    pub hide_spelling_errors: Option<HideSpellingErrors>,
    ///  Do Not Display Visual Indication of Grammatical Errors
    #[xml(child = "w:hideGrammaticalErrors")]
    pub hide_grammatical_errors: Option<HideGrammaticalErrors>,
    ///  Grammar Checking Settings
    #[xml(child = "w:activeWritingStyle")]
    pub active_writing_style: Option<ActiveWritingStyle>,
    ///  Spelling and Grammatical Checking State
    #[xml(child = "w:proofState")]
    pub proof_state: Option<ProofState>,
    ///  Structured Document Tag Placeholder Text Should be Resaved
    #[xml(child = "w:formsDesign")]
    pub forms_design: Option<FormsDesign>,
    ///  Attached Document Template
    #[xml(child = "w:attachedTemplate")]
    pub attached_template: Option<AttachedTemplate<'a>>,
    ///  Automatically Update Styles From Document Template
    #[xml(child = "w:linkStyles")]
    pub link_styles: Option<LinkStyles>,
    ///  Suggested Filtering for List of Document Styles
    #[xml(child = "w:stylePaneFormatFilter")]
    pub style_pane_format_filter: Option<StylePaneFormatFilter>,
    ///  Suggested Sorting for List of Document Styles
    #[xml(child = "w:stylePaneSortMethod")]
    pub style_pane_sort_method: Option<StylePaneSortMethod>,
    ///  Document Classification
    #[xml(child = "w:documentType")]
    pub document_type: Option<DocumentType>,
    ///  Mail Merge Settings
    #[xml(child = "w:mailMerge")]
    pub mail_merge: Option<MailMerge>,
    ///  Visibility of Annotation Types
    #[xml(child = "w:revisionView")]
    pub revision_view: Option<RevisionView>,
    ///  Track Revisions to Document
    #[xml(child = "w:trackRevisions")]
    pub track_revisions: Option<TrackRevisions>,
    ///  Do Not Use Move Syntax When Tracking Revisions
    #[xml(child = "w:doNotTrackMoves")]
    pub do_not_track_moves: Option<DoNotTrackMoves>,
    ///  Do Not Track Formatting Revisions When Tracking Revisions
    #[xml(child = "w:doNotTrackFormatting")]
    pub do_not_track_formatting: Option<DoNotTrackFormatting>,
    ///  Document Editing Restrictions
    #[xml(child = "w:documentProtection")]
    pub document_protection: Option<DocumentProtection>,
    ///  Allow Automatic Formatting to Override Formatting Protection Settings
    #[xml(child = "w:autoFormatOverride")]
    pub auto_format_override: Option<AutoFormatOverride>,
    ///  Prevent Modification of Themes Part
    #[xml(child = "w:styleLockTheme")]
    pub style_lock_theme: Option<StyleLockTheme>,
    ///  Prevent Replacement of Styles Part
    #[xml(child = "w:styleLockQFSet")]
    pub style_lock_qfset: Option<StyleLockQfset>,
    ///  Distance Between Automatic Tab Stops
    #[xml(child = "w:defaultTabStop")]
    pub default_tab_stop: Option<DefaultTabStop>,
    ///  Automatically Hyphenate Document Contents When Displayed
    #[xml(child = "w:autoHyphenation")]
    pub auto_hyphenation: Option<AutoHyphenation>,
    ///  Maximum Number of Consecutively Hyphenated Lines
    #[xml(child = "w:consecutiveHyphenLimit")]
    pub consecutive_hyphen_limit: Option<ConsecutiveHyphenLimit>,
    ///  Hyphenation Zone
    #[xml(child = "w:hyphenationZone")]
    pub hyphenation_zone: Option<HyphenationZone>,
    ///  Do Not Hyphenate Words in ALL CAPITAL LETTERS
    #[xml(child = "w:doNotHyphenateCaps")]
    pub do_not_hyphenate_caps: Option<DoNotHyphenateCaps>,
    ///  Show E-Mail Message Header
    #[xml(child = "w:showEnvelope")]
    pub show_envelope: Option<ShowEnvelope>,
    ///  Percentage of Document to Use When Generating Summary
    #[xml(child = "w:summaryLength")]
    pub summary_length: Option<SummaryLength>,
    ///  Paragraph Style Applied to Automatically Generated Paragraphs
    #[xml(child = "w:clickAndTypeStyle")]
    pub click_and_type_style: Option<ClickAndTypeStyle>,
    ///  Default Table Style for Newly Inserted Tables
    #[xml(child = "w:defaultTableStyle")]
    pub default_table_style: Option<DefaultTableStyle>,
    ///  Different Even/Odd Page Headers and Footers
    #[xml(child = "w:evenAndOddHeaders")]
    pub even_and_odd_headers: Option<EvenAndOddHeaders>,
    ///  Reverse Book Fold Printing
    #[xml(child = "w:bookFoldRevPrinting")]
    pub book_fold_rev_printing: Option<BookFoldRevPrinting>,
    ///  Book Fold Printing
    #[xml(child = "w:bookFoldPrinting")]
    pub book_fold_printing: Option<BookFoldPrinting>,
    ///  Number of Pages Per Booklet
    #[xml(child = "w:bookFoldPrintingSheets")]
    pub book_fold_printing_sheets: Option<BookFoldPrintingSheets>,
    ///  Drawing Grid Horizontal Grid Unit Size
    #[xml(child = "w:drawingGridHorizontalSpacing")]
    pub drawing_grid_horizontal_spacing: Option<DrawingGridHorizontalSpacing>,
    ///  Drawing Grid Vertical Grid Unit Size
    #[xml(child = "w:drawingGridVerticalSpacing")]
    pub drawing_grid_vertical_spacing: Option<DrawingGridVerticalSpacing>,
    ///  Distance between Horizontal Gridlines
    #[xml(child = "w:displayHorizontalDrawingGridEvery")]
    pub display_horizontal_drawing_grid_every: Option<DisplayHorizontalDrawingGridEvery>,
    ///  Distance between Vertical Gridlines
    #[xml(child = "w:displayVerticalDrawingGridEvery")]
    pub display_vertical_drawing_grid_every: Option<DisplayVerticalDrawingGridEvery>,
    ///  Do Not Use Margins for Drawing Grid Origin
    #[xml(child = "w:doNotUseMarginsForDrawingGridOrigin")]
    pub do_not_use_margins_for_drawing_grid_origin: Option<DoNotUseMarginsForDrawingGridOrigin>,
    ///  Drawing Grid Horizontal Origin Point
    #[xml(child = "w:drawingGridHorizontalOrigin")]
    pub drawing_grid_horizontal_origin: Option<DrawingGridHorizontalOrigin>,
    ///  Drawing Grid Vertical Origin Point
    #[xml(child = "w:drawingGridVerticalOrigin")]
    pub drawing_grid_vertical_origin: Option<DrawingGridVerticalOrigin>,
    ///  Do Not Show Visual Indicator For Form Fields
    #[xml(child = "w:doNotShadeFormData")]
    pub do_not_shade_form_data: Option<DoNotShadeFormData>,
    ///  Never Kern Punctuation Characters
    #[xml(child = "w:noPunctuationKerning")]
    pub no_punctuation_kerning: Option<NoPunctuationKerning>,
    ///  Character-Level Whitespace Compression
    #[xml(child = "w:characterSpacingControl")]
    pub character_spacing_control: Option<CharacterSpacingControl>,
    ///  Print Two Pages Per Sheet
    #[xml(child = "w:printTwoOnOne")]
    pub print_two_on_one: Option<PrintTwoOnOne>,
    ///  Use Strict Kinsoku Rules for Japanese Text
    #[xml(child = "w:strictFirstAndLastChars")]
    pub strict_first_and_last_chars: Option<StrictFirstAndLastChars>,
    ///  Custom Set of Characters Which Cannot End a Line
    #[xml(child = "w:noLineBreaksAfter")]
    pub no_line_breaks_after: Option<NoLineBreaksAfter>,
    ///  Custom Set Of Characters Which Cannot Begin A Line
    #[xml(child = "w:noLineBreaksBefore")]
    pub no_line_breaks_before: Option<NoLineBreaksBefore>,
    ///  Generate Thumbnail For Document On Save
    #[xml(child = "w:savePreviewPicture")]
    pub save_preview_picture: Option<SavePreviewPicture>,
    ///  Do Not Validate Custom XML Markup Against Schemas
    #[xml(child = "w:doNotValidateAgainstSchema")]
    pub do_not_validate_against_schema: Option<DoNotValidateAgainstSchema>,
    ///  Allow Saving Document As XML File When Custom XML Markup Is Invalid
    #[xml(child = "w:saveInvalidXml")]
    pub save_invalid_xml: Option<SaveInvalidXml>,
    ///  Ignore Mixed Content When Validating Custom XML Markup
    #[xml(child = "w:ignoreMixedContent")]
    pub ignore_mixed_content: Option<IgnoreMixedContent>,
    ///  Use Custom XML Element Names as Default Placeholder Text
    #[xml(child = "w:alwaysShowPlaceholderText")]
    pub always_show_placeholder_text: Option<AlwaysShowPlaceholderText>,
    ///  Do Not Show Visual Indicator For Invalid Custom XML Markup
    #[xml(child = "w:doNotDemarcateInvalidXml")]
    pub do_not_demarcate_invalid_xml: Option<DoNotDemarcateInvalidXml>,
    ///  Only Save Custom XML Markup
    #[xml(child = "w:saveXmlDataOnly")]
    pub save_xml_data_only: Option<SaveXmlDataOnly>,
    ///  Save Document as XML File through Custom XSL Transform
    #[xml(child = "w:useXSLTWhenSaving")]
    pub use_xsltwhen_saving: Option<UseXsltwhenSaving>,
    ///  Custom XSL Transform To Use When Saving As XML File
    #[xml(child = "w:saveThroughXslt")]
    pub save_through_xslt: Option<SaveThroughXslt>,
    ///  Show Visual Indicators for Custom XML Markup Start/End Locations
    #[xml(child = "w:showXMLTags")]
    pub show_xmltags: Option<ShowXmltags>,
    ///  Do Not Mark Custom XML Elements With No Namespace As Invalid
    #[xml(child = "w:alwaysMergeEmptyNamespace")]
    pub always_merge_empty_namespace: Option<AlwaysMergeEmptyNamespace>,
    ///  Automatically Recalculate Fields on Open
    #[xml(child = "w:updateFields")]
    pub update_fields: Option<UpdateFields>,
    ///  Default Properties for VML Objects in Header and Footer
    #[xml(child = "w:hdrShapeDefaults")]
    pub hdr_shape_defaults: Option<HdrShapeDefaults>,
    ///  Document-Wide Footnote Properties
    #[xml(child = "w:footnotePr")]
    pub footnote_pr: Option<crate::formatting::FootnoteProperty2>,
    ///  Document-Wide Endnote Properties
    #[xml(child = "w:endnotePr")]
    pub endnote_pr: Option<crate::formatting::EndnoteProperty2>,
    ///  Compatibility Settings
    #[xml(child = "w:compat")]
    pub compat: Option<Compat>,
    ///  Document Variables
    #[xml(child = "w:docVars")]
    pub doc_vars: Option<DocVars<'a>>,
    ///  Listing of All Revision Save ID Values
    #[xml(child = "w:rsids")]
    pub rsids: Option<Rsids<'a>>,
    ///// properties of math in the document
    //#[xml(child = "m:mathPr")]
    //pub mathPr: Option<mathPr>,
    ///  Disable Features Incompatible With Earlier Word Processing Formats
    #[xml(child = "w:uiCompat97To2003")]
    pub ui_compat97_to2003: Option<UiCompat97to2003>,
    // /// Attached Custom XML Schema
    // #[xml(child = "w:attachedSchema")]
    // pub attachedSchema: Vec<attachedSchema>,
    ///  Theme Font Languages
    #[xml(child = "w:themeFontLang")]
    pub theme_font_lang: Option<ThemeFontLang<'a>>,
    ///  Theme Color Mappings
    #[xml(child = "w:clrSchemeMapping")]
    pub clr_scheme_mapping: Option<ClrSchemeMapping>,
    ///  Do Not Include Content in Text Boxes, Footnotes, and Endnotes in Document Statistics
    #[xml(child = "w:doNotIncludeSubdocsInStats")]
    pub do_not_include_subdocs_in_stats: Option<DoNotIncludeSubdocsInStats>,
    ///  Do Not Automatically Compress Images
    #[xml(child = "w:doNotAutoCompressPictures")]
    pub do_not_auto_compress_pictures: Option<DoNotAutoCompressPictures>,
    ///  Upgrade Document on Open
    #[xml(child = "w:forceUpgrade")]
    pub force_upgrade: Option<ForceUpgrade>,
    ///  Caption Settings
    #[xml(child = "w:captions")]
    pub captions: Option<Captions>,
    ///  Freeze Document Layout
    #[xml(child = "w:readModeInkLockDown")]
    pub read_mode_ink_lock_down: Option<ReadModeInkLockDown>,
    // /// Supplementary Smart Tag Information
    // #[xml(child = "w:smartTagType")]
    // pub smartTagType: Vec<smartTagType>,
    //     /// Custom XML Schema List
    // #[xml(child = "sl:schemaLibrary")]
    // pub schemaLibrary: Option<schemaLibrary>,
    ///  Default Properties for VML Objects in Main Document
    #[xml(child = "w:shapeDefaults")]
    pub shape_defaults: Option<ShapeDefaults>,
    ///  Remove Smart Tags When Saving
    #[xml(child = "w:doNotEmbedSmartTags")]
    pub do_not_embed_smart_tags: Option<DoNotEmbedSmartTags>,
    ///  Radix Point for Field Code Evaluation
    #[xml(child = "w:decimalSymbol")]
    pub decimal_symbol: Option<DecimalSymbol<'a>>,
    ///  List Separator for Field Code Evaluation
    #[xml(child = "w:listSeparator")]
    pub list_separator: Option<ListSeparator<'a>>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:writeProtection")]
pub struct WriteProtection {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:smartTagType")]
pub struct SmartTagType {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:view")]
pub struct View {
    #[xml(attr = "w:val")]
    pub val: ViewType,
}

#[derive(Debug, Default, Clone)]
#[cfg_attr(test, derive(PartialEq))]
pub enum ViewType {
    #[default]
    None, //	Default View
    Print,       //	Print Layout View
    Outline,     //	Outline View
    MasterPages, //	Master Document View
    Normal,      //	Draft View
    Web,         //	Web Page View
}

__string_enum! {
    ViewType {
        None = "none",
        Print = "print",
        Outline = "outline",
        MasterPages = "masterPages",
        Normal = "normal",
        Web = "web",
    }
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:zoom")]
pub struct Zoom {
    #[xml(attr = "w:val")]
    pub val: Option<ZoomType>,
    #[xml(attr = "w:percent")]
    pub percent: u8,
}

#[derive(Debug, Default, Clone)]
#[cfg_attr(test, derive(PartialEq))]
pub enum ZoomType {
    #[default]
    None, //	No Preset Magnification
    FullPage, //	Display One Full Page
    BestFit,  //	Display Page Width
    TextFit,  //	Display Text Width
}

__string_enum! {
    ZoomType {
        None = "none",
        FullPage = "fullPage",
        BestFit = "bestFit",
        TextFit = "textFit",
    }
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:removePersonalInformation")]
pub struct RemovePersonalInformation {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:removeDateAndTime")]
pub struct RemoveDateAndTime {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotDisplayPageBoundaries")]
pub struct DoNotDisplayPageBoundaries {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:displayBackgroundShape")]
pub struct DisplayBackgroundShape {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:printPostScriptOverText")]
pub struct PrintPostScriptOverText {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:printFractionalCharacterWidth")]
pub struct PrintFractionalCharacterWidth {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:printFormsData")]
pub struct PrintFormsData {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:embedTrueTypeFonts")]
pub struct EmbedTrueTypeFonts {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:embedSystemFonts")]
pub struct EmbedSystemFonts {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:saveSubsetFonts")]
pub struct SaveSubsetFonts {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:saveFormsData")]
pub struct SaveFormsData {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:mirrorMargins")]
pub struct MirrorMargins {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:alignBordersAndEdges")]
pub struct AlignBordersAndEdges {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:bordersDoNotSurroundHeader")]
pub struct BordersDoNotSurroundHeader {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:bordersDoNotSurroundFooter")]
pub struct BordersDoNotSurroundFooter {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:gutterAtTop")]
pub struct GutterAtTop {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:hideSpellingErrors")]
pub struct HideSpellingErrors {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:hideGrammaticalErrors")]
pub struct HideGrammaticalErrors {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:activeWritingStyle")]
pub struct ActiveWritingStyle {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:proofState")]
pub struct ProofState {
    #[xml(attr = "w:spelling")]
    pub spelling: Option<ProofStateType>,
    #[xml(attr = "w:grammar")]
    pub grammar: Option<ProofStateType>,
}

#[derive(Debug, Default, Clone)]
#[cfg_attr(test, derive(PartialEq))]
pub enum ProofStateType {
    #[default]
    Clean, //	Check Completed
    Dirty, //	Check Not Completed
}

__string_enum! {
    ProofStateType {
        Clean ="clean",
        Dirty = "dirty",
    }
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:formsDesign")]
pub struct FormsDesign {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:attachedTemplate")]
pub struct AttachedTemplate<'a> {
    #[xml(attr = "r:id")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:linkStyles")]
pub struct LinkStyles {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:stylePaneFormatFilter")]
pub struct StylePaneFormatFilter {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:stylePaneSortMethod")]
pub struct StylePaneSortMethod {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:documentType")]
pub struct DocumentType {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:mailMerge")]
pub struct MailMerge {
    // ///required    Source Document Type
    // #[xml(child = "w:mainDocumentType")]
    // pub main_document_type: Option<mainDocumentType>,
    // ///required    Query Contains Link to External Query File
    // #[xml(child = "w:linkToQuery")]
    // pub link_to_query: Option<linkToQuery>,
    // ///required    Data Source Type
    // #[xml(child = "w:dataType")]
    // pub data_type: Option<dataType>,
    // ///required    Data Source Connection String
    // #[xml(child = "w:connectString")]
    // pub connect_string: Option<connectString>,
    // ///required    Query For Data Source Records To Merge
    // #[xml(child = "w:query")]
    // pub query: Option<query>,
    // ///required    Data Source File Path
    // #[xml(child = "w:dataSource")]
    // pub data_source: Option<dataSource>,
    // ///required    Header Definition File Path
    // #[xml(child = "w:headerSource")]
    // pub header_source: Option<headerSource>,
    // ///required    Remove Blank Lines from Merged Documents
    // #[xml(child = "w:doNotSuppressBlankLines")]
    // pub do_not_suppress_blank_lines: Option<doNotSuppressBlankLines>,
    // ///required    Merged Document Destination
    // #[xml(child = "w:destination")]
    // pub destination: Option<destination>,
    // ///required    Column Containing E-mail Address
    // #[xml(child = "w:addressFieldName")]
    // pub address_field_name: Option<addressFieldName>,
    // ///required    Merged E-mail or Fax Subject Line
    // #[xml(child = "w:mailSubject")]
    // pub mail_subject: Option<mailSubject>,
    // ///required    Merged Document To E-Mail Attachment
    // #[xml(child = "w:mailAsAttachment")]
    // pub mail_as_attachment: Option<mailAsAttachment>,
    // ///required    View Merged Data Within Document
    // #[xml(child = "w:viewMergedData")]
    // pub view_merged_data: Option<viewMergedData>,
    // ///required    Record Currently Displayed In Merged Document
    // #[xml(child = "w:activeRecord")]
    // pub active_record: Option<activeRecord>,
    // ///required    Mail Merge Error Reporting Setting
    // #[xml(child = "w:checkErrors")]
    // pub check_errors: Option<checkErrors>,
    // ///required    Office Data Source Object Settings
    // #[xml(child = "w:odso")]
    // pub odso: Option<odso>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:revisionView")]
pub struct RevisionView {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:trackRevisions")]
pub struct TrackRevisions {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotTrackMoves")]
pub struct DoNotTrackMoves {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotTrackFormatting")]
pub struct DoNotTrackFormatting {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:documentProtection")]
pub struct DocumentProtection {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:autoFormatOverride")]
pub struct AutoFormatOverride {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:styleLockTheme")]
pub struct StyleLockTheme {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:styleLockQFSet")]
pub struct StyleLockQfset {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:defaultTabStop")]
pub struct DefaultTabStop {
    #[xml(attr = "w:val")]
    pub val: isize,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:autoHyphenation")]
pub struct AutoHyphenation {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:consecutiveHyphenLimit")]
pub struct ConsecutiveHyphenLimit {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:hyphenationZone")]
pub struct HyphenationZone {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotHyphenateCaps")]
pub struct DoNotHyphenateCaps {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:showEnvelope")]
pub struct ShowEnvelope {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:summaryLength")]
pub struct SummaryLength {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:clickAndTypeStyle")]
pub struct ClickAndTypeStyle {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:defaultTableStyle")]
pub struct DefaultTableStyle {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:bookFoldRevPrinting")]
pub struct BookFoldRevPrinting {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:bookFoldPrinting")]
pub struct BookFoldPrinting {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:bookFoldPrintingSheets")]
pub struct BookFoldPrintingSheets {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:drawingGridHorizontalSpacing")]
pub struct DrawingGridHorizontalSpacing {
    #[xml(attr = "w:val")]
    pub val: isize,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:drawingGridVerticalSpacing")]
pub struct DrawingGridVerticalSpacing {
    #[xml(attr = "w:val")]
    pub val: isize,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:displayHorizontalDrawingGridEvery")]
pub struct DisplayHorizontalDrawingGridEvery {
    #[xml(attr = "w:val")]
    pub val: isize,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:displayVerticalDrawingGridEvery")]
pub struct DisplayVerticalDrawingGridEvery {
    #[xml(attr = "w:val")]
    pub val: isize,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotUseMarginsForDrawingGridOrigin")]
pub struct DoNotUseMarginsForDrawingGridOrigin {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:drawingGridHorizontalOrigin")]
pub struct DrawingGridHorizontalOrigin {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:drawingGridVerticalOrigin")]
pub struct DrawingGridVerticalOrigin {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotShadeFormData")]
pub struct DoNotShadeFormData {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:noPunctuationKerning")]
pub struct NoPunctuationKerning {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:characterSpacingControl")]
pub struct CharacterSpacingControl {
    #[xml(attr = "w:val")]
    pub val: CharacterSpacingControlType,
}

#[derive(Debug, Default, Clone)]
#[cfg_attr(test, derive(PartialEq))]
pub enum CharacterSpacingControlType {
    #[default]
    DoNotCompress, //	Do Not Compress Whitespace
    CompressPunctuation, //	Compress Whitespace From Punctuation Characters
    CompressPunctuationAndJapaneseKana, //	Compress Whitespace From Both Japanese Kana And Punctuation Characters
}

__string_enum! {
    CharacterSpacingControlType {
        DoNotCompress = "doNotCompress",
        CompressPunctuation = "compressPunctuation",
        CompressPunctuationAndJapaneseKana = "compressPunctuationAndJapaneseKana",
    }
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:printTwoOnOne")]
pub struct PrintTwoOnOne {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:strictFirstAndLastChars")]
pub struct StrictFirstAndLastChars {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:noLineBreaksAfter")]
pub struct NoLineBreaksAfter {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:noLineBreaksBefore")]
pub struct NoLineBreaksBefore {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:savePreviewPicture")]
pub struct SavePreviewPicture {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotValidateAgainstSchema")]
pub struct DoNotValidateAgainstSchema {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:saveInvalidXml")]
pub struct SaveInvalidXml {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:ignoreMixedContent")]
pub struct IgnoreMixedContent {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:alwaysShowPlaceholderText")]
pub struct AlwaysShowPlaceholderText {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotDemarcateInvalidXml")]
pub struct DoNotDemarcateInvalidXml {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:saveXmlDataOnly")]
pub struct SaveXmlDataOnly {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:useXSLTWhenSaving")]
pub struct UseXsltwhenSaving {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:saveThroughXslt")]
pub struct SaveThroughXslt {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:showXMLTags")]
pub struct ShowXmltags {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:alwaysMergeEmptyNamespace")]
pub struct AlwaysMergeEmptyNamespace {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:updateFields")]
pub struct UpdateFields {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:hdrShapeDefaults")]
pub struct HdrShapeDefaults {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:compat")]
pub struct Compat {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:docVars")]
pub struct DocVars<'a> {
    #[xml(child = "w:docVar")]
    pub vars: Vec<DocVar<'a>>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:docVar")]
pub struct DocVar<'a> {
    #[xml(attr = "w:name")]
    pub name: Cow<'a, str>,
    #[xml(attr = "w:val")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:rsids")]
pub struct Rsids<'a> {
    #[xml(child = "w:rsidRoot")]
    pub ro: Option<RsidRoot<'a>>,
    #[xml(child = "w:rsid")]
    pub rsids: Vec<Rsid<'a>>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:rsid")]
pub struct Rsid<'a> {
    #[xml(attr = "w:val")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:rsidRoot")]
pub struct RsidRoot<'a> {
    #[xml(attr = "w:val")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:uiCompat97To2003")]
pub struct UiCompat97to2003 {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:clrSchemeMapping")]
pub struct ClrSchemeMapping {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotIncludeSubdocsInStats")]
pub struct DoNotIncludeSubdocsInStats {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotAutoCompressPictures")]
pub struct DoNotAutoCompressPictures {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:forceUpgrade")]
pub struct ForceUpgrade {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:captions")]
pub struct Captions {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:readModeInkLockDown")]
pub struct ReadModeInkLockDown {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:shapeDefaults")]
pub struct ShapeDefaults {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:doNotEmbedSmartTags")]
pub struct DoNotEmbedSmartTags {
    #[xml(attr = "w:value")]
    pub val: Option<bool>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:decimalSymbol")]
pub struct DecimalSymbol<'a> {
    #[xml(attr = "w:val")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:listSeparator")]
pub struct ListSeparator<'a> {
    #[xml(attr = "w:val")]
    pub val: Cow<'a, str>,
}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:evenAndOddHeaders")]
pub struct EvenAndOddHeaders {}

#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:themeFontLang")]
pub struct ThemeFontLang<'a> {
    #[xml(attr = "w:val")]
    pub val: Option<Cow<'a, str>>,
    #[xml(attr = "w:eastAsia")]
    pub east_asia: Option<Cow<'a, str>>,
}

impl<'a> XmlWrite for Settings<'a> {
    fn to_writer<W: Write>(&self, writer: &mut XmlWriter<W>) -> XmlResult<()> {
        let Settings {
            write_protection,
            view,
            zoom,
            remove_personal_information,
            remove_date_and_time,
            do_not_display_page_boundaries,
            display_background_shape,
            print_post_script_over_text,
            print_fractional_character_width,
            print_forms_data,
            embed_true_type_fonts,
            embed_system_fonts,
            save_subset_fonts,
            save_forms_data,
            mirror_margins,
            align_borders_and_edges,
            borders_do_not_surround_header,
            borders_do_not_surround_footer,
            gutter_at_top,
            hide_spelling_errors,
            hide_grammatical_errors,
            active_writing_style,
            proof_state,
            forms_design,
            attached_template,
            link_styles,
            style_pane_format_filter,
            style_pane_sort_method,
            document_type,
            mail_merge,
            revision_view,
            track_revisions,
            do_not_track_moves,
            do_not_track_formatting,
            document_protection,
            auto_format_override,
            style_lock_theme,
            style_lock_qfset,
            default_tab_stop,
            auto_hyphenation,
            consecutive_hyphen_limit,
            hyphenation_zone,
            do_not_hyphenate_caps,
            show_envelope,
            summary_length,
            click_and_type_style,
            default_table_style,
            even_and_odd_headers,
            book_fold_rev_printing,
            book_fold_printing,
            book_fold_printing_sheets,
            drawing_grid_horizontal_spacing,
            drawing_grid_vertical_spacing,
            display_horizontal_drawing_grid_every,
            display_vertical_drawing_grid_every,
            do_not_use_margins_for_drawing_grid_origin,
            drawing_grid_horizontal_origin,
            drawing_grid_vertical_origin,
            do_not_shade_form_data,
            no_punctuation_kerning,
            character_spacing_control,
            print_two_on_one,
            strict_first_and_last_chars,
            no_line_breaks_after,
            no_line_breaks_before,
            save_preview_picture,
            do_not_validate_against_schema,
            save_invalid_xml,
            ignore_mixed_content,
            always_show_placeholder_text,
            do_not_demarcate_invalid_xml,
            save_xml_data_only,
            use_xsltwhen_saving,
            save_through_xslt,
            show_xmltags,
            always_merge_empty_namespace,
            update_fields,
            hdr_shape_defaults,
            footnote_pr,
            endnote_pr,
            compat,
            doc_vars,
            rsids,
            ui_compat97_to2003,
            theme_font_lang,
            clr_scheme_mapping,
            do_not_include_subdocs_in_stats,
            do_not_auto_compress_pictures,
            force_upgrade,
            captions,
            read_mode_ink_lock_down,
            shape_defaults,
            do_not_embed_smart_tags,
            decimal_symbol,
            list_separator,
        } = self;

        log::debug!("[Settings] Started writing.");
        let _ = write!(writer.inner, "{}", crate::schema::SCHEMA_XML);

        writer.write_element_start("w:settings")?;

        writer.write_attribute("xmlns:w", SCHEMA_MAIN)?;

        writer.write_attribute("xmlns:w14", SCHEMA_WORDML_14)?;

        writer.write_element_end_open()?;

        write_attr(write_protection, writer)?;
        write_attr(view, writer)?;
        write_attr(zoom, writer)?;
        write_attr(remove_personal_information, writer)?;
        write_attr(remove_date_and_time, writer)?;
        write_attr(do_not_display_page_boundaries, writer)?;
        write_attr(display_background_shape, writer)?;
        write_attr(print_post_script_over_text, writer)?;
        write_attr(print_fractional_character_width, writer)?;
        write_attr(print_forms_data, writer)?;
        write_attr(embed_true_type_fonts, writer)?;
        write_attr(embed_system_fonts, writer)?;
        write_attr(save_subset_fonts, writer)?;
        write_attr(save_forms_data, writer)?;
        write_attr(mirror_margins, writer)?;
        write_attr(align_borders_and_edges, writer)?;
        write_attr(borders_do_not_surround_header, writer)?;
        write_attr(borders_do_not_surround_footer, writer)?;
        write_attr(gutter_at_top, writer)?;
        write_attr(hide_spelling_errors, writer)?;
        write_attr(hide_grammatical_errors, writer)?;
        write_attr(active_writing_style, writer)?;
        write_attr(proof_state, writer)?;
        write_attr(forms_design, writer)?;
        write_attr(attached_template, writer)?;
        write_attr(link_styles, writer)?;
        write_attr(style_pane_format_filter, writer)?;
        write_attr(style_pane_sort_method, writer)?;
        write_attr(document_type, writer)?;
        write_attr(mail_merge, writer)?;
        write_attr(revision_view, writer)?;
        write_attr(track_revisions, writer)?;
        write_attr(do_not_track_moves, writer)?;
        write_attr(do_not_track_formatting, writer)?;
        write_attr(document_protection, writer)?;
        write_attr(auto_format_override, writer)?;
        write_attr(style_lock_theme, writer)?;
        write_attr(style_lock_qfset, writer)?;
        write_attr(default_tab_stop, writer)?;
        write_attr(auto_hyphenation, writer)?;
        write_attr(consecutive_hyphen_limit, writer)?;
        write_attr(hyphenation_zone, writer)?;
        write_attr(do_not_hyphenate_caps, writer)?;
        write_attr(show_envelope, writer)?;
        write_attr(summary_length, writer)?;
        write_attr(click_and_type_style, writer)?;
        write_attr(default_table_style, writer)?;
        write_attr(even_and_odd_headers, writer)?;
        write_attr(book_fold_rev_printing, writer)?;
        write_attr(book_fold_printing, writer)?;
        write_attr(book_fold_printing_sheets, writer)?;
        write_attr(drawing_grid_horizontal_spacing, writer)?;
        write_attr(drawing_grid_vertical_spacing, writer)?;
        write_attr(display_horizontal_drawing_grid_every, writer)?;
        write_attr(display_vertical_drawing_grid_every, writer)?;
        write_attr(do_not_use_margins_for_drawing_grid_origin, writer)?;
        write_attr(drawing_grid_horizontal_origin, writer)?;
        write_attr(drawing_grid_vertical_origin, writer)?;
        write_attr(do_not_shade_form_data, writer)?;
        write_attr(no_punctuation_kerning, writer)?;
        write_attr(character_spacing_control, writer)?;
        write_attr(print_two_on_one, writer)?;
        write_attr(strict_first_and_last_chars, writer)?;
        write_attr(no_line_breaks_after, writer)?;
        write_attr(no_line_breaks_before, writer)?;
        write_attr(save_preview_picture, writer)?;
        write_attr(do_not_validate_against_schema, writer)?;
        write_attr(save_invalid_xml, writer)?;
        write_attr(ignore_mixed_content, writer)?;
        write_attr(always_show_placeholder_text, writer)?;
        write_attr(do_not_demarcate_invalid_xml, writer)?;
        write_attr(save_xml_data_only, writer)?;
        write_attr(use_xsltwhen_saving, writer)?;
        write_attr(save_through_xslt, writer)?;
        write_attr(show_xmltags, writer)?;
        write_attr(always_merge_empty_namespace, writer)?;
        write_attr(update_fields, writer)?;
        write_attr(hdr_shape_defaults, writer)?;
        write_attr(footnote_pr, writer)?;
        write_attr(endnote_pr, writer)?;
        write_attr(compat, writer)?;
        write_attr(doc_vars, writer)?;
        write_attr(rsids, writer)?;
        write_attr(ui_compat97_to2003, writer)?;
        write_attr(theme_font_lang, writer)?;
        write_attr(clr_scheme_mapping, writer)?;
        write_attr(do_not_include_subdocs_in_stats, writer)?;
        write_attr(do_not_auto_compress_pictures, writer)?;
        write_attr(force_upgrade, writer)?;
        write_attr(captions, writer)?;
        write_attr(read_mode_ink_lock_down, writer)?;
        write_attr(shape_defaults, writer)?;
        write_attr(do_not_embed_smart_tags, writer)?;
        write_attr(decimal_symbol, writer)?;
        write_attr(list_separator, writer)?;

        writer.write_element_end_close("w:settings")?;

        log::debug!("[Settings] Finished writing.");

        Ok(())
    }
}

__xml_test_suites!(
    Settings,
    Settings::default(),
    format!(
        r#"{}<w:settings xmlns:w="{}" xmlns:w14="{}"></w:settings>"#,
        crate::schema::SCHEMA_XML,
        SCHEMA_MAIN,
        SCHEMA_WORDML_14
    )
    .as_str(),
);