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