|
| 1 | +using DocumentFormat.OpenXml.Wordprocessing; |
| 2 | + |
| 3 | +namespace DocSharp.Docx; |
| 4 | + |
| 5 | +internal class FormattingState |
| 6 | +{ |
| 7 | + public bool Bold { get; set; } |
| 8 | + public bool Italic { get; set; } |
| 9 | + public bool Strike { get; set; } |
| 10 | + public bool DoubleStrike { get; set; } |
| 11 | + public bool Subscript { get; set; } |
| 12 | + public bool Superscript { get; set; } |
| 13 | + public bool SmallCaps { get; set; } |
| 14 | + public bool AllCaps { get; set; } |
| 15 | + public bool Hidden { get; set; } |
| 16 | + public bool Emboss { get; set; } |
| 17 | + public bool Imprint { get; set; } |
| 18 | + public bool Outline { get; set; } |
| 19 | + public bool Shadow { get; set; } |
| 20 | + |
| 21 | + public UnderlineValues? Underline { get; set; } |
| 22 | + public EmphasisMarkValues? Emphasis { get; set; } |
| 23 | + |
| 24 | + public Border? CharacterBorder { get; set; } |
| 25 | + public Shading? CharacterShading { get; set; } |
| 26 | + |
| 27 | + public int? FontIndex { get; set; } |
| 28 | + public int? FontColorIndex { get; set; } |
| 29 | + public int? HighlightColorIndex { get; set; } |
| 30 | + public int? UnderlineColorIndex { get; set; } |
| 31 | + |
| 32 | + public int? FontSize { get; set; } |
| 33 | + public int? FontScaling { get; set; } |
| 34 | + public int? FontSpacing { get; set; } |
| 35 | + public int? FitText { get; set; } |
| 36 | + public int? Kerning { get; set; } |
| 37 | + public int? VerticalOffset { get; set; } |
| 38 | + |
| 39 | + public int? CharacterStyleIndex { get; set; } |
| 40 | + |
| 41 | + public FormattingState Clone() |
| 42 | + { |
| 43 | + return new FormattingState |
| 44 | + { |
| 45 | + Bold = this.Bold, |
| 46 | + Italic = this.Italic, |
| 47 | + Strike = this.Strike, |
| 48 | + DoubleStrike = this.DoubleStrike, |
| 49 | + Subscript = this.Subscript, |
| 50 | + Superscript = this.Superscript, |
| 51 | + SmallCaps = this.SmallCaps, |
| 52 | + AllCaps = this.AllCaps, |
| 53 | + Hidden = this.Hidden, |
| 54 | + Emboss = this.Emboss, |
| 55 | + Imprint = this.Imprint, |
| 56 | + Outline = this.Outline, |
| 57 | + Shadow = this.Shadow, |
| 58 | + |
| 59 | + Underline = this.Underline, |
| 60 | + Emphasis = this.Emphasis, |
| 61 | + |
| 62 | + CharacterBorder = this.CharacterBorder, |
| 63 | + CharacterShading = this.CharacterShading, |
| 64 | + |
| 65 | + FontIndex = this.FontIndex, |
| 66 | + FontColorIndex = this.FontColorIndex, |
| 67 | + HighlightColorIndex = this.HighlightColorIndex, |
| 68 | + UnderlineColorIndex = this.UnderlineColorIndex, |
| 69 | + |
| 70 | + FontSize = this.FontSize, |
| 71 | + FontScaling = this.FontScaling, |
| 72 | + FontSpacing = this.FontSpacing, |
| 73 | + FitText = this.FitText, |
| 74 | + Kerning = this.Kerning, |
| 75 | + VerticalOffset = this.VerticalOffset, |
| 76 | + |
| 77 | + CharacterStyleIndex = this.CharacterStyleIndex |
| 78 | + }; |
| 79 | + } |
| 80 | + |
| 81 | + public void Clear() |
| 82 | + { |
| 83 | + Bold = false; |
| 84 | + Italic = false; |
| 85 | + Strike = false; |
| 86 | + DoubleStrike = false; |
| 87 | + Subscript = false; |
| 88 | + Superscript = false; |
| 89 | + SmallCaps = false; |
| 90 | + AllCaps = false; |
| 91 | + Hidden = false; |
| 92 | + Emboss = false; |
| 93 | + Imprint = false; |
| 94 | + Outline = false; |
| 95 | + Shadow = false; |
| 96 | + Underline = null; |
| 97 | + Emphasis = null; |
| 98 | + CharacterBorder = null; |
| 99 | + CharacterShading = null; |
| 100 | + FontIndex = null; |
| 101 | + FontColorIndex = null; |
| 102 | + HighlightColorIndex = null; |
| 103 | + UnderlineColorIndex = null; |
| 104 | + FontSize = null; |
| 105 | + FontScaling = null; |
| 106 | + FontSpacing = null; |
| 107 | + FitText = null; |
| 108 | + Kerning = null; |
| 109 | + VerticalOffset = null; |
| 110 | + CharacterStyleIndex = null; |
| 111 | + } |
| 112 | +} |
0 commit comments