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