-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_rpr.go
148 lines (111 loc) · 2.53 KB
/
run_rpr.go
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
package run
import "fmt"
// RPr 内容样式定义
type RPr struct {
// bold 粗体
bold bool
// italics 斜体
italics bool
// emboss 设置浮雕样式
// 设置这个属性时如果未设置 color 属性
// 将会自动将 color 设置为 FFF 白色
// 该属性与 imprint shadow 为互斥属性
emboss bool
// imprint 刻印样式
// 该属性与 emboss shadow 为互斥属性
imprint bool
// shadow 阴影样式
// 该属性与 imprint emboss 为互斥属性
shadow bool
// vanish 不显示内容,仅显示样式
vanish bool
// color 文本颜色
color *string
// deleteLine 删除线样式
deleteLine *DeleteLine
// size 字体大小
size *int
// underline 下划线配置
underline *Underline
// background 背景设置
background *Background
}
func (r *RPr) GetId() string {
return fmt.Sprintf("%p", r)
}
func (r *RPr) GetBackground() *Background {
if nil == r.background {
r.background = new(Background)
r.background.isSet = false
}
return r.background
}
// SetBold 设置粗体
func (r *RPr) SetBold(bold bool) *RPr {
r.bold = bold
return r
}
// SetItalics 设置斜体
func (r *RPr) SetItalics(italics bool) *RPr {
r.italics = italics
return r
}
// SetEmboss 设置浮雕样式
func (r *RPr) SetEmboss(emboss bool) *RPr {
r.emboss = emboss
if emboss {
r.imprint = false
r.shadow = false
}
return r
}
// SetImprint 设置刻印样式
func (r *RPr) SetImprint(imprint bool) *RPr {
r.imprint = imprint
if imprint {
r.emboss = false
r.shadow = false
}
return r
}
// SetShadow 设置阴影
func (r *RPr) SetShadow(shadow bool) *RPr {
r.shadow = shadow
if shadow {
r.emboss = false
r.imprint = false
}
return r
}
// SetVanish 仅显示样式,不显示内容
func (r *RPr) SetVanish(vanish bool) *RPr {
r.vanish = vanish
return r
}
// SetColor 设置文本颜色
func (r *RPr) SetColor(color string) *RPr {
r.color = &color
return r
}
// SetDeleteLine 设置删除线
func (r *RPr) SetDeleteLine(deleteLine DeleteLine) *RPr {
r.deleteLine = &deleteLine
return r
}
// SetSize 设置字体大小
func (r *RPr) SetSize(size int) *RPr {
r.size = &size
return r
}
// SetUnderline 设置下划线样式
func (r *RPr) SetUnderline(lineType UnderlineType) *RPr {
underline := &Underline{lineType: lineType}
r.underline = underline
return r
}
// SetUnderlineWithColor 设置下划线样式与颜色
func (r *RPr) SetUnderlineWithColor(lineType UnderlineType, color string) *RPr {
underline := &Underline{lineType: lineType, color: &color}
r.underline = underline
return r
}