blob: 64e2722fe76955b63f108f8ee2167c891ed4516d (
plain)
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
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <com/sun/star/drawing/Hatch.hpp>
#include <oox/token/tokens.hxx>
#include <tools/color.hxx>
using namespace com::sun::star;
using namespace oox;
static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor)
{
drawing::Hatch aHatch;
aHatch.Color = sal_Int32(nColor);
// best-effort mapping; we do not support all the styles in core
switch (nHatchToken)
{
case XML_pct5:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 250;
aHatch.Angle = 450;
break;
case XML_pct10:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 200;
aHatch.Angle = 450;
break;
case XML_pct20:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 150;
aHatch.Angle = 450;
break;
case XML_pct25:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 200;
aHatch.Angle = 450;
break;
case XML_pct30:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 175;
aHatch.Angle = 450;
break;
case XML_pct40:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 150;
aHatch.Angle = 450;
break;
case XML_pct50:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 125;
aHatch.Angle = 450;
break;
case XML_pct60:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 150;
aHatch.Angle = 450;
break;
case XML_pct70:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 125;
aHatch.Angle = 450;
break;
case XML_pct75:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_pct80:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 75;
aHatch.Angle = 450;
break;
case XML_pct90:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 50;
aHatch.Angle = 450;
break;
case XML_horz:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 0;
break;
case XML_vert:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 900;
break;
case XML_ltHorz:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 0;
break;
case XML_ltVert:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 900;
break;
case XML_dkHorz:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 25;
aHatch.Angle = 0;
break;
case XML_dkVert:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 25;
aHatch.Angle = 900;
break;
case XML_narHorz:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 0;
break;
case XML_narVert:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 900;
break;
case XML_dashHorz:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 150;
aHatch.Angle = 0;
break;
case XML_dashVert:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 150;
aHatch.Angle = 900;
break;
case XML_cross:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 0;
break;
case XML_dnDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 1350;
break;
case XML_upDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_ltDnDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 1350;
break;
case XML_ltUpDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 450;
break;
case XML_dkDnDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 1350;
break;
case XML_dkUpDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 50;
aHatch.Angle = 450;
break;
case XML_wdDnDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 1350;
break;
case XML_wdUpDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_dashDnDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 150;
aHatch.Angle = 1350;
break;
case XML_dashUpDiag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 150;
aHatch.Angle = 450;
break;
case XML_diagCross:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_smCheck:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 50;
aHatch.Angle = 450;
break;
case XML_lgCheck:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_smGrid:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 50;
aHatch.Angle = 0;
break;
case XML_lgGrid:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 0;
break;
case XML_dotGrid:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 400;
aHatch.Angle = 0;
break;
case XML_smConfetti:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 200;
aHatch.Angle = 600;
break;
case XML_lgConfetti:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 600;
break;
case XML_horzBrick:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 300;
aHatch.Angle = 0;
break;
case XML_diagBrick:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 300;
aHatch.Angle = 450;
break;
case XML_solidDmnd:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_openDmnd:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 100;
aHatch.Angle = 450;
break;
case XML_dotDmnd:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 300;
aHatch.Angle = 450;
break;
case XML_plaid:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 200;
aHatch.Angle = 900;
break;
case XML_sphere:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 100;
aHatch.Angle = 0;
break;
case XML_weave:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 150;
aHatch.Angle = 450;
break;
case XML_divot:
aHatch.Style = drawing::HatchStyle_TRIPLE;
aHatch.Distance = 400;
aHatch.Angle = 450;
break;
case XML_shingle:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 200;
aHatch.Angle = 1350;
break;
case XML_wave:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 100;
aHatch.Angle = 0;
break;
case XML_trellis:
aHatch.Style = drawing::HatchStyle_DOUBLE;
aHatch.Distance = 75;
aHatch.Angle = 450;
break;
case XML_zigZag:
aHatch.Style = drawing::HatchStyle_SINGLE;
aHatch.Distance = 75;
aHatch.Angle = 0;
break;
}
return aHatch;
}
|