tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / oox / inc / drawingml / hatchmap.hxx
blob12fb08224228c000f382acddf9a3d195d72681e8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #include <com/sun/star/drawing/Hatch.hpp>
11 #include <oox/token/tokens.hxx>
13 #include <tools/color.hxx>
15 using namespace com::sun::star;
16 using namespace oox;
18 static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor)
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)
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 case XML_dashUpDiag:
37 aHatch.Style = drawing::HatchStyle_SINGLE;
38 aHatch.Distance = 150;
39 aHatch.Angle = 450;
40 break;
41 case XML_pct25:
42 aHatch.Style = drawing::HatchStyle_DOUBLE;
43 aHatch.Distance = 200;
44 aHatch.Angle = 450;
45 break;
46 case XML_pct30:
47 aHatch.Style = drawing::HatchStyle_DOUBLE;
48 aHatch.Distance = 175;
49 aHatch.Angle = 450;
50 break;
51 case XML_pct40:
52 case XML_weave:
53 aHatch.Style = drawing::HatchStyle_DOUBLE;
54 aHatch.Distance = 150;
55 aHatch.Angle = 450;
56 break;
57 case XML_pct50:
58 aHatch.Style = drawing::HatchStyle_DOUBLE;
59 aHatch.Distance = 125;
60 aHatch.Angle = 450;
61 break;
62 case XML_pct60:
63 aHatch.Style = drawing::HatchStyle_TRIPLE;
64 aHatch.Distance = 150;
65 aHatch.Angle = 450;
66 break;
67 case XML_pct70:
68 aHatch.Style = drawing::HatchStyle_TRIPLE;
69 aHatch.Distance = 125;
70 aHatch.Angle = 450;
71 break;
72 case XML_pct75:
73 aHatch.Style = drawing::HatchStyle_TRIPLE;
74 aHatch.Distance = 100;
75 aHatch.Angle = 450;
76 break;
77 case XML_pct80:
78 aHatch.Style = drawing::HatchStyle_TRIPLE;
79 aHatch.Distance = 75;
80 aHatch.Angle = 450;
81 break;
82 case XML_pct90:
83 aHatch.Style = drawing::HatchStyle_TRIPLE;
84 aHatch.Distance = 50;
85 aHatch.Angle = 450;
86 break;
87 case XML_horz:
88 case XML_wave:
89 aHatch.Style = drawing::HatchStyle_SINGLE;
90 aHatch.Distance = 100;
91 aHatch.Angle = 0;
92 break;
93 case XML_vert:
94 aHatch.Style = drawing::HatchStyle_SINGLE;
95 aHatch.Distance = 100;
96 aHatch.Angle = 900;
97 break;
98 case XML_ltHorz:
99 case XML_narHorz:
100 aHatch.Style = drawing::HatchStyle_SINGLE;
101 aHatch.Distance = 50;
102 aHatch.Angle = 0;
103 break;
104 case XML_ltVert:
105 case XML_narVert:
106 aHatch.Style = drawing::HatchStyle_SINGLE;
107 aHatch.Distance = 50;
108 aHatch.Angle = 900;
109 break;
110 case XML_dkHorz:
111 aHatch.Style = drawing::HatchStyle_SINGLE;
112 aHatch.Distance = 25;
113 aHatch.Angle = 0;
114 break;
115 case XML_dkVert:
116 aHatch.Style = drawing::HatchStyle_SINGLE;
117 aHatch.Distance = 25;
118 aHatch.Angle = 900;
119 break;
120 case XML_dashHorz:
121 aHatch.Style = drawing::HatchStyle_SINGLE;
122 aHatch.Distance = 150;
123 aHatch.Angle = 0;
124 break;
125 case XML_dashVert:
126 aHatch.Style = drawing::HatchStyle_SINGLE;
127 aHatch.Distance = 150;
128 aHatch.Angle = 900;
129 break;
130 case XML_cross:
131 case XML_lgGrid:
132 aHatch.Style = drawing::HatchStyle_DOUBLE;
133 aHatch.Distance = 100;
134 aHatch.Angle = 0;
135 break;
136 case XML_dnDiag:
137 case XML_wdDnDiag:
138 aHatch.Style = drawing::HatchStyle_SINGLE;
139 aHatch.Distance = 100;
140 aHatch.Angle = 1350;
141 break;
142 case XML_upDiag:
143 case XML_wdUpDiag:
144 aHatch.Style = drawing::HatchStyle_SINGLE;
145 aHatch.Distance = 100;
146 aHatch.Angle = 450;
147 break;
148 case XML_ltDnDiag:
149 case XML_dkDnDiag:
150 aHatch.Style = drawing::HatchStyle_SINGLE;
151 aHatch.Distance = 50;
152 aHatch.Angle = 1350;
153 break;
154 case XML_ltUpDiag:
155 case XML_dkUpDiag:
156 aHatch.Style = drawing::HatchStyle_SINGLE;
157 aHatch.Distance = 50;
158 aHatch.Angle = 450;
159 break;
160 case XML_dashDnDiag:
161 aHatch.Style = drawing::HatchStyle_SINGLE;
162 aHatch.Distance = 150;
163 aHatch.Angle = 1350;
164 break;
165 case XML_diagCross:
166 aHatch.Style = drawing::HatchStyle_DOUBLE;
167 aHatch.Distance = 100;
168 aHatch.Angle = 450;
169 break;
170 case XML_smCheck:
171 aHatch.Style = drawing::HatchStyle_DOUBLE;
172 aHatch.Distance = 50;
173 aHatch.Angle = 450;
174 break;
175 case XML_lgCheck:
176 aHatch.Style = drawing::HatchStyle_DOUBLE;
177 aHatch.Distance = 100;
178 aHatch.Angle = 450;
179 break;
180 case XML_smGrid:
181 aHatch.Style = drawing::HatchStyle_DOUBLE;
182 aHatch.Distance = 50;
183 aHatch.Angle = 0;
184 break;
185 case XML_dotGrid:
186 aHatch.Style = drawing::HatchStyle_DOUBLE;
187 aHatch.Distance = 400;
188 aHatch.Angle = 0;
189 break;
190 case XML_smConfetti:
191 aHatch.Style = drawing::HatchStyle_SINGLE;
192 aHatch.Distance = 200;
193 aHatch.Angle = 600;
194 break;
195 case XML_lgConfetti:
196 aHatch.Style = drawing::HatchStyle_SINGLE;
197 aHatch.Distance = 100;
198 aHatch.Angle = 600;
199 break;
200 case XML_horzBrick:
201 aHatch.Style = drawing::HatchStyle_DOUBLE;
202 aHatch.Distance = 300;
203 aHatch.Angle = 0;
204 break;
205 case XML_diagBrick:
206 case XML_dotDmnd:
207 aHatch.Style = drawing::HatchStyle_DOUBLE;
208 aHatch.Distance = 300;
209 aHatch.Angle = 450;
210 break;
211 case XML_solidDmnd:
212 aHatch.Style = drawing::HatchStyle_DOUBLE;
213 aHatch.Distance = 100;
214 aHatch.Angle = 450;
215 break;
216 case XML_openDmnd:
217 aHatch.Style = drawing::HatchStyle_DOUBLE;
218 aHatch.Distance = 100;
219 aHatch.Angle = 450;
220 break;
221 case XML_plaid:
222 aHatch.Style = drawing::HatchStyle_TRIPLE;
223 aHatch.Distance = 200;
224 aHatch.Angle = 900;
225 break;
226 case XML_sphere:
227 aHatch.Style = drawing::HatchStyle_TRIPLE;
228 aHatch.Distance = 100;
229 aHatch.Angle = 0;
230 break;
231 case XML_divot:
232 aHatch.Style = drawing::HatchStyle_TRIPLE;
233 aHatch.Distance = 400;
234 aHatch.Angle = 450;
235 break;
236 case XML_shingle:
237 aHatch.Style = drawing::HatchStyle_SINGLE;
238 aHatch.Distance = 200;
239 aHatch.Angle = 1350;
240 break;
241 case XML_trellis:
242 aHatch.Style = drawing::HatchStyle_DOUBLE;
243 aHatch.Distance = 75;
244 aHatch.Angle = 450;
245 break;
246 case XML_zigZag:
247 aHatch.Style = drawing::HatchStyle_SINGLE;
248 aHatch.Distance = 75;
249 aHatch.Angle = 0;
250 break;
253 return aHatch;