LibreOffice Module writerfilter (master) 1
TextEffectsHandler.cxx
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
11#include <sal/config.h>
12
13#include <map>
14
16
17#include <rtl/ustrbuf.hxx>
18#include <comphelper/string.hxx>
19#include <ooxml/resourceids.hxx>
22
24{
25
26using namespace com::sun::star;
27
28namespace
29{
30
31OUString lclGetNameForElementId(sal_uInt32 aId)
32{
33 static std::map<sal_uInt32, OUString> aIdMap;
34 if(aIdMap.empty())
35 {
36 aIdMap[NS_ooxml::LN_EG_ColorChoice_srgbClr] = "srgbClr";
37 aIdMap[NS_ooxml::LN_EG_ColorChoice_schemeClr] = "schemeClr";
38 aIdMap[NS_ooxml::LN_EG_ColorTransform_tint] = "tint";
39 aIdMap[NS_ooxml::LN_EG_ColorTransform_shade] = "shade";
40 aIdMap[NS_ooxml::LN_EG_ColorTransform_alpha] = "alpha";
41 aIdMap[NS_ooxml::LN_EG_ColorTransform_hueMod] = "hueMod";
42 aIdMap[NS_ooxml::LN_EG_ColorTransform_sat] = "sat";
43 aIdMap[NS_ooxml::LN_EG_ColorTransform_satOff] = "satOff";
44 aIdMap[NS_ooxml::LN_EG_ColorTransform_satMod] = "satMod";
45 aIdMap[NS_ooxml::LN_EG_ColorTransform_lum] = "lum";
46 aIdMap[NS_ooxml::LN_EG_ColorTransform_lumOff] = "lumOff";
47 aIdMap[NS_ooxml::LN_EG_ColorTransform_lumMod] = "lumMod";
48 aIdMap[NS_ooxml::LN_EG_FillProperties_noFill] = "noFill";
49 aIdMap[NS_ooxml::LN_EG_FillProperties_solidFill] = "solidFill";
50 aIdMap[NS_ooxml::LN_EG_FillProperties_gradFill] = "gradFill";
51 aIdMap[NS_ooxml::LN_CT_GradientFillProperties_gsLst] = "gsLst";
52 aIdMap[NS_ooxml::LN_CT_GradientStopList_gs] = "gs";
53 aIdMap[NS_ooxml::LN_CT_GradientStop_pos] = "pos";
54 aIdMap[NS_ooxml::LN_EG_ShadeProperties_lin] = "lin";
55 aIdMap[NS_ooxml::LN_EG_ShadeProperties_path] = "path";
56 aIdMap[NS_ooxml::LN_CT_PathShadeProperties_fillToRect] = "fillToRect";
57 aIdMap[NS_ooxml::LN_EG_LineDashProperties_prstDash] = "prstDash";
58 aIdMap[NS_ooxml::LN_EG_LineJoinProperties_round] = "round";
59 aIdMap[NS_ooxml::LN_EG_LineJoinProperties_bevel] = "bevel";
60 aIdMap[NS_ooxml::LN_EG_LineJoinProperties_miter] = "miter";
61 aIdMap[NS_ooxml::LN_CT_Scene3D_camera] = "camera";
62 aIdMap[NS_ooxml::LN_CT_Scene3D_lightRig] = "lightRig";
63 aIdMap[NS_ooxml::LN_CT_LightRig_rot] = "rot";
64 aIdMap[NS_ooxml::LN_CT_Props3D_bevelT] = "bevelT";
65 aIdMap[NS_ooxml::LN_CT_Props3D_bevelB] = "bevelB";
66 aIdMap[NS_ooxml::LN_CT_Props3D_extrusionClr] = "extrusionClr";
67 aIdMap[NS_ooxml::LN_CT_Props3D_contourClr] = "contourClr";
68 aIdMap[NS_ooxml::LN_CT_StylisticSets_styleSet] = "styleSet";
69 aIdMap[NS_ooxml::LN_cntxtAlts_cntxtAlts] = "cntxtAlts";
70 }
71 return aIdMap[aId];
72}
73
74constexpr OUStringLiteral constAttributesSequenceName = u"attributes";
75
76}
77
79{
80 switch (nType)
81 {
82 case NS_ooxml::LN_ST_SchemeColorVal_bg1: return "bg1";
83 case NS_ooxml::LN_ST_SchemeColorVal_tx1: return "tx1";
84 case NS_ooxml::LN_ST_SchemeColorVal_bg2: return "bg2";
85 case NS_ooxml::LN_ST_SchemeColorVal_tx2: return "tx2";
86 case NS_ooxml::LN_ST_SchemeColorVal_accent1: return "accent1";
87 case NS_ooxml::LN_ST_SchemeColorVal_accent2: return "accent2";
88 case NS_ooxml::LN_ST_SchemeColorVal_accent3: return "accent3";
89 case NS_ooxml::LN_ST_SchemeColorVal_accent4: return "accent4";
90 case NS_ooxml::LN_ST_SchemeColorVal_accent5: return "accent5";
91 case NS_ooxml::LN_ST_SchemeColorVal_accent6: return "accent6";
92 case NS_ooxml::LN_ST_SchemeColorVal_hlink: return "hlink";
93 case NS_ooxml::LN_ST_SchemeColorVal_folHlink: return "folHlink";
94 case NS_ooxml::LN_ST_SchemeColorVal_dk1: return "dk1";
95 case NS_ooxml::LN_ST_SchemeColorVal_lt1: return "lt1";
96 case NS_ooxml::LN_ST_SchemeColorVal_dk2: return "dk2";
97 case NS_ooxml::LN_ST_SchemeColorVal_lt2: return "lt2";
98 case NS_ooxml::LN_ST_SchemeColorVal_phClr: return "phClr";
99 default: break;
100 }
101 return OUString();
102}
103
105{
106 switch (nType)
107 {
108 case NS_ooxml::LN_ST_RectAlignment_none: return "none";
109 case NS_ooxml::LN_ST_RectAlignment_tl: return "tl";
110 case NS_ooxml::LN_ST_RectAlignment_t: return "t";
111 case NS_ooxml::LN_ST_RectAlignment_tr: return "tr";
112 case NS_ooxml::LN_ST_RectAlignment_l: return "l";
113 case NS_ooxml::LN_ST_RectAlignment_ctr: return "ctr";
114 case NS_ooxml::LN_ST_RectAlignment_r: return "r";
115 case NS_ooxml::LN_ST_RectAlignment_bl: return "bl";
116 case NS_ooxml::LN_ST_RectAlignment_b: return "b";
117 case NS_ooxml::LN_ST_RectAlignment_br: return "br";
118
119 default: break;
120 }
121 return OUString();
122}
123
125{
126 switch (nType)
127 {
128 case NS_ooxml::LN_ST_LineCap_rnd: return "rnd";
129 case NS_ooxml::LN_ST_LineCap_sq: return "sq";
130 case NS_ooxml::LN_ST_LineCap_flat: return "flat";
131 default: break;
132 }
133 return OUString();
134}
135
137{
138 switch (nType)
139 {
140 case NS_ooxml::LN_ST_CompoundLine_sng: return "sng";
141 case NS_ooxml::LN_ST_CompoundLine_dbl: return "dbl";
142 case NS_ooxml::LN_ST_CompoundLine_thickThin: return "thickThin";
143 case NS_ooxml::LN_ST_CompoundLine_thinThick: return "thinThick";
144 case NS_ooxml::LN_ST_CompoundLine_tri: return "tri";
145 default: break;
146 }
147 return OUString();
148}
149
151{
152 switch (nType)
153 {
154 case NS_ooxml::LN_ST_PenAlignment_ctr: return "ctr";
155 case NS_ooxml::LN_ST_PenAlignment_in: return "in";
156 default: break;
157 }
158 return OUString();
159}
160
161OUString TextEffectsHandler::getOnOffString(sal_Int32 nType)
162{
163 switch (nType)
164 {
165 case NS_ooxml::LN_ST_OnOff_true: return "true";
166 case NS_ooxml::LN_ST_OnOff_false: return "false";
167 case NS_ooxml::LN_ST_OnOff_1: return "1";
168 case NS_ooxml::LN_ST_OnOff_0: return "0";
169 default: break;
170 }
171 return OUString();
172}
173
175{
176 switch (nType)
177 {
178 case NS_ooxml::LN_ST_PathShadeType_shape: return "shape";
179 case NS_ooxml::LN_ST_PathShadeType_circle: return "circle";
180 case NS_ooxml::LN_ST_PathShadeType_rect: return "rect";
181 default: break;
182 }
183 return OUString();
184}
185
187{
188 switch (nType)
189 {
190 case NS_ooxml::LN_ST_PresetLineDashVal_solid: return "solid";
191 case NS_ooxml::LN_ST_PresetLineDashVal_dot: return "dot";
192 case NS_ooxml::LN_ST_PresetLineDashVal_sysDot: return "sysDot";
193 case NS_ooxml::LN_ST_PresetLineDashVal_dash: return "dash";
194 case NS_ooxml::LN_ST_PresetLineDashVal_sysDash: return "sysDash";
195 case NS_ooxml::LN_ST_PresetLineDashVal_lgDash: return "lgDash";
196 case NS_ooxml::LN_ST_PresetLineDashVal_dashDot: return "dashDot";
197 case NS_ooxml::LN_ST_PresetLineDashVal_sysDashDot: return "sysDashDot";
198 case NS_ooxml::LN_ST_PresetLineDashVal_lgDashDot: return "lgDashDot";
199 case NS_ooxml::LN_ST_PresetLineDashVal_lgDashDotDot: return "lgDashDotDot";
200 case NS_ooxml::LN_ST_PresetLineDashVal_sysDashDotDot: return "sysDashDotDot";
201 default: break;
202 }
203 return OUString();
204}
205
207{
208 switch (nType)
209 {
210 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueTopLeft: return "legacyObliqueTopLeft";
211 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueTop: return "legacyObliqueTop";
212 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueTopRight: return "legacyObliqueTopRight";
213 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueLeft: return "legacyObliqueLeft";
214 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueFront: return "legacyObliqueFront";
215 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueRight: return "legacyObliqueRight";
216 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueBottomLeft: return "legacyObliqueBottomLeft";
217 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueBottom: return "legacyObliqueBottom";
218 case NS_ooxml::LN_ST_PresetCameraType_legacyObliqueBottomRight: return "legacyObliqueBottomRight";
219 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveTopLeft: return "legacyPerspectiveTopLeft";
220 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveTop: return "legacyPerspectiveTop";
221 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveTopRight: return "legacyPerspectiveTopRight";
222 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveLeft: return "legacyPerspectiveLeft";
223 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveFront: return "legacyPerspectiveFront";
224 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveRight: return "legacyPerspectiveRight";
225 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveBottomLeft: return "legacyPerspectiveBottomLeft";
226 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveBottom: return "legacyPerspectiveBottom";
227 case NS_ooxml::LN_ST_PresetCameraType_legacyPerspectiveBottomRight: return "legacyPerspectiveBottomRight";
228 case NS_ooxml::LN_ST_PresetCameraType_orthographicFront: return "orthographicFront";
229 case NS_ooxml::LN_ST_PresetCameraType_isometricTopUp: return "isometricTopUp";
230 case NS_ooxml::LN_ST_PresetCameraType_isometricTopDown: return "isometricTopDown";
231 case NS_ooxml::LN_ST_PresetCameraType_isometricBottomUp: return "isometricBottomUp";
232 case NS_ooxml::LN_ST_PresetCameraType_isometricBottomDown: return "isometricBottomDown";
233 case NS_ooxml::LN_ST_PresetCameraType_isometricLeftUp: return "isometricLeftUp";
234 case NS_ooxml::LN_ST_PresetCameraType_isometricLeftDown: return "isometricLeftDown";
235 case NS_ooxml::LN_ST_PresetCameraType_isometricRightUp: return "isometricRightUp";
236 case NS_ooxml::LN_ST_PresetCameraType_isometricRightDown: return "isometricRightDown";
237 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis1Left: return "isometricOffAxis1Left";
238 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis1Right: return "isometricOffAxis1Right";
239 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis1Top: return "isometricOffAxis1Top";
240 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis2Left: return "isometricOffAxis2Left";
241 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis2Right: return "isometricOffAxis2Right";
242 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis2Top: return "isometricOffAxis2Top";
243 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis3Left: return "isometricOffAxis3Left";
244 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis3Right: return "isometricOffAxis3Right";
245 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis3Bottom: return "isometricOffAxis3Bottom";
246 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis4Left: return "isometricOffAxis4Left";
247 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis4Right: return "isometricOffAxis4Right";
248 case NS_ooxml::LN_ST_PresetCameraType_isometricOffAxis4Bottom: return "isometricOffAxis4Bottom";
249 case NS_ooxml::LN_ST_PresetCameraType_obliqueTopLeft: return "obliqueTopLeft";
250 case NS_ooxml::LN_ST_PresetCameraType_obliqueTop: return "obliqueTop";
251 case NS_ooxml::LN_ST_PresetCameraType_obliqueTopRight: return "obliqueTopRight";
252 case NS_ooxml::LN_ST_PresetCameraType_obliqueLeft: return "obliqueLeft";
253 case NS_ooxml::LN_ST_PresetCameraType_obliqueRight: return "obliqueRight";
254 case NS_ooxml::LN_ST_PresetCameraType_obliqueBottomLeft: return "obliqueBottomLeft";
255 case NS_ooxml::LN_ST_PresetCameraType_obliqueBottom: return "obliqueBottom";
256 case NS_ooxml::LN_ST_PresetCameraType_obliqueBottomRight: return "obliqueBottomRight";
257 case NS_ooxml::LN_ST_PresetCameraType_perspectiveFront: return "perspectiveFront";
258 case NS_ooxml::LN_ST_PresetCameraType_perspectiveLeft: return "perspectiveLeft";
259 case NS_ooxml::LN_ST_PresetCameraType_perspectiveRight: return "perspectiveRight";
260 case NS_ooxml::LN_ST_PresetCameraType_perspectiveAbove: return "perspectiveAbove";
261 case NS_ooxml::LN_ST_PresetCameraType_perspectiveBelow: return "perspectiveBelow";
262 case NS_ooxml::LN_ST_PresetCameraType_perspectiveAboveLeftFacing: return "perspectiveAboveLeftFacing";
263 case NS_ooxml::LN_ST_PresetCameraType_perspectiveAboveRightFacing: return "perspectiveAboveRightFacing";
264 case NS_ooxml::LN_ST_PresetCameraType_perspectiveContrastingLeftFacing: return "perspectiveContrastingLeftFacing";
265 case NS_ooxml::LN_ST_PresetCameraType_perspectiveContrastingRightFacing: return "perspectiveContrastingRightFacing";
266 case NS_ooxml::LN_ST_PresetCameraType_perspectiveHeroicLeftFacing: return "perspectiveHeroicLeftFacing";
267 case NS_ooxml::LN_ST_PresetCameraType_perspectiveHeroicRightFacing: return "perspectiveHeroicRightFacing";
268 case NS_ooxml::LN_ST_PresetCameraType_perspectiveHeroicExtremeLeftFacing: return "perspectiveHeroicExtremeLeftFacing";
269 case NS_ooxml::LN_ST_PresetCameraType_perspectiveHeroicExtremeRightFacing: return "perspectiveHeroicExtremeRightFacing";
270 case NS_ooxml::LN_ST_PresetCameraType_perspectiveRelaxed: return "perspectiveRelaxed";
271 case NS_ooxml::LN_ST_PresetCameraType_perspectiveRelaxedModerately: return "perspectiveRelaxedModerately";
272 default: break;
273 }
274 return OUString();
275}
276
277
279{
280 switch (nType)
281 {
282 case NS_ooxml::LN_ST_LightRigType_legacyFlat1: return "legacyFlat1";
283 case NS_ooxml::LN_ST_LightRigType_legacyFlat2: return "legacyFlat2";
284 case NS_ooxml::LN_ST_LightRigType_legacyFlat3: return "legacyFlat3";
285 case NS_ooxml::LN_ST_LightRigType_legacyFlat4: return "legacyFlat4";
286 case NS_ooxml::LN_ST_LightRigType_legacyNormal1: return "legacyNormal1";
287 case NS_ooxml::LN_ST_LightRigType_legacyNormal2: return "legacyNormal2";
288 case NS_ooxml::LN_ST_LightRigType_legacyNormal3: return "legacyNormal3";
289 case NS_ooxml::LN_ST_LightRigType_legacyNormal4: return "legacyNormal4";
290 case NS_ooxml::LN_ST_LightRigType_legacyHarsh1: return "legacyHarsh1";
291 case NS_ooxml::LN_ST_LightRigType_legacyHarsh2: return "legacyHarsh2";
292 case NS_ooxml::LN_ST_LightRigType_legacyHarsh3: return "legacyHarsh3";
293 case NS_ooxml::LN_ST_LightRigType_legacyHarsh4: return "legacyHarsh4";
294 case NS_ooxml::LN_ST_LightRigType_threePt: return "threePt";
295 case NS_ooxml::LN_ST_LightRigType_balanced: return "balanced";
296 case NS_ooxml::LN_ST_LightRigType_soft: return "soft";
297 case NS_ooxml::LN_ST_LightRigType_harsh: return "harsh";
298 case NS_ooxml::LN_ST_LightRigType_flood: return "flood";
299 case NS_ooxml::LN_ST_LightRigType_contrasting: return "contrasting";
300 case NS_ooxml::LN_ST_LightRigType_morning: return "morning";
301 case NS_ooxml::LN_ST_LightRigType_sunrise: return "sunrise";
302 case NS_ooxml::LN_ST_LightRigType_sunset: return "sunset";
303 case NS_ooxml::LN_ST_LightRigType_chilly: return "chilly";
304 case NS_ooxml::LN_ST_LightRigType_freezing: return "freezing";
305 case NS_ooxml::LN_ST_LightRigType_flat: return "flat";
306 case NS_ooxml::LN_ST_LightRigType_twoPt: return "twoPt";
307 case NS_ooxml::LN_ST_LightRigType_glow: return "glow";
308 case NS_ooxml::LN_ST_LightRigType_brightRoom: return "brightRoom";
309 default: break;
310 }
311 return OUString();
312}
313
315{
316 switch (nType)
317 {
318 case NS_ooxml::LN_ST_LightRigDirection_tl: return "tl";
319 case NS_ooxml::LN_ST_LightRigDirection_t: return "t";
320 case NS_ooxml::LN_ST_LightRigDirection_tr: return "tr";
321 case NS_ooxml::LN_ST_LightRigDirection_l: return "l";
322 case NS_ooxml::LN_ST_LightRigDirection_r: return "r";
323 case NS_ooxml::LN_ST_LightRigDirection_bl: return "bl";
324 case NS_ooxml::LN_ST_LightRigDirection_b: return "b";
325 case NS_ooxml::LN_ST_LightRigDirection_br: return "br";
326
327 default: break;
328 }
329 return OUString();
330}
331
333{
334 switch (nType)
335 {
336 case NS_ooxml::LN_ST_BevelPresetType_relaxedInset: return "relaxedInset";
337 case NS_ooxml::LN_ST_BevelPresetType_circle: return "circle";
338 case NS_ooxml::LN_ST_BevelPresetType_slope: return "slope";
339 case NS_ooxml::LN_ST_BevelPresetType_cross: return "cross";
340 case NS_ooxml::LN_ST_BevelPresetType_angle: return "angle";
341 case NS_ooxml::LN_ST_BevelPresetType_softRound: return "softRound";
342 case NS_ooxml::LN_ST_BevelPresetType_convex: return "convex";
343 case NS_ooxml::LN_ST_BevelPresetType_coolSlant: return "coolSlant";
344 case NS_ooxml::LN_ST_BevelPresetType_divot: return "divot";
345 case NS_ooxml::LN_ST_BevelPresetType_riblet: return "riblet";
346 case NS_ooxml::LN_ST_BevelPresetType_hardEdge: return "hardEdge";
347 case NS_ooxml::LN_ST_BevelPresetType_artDeco: return "artDeco";
348 default: break;
349 }
350 return OUString();
351}
352
354{
355 switch (nType)
356 {
357 case NS_ooxml::LN_ST_PresetMaterialType_legacyMatte: return "legacyMatte";
358 case NS_ooxml::LN_ST_PresetMaterialType_legacyPlastic: return "legacyPlastic";
359 case NS_ooxml::LN_ST_PresetMaterialType_legacyMetal: return "legacyMetal";
360 case NS_ooxml::LN_ST_PresetMaterialType_legacyWireframe: return "legacyWireframe";
361 case NS_ooxml::LN_ST_PresetMaterialType_matte: return "matte";
362 case NS_ooxml::LN_ST_PresetMaterialType_plastic: return "plastic";
363 case NS_ooxml::LN_ST_PresetMaterialType_metal: return "metal";
364 case NS_ooxml::LN_ST_PresetMaterialType_warmMatte: return "warmMatte";
365 case NS_ooxml::LN_ST_PresetMaterialType_translucentPowder: return "translucentPowder";
366 case NS_ooxml::LN_ST_PresetMaterialType_powder: return "powder";
367 case NS_ooxml::LN_ST_PresetMaterialType_dkEdge: return "dkEdge";
368 case NS_ooxml::LN_ST_PresetMaterialType_softEdge: return "softEdge";
369 case NS_ooxml::LN_ST_PresetMaterialType_clear: return "clear";
370 case NS_ooxml::LN_ST_PresetMaterialType_flat: return "flat";
371 case NS_ooxml::LN_ST_PresetMaterialType_softmetal: return "softmetal";
372 case NS_ooxml::LN_ST_PresetMaterialType_none: return "none";
373 default: break;
374 }
375 return OUString();
376}
377
379{
380 switch (nType)
381 {
382 case NS_ooxml::LN_ST_Ligatures_none: return "none";
383 case NS_ooxml::LN_ST_Ligatures_standard: return "standard";
384 case NS_ooxml::LN_ST_Ligatures_contextual: return "contextual";
385 case NS_ooxml::LN_ST_Ligatures_historical: return "historical";
386 case NS_ooxml::LN_ST_Ligatures_discretional: return "discretional";
387 case NS_ooxml::LN_ST_Ligatures_standardContextual: return "standardContextual";
388 case NS_ooxml::LN_ST_Ligatures_standardHistorical: return "standardHistorical";
389 case NS_ooxml::LN_ST_Ligatures_contextualHistorical: return "contextualHistorical";
390 case NS_ooxml::LN_ST_Ligatures_standardDiscretional: return "standardDiscretional";
391 case NS_ooxml::LN_ST_Ligatures_contextualDiscretional: return "contextualDiscretional";
392 case NS_ooxml::LN_ST_Ligatures_historicalDiscretional: return "historicalDiscretional";
393 case NS_ooxml::LN_ST_Ligatures_standardContextualHistorical: return "standardContextualHistorical";
394 case NS_ooxml::LN_ST_Ligatures_standardContextualDiscretional: return "standardContextualDiscretional";
395 case NS_ooxml::LN_ST_Ligatures_standardHistoricalDiscretional: return "standardHistoricalDiscretional";
396 case NS_ooxml::LN_ST_Ligatures_contextualHistoricalDiscretional: return "contextualHistoricalDiscretional";
397 case NS_ooxml::LN_ST_Ligatures_all: return "all";
398 default: break;
399 }
400 return OUString();
401}
402
404{
405 switch (nType)
406 {
407 case NS_ooxml::LN_ST_NumForm_default: return "default";
408 case NS_ooxml::LN_ST_NumForm_lining: return "lining";
409 case NS_ooxml::LN_ST_NumForm_oldStyle: return "oldStyle";
410 default: break;
411 }
412 return OUString();
413}
414
416{
417 switch (nType)
418 {
419 case NS_ooxml::LN_ST_NumSpacing_default: return "default";
420 case NS_ooxml::LN_ST_NumSpacing_proportional: return "proportional";
421 case NS_ooxml::LN_ST_NumSpacing_tabular: return "tabular";
422 default: break;
423 }
424 return OUString();
425}
426
428{
429 switch(aElementId)
430 {
431 case NS_ooxml::LN_glow_glow:
433 maElementName = "glow";
434 break;
435 case NS_ooxml::LN_shadow_shadow:
437 maElementName = "shadow";
438 break;
439 case NS_ooxml::LN_reflection_reflection:
441 maElementName = "reflection";
442 break;
443 case NS_ooxml::LN_textOutline_textOutline:
445 maElementName = "textOutline";
446 break;
447 case NS_ooxml::LN_textFill_textFill:
449 maElementName = "textFill";
450 break;
451 case NS_ooxml::LN_scene3d_scene3d:
453 maElementName = "scene3d";
454 break;
455 case NS_ooxml::LN_props3d_props3d:
457 maElementName = "props3d";
458 break;
459 case NS_ooxml::LN_ligatures_ligatures:
461 maElementName = "ligatures";
462 break;
463 case NS_ooxml::LN_numForm_numForm:
465 maElementName = "numForm";
466 break;
467 case NS_ooxml::LN_numSpacing_numSpacing:
469 maElementName = "numSpacing";
470 break;
471 case NS_ooxml::LN_stylisticSets_stylisticSets:
473 maElementName = "stylisticSets";
474 break;
475 case NS_ooxml::LN_cntxtAlts_cntxtAlts:
477 maElementName = "cntxtAlts";
478 break;
479 default:
480 break;
481 }
482}
483
485 LoggedProperties("TextEffectsHandler")
486{
489}
490
492{
493}
494
495
497{
498 if (mpGrabBagStack->getCurrentName() != constAttributesSequenceName)
499 mpGrabBagStack->push(constAttributesSequenceName);
500
501 switch(aName)
502 {
503 case NS_ooxml::LN_CT_Percentage_val:
504 case NS_ooxml::LN_CT_PositiveFixedPercentage_val:
505 case NS_ooxml::LN_CT_PositivePercentage_val:
506 mpGrabBagStack->addInt32("val", sal_Int32(aValue.getInt()));
507 break;
508 case NS_ooxml::LN_CT_Glow_rad:
509 mpGrabBagStack->addInt32("rad", sal_Int32(aValue.getInt()));
510 break;
511 case NS_ooxml::LN_CT_SchemeColor_val:
512 {
513 OUString aString = getSchemeColorValTypeString(sal_Int32(aValue.getInt()));
514 mpGrabBagStack->addString("val", aString);
515 }
516 break;
517 case NS_ooxml::LN_CT_SRgbColor_val:
518 {
519 OUString aBuffer = OUString::number(aValue.getInt(), 16);
520 OUStringBuffer aString;
521 comphelper::string::padToLength(aString, 6 - aBuffer.getLength(), '0');
522 aString.append(aBuffer.getStr());
523 mpGrabBagStack->addString("val", aString.makeStringAndClear().toAsciiUpperCase());
524 }
525 break;
526 case NS_ooxml::LN_CT_Shadow_blurRad:
527 case NS_ooxml::LN_CT_Reflection_blurRad:
528 mpGrabBagStack->addInt32("blurRad", sal_Int32(aValue.getInt()));
529 break;
530 case NS_ooxml::LN_CT_Reflection_stA:
531 mpGrabBagStack->addInt32("stA", sal_Int32(aValue.getInt()));
532 break;
533 case NS_ooxml::LN_CT_Reflection_stPos:
534 mpGrabBagStack->addInt32("stPos", sal_Int32(aValue.getInt()));
535 break;
536 case NS_ooxml::LN_CT_Reflection_endA:
537 mpGrabBagStack->addInt32("endA", sal_Int32(aValue.getInt()));
538 break;
539 case NS_ooxml::LN_CT_Reflection_endPos:
540 mpGrabBagStack->addInt32("endPos", sal_Int32(aValue.getInt()));
541 break;
542 case NS_ooxml::LN_CT_Shadow_dist:
543 case NS_ooxml::LN_CT_Reflection_dist:
544 mpGrabBagStack->addInt32("dist", sal_Int32(aValue.getInt()));
545 break;
546 case NS_ooxml::LN_CT_Shadow_dir:
547 case NS_ooxml::LN_CT_Reflection_dir:
548 mpGrabBagStack->addInt32("dir", sal_Int32(aValue.getInt()));
549 break;
550 case NS_ooxml::LN_CT_Reflection_fadeDir:
551 mpGrabBagStack->addInt32("fadeDir", sal_Int32(aValue.getInt()));
552 break;
553 case NS_ooxml::LN_CT_Shadow_sx:
554 case NS_ooxml::LN_CT_Reflection_sx:
555 mpGrabBagStack->addInt32("sx", sal_Int32(aValue.getInt()));
556 break;
557 case NS_ooxml::LN_CT_Shadow_sy:
558 case NS_ooxml::LN_CT_Reflection_sy:
559 mpGrabBagStack->addInt32("sy", sal_Int32(aValue.getInt()));
560 break;
561 case NS_ooxml::LN_CT_Shadow_kx:
562 case NS_ooxml::LN_CT_Reflection_kx:
563 mpGrabBagStack->addInt32("kx", sal_Int32(aValue.getInt()));
564 break;
565 case NS_ooxml::LN_CT_Shadow_ky:
566 case NS_ooxml::LN_CT_Reflection_ky:
567 mpGrabBagStack->addInt32("ky", sal_Int32(aValue.getInt()));
568 break;
569 case NS_ooxml::LN_CT_Shadow_algn:
570 case NS_ooxml::LN_CT_Reflection_algn:
571 {
572 uno::Any aAny(getRectAlignmentString(sal_Int32(aValue.getInt())));
573 mpGrabBagStack->appendElement("algn", aAny);
574 }
575 break;
576 case NS_ooxml::LN_CT_TextOutlineEffect_w:
577 mpGrabBagStack->addInt32("w", sal_Int32(aValue.getInt()));
578 break;
579 case NS_ooxml::LN_CT_TextOutlineEffect_cap:
580 {
581 uno::Any aAny(getLineCapString(sal_Int32(aValue.getInt())));
582 mpGrabBagStack->appendElement("cap", aAny);
583 }
584 break;
585 case NS_ooxml::LN_CT_TextOutlineEffect_cmpd:
586 {
587 uno::Any aAny(getCompoundLineString(sal_Int32(aValue.getInt())));
588 mpGrabBagStack->appendElement("cmpd", aAny);
589 }
590 break;
591 case NS_ooxml::LN_CT_TextOutlineEffect_algn:
592 {
593 uno::Any aAny(getPenAlignmentString(sal_Int32(aValue.getInt())));
594 mpGrabBagStack->appendElement("algn", aAny);
595 }
596 break;
597 case NS_ooxml::LN_CT_GradientStop_pos:
598 mpGrabBagStack->addInt32("pos", sal_Int32(aValue.getInt()));
599 break;
600 case NS_ooxml::LN_CT_LinearShadeProperties_ang:
601 mpGrabBagStack->addInt32("ang", sal_Int32(aValue.getInt()));
602 break;
603 case NS_ooxml::LN_CT_LinearShadeProperties_scaled:
604 {
605 uno::Any aAny(getOnOffString(sal_Int32(aValue.getInt())));
606 mpGrabBagStack->appendElement("scaled", aAny);
607 }
608 break;
609 case NS_ooxml::LN_CT_PathShadeProperties_path:
610 {
611 uno::Any aAny(getPathShadeTypeString(sal_Int32(aValue.getInt())));
612 mpGrabBagStack->appendElement("path", aAny);
613 }
614 break;
615 case NS_ooxml::LN_CT_RelativeRect_l:
616 mpGrabBagStack->addInt32("l", sal_Int32(aValue.getInt()));
617 break;
618 case NS_ooxml::LN_CT_RelativeRect_t:
619 mpGrabBagStack->addInt32("t", sal_Int32(aValue.getInt()));
620 break;
621 case NS_ooxml::LN_CT_RelativeRect_r:
622 mpGrabBagStack->addInt32("r", sal_Int32(aValue.getInt()));
623 break;
624 case NS_ooxml::LN_CT_RelativeRect_b:
625 mpGrabBagStack->addInt32("b", sal_Int32(aValue.getInt()));
626 break;
627 case NS_ooxml::LN_CT_PresetLineDashProperties_val:
628 {
629 uno::Any aAny(getPresetLineDashValString(sal_Int32(aValue.getInt())));
630 mpGrabBagStack->appendElement("val", aAny);
631 }
632 break;
633 case NS_ooxml::LN_CT_LineJoinMiterProperties_lim:
634 mpGrabBagStack->addInt32("lim", sal_Int32(aValue.getInt()));
635 break;
636 case NS_ooxml::LN_CT_Camera_prst:
637 {
638 uno::Any aAny(getPresetCameraTypeString(sal_Int32(aValue.getInt())));
639 mpGrabBagStack->appendElement("prst", aAny);
640 }
641 break;
642 case NS_ooxml::LN_CT_LightRig_rig:
643 {
644 uno::Any aAny(getLightRigTypeString(sal_Int32(aValue.getInt())));
645 mpGrabBagStack->appendElement("rig", aAny);
646 }
647 break;
648 case NS_ooxml::LN_CT_LightRig_dir:
649 {
650 uno::Any aAny(getLightRigDirectionString(sal_Int32(aValue.getInt())));
651 mpGrabBagStack->appendElement("dir", aAny);
652 }
653 break;
654 case NS_ooxml::LN_CT_SphereCoords_lat:
655 mpGrabBagStack->addInt32("lat", sal_Int32(aValue.getInt()));
656 break;
657 case NS_ooxml::LN_CT_SphereCoords_lon:
658 mpGrabBagStack->addInt32("lon", sal_Int32(aValue.getInt()));
659 break;
660 case NS_ooxml::LN_CT_SphereCoords_rev:
661 mpGrabBagStack->addInt32("rev", sal_Int32(aValue.getInt()));
662 break;
663 case NS_ooxml::LN_CT_Props3D_extrusionH:
664 mpGrabBagStack->addInt32("extrusionH", sal_Int32(aValue.getInt()));
665 break;
666 case NS_ooxml::LN_CT_Props3D_contourW:
667 mpGrabBagStack->addInt32("contourW", sal_Int32(aValue.getInt()));
668 break;
669 case NS_ooxml::LN_CT_Props3D_prstMaterial:
670 {
671 uno::Any aAny(getPresetMaterialTypeString(sal_Int32(aValue.getInt())));
672 mpGrabBagStack->appendElement("prstMaterial", aAny);
673 }
674 break;
675 case NS_ooxml::LN_CT_Bevel_w:
676 mpGrabBagStack->addInt32("w", sal_Int32(aValue.getInt()));
677 break;
678 case NS_ooxml::LN_CT_Bevel_h:
679 mpGrabBagStack->addInt32("h", sal_Int32(aValue.getInt()));
680 break;
681 case NS_ooxml::LN_CT_Bevel_prst:
682 {
683 uno::Any aAny(getBevelPresetTypeString(sal_Int32(aValue.getInt())));
684 mpGrabBagStack->appendElement("prst", aAny);
685 }
686 break;
687 case NS_ooxml::LN_CT_Ligatures_val:
688 {
689 uno::Any aAny(getLigaturesString(sal_Int32(aValue.getInt())));
690 mpGrabBagStack->appendElement("val", aAny);
691 }
692 break;
693 case NS_ooxml::LN_CT_NumForm_val:
694 {
695 uno::Any aAny(getNumFormString(sal_Int32(aValue.getInt())));
696 mpGrabBagStack->appendElement("val", aAny);
697 }
698 break;
699 case NS_ooxml::LN_CT_NumSpacing_val:
700 {
701 uno::Any aAny(getNumSpacingString(sal_Int32(aValue.getInt())));
702 mpGrabBagStack->appendElement("val", aAny);
703 }
704 break;
705 case NS_ooxml::LN_CT_StyleSet_id:
706 mpGrabBagStack->addInt32("id", sal_Int32(aValue.getInt()));
707 break;
708 case NS_ooxml::LN_CT_StyleSet_val:
709 case NS_ooxml::LN_CT_OnOff_val:
710 {
711 uno::Any aAny(getOnOffString(sal_Int32(aValue.getInt())));
712 mpGrabBagStack->appendElement("val", aAny);
713 }
714 break;
715 default:
716 break;
717 }
718}
719
721{
722 if (mpGrabBagStack->getCurrentName() == constAttributesSequenceName)
723 mpGrabBagStack->pop();
724
725 sal_uInt32 nSprmId = rSprm.getId();
726 OUString aElementName = lclGetNameForElementId(nSprmId);
727 if(aElementName.isEmpty())
728 {
729 // Element is unknown -> leave.
730 return;
731 }
732
733 mpGrabBagStack->push(aElementName);
734
736 if( !pProperties )
737 return;
738
739 pProperties->resolve( *this );
740
741 if (mpGrabBagStack->getCurrentName() == constAttributesSequenceName)
742 mpGrabBagStack->pop();
743
744 mpGrabBagStack->pop();
745}
746
748{
749 beans::PropertyValue aReturn = mpGrabBagStack->getRootProperty();
750 mpGrabBagStack.reset();
751 return aReturn;
752}
753
754sal_uInt8 TextEffectsHandler::GetTextFillSolidFillAlpha(const css::beans::PropertyValue& rValue)
755{
756 if (rValue.Name != "textFill")
757 {
758 return 0;
759 }
760
762 rValue.Value >>= aPropertyValues;
764 auto it = aMap.find("solidFill");
765 if (it == aMap.end())
766 {
767 return 0;
768 }
769
770 comphelper::SequenceAsHashMap aSolidFillMap(it->second);
771 it = aSolidFillMap.find("srgbClr");
772 if (it == aSolidFillMap.end())
773 {
774 it = aSolidFillMap.find("schemeClr");
775 if (it == aSolidFillMap.end())
776 return 0;
777 }
778
779 comphelper::SequenceAsHashMap aSrgbClrMap(it->second);
780 it = aSrgbClrMap.find("alpha");
781 if (it == aSrgbClrMap.end())
782 {
783 return 0;
784 }
785
786 comphelper::SequenceAsHashMap aAlphaMap(it->second);
787 it = aAlphaMap.find("attributes");
788 if (it == aAlphaMap.end())
789 {
790 return 0;
791 }
792
793 comphelper::SequenceAsHashMap aAttributesMap(it->second);
794 it = aAttributesMap.find("val");
795 if (it == aAttributesMap.end())
796 {
797 return 0;
798 }
799 sal_Int32 nVal = 0;
800 it->second >>= nVal;
801 return nVal / oox::drawingml::PER_PERCENT;
802}
803
804} // namespace
805
806/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertyValueVector_t aPropertyValues
iterator find(const OUString &rKey)
An SPRM: Section, Paragraph and Run Modifier.
virtual sal_uInt32 getId() const =0
Returns id of the SPRM.
virtual writerfilter::Reference< Properties >::Pointer_t getProps()=0
Returns reference to properties contained in the SPRM.
virtual int getInt() const =0
Returns integer representation of the value.
void convertElementIdToPropertyId(sal_Int32 aElementId)
virtual void lcl_sprm(Sprm &sprm) override
static OUString getSchemeColorValTypeString(sal_Int32 nType)
static OUString getPresetLineDashValString(sal_Int32 nType)
static OUString getPresetMaterialTypeString(sal_Int32 nType)
static OUString getNumSpacingString(sal_Int32 nType)
std::unique_ptr< oox::GrabBagStack > mpGrabBagStack
static OUString getPresetCameraTypeString(sal_Int32 nType)
static OUString getPenAlignmentString(sal_Int32 nType)
static OUString getBevelPresetTypeString(sal_Int32 nType)
static OUString getLightRigDirectionString(sal_Int32 nType)
static OUString getOnOffString(sal_Int32 nType)
static OUString getCompoundLineString(sal_Int32 nType)
static OUString getPathShadeTypeString(sal_Int32 nType)
static OUString getNumFormString(sal_Int32 nType)
static OUString getRectAlignmentString(sal_Int32 nType)
static sal_uInt8 GetTextFillSolidFillAlpha(const css::beans::PropertyValue &rValue)
static OUString getLigaturesString(sal_Int32 nType)
virtual void lcl_attribute(Id aName, Value &aValue) override
static OUString getLightRigTypeString(sal_Int32 nType)
static OUString getLineCapString(sal_Int32 nType)
float u
OUString aName
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
const sal_Int32 PER_PERCENT
HashMap_OWString_Interface aMap
QPRO_FUNC_TYPE nType
sal_uInt32 Id
unsigned char sal_uInt8
std::unique_ptr< char[]> aBuffer