Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/oox/inc/drawingml/hatchmap.hxx
Line
Count
Source (jump to first uncovered line)
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
0
{
20
0
    drawing::Hatch aHatch;
21
0
    aHatch.Color = sal_Int32(nColor);
22
    // best-effort mapping; we do not support all the styles in core
23
0
    switch (nHatchToken)
24
0
    {
25
0
        case XML_pct5:
26
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
27
0
            aHatch.Distance = 250;
28
0
            aHatch.Angle = 450;
29
0
            break;
30
0
        case XML_pct10:
31
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
32
0
            aHatch.Distance = 200;
33
0
            aHatch.Angle = 450;
34
0
            break;
35
0
        case XML_pct20:
36
0
        case XML_dashUpDiag:
37
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
38
0
            aHatch.Distance = 150;
39
0
            aHatch.Angle = 450;
40
0
            break;
41
0
        case XML_pct25:
42
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
43
0
            aHatch.Distance = 200;
44
0
            aHatch.Angle = 450;
45
0
            break;
46
0
        case XML_pct30:
47
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
48
0
            aHatch.Distance = 175;
49
0
            aHatch.Angle = 450;
50
0
            break;
51
0
        case XML_pct40:
52
0
        case XML_weave:
53
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
54
0
            aHatch.Distance = 150;
55
0
            aHatch.Angle = 450;
56
0
            break;
57
0
        case XML_pct50:
58
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
59
0
            aHatch.Distance = 125;
60
0
            aHatch.Angle = 450;
61
0
            break;
62
0
        case XML_pct60:
63
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
64
0
            aHatch.Distance = 150;
65
0
            aHatch.Angle = 450;
66
0
            break;
67
0
        case XML_pct70:
68
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
69
0
            aHatch.Distance = 125;
70
0
            aHatch.Angle = 450;
71
0
            break;
72
0
        case XML_pct75:
73
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
74
0
            aHatch.Distance = 100;
75
0
            aHatch.Angle = 450;
76
0
            break;
77
0
        case XML_pct80:
78
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
79
0
            aHatch.Distance = 75;
80
0
            aHatch.Angle = 450;
81
0
            break;
82
0
        case XML_pct90:
83
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
84
0
            aHatch.Distance = 50;
85
0
            aHatch.Angle = 450;
86
0
            break;
87
0
        case XML_horz:
88
0
        case XML_wave:
89
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
90
0
            aHatch.Distance = 100;
91
0
            aHatch.Angle = 0;
92
0
            break;
93
0
        case XML_vert:
94
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
95
0
            aHatch.Distance = 100;
96
0
            aHatch.Angle = 900;
97
0
            break;
98
0
        case XML_ltHorz:
99
0
        case XML_narHorz:
100
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
101
0
            aHatch.Distance = 50;
102
0
            aHatch.Angle = 0;
103
0
            break;
104
0
        case XML_ltVert:
105
0
        case XML_narVert:
106
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
107
0
            aHatch.Distance = 50;
108
0
            aHatch.Angle = 900;
109
0
            break;
110
0
        case XML_dkHorz:
111
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
112
0
            aHatch.Distance = 25;
113
0
            aHatch.Angle = 0;
114
0
            break;
115
0
        case XML_dkVert:
116
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
117
0
            aHatch.Distance = 25;
118
0
            aHatch.Angle = 900;
119
0
            break;
120
0
        case XML_dashHorz:
121
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
122
0
            aHatch.Distance = 150;
123
0
            aHatch.Angle = 0;
124
0
            break;
125
0
        case XML_dashVert:
126
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
127
0
            aHatch.Distance = 150;
128
0
            aHatch.Angle = 900;
129
0
            break;
130
0
        case XML_cross:
131
0
        case XML_lgGrid:
132
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
133
0
            aHatch.Distance = 100;
134
0
            aHatch.Angle = 0;
135
0
            break;
136
0
        case XML_dnDiag:
137
0
        case XML_wdDnDiag:
138
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
139
0
            aHatch.Distance = 100;
140
0
            aHatch.Angle = 1350;
141
0
            break;
142
0
        case XML_upDiag:
143
0
        case XML_wdUpDiag:
144
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
145
0
            aHatch.Distance = 100;
146
0
            aHatch.Angle = 450;
147
0
            break;
148
0
        case XML_ltDnDiag:
149
0
        case XML_dkDnDiag:
150
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
151
0
            aHatch.Distance = 50;
152
0
            aHatch.Angle = 1350;
153
0
            break;
154
0
        case XML_ltUpDiag:
155
0
        case XML_dkUpDiag:
156
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
157
0
            aHatch.Distance = 50;
158
0
            aHatch.Angle = 450;
159
0
            break;
160
0
        case XML_dashDnDiag:
161
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
162
0
            aHatch.Distance = 150;
163
0
            aHatch.Angle = 1350;
164
0
            break;
165
0
        case XML_diagCross:
166
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
167
0
            aHatch.Distance = 100;
168
0
            aHatch.Angle = 450;
169
0
            break;
170
0
        case XML_smCheck:
171
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
172
0
            aHatch.Distance = 50;
173
0
            aHatch.Angle = 450;
174
0
            break;
175
0
        case XML_lgCheck:
176
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
177
0
            aHatch.Distance = 100;
178
0
            aHatch.Angle = 450;
179
0
            break;
180
0
        case XML_smGrid:
181
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
182
0
            aHatch.Distance = 50;
183
0
            aHatch.Angle = 0;
184
0
            break;
185
0
        case XML_dotGrid:
186
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
187
0
            aHatch.Distance = 400;
188
0
            aHatch.Angle = 0;
189
0
            break;
190
0
        case XML_smConfetti:
191
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
192
0
            aHatch.Distance = 200;
193
0
            aHatch.Angle = 600;
194
0
            break;
195
0
        case XML_lgConfetti:
196
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
197
0
            aHatch.Distance = 100;
198
0
            aHatch.Angle = 600;
199
0
            break;
200
0
        case XML_horzBrick:
201
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
202
0
            aHatch.Distance = 300;
203
0
            aHatch.Angle = 0;
204
0
            break;
205
0
        case XML_diagBrick:
206
0
        case XML_dotDmnd:
207
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
208
0
            aHatch.Distance = 300;
209
0
            aHatch.Angle = 450;
210
0
            break;
211
0
        case XML_solidDmnd:
212
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
213
0
            aHatch.Distance = 100;
214
0
            aHatch.Angle = 450;
215
0
            break;
216
0
        case XML_openDmnd:
217
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
218
0
            aHatch.Distance = 100;
219
0
            aHatch.Angle = 450;
220
0
            break;
221
0
        case XML_plaid:
222
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
223
0
            aHatch.Distance = 200;
224
0
            aHatch.Angle = 900;
225
0
            break;
226
0
        case XML_sphere:
227
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
228
0
            aHatch.Distance = 100;
229
0
            aHatch.Angle = 0;
230
0
            break;
231
0
        case XML_divot:
232
0
            aHatch.Style = drawing::HatchStyle_TRIPLE;
233
0
            aHatch.Distance = 400;
234
0
            aHatch.Angle = 450;
235
0
            break;
236
0
        case XML_shingle:
237
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
238
0
            aHatch.Distance = 200;
239
0
            aHatch.Angle = 1350;
240
0
            break;
241
0
        case XML_trellis:
242
0
            aHatch.Style = drawing::HatchStyle_DOUBLE;
243
0
            aHatch.Distance = 75;
244
0
            aHatch.Angle = 450;
245
0
            break;
246
0
        case XML_zigZag:
247
0
            aHatch.Style = drawing::HatchStyle_SINGLE;
248
0
            aHatch.Distance = 75;
249
0
            aHatch.Angle = 0;
250
0
            break;
251
0
    }
252
253
0
    return aHatch;
254
0
}
Unexecuted instantiation: fillproperties.cxx:createHatch(int, Color)
Unexecuted instantiation: seriesconverter.cxx:createHatch(int, Color)