xref: /AOO41X/main/oox/source/drawingml/customshapegeometry.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/drawingml/customshapegeometry.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <com/sun/star/xml/sax/FastToken.hpp>
31*cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
32*cdf0e10cSrcweir #include <hash_map>
33*cdf0e10cSrcweir #include "oox/helper/helper.hxx"
34*cdf0e10cSrcweir #include "oox/helper/attributelist.hxx"
35*cdf0e10cSrcweir #include "oox/helper/propertymap.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir using ::rtl::OUString;
38*cdf0e10cSrcweir using namespace ::oox::core;
39*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
40*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
41*cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
42*cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace oox { namespace drawingml {
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir enum FormularCommand
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir     FC_MULDIV = 0,
49*cdf0e10cSrcweir     FC_PLUSMINUS,
50*cdf0e10cSrcweir     FC_PLUSDIV,
51*cdf0e10cSrcweir     FC_IFELSE,
52*cdf0e10cSrcweir     FC_ABS,
53*cdf0e10cSrcweir     FC_AT2,
54*cdf0e10cSrcweir 	FC_CAT2,
55*cdf0e10cSrcweir 	FC_COS,
56*cdf0e10cSrcweir 	FC_MAX,
57*cdf0e10cSrcweir 	FC_MIN,
58*cdf0e10cSrcweir 	FC_MOD,
59*cdf0e10cSrcweir 	FC_PIN,
60*cdf0e10cSrcweir 	FC_SAT2,
61*cdf0e10cSrcweir 	FC_SIN,
62*cdf0e10cSrcweir 	FC_SQRT,
63*cdf0e10cSrcweir 	FC_TAN,
64*cdf0e10cSrcweir 	FC_VAL,
65*cdf0e10cSrcweir 	FC_LAST
66*cdf0e10cSrcweir };
67*cdf0e10cSrcweir struct FormularCommandNameTable
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 	const char*		pS;
70*cdf0e10cSrcweir 	FormularCommand	pE;
71*cdf0e10cSrcweir };
72*cdf0e10cSrcweir static FormularCommandNameTable pFormularCommandNameTable[] =
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir 	{ "*/",		FC_MULDIV },
75*cdf0e10cSrcweir 	{ "+-",		FC_PLUSMINUS },
76*cdf0e10cSrcweir 	{ "+/",		FC_PLUSDIV },
77*cdf0e10cSrcweir 	{ "ifelse",	FC_IFELSE },
78*cdf0e10cSrcweir 	{ "abs",	FC_ABS },
79*cdf0e10cSrcweir 	{ "at2",	FC_AT2 },
80*cdf0e10cSrcweir 	{ "cat2",	FC_CAT2 },
81*cdf0e10cSrcweir 	{ "cos",	FC_COS },
82*cdf0e10cSrcweir 	{ "max",	FC_MAX },
83*cdf0e10cSrcweir 	{ "min",	FC_MIN },
84*cdf0e10cSrcweir 	{ "mod",	FC_MOD },
85*cdf0e10cSrcweir 	{ "pin",	FC_PIN },
86*cdf0e10cSrcweir 	{ "sat2",	FC_SAT2 },
87*cdf0e10cSrcweir 	{ "sin",	FC_SIN },
88*cdf0e10cSrcweir 	{ "sqrt",	FC_SQRT },
89*cdf0e10cSrcweir 	{ "tan",	FC_TAN },
90*cdf0e10cSrcweir 	{ "val",	FC_VAL }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir };
93*cdf0e10cSrcweir typedef std::hash_map< rtl::OUString, FormularCommand, comphelper::UStringHash, comphelper::UStringEqual > FormulaCommandHMap;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir static const FormulaCommandHMap* pCommandHashMap;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir //
98*cdf0e10cSrcweir rtl::OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParameter )
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir 	rtl::OUString aRet;
101*cdf0e10cSrcweir 	switch( rParameter.Type )
102*cdf0e10cSrcweir 	{
103*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::NORMAL :
104*cdf0e10cSrcweir 		{
105*cdf0e10cSrcweir 			if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
106*cdf0e10cSrcweir 			{
107*cdf0e10cSrcweir 				double fValue = 0.0;
108*cdf0e10cSrcweir 				if ( rParameter.Value >>= fValue )
109*cdf0e10cSrcweir 					aRet = rtl::OUString::valueOf( fValue );
110*cdf0e10cSrcweir 			}
111*cdf0e10cSrcweir 			else
112*cdf0e10cSrcweir 			{
113*cdf0e10cSrcweir 				sal_Int32 nValue = 0;
114*cdf0e10cSrcweir 				if ( rParameter.Value >>= nValue )
115*cdf0e10cSrcweir 					aRet = rtl::OUString::valueOf( nValue );
116*cdf0e10cSrcweir 			}
117*cdf0e10cSrcweir 		}
118*cdf0e10cSrcweir 		break;
119*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::EQUATION :
120*cdf0e10cSrcweir 		{
121*cdf0e10cSrcweir 			if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
122*cdf0e10cSrcweir 			{
123*cdf0e10cSrcweir 				sal_Int32 nFormulaIndex;
124*cdf0e10cSrcweir 				if ( rParameter.Value >>= nFormulaIndex )
125*cdf0e10cSrcweir 				{
126*cdf0e10cSrcweir 					aRet = CREATE_OUSTRING( "?" )
127*cdf0e10cSrcweir 						+ rtl::OUString::valueOf( nFormulaIndex )
128*cdf0e10cSrcweir 							+ CREATE_OUSTRING( " " );
129*cdf0e10cSrcweir 				}
130*cdf0e10cSrcweir 			}
131*cdf0e10cSrcweir 			else
132*cdf0e10cSrcweir 			{
133*cdf0e10cSrcweir 				// ups... we should have an index here and not the formula name
134*cdf0e10cSrcweir 			}
135*cdf0e10cSrcweir 		}
136*cdf0e10cSrcweir 		break;
137*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::ADJUSTMENT :
138*cdf0e10cSrcweir 		{
139*cdf0e10cSrcweir 			if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
140*cdf0e10cSrcweir 			{
141*cdf0e10cSrcweir 				sal_Int32 nAdjustmentIndex;
142*cdf0e10cSrcweir 				if ( rParameter.Value >>= nAdjustmentIndex )
143*cdf0e10cSrcweir 				{
144*cdf0e10cSrcweir 					aRet = CREATE_OUSTRING( "$" )
145*cdf0e10cSrcweir 						+ rtl::OUString::valueOf( nAdjustmentIndex )
146*cdf0e10cSrcweir 							+ CREATE_OUSTRING( " " );
147*cdf0e10cSrcweir 				}
148*cdf0e10cSrcweir 			}
149*cdf0e10cSrcweir 			else
150*cdf0e10cSrcweir 			{
151*cdf0e10cSrcweir 				// ups... we should have an index here and not the formula name
152*cdf0e10cSrcweir 			}
153*cdf0e10cSrcweir 		}
154*cdf0e10cSrcweir 		break;
155*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::LEFT :
156*cdf0e10cSrcweir 		{
157*cdf0e10cSrcweir 			const rtl::OUString sLeft( CREATE_OUSTRING( "left" ) );
158*cdf0e10cSrcweir 			aRet = sLeft;
159*cdf0e10cSrcweir 		}
160*cdf0e10cSrcweir 		break;
161*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::TOP :
162*cdf0e10cSrcweir 		{
163*cdf0e10cSrcweir 			const rtl::OUString sTop( CREATE_OUSTRING( "top" ) );
164*cdf0e10cSrcweir 			aRet = sTop;
165*cdf0e10cSrcweir 		}
166*cdf0e10cSrcweir 		break;
167*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::RIGHT :
168*cdf0e10cSrcweir 		{
169*cdf0e10cSrcweir 			const rtl::OUString sRight( CREATE_OUSTRING( "right" ) );
170*cdf0e10cSrcweir 			aRet = sRight;
171*cdf0e10cSrcweir 		}
172*cdf0e10cSrcweir 		break;
173*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::BOTTOM :
174*cdf0e10cSrcweir 		{
175*cdf0e10cSrcweir 			const rtl::OUString sBottom( CREATE_OUSTRING( "bottom" ) );
176*cdf0e10cSrcweir 			aRet = sBottom;
177*cdf0e10cSrcweir 		}
178*cdf0e10cSrcweir 		break;
179*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::XSTRETCH :
180*cdf0e10cSrcweir 		{
181*cdf0e10cSrcweir 			const rtl::OUString sXStretch( CREATE_OUSTRING( "xstretch" ) );
182*cdf0e10cSrcweir 			aRet = sXStretch;
183*cdf0e10cSrcweir 		}
184*cdf0e10cSrcweir 		break;
185*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::YSTRETCH :
186*cdf0e10cSrcweir 		{
187*cdf0e10cSrcweir 			const rtl::OUString sYStretch( CREATE_OUSTRING( "ystretch" ) );
188*cdf0e10cSrcweir 			aRet = sYStretch;
189*cdf0e10cSrcweir 		}
190*cdf0e10cSrcweir 		break;
191*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::HASSTROKE :
192*cdf0e10cSrcweir 		{
193*cdf0e10cSrcweir 			const rtl::OUString sHasStroke( CREATE_OUSTRING( "hasstroke" ) );
194*cdf0e10cSrcweir 			aRet = sHasStroke;
195*cdf0e10cSrcweir 		}
196*cdf0e10cSrcweir 		break;
197*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::HASFILL :
198*cdf0e10cSrcweir 		{
199*cdf0e10cSrcweir 			const rtl::OUString sHasFill( CREATE_OUSTRING( "hasfill" ) );
200*cdf0e10cSrcweir 			aRet = sHasFill;
201*cdf0e10cSrcweir 		}
202*cdf0e10cSrcweir 		break;
203*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::WIDTH :
204*cdf0e10cSrcweir 		{
205*cdf0e10cSrcweir 			const rtl::OUString sWidth( CREATE_OUSTRING( "width" ) );
206*cdf0e10cSrcweir 			aRet = sWidth;
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 		break;
209*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::HEIGHT :
210*cdf0e10cSrcweir 		{
211*cdf0e10cSrcweir 			const rtl::OUString sHeight( CREATE_OUSTRING( "height" ) );
212*cdf0e10cSrcweir 			aRet = sHeight;
213*cdf0e10cSrcweir 		}
214*cdf0e10cSrcweir 		break;
215*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::LOGWIDTH :
216*cdf0e10cSrcweir 		{
217*cdf0e10cSrcweir 			const rtl::OUString sLogWidth( CREATE_OUSTRING( "logwidth" ) );
218*cdf0e10cSrcweir 			aRet = sLogWidth;
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 		break;
221*cdf0e10cSrcweir 		case EnhancedCustomShapeParameterType::LOGHEIGHT :
222*cdf0e10cSrcweir 		{
223*cdf0e10cSrcweir 			const rtl::OUString sLogHeight( CREATE_OUSTRING( "logheight" ) );
224*cdf0e10cSrcweir 			aRet = sLogHeight;
225*cdf0e10cSrcweir 		}
226*cdf0e10cSrcweir 		break;
227*cdf0e10cSrcweir 	}
228*cdf0e10cSrcweir 	return aRet;
229*cdf0e10cSrcweir }
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir // ---------------------------------------------------------------------
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCustomShapeProperties, const::rtl::OUString& rValue, sal_Bool bNoSymbols )
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir 	com::sun::star::drawing::EnhancedCustomShapeParameter aRet;
236*cdf0e10cSrcweir 	if ( rValue.getLength() )
237*cdf0e10cSrcweir 	{
238*cdf0e10cSrcweir 		sal_Bool	bConstant = sal_True;
239*cdf0e10cSrcweir 		sal_Int32	nConstant = 0;
240*cdf0e10cSrcweir 		sal_Char	nVal = 0;
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 		// first check if its a constant value
243*cdf0e10cSrcweir 		switch( AttributeConversion::decodeToken( rValue ) )
244*cdf0e10cSrcweir 		{
245*cdf0e10cSrcweir 			case XML_3cd4 :	nConstant = 270 * 60000; break;
246*cdf0e10cSrcweir 			case XML_3cd8 :	nConstant = 135 * 60000; break;
247*cdf0e10cSrcweir 			case XML_5cd8 : nConstant = 225 * 60000; break;
248*cdf0e10cSrcweir 			case XML_7cd8 : nConstant = 315 * 60000; break;
249*cdf0e10cSrcweir 			case XML_cd2  : nConstant = 180 * 60000; break;
250*cdf0e10cSrcweir 			case XML_cd4  : nConstant =  90 * 60000; break;
251*cdf0e10cSrcweir 			case XML_cd8  : nConstant =  45 * 60000; break;
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 			case XML_b :	// variable height of the shape defined in spPr
254*cdf0e10cSrcweir 			case XML_h :
255*cdf0e10cSrcweir 			{
256*cdf0e10cSrcweir 				if ( bNoSymbols )
257*cdf0e10cSrcweir 				{
258*cdf0e10cSrcweir 					CustomShapeGuide aGuide;
259*cdf0e10cSrcweir 					aGuide.maName = rValue;
260*cdf0e10cSrcweir 					aGuide.maFormula = CREATE_OUSTRING( "height" );
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 					aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
263*cdf0e10cSrcweir 					aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
264*cdf0e10cSrcweir 				}
265*cdf0e10cSrcweir 				else
266*cdf0e10cSrcweir 					aRet.Type = EnhancedCustomShapeParameterType::HEIGHT;	// TODO: HEIGHT needs to be implemented
267*cdf0e10cSrcweir 			}
268*cdf0e10cSrcweir 			break;
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 			case XML_hd8 :	// !!PASSTHROUGH INTENDED
272*cdf0e10cSrcweir 				nVal += 2;	// */ h 1.0 8.0
273*cdf0e10cSrcweir 			case XML_hd6 :	// */ h 1.0 6.0
274*cdf0e10cSrcweir 				nVal++;
275*cdf0e10cSrcweir 			case XML_hd5 :	// */ h 1.0 5.0
276*cdf0e10cSrcweir 				nVal++;
277*cdf0e10cSrcweir 			case XML_hd4 :	// */ h 1.0 4.0
278*cdf0e10cSrcweir 				nVal += 2;
279*cdf0e10cSrcweir 			case XML_hd2 :	// */ h 1.0 2.0
280*cdf0e10cSrcweir 			case XML_vc :	// */ h 1.0 2.0
281*cdf0e10cSrcweir 			{
282*cdf0e10cSrcweir 				nVal += '2';
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 				CustomShapeGuide aGuide;
285*cdf0e10cSrcweir 				aGuide.maName = rValue;
286*cdf0e10cSrcweir 				aGuide.maFormula = CREATE_OUSTRING( "height/" ) + rtl::OUString( nVal );
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 				aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
289*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
290*cdf0e10cSrcweir 			}
291*cdf0e10cSrcweir 			break;
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 			case XML_t :
294*cdf0e10cSrcweir 			case XML_l :
295*cdf0e10cSrcweir 			{
296*cdf0e10cSrcweir 				nConstant = 0;
297*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
298*cdf0e10cSrcweir 			}
299*cdf0e10cSrcweir 			break;
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 			case XML_ls :	// longest side: max w h
302*cdf0e10cSrcweir 			{
303*cdf0e10cSrcweir 				CustomShapeGuide aGuide;
304*cdf0e10cSrcweir 				aGuide.maName = rValue;
305*cdf0e10cSrcweir 				aGuide.maFormula = CREATE_OUSTRING( "max(width,height)" );
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 				aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
308*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
309*cdf0e10cSrcweir 			}
310*cdf0e10cSrcweir 			break;
311*cdf0e10cSrcweir 			case XML_ss :	// shortest side: min w h
312*cdf0e10cSrcweir 			{
313*cdf0e10cSrcweir 				CustomShapeGuide aGuide;
314*cdf0e10cSrcweir 				aGuide.maName = rValue;
315*cdf0e10cSrcweir 				aGuide.maFormula = CREATE_OUSTRING( "min(width,height)" );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 				aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
318*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
319*cdf0e10cSrcweir 			}
320*cdf0e10cSrcweir 			break;
321*cdf0e10cSrcweir 			case XML_ssd8 : // */ ss 1.0 8.0
322*cdf0e10cSrcweir 				nVal += 2;
323*cdf0e10cSrcweir 			case XML_ssd6 : // */ ss 1.0 6.0
324*cdf0e10cSrcweir 				nVal += 2;
325*cdf0e10cSrcweir 			case XML_ssd4 :	// */ ss 1.0 4.0
326*cdf0e10cSrcweir 				nVal += 2;
327*cdf0e10cSrcweir 			case XML_ssd2 :	// */ ss 1.0 2.0
328*cdf0e10cSrcweir 			{
329*cdf0e10cSrcweir 				nVal += '2';
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 				CustomShapeGuide aGuide;
332*cdf0e10cSrcweir 				aGuide.maName = rValue;
333*cdf0e10cSrcweir 				aGuide.maFormula = CREATE_OUSTRING( "min(width,height)/" ) + rtl::OUString( nVal );
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 				aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
336*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
337*cdf0e10cSrcweir 			}
338*cdf0e10cSrcweir 			break;
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 			case XML_r :	// variable width of the shape defined in spPr
341*cdf0e10cSrcweir 			case XML_w :
342*cdf0e10cSrcweir 			{
343*cdf0e10cSrcweir 				if ( bNoSymbols )
344*cdf0e10cSrcweir 				{
345*cdf0e10cSrcweir 					CustomShapeGuide aGuide;
346*cdf0e10cSrcweir 					aGuide.maName = rValue;
347*cdf0e10cSrcweir 					aGuide.maFormula = CREATE_OUSTRING( "width" );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 					aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
350*cdf0e10cSrcweir 					aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
351*cdf0e10cSrcweir 				}
352*cdf0e10cSrcweir 				else
353*cdf0e10cSrcweir 					aRet.Type = EnhancedCustomShapeParameterType::WIDTH;
354*cdf0e10cSrcweir 			}
355*cdf0e10cSrcweir 			break;
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 			case XML_wd10 :	// */ w 1.0 10.0
358*cdf0e10cSrcweir 				nVal += 2;
359*cdf0e10cSrcweir 			case XML_wd8 :	// */ w 1.0 8.0
360*cdf0e10cSrcweir 				nVal += 2;
361*cdf0e10cSrcweir 			case XML_wd6 :	// */ w 1.0 6.0
362*cdf0e10cSrcweir 				nVal++;
363*cdf0e10cSrcweir 			case XML_wd5 :	// */ w 1.0 5.0
364*cdf0e10cSrcweir 				nVal++;
365*cdf0e10cSrcweir 			case XML_wd4 :	// */ w 1.0 4.0
366*cdf0e10cSrcweir 				nVal += 2;
367*cdf0e10cSrcweir 			case XML_hc :	// */ w 1.0 2.0
368*cdf0e10cSrcweir 			case XML_wd2 :	// */ w 1.0 2.0
369*cdf0e10cSrcweir 			{
370*cdf0e10cSrcweir 				nVal += '2';
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 				CustomShapeGuide aGuide;
373*cdf0e10cSrcweir 				aGuide.maName = rValue;
374*cdf0e10cSrcweir 				aGuide.maFormula = CREATE_OUSTRING( "width/" ) + rtl::OUString( nVal );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 				aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
377*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
378*cdf0e10cSrcweir 			}
379*cdf0e10cSrcweir 			break;
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 			default:
382*cdf0e10cSrcweir 				bConstant = sal_False;
383*cdf0e10cSrcweir 			break;
384*cdf0e10cSrcweir 		}
385*cdf0e10cSrcweir 		if ( bConstant )
386*cdf0e10cSrcweir 		{
387*cdf0e10cSrcweir 			if ( nConstant )
388*cdf0e10cSrcweir 			{
389*cdf0e10cSrcweir 				aRet.Value = Any( nConstant );
390*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
391*cdf0e10cSrcweir 			}
392*cdf0e10cSrcweir 		}
393*cdf0e10cSrcweir 		else
394*cdf0e10cSrcweir 		{
395*cdf0e10cSrcweir 			sal_Unicode n = rValue[ 0 ];
396*cdf0e10cSrcweir 			if ( ( n == '+' ) || ( n == '-' ) )
397*cdf0e10cSrcweir 			{
398*cdf0e10cSrcweir 				if ( rValue.getLength() > 0 )
399*cdf0e10cSrcweir 					n = rValue[ 1 ];
400*cdf0e10cSrcweir 			}
401*cdf0e10cSrcweir 			if ( ( n >= '0' ) && ( n <= '9' ) )
402*cdf0e10cSrcweir 			{	// seems to be a ST_Coordinate
403*cdf0e10cSrcweir 				aRet.Value = Any( rValue.toInt32() );
404*cdf0e10cSrcweir 				aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
405*cdf0e10cSrcweir 			}
406*cdf0e10cSrcweir 			else
407*cdf0e10cSrcweir 			{
408*cdf0e10cSrcweir 				sal_Int32 nGuideIndex = CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties.getAdjustmentGuideList(), rValue );
409*cdf0e10cSrcweir 				if ( nGuideIndex >= 0 )
410*cdf0e10cSrcweir 				{
411*cdf0e10cSrcweir 					aRet.Value = Any( nGuideIndex );
412*cdf0e10cSrcweir 					aRet.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
413*cdf0e10cSrcweir 				}
414*cdf0e10cSrcweir 				else
415*cdf0e10cSrcweir 				{
416*cdf0e10cSrcweir 					nGuideIndex = CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), rValue );
417*cdf0e10cSrcweir 					if ( nGuideIndex >= 0 )
418*cdf0e10cSrcweir 					{
419*cdf0e10cSrcweir 						aRet.Value = Any( nGuideIndex );
420*cdf0e10cSrcweir 						aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
421*cdf0e10cSrcweir 					}
422*cdf0e10cSrcweir 					else
423*cdf0e10cSrcweir 						aRet.Value = Any( rValue );
424*cdf0e10cSrcweir 				}
425*cdf0e10cSrcweir 			}
426*cdf0e10cSrcweir 		}
427*cdf0e10cSrcweir 	}
428*cdf0e10cSrcweir 	return aRet;
429*cdf0e10cSrcweir }
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir static EnhancedCustomShapeParameter GetAdjAngle( CustomShapeProperties& rCustomShapeProperties, const ::rtl::OUString& rValue )
432*cdf0e10cSrcweir {
433*cdf0e10cSrcweir 	EnhancedCustomShapeParameter aAngle( GetAdjCoordinate( rCustomShapeProperties, rValue, sal_True ) );
434*cdf0e10cSrcweir 	if ( aAngle.Type == EnhancedCustomShapeParameterType::NORMAL )
435*cdf0e10cSrcweir 	{
436*cdf0e10cSrcweir 		sal_Int32 nValue = 0;
437*cdf0e10cSrcweir 		aAngle.Value >>= nValue;
438*cdf0e10cSrcweir 		double fValue = ( static_cast< double >( nValue ) / 60000.0 ) * 360.0;
439*cdf0e10cSrcweir 		aAngle.Value <<= fValue;
440*cdf0e10cSrcweir 	}
441*cdf0e10cSrcweir 	return aAngle;
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir // ---------------------------------------------------------------------
445*cdf0e10cSrcweir // CT_GeomGuideList
446*cdf0e10cSrcweir class GeomGuideListContext : public ContextHandler
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir public:
449*cdf0e10cSrcweir 	GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList );
450*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir protected:
453*cdf0e10cSrcweir     std::vector< CustomShapeGuide >&	mrGuideList;
454*cdf0e10cSrcweir 	CustomShapeProperties&				mrCustomShapeProperties;
455*cdf0e10cSrcweir };
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir GeomGuideListContext::GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList )
458*cdf0e10cSrcweir : ContextHandler( rParent )
459*cdf0e10cSrcweir , mrGuideList( rGuideList )
460*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
461*cdf0e10cSrcweir {
462*cdf0e10cSrcweir }
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir static rtl::OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperties, const rtl::OUString& rSource )
465*cdf0e10cSrcweir {
466*cdf0e10cSrcweir 	if ( !pCommandHashMap )
467*cdf0e10cSrcweir 	{
468*cdf0e10cSrcweir 		FormulaCommandHMap* pHM = new FormulaCommandHMap();
469*cdf0e10cSrcweir 		for( sal_Int32 i = 0; i < FC_LAST; i++ )
470*cdf0e10cSrcweir 			(*pHM)[ OUString::createFromAscii( pFormularCommandNameTable[ i ].pS ) ] =  pFormularCommandNameTable[ i ].pE;
471*cdf0e10cSrcweir 		pCommandHashMap = pHM;
472*cdf0e10cSrcweir 	}
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir 	std::vector< rtl::OUString > aTokens;
475*cdf0e10cSrcweir 	sal_Int32 nIndex = 0;
476*cdf0e10cSrcweir 	do
477*cdf0e10cSrcweir 	{
478*cdf0e10cSrcweir 		rtl::OUString aToken( rSource.getToken( 0, ' ', nIndex ) );
479*cdf0e10cSrcweir 		if ( aToken.getLength() )
480*cdf0e10cSrcweir 			aTokens.push_back( aToken );
481*cdf0e10cSrcweir 	}
482*cdf0e10cSrcweir 	while ( nIndex >= 0 );
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 	rtl::OUString aEquation;
485*cdf0e10cSrcweir 	if ( aTokens.size() )
486*cdf0e10cSrcweir 	{
487*cdf0e10cSrcweir 		sal_Int32 i, nParameters = aTokens.size() - 1;
488*cdf0e10cSrcweir 		if ( nParameters > 3 )
489*cdf0e10cSrcweir 			nParameters = 3;
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir 		rtl::OUString sParameters[ 3 ];
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 		for ( i = 0; i < nParameters; i++ )
494*cdf0e10cSrcweir 			sParameters[ i ] = GetFormulaParameter( GetAdjCoordinate( rCustomShapeProperties, aTokens[ i + 1 ], sal_False ) );
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 		const FormulaCommandHMap::const_iterator aIter( pCommandHashMap->find( aTokens[ 0 ] ) );
497*cdf0e10cSrcweir 		if ( aIter != pCommandHashMap->end() )
498*cdf0e10cSrcweir 		{
499*cdf0e10cSrcweir 			switch( aIter->second )
500*cdf0e10cSrcweir 			{
501*cdf0e10cSrcweir 				case FC_MULDIV :
502*cdf0e10cSrcweir 				{
503*cdf0e10cSrcweir 					if ( nParameters == 3 )
504*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*" ) + sParameters[ 1 ]
505*cdf0e10cSrcweir 							+ CREATE_OUSTRING( "/" ) + sParameters[ 2 ];
506*cdf0e10cSrcweir 				}
507*cdf0e10cSrcweir 				break;
508*cdf0e10cSrcweir 				case FC_PLUSMINUS :
509*cdf0e10cSrcweir 				{
510*cdf0e10cSrcweir 					if ( nParameters == 3 )
511*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "+" ) + sParameters[ 1 ]
512*cdf0e10cSrcweir 							+ CREATE_OUSTRING( "-" ) + sParameters[ 2 ];
513*cdf0e10cSrcweir 				}
514*cdf0e10cSrcweir 				break;
515*cdf0e10cSrcweir 				case FC_PLUSDIV :
516*cdf0e10cSrcweir 				{
517*cdf0e10cSrcweir 					if ( nParameters == 3 )
518*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "+" )
519*cdf0e10cSrcweir 							+ sParameters[ 1 ] + CREATE_OUSTRING( ")/" ) + sParameters[ 2 ];
520*cdf0e10cSrcweir 				}
521*cdf0e10cSrcweir 				break;
522*cdf0e10cSrcweir 				case FC_IFELSE :
523*cdf0e10cSrcweir 				{
524*cdf0e10cSrcweir 					if ( nParameters == 3 )
525*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "if(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," )
526*cdf0e10cSrcweir 							+ sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( ")" );
527*cdf0e10cSrcweir 				}
528*cdf0e10cSrcweir 				break;
529*cdf0e10cSrcweir 				case FC_ABS :
530*cdf0e10cSrcweir 				{
531*cdf0e10cSrcweir 					if ( nParameters == 1 )
532*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "abs(" ) + sParameters[ 0 ] + CREATE_OUSTRING( ")" );
533*cdf0e10cSrcweir 				}
534*cdf0e10cSrcweir 				break;
535*cdf0e10cSrcweir 				case FC_AT2 :
536*cdf0e10cSrcweir 				{
537*cdf0e10cSrcweir 					if ( nParameters == 2 )
538*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "atan2(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," )
539*cdf0e10cSrcweir 						+ sParameters[ 1 ] + CREATE_OUSTRING( ")" );
540*cdf0e10cSrcweir 				}
541*cdf0e10cSrcweir 				break;
542*cdf0e10cSrcweir 				case FC_CAT2 :
543*cdf0e10cSrcweir 				{
544*cdf0e10cSrcweir 					if ( nParameters == 3 )
545*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*(cos(arctan(" ) +
546*cdf0e10cSrcweir 							sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( ")))" );
547*cdf0e10cSrcweir 				}
548*cdf0e10cSrcweir 				break;
549*cdf0e10cSrcweir 				case FC_COS :
550*cdf0e10cSrcweir 				{
551*cdf0e10cSrcweir 					if ( nParameters == 2 )
552*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*cos(" ) +
553*cdf0e10cSrcweir 						sParameters[ 1 ] + CREATE_OUSTRING( ")" );
554*cdf0e10cSrcweir 				}
555*cdf0e10cSrcweir 				break;
556*cdf0e10cSrcweir 				case FC_MAX :
557*cdf0e10cSrcweir 				{
558*cdf0e10cSrcweir 					if ( nParameters == 2 )
559*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "max(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," ) +
560*cdf0e10cSrcweir 							sParameters[ 1 ] + CREATE_OUSTRING( ")" );
561*cdf0e10cSrcweir 				}
562*cdf0e10cSrcweir 				break;
563*cdf0e10cSrcweir 				case FC_MIN :
564*cdf0e10cSrcweir 				{
565*cdf0e10cSrcweir 					if ( nParameters == 2 )
566*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "min(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," ) +
567*cdf0e10cSrcweir 							sParameters[ 1 ] + CREATE_OUSTRING( ")" );
568*cdf0e10cSrcweir 				}
569*cdf0e10cSrcweir 				break;
570*cdf0e10cSrcweir 				case FC_MOD :
571*cdf0e10cSrcweir 				{
572*cdf0e10cSrcweir 					if ( nParameters == 3 )
573*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "sqrt(" )
574*cdf0e10cSrcweir 							+ sParameters[ 0 ] + CREATE_OUSTRING( "*" ) + sParameters[ 0 ] + CREATE_OUSTRING( "+" )
575*cdf0e10cSrcweir 							+ sParameters[ 1 ] + CREATE_OUSTRING( "*" ) + sParameters[ 1 ] + CREATE_OUSTRING( "+" )
576*cdf0e10cSrcweir 							+ sParameters[ 2 ] + CREATE_OUSTRING( "*" ) + sParameters[ 2 ] + CREATE_OUSTRING( ")" );
577*cdf0e10cSrcweir 				}
578*cdf0e10cSrcweir 				break;
579*cdf0e10cSrcweir 				case FC_PIN :
580*cdf0e10cSrcweir 				{
581*cdf0e10cSrcweir 					if ( nParameters == 3 )	// if(x-y,x,if(y-z,z,y))
582*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "if(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "-" ) + sParameters[ 1 ]
583*cdf0e10cSrcweir 							+ CREATE_OUSTRING( "," ) + sParameters[ 0 ] + CREATE_OUSTRING( ",if(" ) + sParameters[ 2 ]
584*cdf0e10cSrcweir 							+ CREATE_OUSTRING( "-" ) + sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 1 ]
585*cdf0e10cSrcweir 							+ CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( "))" );
586*cdf0e10cSrcweir 				}
587*cdf0e10cSrcweir 				break;
588*cdf0e10cSrcweir 				case FC_SAT2 :
589*cdf0e10cSrcweir 				{
590*cdf0e10cSrcweir 					if ( nParameters == 3 )
591*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*(sin(arctan(" ) +
592*cdf0e10cSrcweir 							sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( ")))" );
593*cdf0e10cSrcweir 				}
594*cdf0e10cSrcweir 				break;
595*cdf0e10cSrcweir 				case FC_SIN :
596*cdf0e10cSrcweir 				{
597*cdf0e10cSrcweir 					if ( nParameters == 2 )
598*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*sin(" ) +
599*cdf0e10cSrcweir 						sParameters[ 1 ] + CREATE_OUSTRING( ")" );
600*cdf0e10cSrcweir 				}
601*cdf0e10cSrcweir 				break;
602*cdf0e10cSrcweir 				case FC_SQRT :
603*cdf0e10cSrcweir 				{
604*cdf0e10cSrcweir 					if ( nParameters == 1 )
605*cdf0e10cSrcweir 						aEquation = CREATE_OUSTRING( "sqrt(" ) + sParameters[ 0 ] + CREATE_OUSTRING( ")" );
606*cdf0e10cSrcweir 				}
607*cdf0e10cSrcweir 				break;
608*cdf0e10cSrcweir 				case FC_TAN :
609*cdf0e10cSrcweir 				{
610*cdf0e10cSrcweir 					if ( nParameters == 2 )
611*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*tan(" ) +
612*cdf0e10cSrcweir 						sParameters[ 1 ] + CREATE_OUSTRING( ")" );
613*cdf0e10cSrcweir 				}
614*cdf0e10cSrcweir 				break;
615*cdf0e10cSrcweir 				case FC_VAL :
616*cdf0e10cSrcweir 				{
617*cdf0e10cSrcweir 					if ( nParameters == 1 )
618*cdf0e10cSrcweir 						aEquation = sParameters[ 0 ];
619*cdf0e10cSrcweir 				}
620*cdf0e10cSrcweir 				break;
621*cdf0e10cSrcweir 				default :
622*cdf0e10cSrcweir 					break;
623*cdf0e10cSrcweir 			}
624*cdf0e10cSrcweir 		}
625*cdf0e10cSrcweir 	}
626*cdf0e10cSrcweir 	return aEquation;
627*cdf0e10cSrcweir }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir Reference< XFastContextHandler > GeomGuideListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( gd ) )	// CT_GeomGuide
632*cdf0e10cSrcweir 	{
633*cdf0e10cSrcweir 		CustomShapeGuide aGuide;
634*cdf0e10cSrcweir 		aGuide.maName = xAttribs->getOptionalValue( XML_name );
635*cdf0e10cSrcweir 		aGuide.maFormula = convertToOOEquation( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_fmla ) );
636*cdf0e10cSrcweir 		mrGuideList.push_back( aGuide );
637*cdf0e10cSrcweir 	}
638*cdf0e10cSrcweir 	return this;
639*cdf0e10cSrcweir }
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir // ---------------------------------------------------------------------
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir static const rtl::OUString GetGeomGuideName( const ::rtl::OUString& rValue )
644*cdf0e10cSrcweir {
645*cdf0e10cSrcweir 	return rValue;
646*cdf0e10cSrcweir }
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir // ---------------------------------------------------------------------
649*cdf0e10cSrcweir // CT_AdjPoint2D
650*cdf0e10cSrcweir class AdjPoint2DContext : public ContextHandler
651*cdf0e10cSrcweir {
652*cdf0e10cSrcweir public:
653*cdf0e10cSrcweir     AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
654*cdf0e10cSrcweir };
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir AdjPoint2DContext::AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
657*cdf0e10cSrcweir : ContextHandler( rParent )
658*cdf0e10cSrcweir {
659*cdf0e10cSrcweir 	rAdjPoint2D.First = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_x ), sal_True );
660*cdf0e10cSrcweir 	rAdjPoint2D.Second = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_y ), sal_True );
661*cdf0e10cSrcweir }
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir // ---------------------------------------------------------------------
664*cdf0e10cSrcweir // CT_XYAdjustHandle
665*cdf0e10cSrcweir class XYAdjustHandleContext : public ContextHandler
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir public:
668*cdf0e10cSrcweir     XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
669*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
670*cdf0e10cSrcweir 
671*cdf0e10cSrcweir protected:
672*cdf0e10cSrcweir     AdjustHandle& mrAdjustHandle;
673*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
674*cdf0e10cSrcweir };
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
677*cdf0e10cSrcweir : ContextHandler( rParent )
678*cdf0e10cSrcweir , mrAdjustHandle( rAdjustHandle )
679*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
680*cdf0e10cSrcweir {
681*cdf0e10cSrcweir 	const rtl::OUString aEmptyDefault;
682*cdf0e10cSrcweir 	AttributeList aAttribs( xAttribs );
683*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_gdRefX ) )
684*cdf0e10cSrcweir 	{
685*cdf0e10cSrcweir 		mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefX, aEmptyDefault ) );
686*cdf0e10cSrcweir 	}
687*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_minX ) )
688*cdf0e10cSrcweir 	{
689*cdf0e10cSrcweir 		mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minX, aEmptyDefault ), sal_True );
690*cdf0e10cSrcweir 	}
691*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_maxX ) )
692*cdf0e10cSrcweir 	{
693*cdf0e10cSrcweir 		mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxX, aEmptyDefault ), sal_True );
694*cdf0e10cSrcweir 	}
695*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_gdRefY ) )
696*cdf0e10cSrcweir 	{
697*cdf0e10cSrcweir 		mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefY, aEmptyDefault ) );
698*cdf0e10cSrcweir 	}
699*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_minY ) )
700*cdf0e10cSrcweir 	{
701*cdf0e10cSrcweir 		mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minY, aEmptyDefault ), sal_True );
702*cdf0e10cSrcweir 	}
703*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_maxY ) )
704*cdf0e10cSrcweir 	{
705*cdf0e10cSrcweir 		mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxY, aEmptyDefault ), sal_True );
706*cdf0e10cSrcweir 	}
707*cdf0e10cSrcweir }
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir Reference< XFastContextHandler > XYAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
710*cdf0e10cSrcweir {
711*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
712*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pos ) )
713*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos );	// CT_AdjPoint2D
714*cdf0e10cSrcweir 	return xContext;
715*cdf0e10cSrcweir }
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir // ---------------------------------------------------------------------
718*cdf0e10cSrcweir // CT_PolarAdjustHandle
719*cdf0e10cSrcweir class PolarAdjustHandleContext : public ContextHandler
720*cdf0e10cSrcweir {
721*cdf0e10cSrcweir public:
722*cdf0e10cSrcweir     PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
723*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir protected:
726*cdf0e10cSrcweir     AdjustHandle& mrAdjustHandle;
727*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
728*cdf0e10cSrcweir };
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
731*cdf0e10cSrcweir : ContextHandler( rParent )
732*cdf0e10cSrcweir , mrAdjustHandle( rAdjustHandle )
733*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
734*cdf0e10cSrcweir {
735*cdf0e10cSrcweir 	const rtl::OUString aEmptyDefault;
736*cdf0e10cSrcweir 	AttributeList aAttribs( xAttribs );
737*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_gdRefR ) )
738*cdf0e10cSrcweir 	{
739*cdf0e10cSrcweir 		mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefR, aEmptyDefault ) );
740*cdf0e10cSrcweir 	}
741*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_minR ) )
742*cdf0e10cSrcweir 	{
743*cdf0e10cSrcweir 		mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minR, aEmptyDefault ), sal_True );
744*cdf0e10cSrcweir 	}
745*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_maxR ) )
746*cdf0e10cSrcweir 	{
747*cdf0e10cSrcweir 		mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxR, aEmptyDefault ), sal_True );
748*cdf0e10cSrcweir 	}
749*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_gdRefAng ) )
750*cdf0e10cSrcweir 	{
751*cdf0e10cSrcweir 		mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefAng, aEmptyDefault ) );
752*cdf0e10cSrcweir 	}
753*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_minAng ) )
754*cdf0e10cSrcweir 	{
755*cdf0e10cSrcweir 		mrAdjustHandle.min2 = GetAdjAngle( mrCustomShapeProperties, aAttribs.getString( XML_minAng, aEmptyDefault ) );
756*cdf0e10cSrcweir 	}
757*cdf0e10cSrcweir 	if ( aAttribs.hasAttribute( XML_maxAng ) )
758*cdf0e10cSrcweir 	{
759*cdf0e10cSrcweir 		mrAdjustHandle.max2 = GetAdjAngle( mrCustomShapeProperties, aAttribs.getString( XML_maxAng, aEmptyDefault ) );
760*cdf0e10cSrcweir 	}
761*cdf0e10cSrcweir }
762*cdf0e10cSrcweir 
763*cdf0e10cSrcweir Reference< XFastContextHandler > PolarAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
764*cdf0e10cSrcweir {
765*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
766*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pos ) )
767*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos );	// CT_AdjPoint2D
768*cdf0e10cSrcweir 	return xContext;
769*cdf0e10cSrcweir }
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir // ---------------------------------------------------------------------
772*cdf0e10cSrcweir // CT_AdjustHandleList
773*cdf0e10cSrcweir class AdjustHandleListContext : public ContextHandler
774*cdf0e10cSrcweir {
775*cdf0e10cSrcweir public:
776*cdf0e10cSrcweir     AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList );
777*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir protected:
780*cdf0e10cSrcweir     std::vector< AdjustHandle >& mrAdjustHandleList;
781*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
782*cdf0e10cSrcweir };
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir AdjustHandleListContext::AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList )
785*cdf0e10cSrcweir : ContextHandler( rParent )
786*cdf0e10cSrcweir , mrAdjustHandleList( rAdjustHandleList )
787*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
788*cdf0e10cSrcweir {
789*cdf0e10cSrcweir }
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir Reference< XFastContextHandler > AdjustHandleListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
794*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( ahXY ) )			// CT_XYAdjustHandle
795*cdf0e10cSrcweir 	{
796*cdf0e10cSrcweir 		AdjustHandle aAdjustHandle( sal_False );
797*cdf0e10cSrcweir 		mrAdjustHandleList.push_back( aAdjustHandle );
798*cdf0e10cSrcweir         xContext = new XYAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() );
799*cdf0e10cSrcweir 	}
800*cdf0e10cSrcweir 	else if ( aElementToken == A_TOKEN( ahPolar ) )	// CT_PolarAdjustHandle
801*cdf0e10cSrcweir 	{
802*cdf0e10cSrcweir 		AdjustHandle aAdjustHandle( sal_True );
803*cdf0e10cSrcweir 		mrAdjustHandleList.push_back( aAdjustHandle );
804*cdf0e10cSrcweir 		xContext = new PolarAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() );
805*cdf0e10cSrcweir 	}
806*cdf0e10cSrcweir 	return xContext;
807*cdf0e10cSrcweir }
808*cdf0e10cSrcweir 
809*cdf0e10cSrcweir // ---------------------------------------------------------------------
810*cdf0e10cSrcweir // CT_ConnectionSite
811*cdf0e10cSrcweir class ConnectionSiteContext : public ContextHandler
812*cdf0e10cSrcweir {
813*cdf0e10cSrcweir public:
814*cdf0e10cSrcweir     ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite );
815*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir protected:
818*cdf0e10cSrcweir     ConnectionSite& mrConnectionSite;
819*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
820*cdf0e10cSrcweir };
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir ConnectionSiteContext::ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite )
823*cdf0e10cSrcweir : ContextHandler( rParent )
824*cdf0e10cSrcweir , mrConnectionSite( rConnectionSite )
825*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
826*cdf0e10cSrcweir {
827*cdf0e10cSrcweir 	mrConnectionSite.ang = GetAdjAngle( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_ang ) );
828*cdf0e10cSrcweir }
829*cdf0e10cSrcweir 
830*cdf0e10cSrcweir Reference< XFastContextHandler > ConnectionSiteContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
831*cdf0e10cSrcweir {
832*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
833*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pos ) )
834*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrConnectionSite.pos );	// CT_AdjPoint2D
835*cdf0e10cSrcweir 	return xContext;
836*cdf0e10cSrcweir }
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir // ---------------------------------------------------------------------
839*cdf0e10cSrcweir // CT_Path2DMoveTo
840*cdf0e10cSrcweir class Path2DMoveToContext : public ContextHandler
841*cdf0e10cSrcweir {
842*cdf0e10cSrcweir public:
843*cdf0e10cSrcweir     Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
844*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir protected:
847*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrAdjPoint2D;
848*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
849*cdf0e10cSrcweir };
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir Path2DMoveToContext::Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
852*cdf0e10cSrcweir : ContextHandler( rParent )
853*cdf0e10cSrcweir , mrAdjPoint2D( rAdjPoint2D )
854*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
855*cdf0e10cSrcweir {
856*cdf0e10cSrcweir }
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir Reference< XFastContextHandler > Path2DMoveToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
859*cdf0e10cSrcweir {
860*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
861*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pt ) )
862*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D );		// CT_AdjPoint2D
863*cdf0e10cSrcweir 	return xContext;
864*cdf0e10cSrcweir }
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir // ---------------------------------------------------------------------
867*cdf0e10cSrcweir // CT_Path2DLineTo
868*cdf0e10cSrcweir class Path2DLineToContext : public ContextHandler
869*cdf0e10cSrcweir {
870*cdf0e10cSrcweir public:
871*cdf0e10cSrcweir     Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
872*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir protected:
875*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrAdjPoint2D;
876*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
877*cdf0e10cSrcweir };
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir Path2DLineToContext::Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
880*cdf0e10cSrcweir : ContextHandler( rParent )
881*cdf0e10cSrcweir , mrAdjPoint2D( rAdjPoint2D )
882*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
883*cdf0e10cSrcweir {
884*cdf0e10cSrcweir }
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir Reference< XFastContextHandler > Path2DLineToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
887*cdf0e10cSrcweir {
888*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
889*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pt ) )
890*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D );		// CT_AdjPoint2D
891*cdf0e10cSrcweir 	return xContext;
892*cdf0e10cSrcweir }
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir // ---------------------------------------------------------------------
895*cdf0e10cSrcweir // CT_Path2DQuadBezierTo
896*cdf0e10cSrcweir class Path2DQuadBezierToContext : public ContextHandler
897*cdf0e10cSrcweir {
898*cdf0e10cSrcweir public:
899*cdf0e10cSrcweir     Path2DQuadBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 );
900*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir protected:
903*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrPt1;
904*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrPt2;
905*cdf0e10cSrcweir 	int nCount;
906*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
907*cdf0e10cSrcweir };
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler& rParent,
910*cdf0e10cSrcweir 	CustomShapeProperties& rCustomShapeProperties,
911*cdf0e10cSrcweir 		EnhancedCustomShapeParameterPair& rPt1,
912*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair& rPt2 )
913*cdf0e10cSrcweir : ContextHandler( rParent )
914*cdf0e10cSrcweir , mrPt1( rPt1 )
915*cdf0e10cSrcweir , mrPt2( rPt2 )
916*cdf0e10cSrcweir , nCount( 0 )
917*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
918*cdf0e10cSrcweir {
919*cdf0e10cSrcweir }
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir Reference< XFastContextHandler > Path2DQuadBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
922*cdf0e10cSrcweir {
923*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
924*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pt ) )
925*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, nCount++ ? mrPt2 : mrPt1 );	// CT_AdjPoint2D
926*cdf0e10cSrcweir 	return xContext;
927*cdf0e10cSrcweir }
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir // ---------------------------------------------------------------------
930*cdf0e10cSrcweir // CT_Path2DCubicBezierTo
931*cdf0e10cSrcweir class Path2DCubicBezierToContext : public ContextHandler
932*cdf0e10cSrcweir {
933*cdf0e10cSrcweir public:
934*cdf0e10cSrcweir     Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties,
935*cdf0e10cSrcweir 		EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair& );
936*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir protected:
939*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
940*cdf0e10cSrcweir 	EnhancedCustomShapeParameterPair& mrControlPt1;
941*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrControlPt2;
942*cdf0e10cSrcweir     EnhancedCustomShapeParameterPair& mrEndPt;
943*cdf0e10cSrcweir 	int nCount;
944*cdf0e10cSrcweir };
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties,
947*cdf0e10cSrcweir 	EnhancedCustomShapeParameterPair& rControlPt1,
948*cdf0e10cSrcweir 		EnhancedCustomShapeParameterPair& rControlPt2,
949*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair& rEndPt )
950*cdf0e10cSrcweir : ContextHandler( rParent )
951*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
952*cdf0e10cSrcweir , mrControlPt1( rControlPt1 )
953*cdf0e10cSrcweir , mrControlPt2( rControlPt2 )
954*cdf0e10cSrcweir , mrEndPt( rEndPt )
955*cdf0e10cSrcweir , nCount( 0 )
956*cdf0e10cSrcweir {
957*cdf0e10cSrcweir }
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir Reference< XFastContextHandler > Path2DCubicBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
960*cdf0e10cSrcweir {
961*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
962*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( pt ) )
963*cdf0e10cSrcweir 		xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties,
964*cdf0e10cSrcweir 			nCount++ ? nCount == 2 ? mrControlPt2 : mrEndPt : mrControlPt1 );	// CT_AdjPoint2D
965*cdf0e10cSrcweir 	return xContext;
966*cdf0e10cSrcweir }
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir // ---------------------------------------------------------------------
969*cdf0e10cSrcweir // CT_Path2DContext
970*cdf0e10cSrcweir class Path2DContext : public ContextHandler
971*cdf0e10cSrcweir {
972*cdf0e10cSrcweir public:
973*cdf0e10cSrcweir     Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D );
974*cdf0e10cSrcweir 	virtual ~Path2DContext();
975*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
976*cdf0e10cSrcweir 		createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs )
977*cdf0e10cSrcweir 			throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir protected:
980*cdf0e10cSrcweir 	Path2D& mrPath2D;
981*cdf0e10cSrcweir 	std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& mrSegments;
982*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
983*cdf0e10cSrcweir };
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir Path2DContext::Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D )
986*cdf0e10cSrcweir : ContextHandler( rParent )
987*cdf0e10cSrcweir , mrPath2D( rPath2D )
988*cdf0e10cSrcweir , mrSegments( rSegments )
989*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
990*cdf0e10cSrcweir {
991*cdf0e10cSrcweir 	const rtl::OUString aEmptyString;
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir 	AttributeList aAttribs( xAttribs );
994*cdf0e10cSrcweir 	rPath2D.w = aAttribs.getString( XML_w, aEmptyString ).toInt64();
995*cdf0e10cSrcweir 	rPath2D.h = aAttribs.getString( XML_h, aEmptyString ).toInt64();
996*cdf0e10cSrcweir 	rPath2D.fill = aAttribs.getToken( XML_fill, XML_norm );
997*cdf0e10cSrcweir 	rPath2D.stroke = aAttribs.getBool( XML_stroke, sal_True );
998*cdf0e10cSrcweir 	rPath2D.extrusionOk = aAttribs.getBool( XML_extrusionOk, sal_True );
999*cdf0e10cSrcweir }
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir Path2DContext::~Path2DContext()
1002*cdf0e10cSrcweir {
1003*cdf0e10cSrcweir 	EnhancedCustomShapeSegment aNewSegment;
1004*cdf0e10cSrcweir 	if ( mrPath2D.fill == XML_none )
1005*cdf0e10cSrcweir 	{
1006*cdf0e10cSrcweir 		aNewSegment.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
1007*cdf0e10cSrcweir 		aNewSegment.Count = 0;
1008*cdf0e10cSrcweir 		mrSegments.push_back( aNewSegment );
1009*cdf0e10cSrcweir 	}
1010*cdf0e10cSrcweir 	aNewSegment.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
1011*cdf0e10cSrcweir 	aNewSegment.Count = 0;
1012*cdf0e10cSrcweir 	mrSegments.push_back( aNewSegment );
1013*cdf0e10cSrcweir }
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int32 aElementToken,
1016*cdf0e10cSrcweir 	const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
1017*cdf0e10cSrcweir {
1018*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
1019*cdf0e10cSrcweir 	switch( aElementToken )
1020*cdf0e10cSrcweir 	{
1021*cdf0e10cSrcweir 		case A_TOKEN( close ) :
1022*cdf0e10cSrcweir 		{
1023*cdf0e10cSrcweir 			EnhancedCustomShapeSegment aNewSegment;
1024*cdf0e10cSrcweir 			aNewSegment.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
1025*cdf0e10cSrcweir 			aNewSegment.Count = 0;
1026*cdf0e10cSrcweir 			mrSegments.push_back( aNewSegment );
1027*cdf0e10cSrcweir 		}
1028*cdf0e10cSrcweir 		break;
1029*cdf0e10cSrcweir 		case A_TOKEN( moveTo ) :
1030*cdf0e10cSrcweir 		{
1031*cdf0e10cSrcweir 			EnhancedCustomShapeSegment aNewSegment;
1032*cdf0e10cSrcweir 			aNewSegment.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
1033*cdf0e10cSrcweir 			aNewSegment.Count = 1;
1034*cdf0e10cSrcweir 			mrSegments.push_back( aNewSegment );
1035*cdf0e10cSrcweir 
1036*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aAdjPoint2D;
1037*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aAdjPoint2D );
1038*cdf0e10cSrcweir 			xContext = new Path2DMoveToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
1039*cdf0e10cSrcweir 		}
1040*cdf0e10cSrcweir 		break;
1041*cdf0e10cSrcweir 		case A_TOKEN( lnTo ) :
1042*cdf0e10cSrcweir 		{
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir 			if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::LINETO ) )
1045*cdf0e10cSrcweir 				mrSegments.back().Count++;
1046*cdf0e10cSrcweir 			else
1047*cdf0e10cSrcweir 			{
1048*cdf0e10cSrcweir 				EnhancedCustomShapeSegment aSegment;
1049*cdf0e10cSrcweir 				aSegment.Command = EnhancedCustomShapeSegmentCommand::LINETO;
1050*cdf0e10cSrcweir 				aSegment.Count = 1;
1051*cdf0e10cSrcweir 				mrSegments.push_back( aSegment );
1052*cdf0e10cSrcweir 			}
1053*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aAdjPoint2D;
1054*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aAdjPoint2D );
1055*cdf0e10cSrcweir 			xContext = new Path2DLineToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
1056*cdf0e10cSrcweir 		}
1057*cdf0e10cSrcweir 		break;
1058*cdf0e10cSrcweir 		case A_TOKEN( arcTo ) :	// CT_Path2DArcTo
1059*cdf0e10cSrcweir 		{
1060*cdf0e10cSrcweir 			if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::ARCTO ) )
1061*cdf0e10cSrcweir 				mrSegments.back().Count++;
1062*cdf0e10cSrcweir 			else
1063*cdf0e10cSrcweir 			{
1064*cdf0e10cSrcweir 				EnhancedCustomShapeSegment aSegment;
1065*cdf0e10cSrcweir 				aSegment.Command = EnhancedCustomShapeSegmentCommand::ARCTO;
1066*cdf0e10cSrcweir 				aSegment.Count = 1;
1067*cdf0e10cSrcweir 				mrSegments.push_back( aSegment );
1068*cdf0e10cSrcweir 			}
1069*cdf0e10cSrcweir 			EnhancedCustomShapeParameter aWidth = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_wR ), sal_True );
1070*cdf0e10cSrcweir 			EnhancedCustomShapeParameter aHeight = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_hR ), sal_True );
1071*cdf0e10cSrcweir 			EnhancedCustomShapeParameter aStartAngle = GetAdjAngle( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_stAng ) );
1072*cdf0e10cSrcweir 			EnhancedCustomShapeParameter swAngle = GetAdjAngle( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_swAng ) );
1073*cdf0e10cSrcweir 
1074*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt1;	// TODO: conversion from (wr hr stAng swAng)
1075*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt2;	// to (x1 y1 x2 y2 x3 y3 x y) needed
1076*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt3;
1077*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt;
1078*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt1 );
1079*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt2 );
1080*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt3 );
1081*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt );
1082*cdf0e10cSrcweir 		}
1083*cdf0e10cSrcweir 		break;
1084*cdf0e10cSrcweir 		case A_TOKEN( quadBezTo ) :
1085*cdf0e10cSrcweir 		{
1086*cdf0e10cSrcweir 			if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO ) )
1087*cdf0e10cSrcweir 				mrSegments.back().Count++;
1088*cdf0e10cSrcweir 			else
1089*cdf0e10cSrcweir 			{
1090*cdf0e10cSrcweir 				EnhancedCustomShapeSegment aSegment;
1091*cdf0e10cSrcweir 				aSegment.Command = EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
1092*cdf0e10cSrcweir 				aSegment.Count = 1;
1093*cdf0e10cSrcweir 				mrSegments.push_back( aSegment );
1094*cdf0e10cSrcweir 			}
1095*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt1;
1096*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aPt2;
1097*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt1 );
1098*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aPt2 );
1099*cdf0e10cSrcweir 			xContext = new Path2DQuadBezierToContext( *this, mrCustomShapeProperties,
1100*cdf0e10cSrcweir 							mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ],
1101*cdf0e10cSrcweir 								mrPath2D.parameter.back() );
1102*cdf0e10cSrcweir 		}
1103*cdf0e10cSrcweir 		break;
1104*cdf0e10cSrcweir 		case A_TOKEN( cubicBezTo ) :
1105*cdf0e10cSrcweir 		{
1106*cdf0e10cSrcweir 			if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::CURVETO ) )
1107*cdf0e10cSrcweir 				mrSegments.back().Count++;
1108*cdf0e10cSrcweir 			else
1109*cdf0e10cSrcweir 			{
1110*cdf0e10cSrcweir 				EnhancedCustomShapeSegment aSegment;
1111*cdf0e10cSrcweir 				aSegment.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
1112*cdf0e10cSrcweir 				aSegment.Count = 1;
1113*cdf0e10cSrcweir 				mrSegments.push_back( aSegment );
1114*cdf0e10cSrcweir 			}
1115*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aControlPt1;
1116*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aControlPt2;
1117*cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aEndPt;
1118*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aControlPt1 );
1119*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aControlPt2 );
1120*cdf0e10cSrcweir 			mrPath2D.parameter.push_back( aEndPt );
1121*cdf0e10cSrcweir 			xContext = new Path2DCubicBezierToContext( *this, mrCustomShapeProperties,
1122*cdf0e10cSrcweir 							mrPath2D.parameter[ mrPath2D.parameter.size() - 3 ],
1123*cdf0e10cSrcweir 								mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ],
1124*cdf0e10cSrcweir 									mrPath2D.parameter.back() );
1125*cdf0e10cSrcweir 		}
1126*cdf0e10cSrcweir 		break;
1127*cdf0e10cSrcweir 	}
1128*cdf0e10cSrcweir 	return xContext;
1129*cdf0e10cSrcweir }
1130*cdf0e10cSrcweir 
1131*cdf0e10cSrcweir // ---------------------------------------------------------------------
1132*cdf0e10cSrcweir // CT_Path2DList
1133*cdf0e10cSrcweir class Path2DListContext : public ContextHandler
1134*cdf0e10cSrcweir {
1135*cdf0e10cSrcweir public:
1136*cdf0e10cSrcweir 	Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
1137*cdf0e10cSrcweir 		std::vector< Path2D >& rPath2DList );
1138*cdf0e10cSrcweir 
1139*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir protected:
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir 	CustomShapeProperties& mrCustomShapeProperties;
1144*cdf0e10cSrcweir 	std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& mrSegments;
1145*cdf0e10cSrcweir 	std::vector< Path2D >& mrPath2DList;
1146*cdf0e10cSrcweir };
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir Path2DListContext::Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
1149*cdf0e10cSrcweir 										std::vector< Path2D >& rPath2DList )
1150*cdf0e10cSrcweir : ContextHandler( rParent )
1151*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
1152*cdf0e10cSrcweir , mrSegments( rSegments )
1153*cdf0e10cSrcweir , mrPath2DList( rPath2DList )
1154*cdf0e10cSrcweir {
1155*cdf0e10cSrcweir }
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL Path2DListContext::createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
1158*cdf0e10cSrcweir {
1159*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
1160*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( path ) )
1161*cdf0e10cSrcweir 	{
1162*cdf0e10cSrcweir 		Path2D aPath2D;
1163*cdf0e10cSrcweir 		mrPath2DList.push_back( aPath2D );
1164*cdf0e10cSrcweir 		xContext = new Path2DContext( *this, xAttribs, mrCustomShapeProperties,  mrSegments, mrPath2DList.back() );
1165*cdf0e10cSrcweir 	}
1166*cdf0e10cSrcweir 	return xContext;
1167*cdf0e10cSrcweir }
1168*cdf0e10cSrcweir 
1169*cdf0e10cSrcweir // ---------------------------------------------------------------------
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir OUString GetShapeType( sal_Int32 nType )
1172*cdf0e10cSrcweir {
1173*cdf0e10cSrcweir 	OUString sType;
1174*cdf0e10cSrcweir  	switch( nType )
1175*cdf0e10cSrcweir 	{
1176*cdf0e10cSrcweir 		case XML_lineInv:	// TODO
1177*cdf0e10cSrcweir 		case XML_line: {
1178*cdf0e10cSrcweir             static const OUString sLine = CREATE_OUSTRING( "mso-spt20" );
1179*cdf0e10cSrcweir 			sType = sLine;
1180*cdf0e10cSrcweir 			} break;
1181*cdf0e10cSrcweir 		case XML_triangle: {
1182*cdf0e10cSrcweir             static const OUString sTriangle = CREATE_OUSTRING( "isosceles-triangle" );
1183*cdf0e10cSrcweir 			sType = sTriangle;
1184*cdf0e10cSrcweir 			} break;
1185*cdf0e10cSrcweir 		case XML_rtTriangle: {
1186*cdf0e10cSrcweir             static const OUString sRtTriangle = CREATE_OUSTRING( "right-triangle" );
1187*cdf0e10cSrcweir 			sType = sRtTriangle;
1188*cdf0e10cSrcweir 			} break;
1189*cdf0e10cSrcweir 		case XML_rect: {
1190*cdf0e10cSrcweir             static const OUString sRectangle = CREATE_OUSTRING( "rectangle" );
1191*cdf0e10cSrcweir 			sType = sRectangle;
1192*cdf0e10cSrcweir 			} break;
1193*cdf0e10cSrcweir 		case XML_diamond: {
1194*cdf0e10cSrcweir             static const OUString sDiamond = CREATE_OUSTRING( "diamond" );
1195*cdf0e10cSrcweir 			sType = sDiamond;
1196*cdf0e10cSrcweir 			} break;
1197*cdf0e10cSrcweir 		case XML_parallelogram: {
1198*cdf0e10cSrcweir             static const OUString sParallelogram = CREATE_OUSTRING( "parallelogram" );
1199*cdf0e10cSrcweir 			sType = sParallelogram;
1200*cdf0e10cSrcweir 			} break;
1201*cdf0e10cSrcweir 		case XML_nonIsoscelesTrapezoid:		// TODO
1202*cdf0e10cSrcweir 		case XML_trapezoid: {
1203*cdf0e10cSrcweir             static const OUString sTrapezoid = CREATE_OUSTRING( "trapezoid" );
1204*cdf0e10cSrcweir 			sType = sTrapezoid;
1205*cdf0e10cSrcweir 			} break;
1206*cdf0e10cSrcweir 		case XML_pentagon: {
1207*cdf0e10cSrcweir             static const OUString sPentagon = CREATE_OUSTRING( "pentagon" );
1208*cdf0e10cSrcweir 			sType = sPentagon;
1209*cdf0e10cSrcweir 			} break;
1210*cdf0e10cSrcweir 		case XML_heptagon:					// TODO
1211*cdf0e10cSrcweir 		case XML_hexagon: {
1212*cdf0e10cSrcweir             static const OUString sHexagon = CREATE_OUSTRING( "hexagon" );
1213*cdf0e10cSrcweir 			sType = sHexagon;
1214*cdf0e10cSrcweir 			} break;
1215*cdf0e10cSrcweir 		case XML_decagon:					// TODO
1216*cdf0e10cSrcweir 		case XML_dodecagon:					// TODO
1217*cdf0e10cSrcweir 		case XML_octagon: {
1218*cdf0e10cSrcweir             static const OUString sOctagon = CREATE_OUSTRING( "octagon" );
1219*cdf0e10cSrcweir 			sType = sOctagon;
1220*cdf0e10cSrcweir 			} break;
1221*cdf0e10cSrcweir 		case XML_star4: {
1222*cdf0e10cSrcweir             static const OUString sStar4 = CREATE_OUSTRING( "star4" );
1223*cdf0e10cSrcweir 			sType = sStar4;
1224*cdf0e10cSrcweir 			} break;
1225*cdf0e10cSrcweir 		case XML_star6:						// TODO
1226*cdf0e10cSrcweir 		case XML_star7:						// TODO
1227*cdf0e10cSrcweir 		case XML_star5: {
1228*cdf0e10cSrcweir             static const OUString sStar5 = CREATE_OUSTRING( "star5" );
1229*cdf0e10cSrcweir 			sType = sStar5;
1230*cdf0e10cSrcweir 			} break;
1231*cdf0e10cSrcweir 		case XML_star10:					// TODO
1232*cdf0e10cSrcweir 		case XML_star12:					// TODO
1233*cdf0e10cSrcweir 		case XML_star16:					// TODO
1234*cdf0e10cSrcweir 		case XML_star8: {
1235*cdf0e10cSrcweir             static const OUString sStar8 = CREATE_OUSTRING( "star8" );
1236*cdf0e10cSrcweir 			sType = sStar8;
1237*cdf0e10cSrcweir 			} break;
1238*cdf0e10cSrcweir 		case XML_star32:					// TODO
1239*cdf0e10cSrcweir 		case XML_star24: {
1240*cdf0e10cSrcweir             static const OUString sStar24 = CREATE_OUSTRING( "star24" );
1241*cdf0e10cSrcweir 			sType = sStar24;
1242*cdf0e10cSrcweir 			} break;
1243*cdf0e10cSrcweir 		case XML_round1Rect:				// TODO
1244*cdf0e10cSrcweir 		case XML_round2SameRect:			// TODO
1245*cdf0e10cSrcweir 		case XML_round2DiagRect:			// TODO
1246*cdf0e10cSrcweir 		case XML_snipRoundRect:				// TODO
1247*cdf0e10cSrcweir 		case XML_snip1Rect:					// TODO
1248*cdf0e10cSrcweir 		case XML_snip2SameRect:				// TODO
1249*cdf0e10cSrcweir 		case XML_snip2DiagRect:				// TODO
1250*cdf0e10cSrcweir 		case XML_roundRect: {
1251*cdf0e10cSrcweir             static const OUString sRoundRect = CREATE_OUSTRING( "round-rectangle" );
1252*cdf0e10cSrcweir 			sType = sRoundRect;
1253*cdf0e10cSrcweir 			} break;
1254*cdf0e10cSrcweir 		case XML_plaque: {
1255*cdf0e10cSrcweir             static const OUString sPlaque = CREATE_OUSTRING( "mso-spt21" );
1256*cdf0e10cSrcweir 			sType = sPlaque;
1257*cdf0e10cSrcweir 			} break;
1258*cdf0e10cSrcweir 		case XML_teardrop:					// TODO
1259*cdf0e10cSrcweir 		case XML_ellipse: {
1260*cdf0e10cSrcweir             static const OUString sEllipse = CREATE_OUSTRING( "ellipse" );
1261*cdf0e10cSrcweir 			sType = sEllipse;
1262*cdf0e10cSrcweir 			} break;
1263*cdf0e10cSrcweir 		case XML_homePlate: {
1264*cdf0e10cSrcweir             static const OUString sHomePlate = CREATE_OUSTRING( "pentagon-right" );
1265*cdf0e10cSrcweir 			sType = sHomePlate;
1266*cdf0e10cSrcweir 			} break;
1267*cdf0e10cSrcweir 		case XML_chevron: {
1268*cdf0e10cSrcweir             static const OUString sChevron = CREATE_OUSTRING( "chevron" );
1269*cdf0e10cSrcweir 			sType = sChevron;
1270*cdf0e10cSrcweir 			} break;
1271*cdf0e10cSrcweir 		case XML_pieWedge:					// TODO
1272*cdf0e10cSrcweir 		case XML_pie:						// TODO
1273*cdf0e10cSrcweir 		case XML_blockArc: {
1274*cdf0e10cSrcweir             static const OUString sBlockArc = CREATE_OUSTRING( "block-arc" );
1275*cdf0e10cSrcweir 			sType = sBlockArc;
1276*cdf0e10cSrcweir 			} break;
1277*cdf0e10cSrcweir 		case XML_donut: {
1278*cdf0e10cSrcweir             static const OUString sDonut = CREATE_OUSTRING( "ring" );
1279*cdf0e10cSrcweir 			sType = sDonut;
1280*cdf0e10cSrcweir 			} break;
1281*cdf0e10cSrcweir 		case XML_noSmoking: {
1282*cdf0e10cSrcweir             static const OUString sNoSmoking = CREATE_OUSTRING( "forbidden" );
1283*cdf0e10cSrcweir 			sType = sNoSmoking;
1284*cdf0e10cSrcweir 			} break;
1285*cdf0e10cSrcweir 		case XML_rightArrow: {
1286*cdf0e10cSrcweir             static const OUString sRightArrow = CREATE_OUSTRING( "right-arrow" );
1287*cdf0e10cSrcweir 			sType = sRightArrow;
1288*cdf0e10cSrcweir 			} break;
1289*cdf0e10cSrcweir 		case XML_leftArrow: {
1290*cdf0e10cSrcweir             static const OUString sLeftArrow = CREATE_OUSTRING( "left-arrow" );
1291*cdf0e10cSrcweir 			sType = sLeftArrow;
1292*cdf0e10cSrcweir 			} break;
1293*cdf0e10cSrcweir 		case XML_upArrow: {
1294*cdf0e10cSrcweir             static const OUString sUpArrow = CREATE_OUSTRING( "up-arrow" );
1295*cdf0e10cSrcweir 			sType = sUpArrow;
1296*cdf0e10cSrcweir 			} break;
1297*cdf0e10cSrcweir 		case XML_downArrow: {
1298*cdf0e10cSrcweir             static const OUString sDownArrow = CREATE_OUSTRING( "down-arrow" );
1299*cdf0e10cSrcweir 			sType = sDownArrow;
1300*cdf0e10cSrcweir 			} break;
1301*cdf0e10cSrcweir 		case XML_stripedRightArrow: {
1302*cdf0e10cSrcweir             static const OUString sStripedRightArrow = CREATE_OUSTRING( "striped-right-arrow" );
1303*cdf0e10cSrcweir 			sType = sStripedRightArrow;
1304*cdf0e10cSrcweir 			} break;
1305*cdf0e10cSrcweir 		case XML_notchedRightArrow: {
1306*cdf0e10cSrcweir             static const OUString sNotchedRightArrow = CREATE_OUSTRING( "notched-right-arrow" );
1307*cdf0e10cSrcweir 			sType = sNotchedRightArrow;
1308*cdf0e10cSrcweir 			} break;
1309*cdf0e10cSrcweir 		case XML_bentUpArrow: {
1310*cdf0e10cSrcweir             static const OUString sBentUpArrow = CREATE_OUSTRING( "mso-spt90" );
1311*cdf0e10cSrcweir 			sType = sBentUpArrow;
1312*cdf0e10cSrcweir 			} break;
1313*cdf0e10cSrcweir 		case XML_leftRightArrow: {
1314*cdf0e10cSrcweir             static const OUString sLeftRightArrow = CREATE_OUSTRING( "left-right-arrow" );
1315*cdf0e10cSrcweir 			sType = sLeftRightArrow;
1316*cdf0e10cSrcweir 			} break;
1317*cdf0e10cSrcweir 		case XML_upDownArrow: {
1318*cdf0e10cSrcweir             static const OUString sUpDownArrow = CREATE_OUSTRING( "up-down-arrow" );
1319*cdf0e10cSrcweir 			sType = sUpDownArrow;
1320*cdf0e10cSrcweir 			} break;
1321*cdf0e10cSrcweir 		case XML_leftUpArrow: {
1322*cdf0e10cSrcweir             static const OUString sLeftUpArrow = CREATE_OUSTRING( "mso-spt89" );
1323*cdf0e10cSrcweir 			sType = sLeftUpArrow;
1324*cdf0e10cSrcweir 			} break;
1325*cdf0e10cSrcweir 		case XML_leftRightUpArrow: {
1326*cdf0e10cSrcweir             static const OUString sLeftRightUpArrow = CREATE_OUSTRING( "mso-spt182" );
1327*cdf0e10cSrcweir 			sType = sLeftRightUpArrow;
1328*cdf0e10cSrcweir 			} break;
1329*cdf0e10cSrcweir 		case XML_quadArrow: {
1330*cdf0e10cSrcweir             static const OUString sQuadArrow = CREATE_OUSTRING( "quad-arrow" );
1331*cdf0e10cSrcweir 			sType = sQuadArrow;
1332*cdf0e10cSrcweir 			} break;
1333*cdf0e10cSrcweir 		case XML_leftArrowCallout: {
1334*cdf0e10cSrcweir             static const OUString sLeftArrowCallout = CREATE_OUSTRING( "left-arrow-callout" );
1335*cdf0e10cSrcweir 			sType = sLeftArrowCallout;
1336*cdf0e10cSrcweir 			} break;
1337*cdf0e10cSrcweir 		case XML_rightArrowCallout: {
1338*cdf0e10cSrcweir             static const OUString sRightArrowCallout = CREATE_OUSTRING( "right-arrow-callout" );
1339*cdf0e10cSrcweir 			sType = sRightArrowCallout;
1340*cdf0e10cSrcweir 			} break;
1341*cdf0e10cSrcweir 		case XML_upArrowCallout: {
1342*cdf0e10cSrcweir             static const OUString sUpArrowCallout = CREATE_OUSTRING( "up-arrow-callout" );
1343*cdf0e10cSrcweir 			sType = sUpArrowCallout;
1344*cdf0e10cSrcweir 			} break;
1345*cdf0e10cSrcweir 		case XML_downArrowCallout: {
1346*cdf0e10cSrcweir             static const OUString sDownArrowCallout = CREATE_OUSTRING( "down-arrow-callout" );
1347*cdf0e10cSrcweir 			sType = sDownArrowCallout;
1348*cdf0e10cSrcweir 			} break;
1349*cdf0e10cSrcweir 		case XML_leftRightArrowCallout: {
1350*cdf0e10cSrcweir             static const OUString sLeftRightArrowCallout = CREATE_OUSTRING( "left-right-arrow-callout" );
1351*cdf0e10cSrcweir 			sType = sLeftRightArrowCallout;
1352*cdf0e10cSrcweir 			} break;
1353*cdf0e10cSrcweir 		case XML_upDownArrowCallout: {
1354*cdf0e10cSrcweir             static const OUString sUpDownArrowCallout = CREATE_OUSTRING( "up-down-arrow-callout" );
1355*cdf0e10cSrcweir 			sType = sUpDownArrowCallout;
1356*cdf0e10cSrcweir 			} break;
1357*cdf0e10cSrcweir 		case XML_quadArrowCallout: {
1358*cdf0e10cSrcweir             static const OUString sQuadArrowCallout = CREATE_OUSTRING( "quad-arrow-callout" );
1359*cdf0e10cSrcweir 			sType = sQuadArrowCallout;
1360*cdf0e10cSrcweir 			} break;
1361*cdf0e10cSrcweir 		case XML_bentArrow: {
1362*cdf0e10cSrcweir             static const OUString sBentArrow = CREATE_OUSTRING( "mso-spt91" );
1363*cdf0e10cSrcweir 			sType = sBentArrow;
1364*cdf0e10cSrcweir 			} break;
1365*cdf0e10cSrcweir 		case XML_uturnArrow: {
1366*cdf0e10cSrcweir             static const OUString sUTurnArrow = CREATE_OUSTRING( "mso-spt101" );
1367*cdf0e10cSrcweir 			sType = sUTurnArrow;
1368*cdf0e10cSrcweir 			} break;
1369*cdf0e10cSrcweir 		case XML_leftCircularArrow:			// TODO
1370*cdf0e10cSrcweir 		case XML_leftRightCircularArrow:	// TODO
1371*cdf0e10cSrcweir 		case XML_circularArrow: {
1372*cdf0e10cSrcweir             static const OUString sCircularArrow = CREATE_OUSTRING( "circular-arrow" );
1373*cdf0e10cSrcweir 			sType = sCircularArrow;
1374*cdf0e10cSrcweir 			} break;
1375*cdf0e10cSrcweir 		case XML_curvedRightArrow: {
1376*cdf0e10cSrcweir             static const OUString sCurvedRightArrow = CREATE_OUSTRING( "mso-spt102" );
1377*cdf0e10cSrcweir 			sType = sCurvedRightArrow;
1378*cdf0e10cSrcweir 			} break;
1379*cdf0e10cSrcweir 		case XML_curvedLeftArrow: {
1380*cdf0e10cSrcweir             static const OUString sCurvedLeftArrow = CREATE_OUSTRING( "mso-spt103" );
1381*cdf0e10cSrcweir 			sType = sCurvedLeftArrow;
1382*cdf0e10cSrcweir 			} break;
1383*cdf0e10cSrcweir 		case XML_curvedUpArrow: {
1384*cdf0e10cSrcweir             static const OUString sCurvedUpArrow = CREATE_OUSTRING( "mso-spt104" );
1385*cdf0e10cSrcweir 			sType = sCurvedUpArrow;
1386*cdf0e10cSrcweir 			} break;
1387*cdf0e10cSrcweir 		case XML_swooshArrow:				// TODO
1388*cdf0e10cSrcweir 		case XML_curvedDownArrow: {
1389*cdf0e10cSrcweir             static const OUString sCurvedDownArrow = CREATE_OUSTRING( "mso-spt105" );
1390*cdf0e10cSrcweir 			sType = sCurvedDownArrow;
1391*cdf0e10cSrcweir 			} break;
1392*cdf0e10cSrcweir 		case XML_cube: {
1393*cdf0e10cSrcweir             static const OUString sCube = CREATE_OUSTRING( "cube" );
1394*cdf0e10cSrcweir 			sType = sCube;
1395*cdf0e10cSrcweir 			} break;
1396*cdf0e10cSrcweir 		case XML_can: {
1397*cdf0e10cSrcweir             static const OUString sCan = CREATE_OUSTRING( "can" );
1398*cdf0e10cSrcweir 			sType = sCan;
1399*cdf0e10cSrcweir 			} break;
1400*cdf0e10cSrcweir 		case XML_lightningBolt: {
1401*cdf0e10cSrcweir             static const OUString sLightningBolt = CREATE_OUSTRING( "lightning" );
1402*cdf0e10cSrcweir 			sType = sLightningBolt;
1403*cdf0e10cSrcweir 			} break;
1404*cdf0e10cSrcweir 		case XML_heart: {
1405*cdf0e10cSrcweir             static const OUString sHeart = CREATE_OUSTRING( "heart" );
1406*cdf0e10cSrcweir 			sType = sHeart;
1407*cdf0e10cSrcweir 			} break;
1408*cdf0e10cSrcweir 		case XML_sun: {
1409*cdf0e10cSrcweir             static const OUString sSun = CREATE_OUSTRING( "sun" );
1410*cdf0e10cSrcweir 			sType = sSun;
1411*cdf0e10cSrcweir 			} break;
1412*cdf0e10cSrcweir 		case XML_moon: {
1413*cdf0e10cSrcweir             static const OUString sMoon = CREATE_OUSTRING( "moon" );
1414*cdf0e10cSrcweir 			sType = sMoon;
1415*cdf0e10cSrcweir 			} break;
1416*cdf0e10cSrcweir 		case XML_smileyFace: {
1417*cdf0e10cSrcweir             static const OUString sSmileyFace = CREATE_OUSTRING( "smiley" );
1418*cdf0e10cSrcweir 			sType = sSmileyFace;
1419*cdf0e10cSrcweir 			} break;
1420*cdf0e10cSrcweir 		case XML_irregularSeal1: {
1421*cdf0e10cSrcweir             static const OUString sIrregularSeal1 = CREATE_OUSTRING( "mso-spt71" );
1422*cdf0e10cSrcweir 			sType = sIrregularSeal1;
1423*cdf0e10cSrcweir 			} break;
1424*cdf0e10cSrcweir 		case XML_irregularSeal2: {
1425*cdf0e10cSrcweir             static const OUString sIrregularSeal2 = CREATE_OUSTRING( "bang" );
1426*cdf0e10cSrcweir 			sType = sIrregularSeal2;
1427*cdf0e10cSrcweir 			} break;
1428*cdf0e10cSrcweir 		case XML_foldedCorner: {
1429*cdf0e10cSrcweir             static const OUString sFoldedCorner = CREATE_OUSTRING( "paper" );
1430*cdf0e10cSrcweir 			sType = sFoldedCorner;
1431*cdf0e10cSrcweir 			} break;
1432*cdf0e10cSrcweir 		case XML_bevel: {
1433*cdf0e10cSrcweir             static const OUString sBevel = CREATE_OUSTRING( "quad-bevel" );
1434*cdf0e10cSrcweir 			sType = sBevel;
1435*cdf0e10cSrcweir 			} break;
1436*cdf0e10cSrcweir 		case XML_halfFrame:					// TODO
1437*cdf0e10cSrcweir 		case XML_corner:					// TODO
1438*cdf0e10cSrcweir 		case XML_diagStripe:				// TODO
1439*cdf0e10cSrcweir 		case XML_chord:						// TODO
1440*cdf0e10cSrcweir 		case XML_frame: {
1441*cdf0e10cSrcweir             static const OUString sFrame = CREATE_OUSTRING( "mso-spt75" );
1442*cdf0e10cSrcweir 			sType = sFrame;
1443*cdf0e10cSrcweir 			} break;
1444*cdf0e10cSrcweir 		case XML_arc: {
1445*cdf0e10cSrcweir             static const OUString sArc = CREATE_OUSTRING( "mso-spt19" );
1446*cdf0e10cSrcweir 			sType = sArc;
1447*cdf0e10cSrcweir 			} break;
1448*cdf0e10cSrcweir 		case XML_leftBracket: {
1449*cdf0e10cSrcweir             static const OUString sLeftBracket = CREATE_OUSTRING( "left-bracket" );
1450*cdf0e10cSrcweir 			sType = sLeftBracket;
1451*cdf0e10cSrcweir 			} break;
1452*cdf0e10cSrcweir 		case XML_rightBracket: {
1453*cdf0e10cSrcweir             static const OUString sRightBracket = CREATE_OUSTRING( "right-bracket" );
1454*cdf0e10cSrcweir 			sType = sRightBracket;
1455*cdf0e10cSrcweir 			} break;
1456*cdf0e10cSrcweir 		case XML_leftBrace: {
1457*cdf0e10cSrcweir             static const OUString sLeftBrace = CREATE_OUSTRING( "left-brace" );
1458*cdf0e10cSrcweir 			sType = sLeftBrace;
1459*cdf0e10cSrcweir 			} break;
1460*cdf0e10cSrcweir 		case XML_rightBrace: {
1461*cdf0e10cSrcweir             static const OUString sRightBrace = CREATE_OUSTRING( "right-brace" );
1462*cdf0e10cSrcweir 			sType = sRightBrace;
1463*cdf0e10cSrcweir 			} break;
1464*cdf0e10cSrcweir 		case XML_bracketPair: {
1465*cdf0e10cSrcweir             static const OUString sBracketPair = CREATE_OUSTRING( "bracket-pair" );
1466*cdf0e10cSrcweir 			sType = sBracketPair;
1467*cdf0e10cSrcweir 			} break;
1468*cdf0e10cSrcweir 		case XML_bracePair: {
1469*cdf0e10cSrcweir             static const OUString sBracePair = CREATE_OUSTRING( "brace-pair" );
1470*cdf0e10cSrcweir 			sType = sBracePair;
1471*cdf0e10cSrcweir 			} break;
1472*cdf0e10cSrcweir 		case XML_straightConnector1: {
1473*cdf0e10cSrcweir             static const OUString sStraightConnector1 = CREATE_OUSTRING( "mso-spt32" );
1474*cdf0e10cSrcweir 			sType = sStraightConnector1;
1475*cdf0e10cSrcweir 			} break;
1476*cdf0e10cSrcweir 		case XML_bentConnector2: {
1477*cdf0e10cSrcweir             static const OUString sBentConnector2 = CREATE_OUSTRING( "mso-spt33" );
1478*cdf0e10cSrcweir 			sType = sBentConnector2;
1479*cdf0e10cSrcweir 			} break;
1480*cdf0e10cSrcweir 		case XML_bentConnector3: {
1481*cdf0e10cSrcweir             static const OUString sBentConnector3 = CREATE_OUSTRING( "mso-spt34" );
1482*cdf0e10cSrcweir 			sType = sBentConnector3;
1483*cdf0e10cSrcweir 			} break;
1484*cdf0e10cSrcweir 		case XML_bentConnector4: {
1485*cdf0e10cSrcweir             static const OUString sBentConnector4 = CREATE_OUSTRING( "mso-spt35" );
1486*cdf0e10cSrcweir 			sType = sBentConnector4;
1487*cdf0e10cSrcweir 			} break;
1488*cdf0e10cSrcweir 		case XML_bentConnector5: {
1489*cdf0e10cSrcweir             static const OUString sBentConnector5 = CREATE_OUSTRING( "mso-spt36" );
1490*cdf0e10cSrcweir 			sType = sBentConnector5;
1491*cdf0e10cSrcweir 			} break;
1492*cdf0e10cSrcweir 		case XML_curvedConnector2: {
1493*cdf0e10cSrcweir             static const OUString sCurvedConnector2 = CREATE_OUSTRING( "mso-spt37" );
1494*cdf0e10cSrcweir 			sType = sCurvedConnector2;
1495*cdf0e10cSrcweir 			} break;
1496*cdf0e10cSrcweir 		case XML_curvedConnector3: {
1497*cdf0e10cSrcweir             static const OUString sCurvedConnector3 = CREATE_OUSTRING( "mso-spt38" );
1498*cdf0e10cSrcweir 			sType = sCurvedConnector3;
1499*cdf0e10cSrcweir 			} break;
1500*cdf0e10cSrcweir 		case XML_curvedConnector4: {
1501*cdf0e10cSrcweir             static const OUString sCurvedConnector4 = CREATE_OUSTRING( "mso-spt39" );
1502*cdf0e10cSrcweir 			sType = sCurvedConnector4;
1503*cdf0e10cSrcweir 			} break;
1504*cdf0e10cSrcweir 		case XML_curvedConnector5: {
1505*cdf0e10cSrcweir             static const OUString sCurvedConnector5 = CREATE_OUSTRING( "mso-spt40" );
1506*cdf0e10cSrcweir 			sType = sCurvedConnector5;
1507*cdf0e10cSrcweir 			} break;
1508*cdf0e10cSrcweir 		case XML_callout1: {
1509*cdf0e10cSrcweir             static const OUString sCallout1 = CREATE_OUSTRING( "mso-spt41" );
1510*cdf0e10cSrcweir 			sType = sCallout1;
1511*cdf0e10cSrcweir 			} break;
1512*cdf0e10cSrcweir 		case XML_callout2: {
1513*cdf0e10cSrcweir             static const OUString sCallout2 = CREATE_OUSTRING( "mso-spt42" );
1514*cdf0e10cSrcweir 			sType = sCallout2;
1515*cdf0e10cSrcweir 			} break;
1516*cdf0e10cSrcweir 		case XML_callout3: {
1517*cdf0e10cSrcweir             static const OUString sCallout3 = CREATE_OUSTRING( "mso-spt43" );
1518*cdf0e10cSrcweir 			sType = sCallout3;
1519*cdf0e10cSrcweir 			} break;
1520*cdf0e10cSrcweir 		case XML_accentCallout1: {
1521*cdf0e10cSrcweir             static const OUString sAccentCallout1 = CREATE_OUSTRING( "mso-spt44" );
1522*cdf0e10cSrcweir 			sType = sAccentCallout1;
1523*cdf0e10cSrcweir 			} break;
1524*cdf0e10cSrcweir 		case XML_accentCallout2: {
1525*cdf0e10cSrcweir             static const OUString sAccentCallout2 = CREATE_OUSTRING( "mso-spt45" );
1526*cdf0e10cSrcweir 			sType = sAccentCallout2;
1527*cdf0e10cSrcweir 			} break;
1528*cdf0e10cSrcweir 		case XML_accentCallout3: {
1529*cdf0e10cSrcweir             static const OUString sAccentCallout3 = CREATE_OUSTRING( "mso-spt46" );
1530*cdf0e10cSrcweir 			sType = sAccentCallout3;
1531*cdf0e10cSrcweir 			} break;
1532*cdf0e10cSrcweir 		case XML_borderCallout1: {
1533*cdf0e10cSrcweir             static const OUString sBorderCallout1 = CREATE_OUSTRING( "line-callout-1" );
1534*cdf0e10cSrcweir 			sType = sBorderCallout1;
1535*cdf0e10cSrcweir 			} break;
1536*cdf0e10cSrcweir 		case XML_borderCallout2: {
1537*cdf0e10cSrcweir             static const OUString sBorderCallout2 = CREATE_OUSTRING( "line-callout-2" );
1538*cdf0e10cSrcweir 			sType = sBorderCallout2;
1539*cdf0e10cSrcweir 			} break;
1540*cdf0e10cSrcweir 		case XML_borderCallout3: {
1541*cdf0e10cSrcweir             static const OUString sBorderCallout3 = CREATE_OUSTRING( "mso-spt49" );
1542*cdf0e10cSrcweir 			sType = sBorderCallout3;
1543*cdf0e10cSrcweir 			} break;
1544*cdf0e10cSrcweir 		case XML_accentBorderCallout1: {
1545*cdf0e10cSrcweir             static const OUString sAccentBorderCallout1 = CREATE_OUSTRING( "mso-spt50" );
1546*cdf0e10cSrcweir 			sType = sAccentBorderCallout1;
1547*cdf0e10cSrcweir 			} break;
1548*cdf0e10cSrcweir 		case XML_accentBorderCallout2: {
1549*cdf0e10cSrcweir             static const OUString sAccentBorderCallout2 = CREATE_OUSTRING( "mso-spt51" );
1550*cdf0e10cSrcweir 			sType = sAccentBorderCallout2;
1551*cdf0e10cSrcweir 			} break;
1552*cdf0e10cSrcweir 		case XML_accentBorderCallout3: {
1553*cdf0e10cSrcweir             static const OUString sAccentBorderCallout3 = CREATE_OUSTRING( "mso-spt52" );
1554*cdf0e10cSrcweir 			sType = sAccentBorderCallout3;
1555*cdf0e10cSrcweir 			} break;
1556*cdf0e10cSrcweir 		case XML_wedgeRectCallout: {
1557*cdf0e10cSrcweir             static const OUString sWedgeRectCallout = CREATE_OUSTRING( "rectangular-callout" );
1558*cdf0e10cSrcweir 			sType = sWedgeRectCallout;
1559*cdf0e10cSrcweir 			} break;
1560*cdf0e10cSrcweir 		case XML_wedgeRoundRectCallout: {
1561*cdf0e10cSrcweir             static const OUString sWedgeRoundRectCallout = CREATE_OUSTRING( "round-rectangular-callout" );
1562*cdf0e10cSrcweir 			sType = sWedgeRoundRectCallout;
1563*cdf0e10cSrcweir 			} break;
1564*cdf0e10cSrcweir 		case XML_wedgeEllipseCallout: {
1565*cdf0e10cSrcweir             static const OUString sWedgeEllipseCallout = CREATE_OUSTRING( "round-callout" );
1566*cdf0e10cSrcweir 			sType = sWedgeEllipseCallout;
1567*cdf0e10cSrcweir 			} break;
1568*cdf0e10cSrcweir 		case XML_cloud:						// TODO
1569*cdf0e10cSrcweir 		case XML_cloudCallout: {
1570*cdf0e10cSrcweir             static const OUString sCloudCallout = CREATE_OUSTRING( "cloud-callout" );
1571*cdf0e10cSrcweir 			sType = sCloudCallout;
1572*cdf0e10cSrcweir 			} break;
1573*cdf0e10cSrcweir 		case XML_ribbon: {
1574*cdf0e10cSrcweir             static const OUString sRibbon = CREATE_OUSTRING( "mso-spt53" );
1575*cdf0e10cSrcweir 			sType = sRibbon;
1576*cdf0e10cSrcweir 			} break;
1577*cdf0e10cSrcweir 		case XML_ribbon2: {
1578*cdf0e10cSrcweir             static const OUString sRibbon2 = CREATE_OUSTRING( "mso-spt54" );
1579*cdf0e10cSrcweir 			sType = sRibbon2;
1580*cdf0e10cSrcweir 			} break;
1581*cdf0e10cSrcweir 		case XML_ellipseRibbon: {
1582*cdf0e10cSrcweir             static const OUString sEllipseRibbon = CREATE_OUSTRING( "mso-spt107" );
1583*cdf0e10cSrcweir 			sType = sEllipseRibbon;
1584*cdf0e10cSrcweir 			} break;
1585*cdf0e10cSrcweir 		case XML_leftRightRibbon:			// TODO
1586*cdf0e10cSrcweir 		case XML_ellipseRibbon2: {
1587*cdf0e10cSrcweir             static const OUString sEllipseRibbon2 = CREATE_OUSTRING( "mso-spt108" );
1588*cdf0e10cSrcweir 			sType = sEllipseRibbon2;
1589*cdf0e10cSrcweir 			} break;
1590*cdf0e10cSrcweir 		case XML_verticalScroll: {
1591*cdf0e10cSrcweir             static const OUString sVerticalScroll = CREATE_OUSTRING( "vertical-scroll" );
1592*cdf0e10cSrcweir 			sType = sVerticalScroll;
1593*cdf0e10cSrcweir 			} break;
1594*cdf0e10cSrcweir 		case XML_horizontalScroll: {
1595*cdf0e10cSrcweir             static const OUString sHorizontalScroll = CREATE_OUSTRING( "horizontal-scroll" );
1596*cdf0e10cSrcweir 			sType = sHorizontalScroll;
1597*cdf0e10cSrcweir 			} break;
1598*cdf0e10cSrcweir 		case XML_wave: {
1599*cdf0e10cSrcweir             static const OUString sWave = CREATE_OUSTRING( "mso-spt64" );
1600*cdf0e10cSrcweir 			sType = sWave;
1601*cdf0e10cSrcweir 			} break;
1602*cdf0e10cSrcweir 		case XML_doubleWave: {
1603*cdf0e10cSrcweir             static const OUString sDoubleWave = CREATE_OUSTRING( "mso-spt188" );
1604*cdf0e10cSrcweir 			sType = sDoubleWave;
1605*cdf0e10cSrcweir 			} break;
1606*cdf0e10cSrcweir 		case XML_plus: {
1607*cdf0e10cSrcweir             static const OUString sPlus = CREATE_OUSTRING( "cross" );
1608*cdf0e10cSrcweir 			sType = sPlus;
1609*cdf0e10cSrcweir 			} break;
1610*cdf0e10cSrcweir 		case XML_flowChartProcess: {
1611*cdf0e10cSrcweir             static const OUString sFlowChartProcess = CREATE_OUSTRING( "flowchart-process" );
1612*cdf0e10cSrcweir 			sType = sFlowChartProcess;
1613*cdf0e10cSrcweir 			} break;
1614*cdf0e10cSrcweir 		case XML_flowChartDecision: {
1615*cdf0e10cSrcweir             static const OUString sFlowChartDecision = CREATE_OUSTRING( "flowchart-decision" );
1616*cdf0e10cSrcweir 			sType = sFlowChartDecision;
1617*cdf0e10cSrcweir 			} break;
1618*cdf0e10cSrcweir 		case XML_flowChartInputOutput: {
1619*cdf0e10cSrcweir             static const OUString sFlowChartInputOutput = CREATE_OUSTRING( "flowchart-data" );
1620*cdf0e10cSrcweir 			sType = sFlowChartInputOutput;
1621*cdf0e10cSrcweir 			} break;
1622*cdf0e10cSrcweir 		case XML_flowChartPredefinedProcess: {
1623*cdf0e10cSrcweir             static const OUString sFlowChartPredefinedProcess = CREATE_OUSTRING( "flowchart-predefined-process" );
1624*cdf0e10cSrcweir 			sType = sFlowChartPredefinedProcess;
1625*cdf0e10cSrcweir 			} break;
1626*cdf0e10cSrcweir 		case XML_flowChartInternalStorage: {
1627*cdf0e10cSrcweir             static const OUString sFlowChartInternalStorage = CREATE_OUSTRING( "flowchart-internal-storage" );
1628*cdf0e10cSrcweir 			sType = sFlowChartInternalStorage;
1629*cdf0e10cSrcweir 			} break;
1630*cdf0e10cSrcweir 		case XML_flowChartDocument: {
1631*cdf0e10cSrcweir             static const OUString sFlowChartDocument = CREATE_OUSTRING( "flowchart-document" );
1632*cdf0e10cSrcweir 			sType = sFlowChartDocument;
1633*cdf0e10cSrcweir 			} break;
1634*cdf0e10cSrcweir 		case XML_flowChartMultidocument: {
1635*cdf0e10cSrcweir             static const OUString sFlowChartMultidocument = CREATE_OUSTRING( "flowchart-multidocument" );
1636*cdf0e10cSrcweir 			sType = sFlowChartMultidocument;
1637*cdf0e10cSrcweir 			} break;
1638*cdf0e10cSrcweir 		case XML_flowChartTerminator: {
1639*cdf0e10cSrcweir             static const OUString sFlowChartTerminator = CREATE_OUSTRING( "flowchart-terminator" );
1640*cdf0e10cSrcweir 			sType = sFlowChartTerminator;
1641*cdf0e10cSrcweir 			} break;
1642*cdf0e10cSrcweir 		case XML_flowChartPreparation : {
1643*cdf0e10cSrcweir             static const OUString sFlowChartPreparation = CREATE_OUSTRING( "flowchart-preparation" );
1644*cdf0e10cSrcweir 			sType = sFlowChartPreparation;
1645*cdf0e10cSrcweir 			} break;
1646*cdf0e10cSrcweir 		case XML_flowChartManualInput: {
1647*cdf0e10cSrcweir             static const OUString sFlowChartManualInput = CREATE_OUSTRING( "flowchart-manual-input" );
1648*cdf0e10cSrcweir 			sType = sFlowChartManualInput;
1649*cdf0e10cSrcweir 			} break;
1650*cdf0e10cSrcweir 		case XML_flowChartManualOperation: {
1651*cdf0e10cSrcweir             static const OUString sFlowChartManualOperation = CREATE_OUSTRING( "flowchart-manual-operation" );
1652*cdf0e10cSrcweir 			sType = sFlowChartManualOperation;
1653*cdf0e10cSrcweir 			} break;
1654*cdf0e10cSrcweir 		case XML_flowChartConnector: {
1655*cdf0e10cSrcweir             static const OUString sFlowChartConnector = CREATE_OUSTRING( "flowchart-connector" );
1656*cdf0e10cSrcweir 			sType = sFlowChartConnector;
1657*cdf0e10cSrcweir 			} break;
1658*cdf0e10cSrcweir 		case XML_flowChartPunchedCard: {
1659*cdf0e10cSrcweir             static const OUString sFlowChartPunchedCard = CREATE_OUSTRING( "flowchart-card" );
1660*cdf0e10cSrcweir 			sType = sFlowChartPunchedCard;
1661*cdf0e10cSrcweir 			} break;
1662*cdf0e10cSrcweir 		case XML_flowChartPunchedTape: {
1663*cdf0e10cSrcweir             static const OUString sFlowChartPunchedTape = CREATE_OUSTRING( "flowchart-punched-tape" );
1664*cdf0e10cSrcweir 			sType = sFlowChartPunchedTape;
1665*cdf0e10cSrcweir 			} break;
1666*cdf0e10cSrcweir 		case XML_flowChartSummingJunction: {
1667*cdf0e10cSrcweir             static const OUString sFlowChartSummingJunction = CREATE_OUSTRING( "flowchart-summing-junction" );
1668*cdf0e10cSrcweir 			sType = sFlowChartSummingJunction;
1669*cdf0e10cSrcweir 			} break;
1670*cdf0e10cSrcweir 		case XML_flowChartOr: {
1671*cdf0e10cSrcweir             static const OUString sFlowChartOr = CREATE_OUSTRING( "flowchart-or" );
1672*cdf0e10cSrcweir 			sType = sFlowChartOr;
1673*cdf0e10cSrcweir 			} break;
1674*cdf0e10cSrcweir 		case XML_flowChartCollate: {
1675*cdf0e10cSrcweir             static const OUString sFlowChartCollate = CREATE_OUSTRING( "flowchart-collate" );
1676*cdf0e10cSrcweir 			sType = sFlowChartCollate;
1677*cdf0e10cSrcweir 			} break;
1678*cdf0e10cSrcweir 		case XML_flowChartSort: {
1679*cdf0e10cSrcweir             static const OUString sFlowChartSort = CREATE_OUSTRING( "flowchart-sort" );
1680*cdf0e10cSrcweir 			sType = sFlowChartSort;
1681*cdf0e10cSrcweir 			} break;
1682*cdf0e10cSrcweir 		case XML_flowChartExtract: {
1683*cdf0e10cSrcweir             static const OUString sFlowChartExtract = CREATE_OUSTRING( "flowchart-extract" );
1684*cdf0e10cSrcweir 			sType = sFlowChartExtract;
1685*cdf0e10cSrcweir 			} break;
1686*cdf0e10cSrcweir 		case XML_flowChartMerge: {
1687*cdf0e10cSrcweir             static const OUString sFlowChartMerge = CREATE_OUSTRING( "flowchart-merge" );
1688*cdf0e10cSrcweir 			sType = sFlowChartMerge;
1689*cdf0e10cSrcweir 			} break;
1690*cdf0e10cSrcweir 		case XML_flowChartOfflineStorage: {
1691*cdf0e10cSrcweir             static const OUString sFlowChartOfflineStorage = CREATE_OUSTRING( "mso-spt129" );
1692*cdf0e10cSrcweir 			sType = sFlowChartOfflineStorage;
1693*cdf0e10cSrcweir 			} break;
1694*cdf0e10cSrcweir 		case XML_flowChartOnlineStorage: {
1695*cdf0e10cSrcweir             static const OUString sFlowChartOnlineStorage = CREATE_OUSTRING( "flowchart-stored-data" );
1696*cdf0e10cSrcweir 			sType = sFlowChartOnlineStorage;
1697*cdf0e10cSrcweir 			} break;
1698*cdf0e10cSrcweir 		case XML_flowChartMagneticTape: {
1699*cdf0e10cSrcweir             static const OUString sFlowChartMagneticTape = CREATE_OUSTRING( "flowchart-sequential-access" );
1700*cdf0e10cSrcweir 			sType = sFlowChartMagneticTape;
1701*cdf0e10cSrcweir 			} break;
1702*cdf0e10cSrcweir 		case XML_flowChartMagneticDisk: {
1703*cdf0e10cSrcweir             static const OUString sFlowChartMagneticDisk = CREATE_OUSTRING( "flowchart-magnetic-disk" );
1704*cdf0e10cSrcweir 			sType = sFlowChartMagneticDisk;
1705*cdf0e10cSrcweir 			} break;
1706*cdf0e10cSrcweir 		case XML_flowChartMagneticDrum: {
1707*cdf0e10cSrcweir             static const OUString sFlowChartMagneticDrum = CREATE_OUSTRING( "flowchart-direct-access-storage" );
1708*cdf0e10cSrcweir 			sType = sFlowChartMagneticDrum;
1709*cdf0e10cSrcweir 			} break;
1710*cdf0e10cSrcweir 		case XML_flowChartDisplay: {
1711*cdf0e10cSrcweir             static const OUString sFlowChartDisplay = CREATE_OUSTRING( "flowchart-display" );
1712*cdf0e10cSrcweir 			sType = sFlowChartDisplay;
1713*cdf0e10cSrcweir 			} break;
1714*cdf0e10cSrcweir 		case XML_flowChartDelay: {
1715*cdf0e10cSrcweir             static const OUString sFlowChartDelay = CREATE_OUSTRING( "flowchart-delay" );
1716*cdf0e10cSrcweir 			sType = sFlowChartDelay;
1717*cdf0e10cSrcweir 			} break;
1718*cdf0e10cSrcweir 		case XML_flowChartAlternateProcess: {
1719*cdf0e10cSrcweir             static const OUString sFlowChartAlternateProcess = CREATE_OUSTRING( "flowchart-alternate-process" );
1720*cdf0e10cSrcweir 			sType = sFlowChartAlternateProcess;
1721*cdf0e10cSrcweir 			} break;
1722*cdf0e10cSrcweir 		case XML_flowChartOffpageConnector: {
1723*cdf0e10cSrcweir             static const OUString sFlowChartOffpageConnector = CREATE_OUSTRING( "flowchart-off-page-connector" );
1724*cdf0e10cSrcweir 			sType = sFlowChartOffpageConnector;
1725*cdf0e10cSrcweir 			} break;
1726*cdf0e10cSrcweir 		case XML_actionButtonBlank: {
1727*cdf0e10cSrcweir             static const OUString sActionButtonBlank = CREATE_OUSTRING( "mso-spt189" );
1728*cdf0e10cSrcweir 			sType = sActionButtonBlank;
1729*cdf0e10cSrcweir 			} break;
1730*cdf0e10cSrcweir 		case XML_actionButtonHome: {
1731*cdf0e10cSrcweir             static const OUString sActionButtonHome = CREATE_OUSTRING( "mso-spt190" );
1732*cdf0e10cSrcweir 			sType = sActionButtonHome;
1733*cdf0e10cSrcweir 			} break;
1734*cdf0e10cSrcweir 		case XML_actionButtonHelp: {
1735*cdf0e10cSrcweir             static const OUString sActionButtonHelp = CREATE_OUSTRING( "mso-spt191" );
1736*cdf0e10cSrcweir 			sType = sActionButtonHelp;
1737*cdf0e10cSrcweir 			} break;
1738*cdf0e10cSrcweir 		case XML_actionButtonInformation: {
1739*cdf0e10cSrcweir             static const OUString sActionButtonInformation = CREATE_OUSTRING( "mso-spt192" );
1740*cdf0e10cSrcweir 			sType = sActionButtonInformation;
1741*cdf0e10cSrcweir 			} break;
1742*cdf0e10cSrcweir 		case XML_actionButtonForwardNext: {
1743*cdf0e10cSrcweir             static const OUString sActionButtonForwardNext = CREATE_OUSTRING( "mso-spt193" );
1744*cdf0e10cSrcweir 			sType = sActionButtonForwardNext;
1745*cdf0e10cSrcweir 			} break;
1746*cdf0e10cSrcweir 		case XML_actionButtonBackPrevious: {
1747*cdf0e10cSrcweir             static const OUString sActionButtonBackPrevious = CREATE_OUSTRING( "mso-spt194" );
1748*cdf0e10cSrcweir 			sType = sActionButtonBackPrevious;
1749*cdf0e10cSrcweir 			} break;
1750*cdf0e10cSrcweir 		case XML_actionButtonEnd: {
1751*cdf0e10cSrcweir             static const OUString sActionButtonEnd = CREATE_OUSTRING( "mso-spt195" );
1752*cdf0e10cSrcweir 			sType = sActionButtonEnd;
1753*cdf0e10cSrcweir 			} break;
1754*cdf0e10cSrcweir 		case XML_actionButtonBeginning: {
1755*cdf0e10cSrcweir             static const OUString sActionButtonBeginning = CREATE_OUSTRING( "mso-spt196" );
1756*cdf0e10cSrcweir 			sType = sActionButtonBeginning;
1757*cdf0e10cSrcweir 			} break;
1758*cdf0e10cSrcweir 		case XML_actionButtonReturn: {
1759*cdf0e10cSrcweir             static const OUString sActionButtonReturn = CREATE_OUSTRING( "mso-spt197" );
1760*cdf0e10cSrcweir 			sType = sActionButtonReturn;
1761*cdf0e10cSrcweir 			} break;
1762*cdf0e10cSrcweir 		case XML_actionButtonDocument: {
1763*cdf0e10cSrcweir             static const OUString sActionButtonDocument = CREATE_OUSTRING( "mso-spt198" );
1764*cdf0e10cSrcweir 			sType = sActionButtonDocument;
1765*cdf0e10cSrcweir 			} break;
1766*cdf0e10cSrcweir 		case XML_actionButtonSound: {
1767*cdf0e10cSrcweir             static const OUString sActionButtonSound = CREATE_OUSTRING( "mso-spt199" );
1768*cdf0e10cSrcweir 			sType = sActionButtonSound;
1769*cdf0e10cSrcweir 			} break;
1770*cdf0e10cSrcweir 		case XML_actionButtonMovie: {
1771*cdf0e10cSrcweir             static const OUString sActionButtonMovie = CREATE_OUSTRING( "mso-spt200" );
1772*cdf0e10cSrcweir 			sType = sActionButtonMovie;
1773*cdf0e10cSrcweir 			} break;
1774*cdf0e10cSrcweir 		case XML_gear6:						// TODO
1775*cdf0e10cSrcweir 		case XML_gear9:						// TODO
1776*cdf0e10cSrcweir 		case XML_funnel:					// TODO
1777*cdf0e10cSrcweir 		case XML_mathPlus:					// TODO
1778*cdf0e10cSrcweir 		case XML_mathMinus:					// TODO
1779*cdf0e10cSrcweir 		case XML_mathMultiply:				// TODO
1780*cdf0e10cSrcweir 		case XML_mathDivide:				// TODO
1781*cdf0e10cSrcweir 		case XML_mathEqual:					// TODO
1782*cdf0e10cSrcweir 		case XML_mathNotEqual:				// TODO
1783*cdf0e10cSrcweir 		case XML_cornerTabs:				// TODO
1784*cdf0e10cSrcweir 		case XML_squareTabs:				// TODO
1785*cdf0e10cSrcweir 		case XML_plaqueTabs:				// TODO
1786*cdf0e10cSrcweir 		case XML_chartX:					// TODO
1787*cdf0e10cSrcweir 		case XML_chartStar:					// TODO
1788*cdf0e10cSrcweir 		case XML_chartPlus: {				// TODO
1789*cdf0e10cSrcweir             static const OUString sRectangle = CREATE_OUSTRING( "rectangle" );
1790*cdf0e10cSrcweir 			sType = sRectangle;
1791*cdf0e10cSrcweir 			} break;
1792*cdf0e10cSrcweir 		default:
1793*cdf0e10cSrcweir 			break;
1794*cdf0e10cSrcweir 	}
1795*cdf0e10cSrcweir 	return sType;
1796*cdf0e10cSrcweir }
1797*cdf0e10cSrcweir 
1798*cdf0e10cSrcweir static OUString GetTextShapeType( sal_Int32 nType )
1799*cdf0e10cSrcweir {
1800*cdf0e10cSrcweir 	OUString sType;
1801*cdf0e10cSrcweir 	switch( nType )
1802*cdf0e10cSrcweir 	{
1803*cdf0e10cSrcweir 		case XML_textNoShape:				// TODO
1804*cdf0e10cSrcweir 		case XML_textPlain: {
1805*cdf0e10cSrcweir             static const OUString sTextPlain = CREATE_OUSTRING( "fontwork-plain-text" );
1806*cdf0e10cSrcweir 			sType = sTextPlain;
1807*cdf0e10cSrcweir 			} break;
1808*cdf0e10cSrcweir 		case XML_textStop: {
1809*cdf0e10cSrcweir             static const OUString sTextStop = CREATE_OUSTRING( "fontwork-stop" );
1810*cdf0e10cSrcweir 			sType = sTextStop;
1811*cdf0e10cSrcweir 			} break;
1812*cdf0e10cSrcweir 		case XML_textTriangle: {
1813*cdf0e10cSrcweir             static const OUString sTextTriangle = CREATE_OUSTRING( "fontwork-triangle-up" );
1814*cdf0e10cSrcweir 			sType = sTextTriangle;
1815*cdf0e10cSrcweir 			} break;
1816*cdf0e10cSrcweir 		case XML_textTriangleInverted: {
1817*cdf0e10cSrcweir             static const OUString sTextTriangleInverted = CREATE_OUSTRING( "fontwork-triangle-down" );
1818*cdf0e10cSrcweir 			sType = sTextTriangleInverted;
1819*cdf0e10cSrcweir 			} break;
1820*cdf0e10cSrcweir 		case XML_textChevron: {
1821*cdf0e10cSrcweir             static const OUString sTextChevron = CREATE_OUSTRING( "fontwork-chevron-up" );
1822*cdf0e10cSrcweir 			sType = sTextChevron;
1823*cdf0e10cSrcweir 			} break;
1824*cdf0e10cSrcweir 		case XML_textChevronInverted: {
1825*cdf0e10cSrcweir             static const OUString sTextChevronInverted = CREATE_OUSTRING( "fontwork-chevron-down" );
1826*cdf0e10cSrcweir 			sType = sTextChevronInverted;
1827*cdf0e10cSrcweir 			} break;
1828*cdf0e10cSrcweir 		case XML_textRingInside: {
1829*cdf0e10cSrcweir             static const OUString sTextRingInside = CREATE_OUSTRING( "mso-spt142" );
1830*cdf0e10cSrcweir 			sType = sTextRingInside;
1831*cdf0e10cSrcweir 			} break;
1832*cdf0e10cSrcweir 		case XML_textRingOutside: {
1833*cdf0e10cSrcweir             static const OUString sTextRingOutside = CREATE_OUSTRING( "mso-spt143" );
1834*cdf0e10cSrcweir 			sType = sTextRingOutside;
1835*cdf0e10cSrcweir 			} break;
1836*cdf0e10cSrcweir 		case XML_textArchUp: {
1837*cdf0e10cSrcweir             static const OUString sTextArchUp = CREATE_OUSTRING( "fontwork-arch-up-curve" );
1838*cdf0e10cSrcweir 			sType = sTextArchUp;
1839*cdf0e10cSrcweir 			} break;
1840*cdf0e10cSrcweir 		case XML_textArchDown: {
1841*cdf0e10cSrcweir             static const OUString sTextArchDown = CREATE_OUSTRING( "fontwork-arch-down-curve" );
1842*cdf0e10cSrcweir 			sType = sTextArchDown;
1843*cdf0e10cSrcweir 			} break;
1844*cdf0e10cSrcweir 		case XML_textCircle: {
1845*cdf0e10cSrcweir             static const OUString sTextCircle = CREATE_OUSTRING( "fontwork-circle-curve" );
1846*cdf0e10cSrcweir 			sType = sTextCircle;
1847*cdf0e10cSrcweir 			} break;
1848*cdf0e10cSrcweir 		case XML_textButton: {
1849*cdf0e10cSrcweir             static const OUString sTextButton = CREATE_OUSTRING( "fontwork-open-circle-curve" );
1850*cdf0e10cSrcweir 			sType = sTextButton;
1851*cdf0e10cSrcweir 			} break;
1852*cdf0e10cSrcweir 		case XML_textArchUpPour: {
1853*cdf0e10cSrcweir             static const OUString sTextArchUpPour = CREATE_OUSTRING( "fontwork-arch-up-pour" );
1854*cdf0e10cSrcweir 			sType = sTextArchUpPour;
1855*cdf0e10cSrcweir 			} break;
1856*cdf0e10cSrcweir 		case XML_textArchDownPour: {
1857*cdf0e10cSrcweir             static const OUString sTextArchDownPour = CREATE_OUSTRING( "fontwork-arch-down-pour" );
1858*cdf0e10cSrcweir 			sType = sTextArchDownPour;
1859*cdf0e10cSrcweir 			} break;
1860*cdf0e10cSrcweir 		case XML_textCirclePour: {
1861*cdf0e10cSrcweir             static const OUString sTextCirclePour = CREATE_OUSTRING( "fontwork-circle-pour" );
1862*cdf0e10cSrcweir 			sType = sTextCirclePour;
1863*cdf0e10cSrcweir 			} break;
1864*cdf0e10cSrcweir 		case XML_textButtonPour: {
1865*cdf0e10cSrcweir             static const OUString sTextButtonPour = CREATE_OUSTRING( "fontwork-open-circle-pour" );
1866*cdf0e10cSrcweir 			sType = sTextButtonPour;
1867*cdf0e10cSrcweir 			} break;
1868*cdf0e10cSrcweir 		case XML_textCurveUp: {
1869*cdf0e10cSrcweir             static const OUString sTextCurveUp = CREATE_OUSTRING( "fontwork-curve-up" );
1870*cdf0e10cSrcweir 			sType = sTextCurveUp;
1871*cdf0e10cSrcweir 			} break;
1872*cdf0e10cSrcweir 		case XML_textCurveDown: {
1873*cdf0e10cSrcweir             static const OUString sTextCurveDown = CREATE_OUSTRING( "fontwork-curve-down" );
1874*cdf0e10cSrcweir 			sType = sTextCurveDown;
1875*cdf0e10cSrcweir 			} break;
1876*cdf0e10cSrcweir 		case XML_textCanUp: {
1877*cdf0e10cSrcweir             static const OUString sTextCanUp = CREATE_OUSTRING( "mso-spt174" );
1878*cdf0e10cSrcweir 			sType = sTextCanUp;
1879*cdf0e10cSrcweir 			} break;
1880*cdf0e10cSrcweir 		case XML_textCanDown: {
1881*cdf0e10cSrcweir             static const OUString sTextCanDown = CREATE_OUSTRING( "mso-spt175" );
1882*cdf0e10cSrcweir 			sType = sTextCanDown;
1883*cdf0e10cSrcweir 			} break;
1884*cdf0e10cSrcweir 		case XML_textWave1: {
1885*cdf0e10cSrcweir             static const OUString sTextWave1 = CREATE_OUSTRING( "fontwork-wave" );
1886*cdf0e10cSrcweir 			sType = sTextWave1;
1887*cdf0e10cSrcweir 			} break;
1888*cdf0e10cSrcweir 		case XML_textWave2: {
1889*cdf0e10cSrcweir             static const OUString sTextWave2 = CREATE_OUSTRING( "mso-spt157" );
1890*cdf0e10cSrcweir 			sType = sTextWave2;
1891*cdf0e10cSrcweir 			} break;
1892*cdf0e10cSrcweir 		case XML_textDoubleWave1: {
1893*cdf0e10cSrcweir             static const OUString sTextDoubleWave1 = CREATE_OUSTRING( "mso-spt158" );
1894*cdf0e10cSrcweir 			sType = sTextDoubleWave1;
1895*cdf0e10cSrcweir 			} break;
1896*cdf0e10cSrcweir 		case XML_textWave4: {
1897*cdf0e10cSrcweir             static const OUString sTextWave4 = CREATE_OUSTRING( "mso-spt159" );
1898*cdf0e10cSrcweir 			sType = sTextWave4;
1899*cdf0e10cSrcweir 			} break;
1900*cdf0e10cSrcweir 		case XML_textInflate: {
1901*cdf0e10cSrcweir             static const OUString sTextInflate = CREATE_OUSTRING( "fontwork-inflate" );
1902*cdf0e10cSrcweir 			sType = sTextInflate;
1903*cdf0e10cSrcweir 			} break;
1904*cdf0e10cSrcweir 		case XML_textDeflate: {
1905*cdf0e10cSrcweir             static const OUString sTextDeflate = CREATE_OUSTRING( "mso-spt161" );
1906*cdf0e10cSrcweir 			sType = sTextDeflate;
1907*cdf0e10cSrcweir 			} break;
1908*cdf0e10cSrcweir 		case XML_textInflateBottom: {
1909*cdf0e10cSrcweir             static const OUString sTextInflateBottom = CREATE_OUSTRING( "mso-spt162" );
1910*cdf0e10cSrcweir 			sType = sTextInflateBottom;
1911*cdf0e10cSrcweir 			} break;
1912*cdf0e10cSrcweir 		case XML_textDeflateBottom: {
1913*cdf0e10cSrcweir             static const OUString sTextDeflateBottom = CREATE_OUSTRING( "mso-spt163" );
1914*cdf0e10cSrcweir 			sType = sTextDeflateBottom;
1915*cdf0e10cSrcweir 			} break;
1916*cdf0e10cSrcweir 		case XML_textInflateTop: {
1917*cdf0e10cSrcweir             static const OUString sTextInflateTop = CREATE_OUSTRING( "mso-spt164" );
1918*cdf0e10cSrcweir 			sType = sTextInflateTop;
1919*cdf0e10cSrcweir 			} break;
1920*cdf0e10cSrcweir 		case XML_textDeflateTop: {
1921*cdf0e10cSrcweir             static const OUString sTextDeflateTop = CREATE_OUSTRING( "mso-spt165" );
1922*cdf0e10cSrcweir 			sType = sTextDeflateTop;
1923*cdf0e10cSrcweir 			} break;
1924*cdf0e10cSrcweir 		case XML_textDeflateInflate: {
1925*cdf0e10cSrcweir             static const OUString sTextDeflateInflate = CREATE_OUSTRING( "mso-spt166" );
1926*cdf0e10cSrcweir 			sType = sTextDeflateInflate;
1927*cdf0e10cSrcweir 			} break;
1928*cdf0e10cSrcweir 		case XML_textDeflateInflateDeflate: {
1929*cdf0e10cSrcweir             static const OUString sTextDeflateInflateDeflate = CREATE_OUSTRING( "mso-spt167" );
1930*cdf0e10cSrcweir 			sType = sTextDeflateInflateDeflate;
1931*cdf0e10cSrcweir 			} break;
1932*cdf0e10cSrcweir 		case XML_textFadeRight: {
1933*cdf0e10cSrcweir             static const OUString sTextFadeRight = CREATE_OUSTRING( "fontwork-fade-right" );
1934*cdf0e10cSrcweir 			sType = sTextFadeRight;
1935*cdf0e10cSrcweir 			} break;
1936*cdf0e10cSrcweir 		case XML_textFadeLeft: {
1937*cdf0e10cSrcweir             static const OUString sTextFadeLeft = CREATE_OUSTRING( "fontwork-fade-left" );
1938*cdf0e10cSrcweir 			sType = sTextFadeLeft;
1939*cdf0e10cSrcweir 			} break;
1940*cdf0e10cSrcweir 		case XML_textFadeUp: {
1941*cdf0e10cSrcweir             static const OUString sTextFadeUp = CREATE_OUSTRING( "fontwork-fade-up" );
1942*cdf0e10cSrcweir 			sType = sTextFadeUp;
1943*cdf0e10cSrcweir 			} break;
1944*cdf0e10cSrcweir 		case XML_textFadeDown: {
1945*cdf0e10cSrcweir             static const OUString sTextFadeDown = CREATE_OUSTRING( "fontwork-fade-down" );
1946*cdf0e10cSrcweir 			sType = sTextFadeDown;
1947*cdf0e10cSrcweir 			} break;
1948*cdf0e10cSrcweir 		case XML_textSlantUp: {
1949*cdf0e10cSrcweir             static const OUString sTextSlantUp = CREATE_OUSTRING( "fontwork-slant-up" );
1950*cdf0e10cSrcweir 			sType = sTextSlantUp;
1951*cdf0e10cSrcweir 			} break;
1952*cdf0e10cSrcweir 		case XML_textSlantDown: {
1953*cdf0e10cSrcweir             static const OUString sTextSlantDown = CREATE_OUSTRING( "fontwork-slant-down" );
1954*cdf0e10cSrcweir 			sType = sTextSlantDown;
1955*cdf0e10cSrcweir 			} break;
1956*cdf0e10cSrcweir 		case XML_textCascadeUp: {
1957*cdf0e10cSrcweir             static const OUString sTextCascadeUp = CREATE_OUSTRING( "fontwork-fade-up-and-right" );
1958*cdf0e10cSrcweir 			sType = sTextCascadeUp;
1959*cdf0e10cSrcweir 			} break;
1960*cdf0e10cSrcweir 		case XML_textCascadeDown: {
1961*cdf0e10cSrcweir             static const OUString sTextCascadeDown = CREATE_OUSTRING( "fontwork-fade-up-and-left" );
1962*cdf0e10cSrcweir 			sType = sTextCascadeDown;
1963*cdf0e10cSrcweir 			} break;
1964*cdf0e10cSrcweir 		default:
1965*cdf0e10cSrcweir 		break;
1966*cdf0e10cSrcweir 	}
1967*cdf0e10cSrcweir 	return sType;
1968*cdf0e10cSrcweir }
1969*cdf0e10cSrcweir 
1970*cdf0e10cSrcweir // ---------------------------------------------------------------------
1971*cdf0e10cSrcweir // CT_CustomGeometry2D
1972*cdf0e10cSrcweir CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& /* xAttribs */, CustomShapeProperties& rCustomShapeProperties )
1973*cdf0e10cSrcweir : ContextHandler( rParent )
1974*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
1975*cdf0e10cSrcweir {
1976*cdf0e10cSrcweir }
1977*cdf0e10cSrcweir 
1978*cdf0e10cSrcweir Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
1979*cdf0e10cSrcweir {
1980*cdf0e10cSrcweir 	Reference< XFastContextHandler > xContext;
1981*cdf0e10cSrcweir 	switch( aElementToken )
1982*cdf0e10cSrcweir 	{
1983*cdf0e10cSrcweir 		case A_TOKEN( avLst ):			// CT_GeomGuideList adjust value list
1984*cdf0e10cSrcweir 			xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
1985*cdf0e10cSrcweir 		break;
1986*cdf0e10cSrcweir 		case A_TOKEN( gdLst ):			// CT_GeomGuideList guide list
1987*cdf0e10cSrcweir 			xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getGuideList() );
1988*cdf0e10cSrcweir 		break;
1989*cdf0e10cSrcweir 		case A_TOKEN( ahLst ):			// CT_AdjustHandleList adjust handle list
1990*cdf0e10cSrcweir 			xContext = new AdjustHandleListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustHandleList() );
1991*cdf0e10cSrcweir 		break;
1992*cdf0e10cSrcweir 		case A_TOKEN( cxnLst ):			// CT_ConnectionSiteList connection site list
1993*cdf0e10cSrcweir 			xContext = this;
1994*cdf0e10cSrcweir 		break;
1995*cdf0e10cSrcweir 		case A_TOKEN( rect ):			// CT_GeomRectList geometry rect list
1996*cdf0e10cSrcweir 		{
1997*cdf0e10cSrcweir 			GeomRect aGeomRect;
1998*cdf0e10cSrcweir 			aGeomRect.l = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_l ), sal_True );
1999*cdf0e10cSrcweir 			aGeomRect.t = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_t ), sal_True );
2000*cdf0e10cSrcweir 			aGeomRect.r = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_r ), sal_True );
2001*cdf0e10cSrcweir 			aGeomRect.b = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_b ), sal_True );
2002*cdf0e10cSrcweir 			mrCustomShapeProperties.getTextRect() = aGeomRect;
2003*cdf0e10cSrcweir 		}
2004*cdf0e10cSrcweir 		break;
2005*cdf0e10cSrcweir 		case A_TOKEN( pathLst ):		// CT_Path2DList 2d path list
2006*cdf0e10cSrcweir 			xContext = new Path2DListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getSegments(), mrCustomShapeProperties.getPath2DList() );
2007*cdf0e10cSrcweir 		break;
2008*cdf0e10cSrcweir 
2009*cdf0e10cSrcweir 		// from cxnLst:
2010*cdf0e10cSrcweir 		case A_TOKEN( cxn ):				// CT_ConnectionSite
2011*cdf0e10cSrcweir 		{
2012*cdf0e10cSrcweir 			ConnectionSite aConnectionSite;
2013*cdf0e10cSrcweir 			mrCustomShapeProperties.getConnectionSiteList().push_back( aConnectionSite );
2014*cdf0e10cSrcweir 			xContext = new ConnectionSiteContext( *this, xAttribs, mrCustomShapeProperties, mrCustomShapeProperties.getConnectionSiteList().back() );
2015*cdf0e10cSrcweir 		}
2016*cdf0e10cSrcweir 		break;
2017*cdf0e10cSrcweir 	}
2018*cdf0e10cSrcweir 	return xContext;
2019*cdf0e10cSrcweir }
2020*cdf0e10cSrcweir 
2021*cdf0e10cSrcweir // ---------------------------------------------------------------------
2022*cdf0e10cSrcweir // CT_PresetGeometry2D
2023*cdf0e10cSrcweir PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties )
2024*cdf0e10cSrcweir : ContextHandler( rParent )
2025*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
2026*cdf0e10cSrcweir {
2027*cdf0e10cSrcweir 	OUString sShapeType;
2028*cdf0e10cSrcweir 	sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
2029*cdf0e10cSrcweir 	if ( nShapeType != FastToken::DONTKNOW )
2030*cdf0e10cSrcweir 		sShapeType = GetShapeType( nShapeType );
2031*cdf0e10cSrcweir 	OSL_ENSURE( sShapeType.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
2032*cdf0e10cSrcweir 	mrCustomShapeProperties.setShapePresetType( sShapeType );
2033*cdf0e10cSrcweir }
2034*cdf0e10cSrcweir 
2035*cdf0e10cSrcweir Reference< XFastContextHandler > PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
2036*cdf0e10cSrcweir {
2037*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( avLst ) )
2038*cdf0e10cSrcweir         return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
2039*cdf0e10cSrcweir 	else
2040*cdf0e10cSrcweir 		return this;
2041*cdf0e10cSrcweir }
2042*cdf0e10cSrcweir 
2043*cdf0e10cSrcweir // ---------------------------------------------------------------------
2044*cdf0e10cSrcweir // CT_PresetTextShape
2045*cdf0e10cSrcweir PresetTextShapeContext::PresetTextShapeContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties )
2046*cdf0e10cSrcweir : ContextHandler( rParent )
2047*cdf0e10cSrcweir , mrCustomShapeProperties( rCustomShapeProperties )
2048*cdf0e10cSrcweir {
2049*cdf0e10cSrcweir 	OUString sShapeType;
2050*cdf0e10cSrcweir 	sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
2051*cdf0e10cSrcweir 	if ( nShapeType != FastToken::DONTKNOW )
2052*cdf0e10cSrcweir 		sShapeType = GetTextShapeType( nShapeType );
2053*cdf0e10cSrcweir 	OSL_ENSURE( sShapeType.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
2054*cdf0e10cSrcweir 	mrCustomShapeProperties.setShapePresetType( sShapeType );
2055*cdf0e10cSrcweir }
2056*cdf0e10cSrcweir 
2057*cdf0e10cSrcweir Reference< XFastContextHandler > PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
2058*cdf0e10cSrcweir {
2059*cdf0e10cSrcweir 	if ( aElementToken == A_TOKEN( avLst ) )
2060*cdf0e10cSrcweir         return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
2061*cdf0e10cSrcweir 	else
2062*cdf0e10cSrcweir 		return this;
2063*cdf0e10cSrcweir }
2064*cdf0e10cSrcweir 
2065*cdf0e10cSrcweir } }
2066