LibreOffice Module oox (master)  1
hatchmap.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #include <com/sun/star/drawing/Hatch.hpp>
11 #include <oox/token/tokens.hxx>
12 
13 #include <tools/color.hxx>
14 
15 using namespace com::sun::star;
16 using namespace oox;
17 
18 static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor)
19 {
20  drawing::Hatch aHatch;
21  aHatch.Color = sal_Int32(nColor);
22  // best-effort mapping; we do not support all the styles in core
23  switch (nHatchToken)
24  {
25  case XML_pct5:
26  aHatch.Style = drawing::HatchStyle_SINGLE;
27  aHatch.Distance = 250;
28  aHatch.Angle = 450;
29  break;
30  case XML_pct10:
31  aHatch.Style = drawing::HatchStyle_SINGLE;
32  aHatch.Distance = 200;
33  aHatch.Angle = 450;
34  break;
35  case XML_pct20:
36  aHatch.Style = drawing::HatchStyle_SINGLE;
37  aHatch.Distance = 150;
38  aHatch.Angle = 450;
39  break;
40  case XML_pct25:
41  aHatch.Style = drawing::HatchStyle_DOUBLE;
42  aHatch.Distance = 200;
43  aHatch.Angle = 450;
44  break;
45  case XML_pct30:
46  aHatch.Style = drawing::HatchStyle_DOUBLE;
47  aHatch.Distance = 175;
48  aHatch.Angle = 450;
49  break;
50  case XML_pct40:
51  aHatch.Style = drawing::HatchStyle_DOUBLE;
52  aHatch.Distance = 150;
53  aHatch.Angle = 450;
54  break;
55  case XML_pct50:
56  aHatch.Style = drawing::HatchStyle_DOUBLE;
57  aHatch.Distance = 125;
58  aHatch.Angle = 450;
59  break;
60  case XML_pct60:
61  aHatch.Style = drawing::HatchStyle_TRIPLE;
62  aHatch.Distance = 150;
63  aHatch.Angle = 450;
64  break;
65  case XML_pct70:
66  aHatch.Style = drawing::HatchStyle_TRIPLE;
67  aHatch.Distance = 125;
68  aHatch.Angle = 450;
69  break;
70  case XML_pct75:
71  aHatch.Style = drawing::HatchStyle_TRIPLE;
72  aHatch.Distance = 100;
73  aHatch.Angle = 450;
74  break;
75  case XML_pct80:
76  aHatch.Style = drawing::HatchStyle_TRIPLE;
77  aHatch.Distance = 75;
78  aHatch.Angle = 450;
79  break;
80  case XML_pct90:
81  aHatch.Style = drawing::HatchStyle_TRIPLE;
82  aHatch.Distance = 50;
83  aHatch.Angle = 450;
84  break;
85  case XML_horz:
86  aHatch.Style = drawing::HatchStyle_SINGLE;
87  aHatch.Distance = 100;
88  aHatch.Angle = 0;
89  break;
90  case XML_vert:
91  aHatch.Style = drawing::HatchStyle_SINGLE;
92  aHatch.Distance = 100;
93  aHatch.Angle = 900;
94  break;
95  case XML_ltHorz:
96  aHatch.Style = drawing::HatchStyle_SINGLE;
97  aHatch.Distance = 50;
98  aHatch.Angle = 0;
99  break;
100  case XML_ltVert:
101  aHatch.Style = drawing::HatchStyle_SINGLE;
102  aHatch.Distance = 50;
103  aHatch.Angle = 900;
104  break;
105  case XML_dkHorz:
106  aHatch.Style = drawing::HatchStyle_SINGLE;
107  aHatch.Distance = 25;
108  aHatch.Angle = 0;
109  break;
110  case XML_dkVert:
111  aHatch.Style = drawing::HatchStyle_SINGLE;
112  aHatch.Distance = 25;
113  aHatch.Angle = 900;
114  break;
115  case XML_narHorz:
116  aHatch.Style = drawing::HatchStyle_SINGLE;
117  aHatch.Distance = 50;
118  aHatch.Angle = 0;
119  break;
120  case XML_narVert:
121  aHatch.Style = drawing::HatchStyle_SINGLE;
122  aHatch.Distance = 50;
123  aHatch.Angle = 900;
124  break;
125  case XML_dashHorz:
126  aHatch.Style = drawing::HatchStyle_SINGLE;
127  aHatch.Distance = 150;
128  aHatch.Angle = 0;
129  break;
130  case XML_dashVert:
131  aHatch.Style = drawing::HatchStyle_SINGLE;
132  aHatch.Distance = 150;
133  aHatch.Angle = 900;
134  break;
135  case XML_cross:
136  aHatch.Style = drawing::HatchStyle_DOUBLE;
137  aHatch.Distance = 100;
138  aHatch.Angle = 0;
139  break;
140  case XML_dnDiag:
141  aHatch.Style = drawing::HatchStyle_SINGLE;
142  aHatch.Distance = 100;
143  aHatch.Angle = 1350;
144  break;
145  case XML_upDiag:
146  aHatch.Style = drawing::HatchStyle_SINGLE;
147  aHatch.Distance = 100;
148  aHatch.Angle = 450;
149  break;
150  case XML_ltDnDiag:
151  aHatch.Style = drawing::HatchStyle_SINGLE;
152  aHatch.Distance = 50;
153  aHatch.Angle = 1350;
154  break;
155  case XML_ltUpDiag:
156  aHatch.Style = drawing::HatchStyle_SINGLE;
157  aHatch.Distance = 50;
158  aHatch.Angle = 450;
159  break;
160  case XML_dkDnDiag:
161  aHatch.Style = drawing::HatchStyle_SINGLE;
162  aHatch.Distance = 50;
163  aHatch.Angle = 1350;
164  break;
165  case XML_dkUpDiag:
166  aHatch.Style = drawing::HatchStyle_SINGLE;
167  aHatch.Distance = 50;
168  aHatch.Angle = 450;
169  break;
170  case XML_wdDnDiag:
171  aHatch.Style = drawing::HatchStyle_SINGLE;
172  aHatch.Distance = 100;
173  aHatch.Angle = 1350;
174  break;
175  case XML_wdUpDiag:
176  aHatch.Style = drawing::HatchStyle_SINGLE;
177  aHatch.Distance = 100;
178  aHatch.Angle = 450;
179  break;
180  case XML_dashDnDiag:
181  aHatch.Style = drawing::HatchStyle_SINGLE;
182  aHatch.Distance = 150;
183  aHatch.Angle = 1350;
184  break;
185  case XML_dashUpDiag:
186  aHatch.Style = drawing::HatchStyle_SINGLE;
187  aHatch.Distance = 150;
188  aHatch.Angle = 450;
189  break;
190  case XML_diagCross:
191  aHatch.Style = drawing::HatchStyle_DOUBLE;
192  aHatch.Distance = 100;
193  aHatch.Angle = 450;
194  break;
195  case XML_smCheck:
196  aHatch.Style = drawing::HatchStyle_DOUBLE;
197  aHatch.Distance = 50;
198  aHatch.Angle = 450;
199  break;
200  case XML_lgCheck:
201  aHatch.Style = drawing::HatchStyle_DOUBLE;
202  aHatch.Distance = 100;
203  aHatch.Angle = 450;
204  break;
205  case XML_smGrid:
206  aHatch.Style = drawing::HatchStyle_DOUBLE;
207  aHatch.Distance = 50;
208  aHatch.Angle = 0;
209  break;
210  case XML_lgGrid:
211  aHatch.Style = drawing::HatchStyle_DOUBLE;
212  aHatch.Distance = 100;
213  aHatch.Angle = 0;
214  break;
215  case XML_dotGrid:
216  aHatch.Style = drawing::HatchStyle_DOUBLE;
217  aHatch.Distance = 400;
218  aHatch.Angle = 0;
219  break;
220  case XML_smConfetti:
221  aHatch.Style = drawing::HatchStyle_SINGLE;
222  aHatch.Distance = 200;
223  aHatch.Angle = 600;
224  break;
225  case XML_lgConfetti:
226  aHatch.Style = drawing::HatchStyle_SINGLE;
227  aHatch.Distance = 100;
228  aHatch.Angle = 600;
229  break;
230  case XML_horzBrick:
231  aHatch.Style = drawing::HatchStyle_DOUBLE;
232  aHatch.Distance = 300;
233  aHatch.Angle = 0;
234  break;
235  case XML_diagBrick:
236  aHatch.Style = drawing::HatchStyle_DOUBLE;
237  aHatch.Distance = 300;
238  aHatch.Angle = 450;
239  break;
240  case XML_solidDmnd:
241  aHatch.Style = drawing::HatchStyle_DOUBLE;
242  aHatch.Distance = 100;
243  aHatch.Angle = 450;
244  break;
245  case XML_openDmnd:
246  aHatch.Style = drawing::HatchStyle_DOUBLE;
247  aHatch.Distance = 100;
248  aHatch.Angle = 450;
249  break;
250  case XML_dotDmnd:
251  aHatch.Style = drawing::HatchStyle_DOUBLE;
252  aHatch.Distance = 300;
253  aHatch.Angle = 450;
254  break;
255  case XML_plaid:
256  aHatch.Style = drawing::HatchStyle_TRIPLE;
257  aHatch.Distance = 200;
258  aHatch.Angle = 900;
259  break;
260  case XML_sphere:
261  aHatch.Style = drawing::HatchStyle_TRIPLE;
262  aHatch.Distance = 100;
263  aHatch.Angle = 0;
264  break;
265  case XML_weave:
266  aHatch.Style = drawing::HatchStyle_DOUBLE;
267  aHatch.Distance = 150;
268  aHatch.Angle = 450;
269  break;
270  case XML_divot:
271  aHatch.Style = drawing::HatchStyle_TRIPLE;
272  aHatch.Distance = 400;
273  aHatch.Angle = 450;
274  break;
275  case XML_shingle:
276  aHatch.Style = drawing::HatchStyle_SINGLE;
277  aHatch.Distance = 200;
278  aHatch.Angle = 1350;
279  break;
280  case XML_wave:
281  aHatch.Style = drawing::HatchStyle_SINGLE;
282  aHatch.Distance = 100;
283  aHatch.Angle = 0;
284  break;
285  case XML_trellis:
286  aHatch.Style = drawing::HatchStyle_DOUBLE;
287  aHatch.Distance = 75;
288  aHatch.Angle = 450;
289  break;
290  case XML_zigZag:
291  aHatch.Style = drawing::HatchStyle_SINGLE;
292  aHatch.Distance = 75;
293  aHatch.Angle = 0;
294  break;
295  }
296 
297  return aHatch;
298 }
static drawing::Hatch createHatch(sal_Int32 nHatchToken,::Color nColor)
Definition: hatchmap.hxx:18