Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "ximpcustomshape.hxx"
30 : : #include "ximpshap.hxx"
31 : : #include <rtl/math.hxx>
32 : : #include <rtl/ustrbuf.hxx>
33 : : #include <rtl/ustring.hxx>
34 : : #include <com/sun/star/uno/Reference.h>
35 : : #include <com/sun/star/beans/XPropertySet.hpp>
36 : : #include <com/sun/star/xml/sax/XAttributeList.hpp>
37 : : #include <com/sun/star/container/XIndexContainer.hpp>
38 : : #include <xmloff/xmltoken.hxx>
39 : : #include "EnhancedCustomShapeToken.hxx"
40 : : #include <xmloff/xmlimp.hxx>
41 : : #include <xmloff/xmltkmap.hxx>
42 : : #include "xmloff/xmlnmspe.hxx"
43 : : #include <xmloff/nmspmap.hxx>
44 : : #include <xmloff/xmluconv.hxx>
45 : : #include "xexptran.hxx"
46 : : #include "xmloff/xmlerror.hxx"
47 : : #include <com/sun/star/drawing/Direction3D.hpp>
48 : : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
49 : : #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
50 : : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
51 : : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
52 : : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
53 : : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
54 : : #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
55 : : #include <com/sun/star/drawing/ProjectionMode.hpp>
56 : : #include <boost/unordered_map.hpp>
57 : : #include <sax/tools/converter.hxx>
58 : :
59 : : using namespace ::com::sun::star;
60 : : using namespace ::xmloff::token;
61 : : using namespace ::xmloff::EnhancedCustomShapeToken;
62 : :
63 [ # # ][ # # ]: 0 : TYPEINIT1( XMLEnhancedCustomShapeContext, SvXMLImportContext );
64 : :
65 : 186 : XMLEnhancedCustomShapeContext::XMLEnhancedCustomShapeContext( SvXMLImport& rImport,
66 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
67 : : sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
68 : : std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry ) :
69 : : SvXMLImportContext( rImport, nPrefix, rLocalName ),
70 : 186 : mrUnitConverter( rImport.GetMM100UnitConverter() ),
71 : : mrxShape( rxShape ),
72 [ + - ][ + - ]: 372 : mrCustomShapeGeometry( rCustomShapeGeometry )
[ + - ][ + - ]
[ + - ][ + - ]
73 : : {
74 : 186 : }
75 : :
76 : : const SvXMLEnumMapEntry aXML_GluePointEnumMap[] =
77 : : {
78 : : { XML_NONE, 0 },
79 : : { XML_SEGMENTS, 1 },
80 : : { XML_NONE, 2 },
81 : : { XML_RECTANGLE, 3 },
82 : : { XML_TOKEN_INVALID, 0 }
83 : : };
84 : 54 : void GetBool( std::vector< com::sun::star::beans::PropertyValue >& rDest,
85 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
86 : : {
87 : : bool bAttrBool;
88 [ + - ][ + - ]: 54 : if (::sax::Converter::convertBool( bAttrBool, rValue ))
89 : : {
90 : 54 : beans::PropertyValue aProp;
91 [ + - ]: 54 : aProp.Name = EASGet( eDestProp );
92 [ + - ]: 54 : aProp.Value <<= bAttrBool;
93 [ + - ]: 54 : rDest.push_back( aProp );
94 : : }
95 : 54 : }
96 : :
97 : 0 : void GetInt32( std::vector< com::sun::star::beans::PropertyValue >& rDest,
98 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
99 : : {
100 : : sal_Int32 nAttrNumber;
101 [ # # ][ # # ]: 0 : if (::sax::Converter::convertNumber( nAttrNumber, rValue ))
102 : : {
103 : 0 : beans::PropertyValue aProp;
104 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
105 [ # # ]: 0 : aProp.Value <<= nAttrNumber;
106 [ # # ]: 0 : rDest.push_back( aProp );
107 : : }
108 : 0 : }
109 : :
110 : 0 : void GetDouble( std::vector< com::sun::star::beans::PropertyValue >& rDest,
111 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
112 : : {
113 : : double fAttrDouble;
114 [ # # ][ # # ]: 0 : if (::sax::Converter::convertDouble( fAttrDouble, rValue ))
115 : : {
116 : 0 : beans::PropertyValue aProp;
117 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
118 [ # # ]: 0 : aProp.Value <<= fAttrDouble;
119 [ # # ]: 0 : rDest.push_back( aProp );
120 : : }
121 : 0 : }
122 : :
123 : 0 : void GetDistance( std::vector< com::sun::star::beans::PropertyValue >& rDest,
124 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
125 : : {
126 : : double fAttrDouble;
127 : : sal_Int16 const eSrcUnit( ::sax::Converter::GetUnitFromString(
128 [ # # ]: 0 : rValue, util::MeasureUnit::MM_100TH) );
129 [ # # ][ # # ]: 0 : if (::sax::Converter::convertDouble(fAttrDouble, rValue, eSrcUnit,
130 : 0 : util::MeasureUnit::MM_100TH))
131 : : {
132 : 0 : beans::PropertyValue aProp;
133 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
134 [ # # ]: 0 : aProp.Value <<= fAttrDouble;
135 [ # # ]: 0 : rDest.push_back( aProp );
136 : : }
137 : 0 : }
138 : :
139 : 186 : void GetString( std::vector< com::sun::star::beans::PropertyValue >& rDest,
140 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
141 : : {
142 : 186 : beans::PropertyValue aProp;
143 [ + - ]: 186 : aProp.Name = EASGet( eDestProp );
144 [ + - ]: 186 : aProp.Value <<= rValue;
145 [ + - ]: 186 : rDest.push_back( aProp );
146 : 186 : }
147 : :
148 : 6 : void GetEnum( std::vector< com::sun::star::beans::PropertyValue >& rDest,
149 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
150 : : const SvXMLEnumMapEntry& rMap )
151 : : {
152 : : sal_uInt16 eKind;
153 [ + - ][ + - ]: 6 : if( SvXMLUnitConverter::convertEnum( eKind, rValue, &rMap ) )
154 : : {
155 : 6 : sal_Int16 nEnum = (sal_Int16)eKind;
156 : 6 : beans::PropertyValue aProp;
157 [ + - ]: 6 : aProp.Name = EASGet( eDestProp );
158 [ + - ]: 6 : aProp.Value <<= nEnum;
159 [ + - ]: 6 : rDest.push_back( aProp );
160 : : }
161 : 6 : }
162 : :
163 : 0 : void GetDoublePercentage( std::vector< com::sun::star::beans::PropertyValue >& rDest,
164 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
165 : : {
166 : : sal_Int16 const eSrcUnit = ::sax::Converter::GetUnitFromString(
167 : 0 : rValue, util::MeasureUnit::MM_100TH);
168 [ # # ]: 0 : if (util::MeasureUnit::PERCENT == eSrcUnit)
169 : : {
170 : : rtl_math_ConversionStatus eStatus;
171 : : double fAttrDouble = ::rtl::math::stringToDouble( rValue,
172 : 0 : (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
173 [ # # ]: 0 : if ( eStatus == rtl_math_ConversionStatus_Ok )
174 : : {
175 : 0 : beans::PropertyValue aProp;
176 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
177 [ # # ]: 0 : aProp.Value <<= fAttrDouble;
178 [ # # ]: 0 : rDest.push_back( aProp );
179 : : }
180 : : }
181 : 0 : }
182 : :
183 : 0 : void GetB3DVector( std::vector< com::sun::star::beans::PropertyValue >& rDest,
184 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
185 : : {
186 : 0 : ::basegfx::B3DVector aB3DVector;
187 [ # # ][ # # ]: 0 : if ( SvXMLUnitConverter::convertB3DVector( aB3DVector, rValue ) )
188 : : {
189 : 0 : drawing::Direction3D aDirection3D( aB3DVector.getX(), aB3DVector.getY(), aB3DVector.getZ() );
190 : 0 : beans::PropertyValue aProp;
191 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
192 [ # # ]: 0 : aProp.Value <<= aDirection3D;
193 [ # # ]: 0 : rDest.push_back( aProp );
194 : 0 : }
195 : 0 : }
196 : :
197 : 4560 : sal_Bool GetEquationName( const rtl::OUString& rEquation, const sal_Int32 nStart, rtl::OUString& rEquationName )
198 : : {
199 : 4560 : sal_Int32 nIndex = nStart;
200 [ + + ]: 14853 : while( nIndex < rEquation.getLength() )
201 : : {
202 : 14652 : sal_Unicode nChar = rEquation[ nIndex ];
203 [ - + ][ - + ]: 14652 : if (
[ # # ][ + + ]
[ + - ][ + + ]
204 : : ( ( nChar >= 'a' ) && ( nChar <= 'z' ) )
205 : : || ( ( nChar >= 'A' ) && ( nChar <= 'Z' ) )
206 : : || ( ( nChar >= '0' ) && ( nChar <= '9' ) )
207 : : )
208 : : {
209 : 10293 : nIndex++;
210 : : }
211 : : else
212 : 4359 : break;
213 : : }
214 : 4560 : sal_Bool bValid = ( nIndex - nStart ) != 0;
215 [ + - ]: 4560 : if ( bValid )
216 : 4560 : rEquationName = rEquation.copy( nStart, nIndex - nStart );
217 : 4560 : return bValid;
218 : : }
219 : :
220 : 10920 : sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, sal_Int32& nIndex, const rtl::OUString& rParaString )
221 : : {
222 [ + + ]: 10920 : if ( nIndex >= rParaString.getLength() )
223 : 384 : return sal_False;
224 : :
225 : 10536 : sal_Bool bValid = sal_True;
226 : 10536 : sal_Bool bNumberRequired = sal_True;
227 : 10536 : sal_Bool bMustBePositiveWholeNumbered = sal_False;
228 : :
229 : 10536 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL;
230 [ + + ]: 10536 : if ( rParaString[ nIndex ] == (sal_Unicode)'$' )
231 : : {
232 : 144 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT;
233 : 144 : bMustBePositiveWholeNumbered = sal_True;
234 : 144 : nIndex++;
235 : : }
236 [ + + ]: 10392 : else if ( rParaString[ nIndex ] == (sal_Unicode)'?' )
237 : : {
238 : 3159 : nIndex++;
239 : 3159 : bNumberRequired = sal_False;
240 : 3159 : rtl::OUString aEquationName;
241 : 3159 : bValid = GetEquationName( rParaString, nIndex, aEquationName );
242 [ + - ]: 3159 : if ( bValid )
243 : : {
244 : 3159 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION;
245 [ + - ]: 3159 : rParameter.Value <<= aEquationName;
246 : 3159 : nIndex += aEquationName.getLength();
247 : 3159 : }
248 : : }
249 [ + + ]: 7233 : else if ( rParaString[ nIndex ] > (sal_Unicode)'9' )
250 : : {
251 : 75 : bNumberRequired = sal_False;
252 [ + + ]: 75 : if ( rParaString.matchIgnoreAsciiCaseAsciiL( "left", 4, nIndex ) )
253 : : {
254 : 24 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT;
255 : 24 : nIndex += 4;
256 : : }
257 [ + + ]: 51 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "top", 3, nIndex ) )
258 : : {
259 : 39 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP;
260 : 39 : nIndex += 3;
261 : : }
262 [ + + ]: 12 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "right", 5, nIndex ) )
263 : : {
264 : 6 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT;
265 : 6 : nIndex += 5;
266 : : }
267 [ + - ]: 6 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "bottom", 6, nIndex ) )
268 : : {
269 : 6 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM;
270 : 6 : nIndex += 6;
271 : : }
272 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "xstretch", 8, nIndex ) )
273 : : {
274 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH;
275 : 0 : nIndex += 8;
276 : : }
277 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "ystretch", 8, nIndex ) )
278 : : {
279 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH;
280 : 0 : nIndex += 8;
281 : : }
282 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasstroke", 9, nIndex ) )
283 : : {
284 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE;
285 : 0 : nIndex += 9;
286 : : }
287 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasfill", 7, nIndex ) )
288 : : {
289 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL;
290 : 0 : nIndex += 7;
291 : : }
292 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "width", 5, nIndex ) )
293 : : {
294 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH;
295 : 0 : nIndex += 5;
296 : : }
297 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "height", 6, nIndex ) )
298 : : {
299 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT;
300 : 0 : nIndex += 6;
301 : : }
302 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logwidth", 8, nIndex ) )
303 : : {
304 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH;
305 : 0 : nIndex += 8;
306 : : }
307 [ # # ]: 0 : else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logheight", 9, nIndex ) )
308 : : {
309 : 0 : rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT;
310 : 0 : nIndex += 9;
311 : : }
312 : : else
313 : 0 : bValid = sal_False;
314 : : }
315 [ + - ]: 10536 : if ( bValid )
316 : : {
317 [ + + ]: 10536 : if ( bNumberRequired )
318 : : {
319 : 7302 : sal_Int32 nStartIndex = nIndex;
320 : 7302 : sal_Int32 nEIndex = 0; // index of "E" in double
321 : :
322 : 7302 : sal_Bool bE = sal_False; // set if a double is including a "E" statement
323 : 7302 : sal_Bool bENum = sal_False; // there is at least one number after "E"
324 : 7302 : sal_Bool bDot = sal_False; // set if there is a dot included
325 : 7302 : sal_Bool bEnd = sal_False; // set for each value that can not be part of a double/integer
326 : :
327 [ + + ][ + - ]: 33951 : while( ( nIndex < rParaString.getLength() ) && bValid )
[ + + ]
328 : : {
329 [ + + - + : 33288 : switch( rParaString[ nIndex ] )
+ ]
330 : : {
331 : : case '.' :
332 : : {
333 [ - + ]: 3 : if ( bMustBePositiveWholeNumbered )
334 : 0 : bValid = sal_False;
335 : : else
336 : : {
337 [ - + ]: 3 : if ( bDot )
338 : 0 : bValid = sal_False;
339 : : else
340 : 3 : bDot = sal_True;
341 : : }
342 : : }
343 : 3 : break;
344 : : case '-' :
345 : : {
346 [ - + ]: 39 : if ( bMustBePositiveWholeNumbered )
347 : 0 : bValid = sal_False;
348 : : else
349 : : {
350 [ + - ]: 39 : if ( nStartIndex == nIndex )
351 : 39 : bValid = sal_True;
352 [ # # ]: 0 : else if ( bE )
353 : : {
354 [ # # ]: 0 : if ( nEIndex + 1 == nIndex )
355 : 0 : bValid = sal_True;
356 [ # # ]: 0 : else if ( bENum )
357 : 0 : bEnd = sal_True;
358 : : else
359 : 0 : bValid = sal_False;
360 : : }
361 : : }
362 : : }
363 : 39 : break;
364 : :
365 : : case 'e' :
366 : : case 'E' :
367 : : {
368 [ # # ]: 0 : if ( bMustBePositiveWholeNumbered )
369 : 0 : bEnd = sal_True;
370 : : else
371 : : {
372 [ # # ]: 0 : if ( !bE )
373 : : {
374 : 0 : bE = sal_True;
375 : 0 : nEIndex = nIndex;
376 : : }
377 : : else
378 : 0 : bEnd = sal_True;
379 : : }
380 : : }
381 : 0 : break;
382 : : case '0' :
383 : : case '1' :
384 : : case '2' :
385 : : case '3' :
386 : : case '4' :
387 : : case '5' :
388 : : case '6' :
389 : : case '7' :
390 : : case '8' :
391 : : case '9' :
392 : : {
393 [ - + ][ # # ]: 26607 : if ( bE && ! bENum )
394 : 0 : bENum = sal_True;
395 : : }
396 : 26607 : break;
397 : : default:
398 : 6639 : bEnd = sal_True;
399 : : }
400 [ + + ]: 33288 : if ( !bEnd )
401 : 26649 : nIndex++;
402 : : else
403 : 6639 : break;
404 : : }
405 [ - + ]: 7302 : if ( nIndex == nStartIndex )
406 : 0 : bValid = sal_False;
407 [ + - ]: 7302 : if ( bValid )
408 : : {
409 : 7302 : rtl::OUString aNumber( rParaString.copy( nStartIndex, nIndex - nStartIndex ) );
410 [ + + ][ + - ]: 7302 : if ( bE || bDot )
411 : : {
412 : : double fAttrDouble;
413 [ + - ][ + - ]: 3 : if (::sax::Converter::convertDouble(fAttrDouble, aNumber))
414 [ + - ]: 3 : rParameter.Value <<= fAttrDouble;
415 : : else
416 : 3 : bValid = sal_False;
417 : : }
418 : : else
419 : : {
420 : : sal_Int32 nValue;
421 [ + - ][ + - ]: 7299 : if (::sax::Converter::convertNumber(nValue, aNumber))
422 [ + - ]: 7299 : rParameter.Value <<= nValue;
423 : : else
424 : 7299 : bValid = sal_False;
425 : 7302 : }
426 : : }
427 : : }
428 : : }
429 [ + - ]: 10536 : if ( bValid )
430 : : { // skipping white spaces
431 [ + + ][ + + ]: 20244 : while( ( nIndex < rParaString.getLength() ) && rParaString[ nIndex ] == (sal_Unicode)' ' )
[ + + ]
432 : 9708 : nIndex++;
433 : : }
434 : 10920 : return bValid;
435 : : }
436 : :
437 : 3 : void GetPosition3D( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:extrusion-viewpoint
438 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp,
439 : : SvXMLUnitConverter& rUnitConverter )
440 : : {
441 : 3 : drawing::Position3D aPosition3D;
442 [ + - ][ + - ]: 3 : if ( rUnitConverter.convertPosition3D( aPosition3D, rValue ) )
443 : : {
444 : 3 : beans::PropertyValue aProp;
445 [ + - ]: 3 : aProp.Name = EASGet( eDestProp );
446 [ + - ]: 3 : aProp.Value <<= aPosition3D;
447 [ + - ]: 3 : rDest.push_back( aProp );
448 : : }
449 : 3 : }
450 : :
451 : 0 : void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions
452 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
453 : : {
454 [ # # ]: 0 : std::vector< double > vDirection;
455 : 0 : sal_Int32 nIndex = 0;
456 [ # # ]: 0 : do
457 : : {
458 : : double fAttrDouble;
459 : 0 : rtl::OUString aToken( rValue.getToken( 0, ',', nIndex ) );
460 [ # # ][ # # ]: 0 : if (!::sax::Converter::convertDouble( fAttrDouble, aToken ))
461 : : break;
462 : : else
463 [ # # ][ # # ]: 0 : vDirection.push_back( fAttrDouble );
464 : : }
465 : : while ( nIndex >= 0 );
466 : :
467 [ # # ]: 0 : if ( !vDirection.empty() )
468 : : {
469 [ # # ]: 0 : uno::Sequence< double > aDirectionsSeq( vDirection.size() );
470 [ # # ]: 0 : std::vector< double >::const_iterator aIter = vDirection.begin();
471 [ # # ]: 0 : std::vector< double >::const_iterator aEnd = vDirection.end();
472 [ # # ]: 0 : double* pValues = aDirectionsSeq.getArray();
473 : :
474 [ # # ][ # # ]: 0 : while ( aIter != aEnd )
475 [ # # ][ # # ]: 0 : *pValues++ = *aIter++;
476 : :
477 : 0 : beans::PropertyValue aProp;
478 [ # # ]: 0 : aProp.Name = EASGet( eDestProp );
479 [ # # ]: 0 : aProp.Value <<= aDirectionsSeq;
480 [ # # ][ # # ]: 0 : rDest.push_back( aProp );
481 : 0 : }
482 : 0 : }
483 : :
484 : 282 : void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
485 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
486 : : {
487 : 282 : sal_Int32 nIndex = 0;
488 : 282 : com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
489 [ + - ][ + - ]: 282 : if ( GetNextParameter( aParameter, nIndex, rValue ) )
490 : : {
491 : 282 : beans::PropertyValue aProp;
492 [ + - ]: 282 : aProp.Name = EASGet( eDestProp );
493 [ + - ]: 282 : aProp.Value <<= aParameter;
494 [ + - ]: 282 : rDest.push_back( aProp );
495 : 282 : }
496 : 282 : }
497 : :
498 : 153 : void GetEnhancedParameterPair( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
499 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
500 : : {
501 : 153 : sal_Int32 nIndex = 0;
502 : 153 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
503 [ + - ][ + - ]: 306 : if ( GetNextParameter( aParameterPair.First, nIndex, rValue )
[ + - ][ + - ]
504 [ + - ]: 153 : && GetNextParameter( aParameterPair.Second, nIndex, rValue ) )
505 : : {
506 : 153 : beans::PropertyValue aProp;
507 [ + - ]: 153 : aProp.Name = EASGet( eDestProp );
508 [ + - ]: 153 : aProp.Value <<= aParameterPair;
509 [ + - ]: 153 : rDest.push_back( aProp );
510 : 153 : }
511 : 153 : }
512 : :
513 : 99 : sal_Int32 GetEnhancedParameterPairSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-points
514 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
515 : : {
516 [ + - ]: 99 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vParameter;
517 : 99 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameter;
518 : :
519 : 99 : sal_Int32 nIndex = 0;
520 [ + - ][ + + ]: 1113 : while ( GetNextParameter( aParameter.First, nIndex, rValue )
[ + - ][ + + ]
521 [ + - ]: 507 : && GetNextParameter( aParameter.Second, nIndex, rValue ) )
522 : : {
523 [ + - ]: 507 : vParameter.push_back( aParameter );
524 : : }
525 [ + - ]: 99 : if ( !vParameter.empty() )
526 : : {
527 [ + - ]: 99 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aParameterSeq( vParameter.size() );
528 [ + - ]: 99 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aIter = vParameter.begin();
529 [ + - ]: 99 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aEnd = vParameter.end();
530 [ + - ]: 99 : com::sun::star::drawing::EnhancedCustomShapeParameterPair* pValues = aParameterSeq.getArray();
531 : :
532 [ + - ][ + + ]: 606 : while ( aIter != aEnd )
533 [ + - ]: 507 : *pValues++ = *aIter++;
534 : :
535 : 99 : beans::PropertyValue aProp;
536 [ + - ]: 99 : aProp.Name = EASGet( eDestProp );
537 [ + - ]: 99 : aProp.Value <<= aParameterSeq;
538 [ + - ][ + - ]: 99 : rDest.push_back( aProp );
539 : : }
540 : 99 : return vParameter.size();
541 : : }
542 : :
543 : 156 : void GetEnhancedRectangleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:text-areas
544 : : const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
545 : : {
546 [ + - ]: 156 : std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame > vTextFrame;
547 : 156 : com::sun::star::drawing::EnhancedCustomShapeTextFrame aParameter;
548 : :
549 : 156 : sal_Int32 nIndex = 0;
550 : :
551 [ + - ][ + + ]: 792 : while ( GetNextParameter( aParameter.TopLeft.First, nIndex, rValue )
[ + - ][ + - ]
[ + - ][ + + ]
552 [ + - ]: 159 : && GetNextParameter( aParameter.TopLeft.Second, nIndex, rValue )
553 [ + - ]: 159 : && GetNextParameter( aParameter.BottomRight.First, nIndex, rValue )
554 [ + - ]: 159 : && GetNextParameter( aParameter.BottomRight.Second, nIndex, rValue ) )
555 : : {
556 [ + - ]: 159 : vTextFrame.push_back( aParameter );
557 : : }
558 [ + - ]: 156 : if ( !vTextFrame.empty() )
559 : : {
560 [ + - ]: 156 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrameSeq( vTextFrame.size() );
561 [ + - ]: 156 : std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aIter = vTextFrame.begin();
562 [ + - ]: 156 : std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aEnd = vTextFrame.end();
563 [ + - ]: 156 : com::sun::star::drawing::EnhancedCustomShapeTextFrame* pValues = aTextFrameSeq.getArray();
564 : :
565 [ + - ][ + + ]: 315 : while ( aIter != aEnd )
566 [ + - ]: 159 : *pValues++ = *aIter++;
567 : :
568 : 156 : beans::PropertyValue aProp;
569 [ + - ]: 156 : aProp.Name = EASGet( eDestProp );
570 [ + - ]: 156 : aProp.Value <<= aTextFrameSeq;
571 [ + - ][ + - ]: 156 : rDest.push_back( aProp );
572 : 156 : }
573 : 156 : }
574 : :
575 : 186 : void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:enhanced-path
576 : : const rtl::OUString& rValue )
577 : : {
578 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vCoordinates;
579 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment > vSegments;
580 : :
581 : 186 : sal_Int32 nIndex = 0;
582 : 186 : sal_Int32 nParameterCount = 0;
583 : :
584 : 186 : sal_Int32 nParametersNeeded = 1;
585 : 186 : sal_Int16 nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
586 : :
587 : 186 : sal_Bool bValid = sal_True;
588 : :
589 [ + - ][ + + ]: 7959 : while( bValid && ( nIndex < rValue.getLength() ) )
[ + + ]
590 : : {
591 [ + + + + : 7773 : switch( rValue[ nIndex ] )
+ + + - +
- + - + +
+ + - + +
- ]
592 : : {
593 : : case 'M' :
594 : : {
595 : 420 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
596 : 420 : nParametersNeeded = 1;
597 : 420 : nIndex++;
598 : : }
599 : 420 : break;
600 : : case 'L' :
601 : : {
602 : 372 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
603 : 372 : nParametersNeeded = 1;
604 : 372 : nIndex++;
605 : : }
606 : 372 : break;
607 : : case 'C' :
608 : : {
609 : 156 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
610 : 156 : nParametersNeeded = 3;
611 : 156 : nIndex++;
612 : : }
613 : 156 : break;
614 : : case 'Z' :
615 : : {
616 : 369 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
617 : 369 : nParametersNeeded = 0;
618 : 369 : nIndex++;
619 : : }
620 : 369 : break;
621 : : case 'N' :
622 : : {
623 : 408 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
624 : 408 : nParametersNeeded = 0;
625 : 408 : nIndex++;
626 : : }
627 : 408 : break;
628 : : case 'F' :
629 : : {
630 : 36 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL;
631 : 36 : nParametersNeeded = 0;
632 : 36 : nIndex++;
633 : : }
634 : 36 : break;
635 : : case 'S' :
636 : : {
637 : 12 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE;
638 : 12 : nParametersNeeded = 0;
639 : 12 : nIndex++;
640 : : }
641 : 12 : break;
642 : : case 'T' :
643 : : {
644 : 0 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
645 : 0 : nParametersNeeded = 3;
646 : 0 : nIndex++;
647 : : }
648 : 0 : break;
649 : : case 'U' :
650 : : {
651 : 30 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
652 : 30 : nParametersNeeded = 3;
653 : 30 : nIndex++;
654 : : }
655 : 30 : break;
656 : : case 'A' :
657 : : {
658 : 0 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
659 : 0 : nParametersNeeded = 4;
660 : 0 : nIndex++;
661 : : }
662 : 0 : break;
663 : : case 'B' :
664 : : {
665 : 9 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC;
666 : 9 : nParametersNeeded = 4;
667 : 9 : nIndex++;
668 : : }
669 : 9 : break;
670 : : case 'G' :
671 : : {
672 : 0 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO;
673 : 0 : nParametersNeeded = 2;
674 : 0 : nIndex++;
675 : : }
676 : 0 : break;
677 : : case 'W' :
678 : : {
679 : 3 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
680 : 3 : nParametersNeeded = 4;
681 : 3 : nIndex++;
682 : : }
683 : 3 : break;
684 : : case 'V' :
685 : : {
686 : 3 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
687 : 3 : nParametersNeeded = 4;
688 : 3 : nIndex++;
689 : : }
690 : 3 : break;
691 : : case 'X' :
692 : : {
693 : 57 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
694 : 57 : nParametersNeeded = 1;
695 : 57 : nIndex++;
696 : : }
697 : 57 : break;
698 : : case 'Y' :
699 : : {
700 : 66 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
701 : 66 : nParametersNeeded = 1;
702 : 66 : nIndex++;
703 : : }
704 : 66 : break;
705 : : case 'Q' :
706 : : {
707 : 0 : nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
708 : 0 : nParametersNeeded = 2;
709 : 0 : nIndex++;
710 : : }
711 : 0 : break;
712 : : case ' ' :
713 : : {
714 : 1758 : nIndex++;
715 : : }
716 : 1758 : break;
717 : :
718 : : case '$' :
719 : : case '?' :
720 : : case '0' :
721 : : case '1' :
722 : : case '2' :
723 : : case '3' :
724 : : case '4' :
725 : : case '5' :
726 : : case '6' :
727 : : case '7' :
728 : : case '8' :
729 : : case '9' :
730 : : case '.' :
731 : : case '-' :
732 : : {
733 : 4074 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair;
734 [ + - ][ + - ]: 8148 : if ( GetNextParameter( aPair.First, nIndex, rValue ) &&
[ + - ][ + - ]
735 [ + - ]: 4074 : GetNextParameter( aPair.Second, nIndex, rValue ) )
736 : : {
737 [ + - ]: 4074 : vCoordinates.push_back( aPair );
738 : 4074 : nParameterCount++;
739 : : }
740 : : else
741 : 4074 : bValid = sal_False;
742 : : }
743 : 4074 : break;
744 : : default:
745 : 0 : nIndex++;
746 : 0 : break;
747 : : }
748 [ + + ][ + + ]: 7773 : if ( !nParameterCount && !nParametersNeeded )
749 : : {
750 : 825 : com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
751 : 825 : aSegment.Command = nLatestSegmentCommand;
752 : 825 : aSegment.Count = 0;
753 [ + - ]: 825 : vSegments.push_back( aSegment );
754 : 825 : nParametersNeeded = 0x7fffffff;
755 : : }
756 [ + + ]: 6948 : else if ( nParameterCount >= nParametersNeeded )
757 : : {
758 : : // check if the last command is identical,
759 : : // if so, we just need to increment the count
760 [ + + ][ + + ]: 2673 : if ( !vSegments.empty() && ( vSegments[ vSegments.size() - 1 ].Command == nLatestSegmentCommand ) )
[ + + ]
761 : 1557 : vSegments[ vSegments.size() -1 ].Count++;
762 : : else
763 : : {
764 : 1116 : com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
765 : 1116 : aSegment.Command = nLatestSegmentCommand;
766 : 1116 : aSegment.Count = 1;
767 [ + - ]: 1116 : vSegments.push_back( aSegment );
768 : : }
769 : 2673 : nParameterCount = 0;
770 : : }
771 : : }
772 : : // adding the Coordinates property
773 [ + - ]: 186 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > seqCoordinates( vCoordinates.size() );
774 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesIter = vCoordinates.begin();
775 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesEnd = vCoordinates.end();
776 [ + - ]: 186 : com::sun::star::drawing::EnhancedCustomShapeParameterPair* pCoordinateValues = seqCoordinates.getArray();
777 : :
778 [ + - ][ + + ]: 4260 : while ( aCoordinatesIter != aCoordinatesEnd )
779 [ + - ]: 4074 : *pCoordinateValues++ = *aCoordinatesIter++;
780 : :
781 : 186 : beans::PropertyValue aProp;
782 [ + - ]: 186 : aProp.Name = EASGet( EAS_Coordinates );
783 [ + - ]: 186 : aProp.Value <<= seqCoordinates;
784 [ + - ]: 186 : rDest.push_back( aProp );
785 : :
786 : :
787 : : // adding the Segments property
788 [ + - ]: 186 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments( vSegments.size() );
789 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsIter = vSegments.begin();
790 [ + - ]: 186 : std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsEnd = vSegments.end();
791 [ + - ]: 186 : com::sun::star::drawing::EnhancedCustomShapeSegment* pSegmentValues = seqSegments.getArray();
792 : :
793 [ + - ][ + + ]: 2127 : while ( aSegmentsIter != aSegmentsEnd )
794 [ + - ]: 1941 : *pSegmentValues++ = *aSegmentsIter++;
795 : :
796 [ + - ]: 186 : aProp.Name = EASGet( EAS_Segments );
797 [ + - ]: 186 : aProp.Value <<= seqSegments;
798 [ + - ][ + - ]: 186 : rDest.push_back( aProp );
[ + - ]
799 : 186 : }
800 : :
801 : 129 : void GetAdjustmentValues( std::vector< com::sun::star::beans::PropertyValue >& rDest, // draw:adjustments
802 : : const rtl::OUString& rValue )
803 : : {
804 [ + - ]: 129 : std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > vAdjustmentValue;
805 : 129 : com::sun::star::drawing::EnhancedCustomShapeParameter aParameter;
806 : 129 : sal_Int32 nIndex = 0;
807 [ + - ][ + + ]: 273 : while ( GetNextParameter( aParameter, nIndex, rValue ) )
808 : : {
809 : 144 : com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue aAdj;
810 [ + - ]: 144 : if ( aParameter.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL )
811 : : {
812 [ + - ]: 144 : aAdj.Value <<= aParameter.Value;
813 : 144 : aAdj.State = beans::PropertyState_DIRECT_VALUE;
814 : : }
815 : : else
816 : 0 : aAdj.State = beans::PropertyState_DEFAULT_VALUE; // this should not be, but better than setting nothing
817 : :
818 [ + - ]: 144 : vAdjustmentValue.push_back( aAdj );
819 : 144 : }
820 : :
821 : 129 : sal_Int32 nAdjustmentValues = vAdjustmentValue.size();
822 [ + - ]: 129 : if ( nAdjustmentValues )
823 : : {
824 [ + - ]: 129 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( nAdjustmentValues );
825 [ + - ]: 129 : std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aIter = vAdjustmentValue.begin();
826 [ + - ]: 129 : std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aEnd = vAdjustmentValue.end();
827 [ + - ]: 129 : com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue* pValues = aAdjustmentValues.getArray();
828 : :
829 [ + - ][ + + ]: 273 : while ( aIter != aEnd )
830 [ + - ]: 144 : *pValues++ = *aIter++;
831 : :
832 : 129 : beans::PropertyValue aProp;
833 [ + - ]: 129 : aProp.Name = EASGet( EAS_AdjustmentValues );
834 [ + - ]: 129 : aProp.Value <<= aAdjustmentValues;
835 [ + - ][ + - ]: 129 : rDest.push_back( aProp );
836 : 129 : }
837 : 129 : }
838 : :
839 : 186 : void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
840 : : {
841 : 186 : sal_Int16 nLength = xAttrList->getLength();
842 [ + - ]: 186 : if ( nLength )
843 : : {
844 : : sal_Int32 nAttrNumber;
845 [ + + ]: 1263 : for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
846 : : {
847 : 1077 : rtl::OUString aLocalName;
848 [ + - ][ + - ]: 1077 : const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
849 [ + - ][ + - ]: 1077 : /* sven fixme, this must be checked! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
[ + - ]
850 : :
851 [ + + + + : 1077 : switch( EASGet( aLocalName ) )
- - - - -
- + - - -
- - - - -
- - - - -
- + - + +
+ - + + +
+ + + - -
- - - +
- ][ + - ]
852 : : {
853 : : case EAS_type :
854 [ + - ]: 186 : GetString( mrCustomShapeGeometry, rValue, EAS_Type );
855 : 186 : break;
856 : : case EAS_mirror_horizontal :
857 [ + - ]: 9 : GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredX );
858 : 9 : break;
859 : : case EAS_mirror_vertical :
860 [ + - ]: 6 : GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredY );
861 : 6 : break;
862 : : case EAS_viewBox :
863 : : {
864 [ + - ]: 183 : SdXMLImExViewBox aViewBox( rValue, GetImport().GetMM100UnitConverter() );
865 : 183 : awt::Rectangle aRect( aViewBox.GetX(), aViewBox.GetY(), aViewBox.GetWidth(), aViewBox.GetHeight() );
866 : 183 : beans::PropertyValue aProp;
867 [ + - ]: 183 : aProp.Name = EASGet( EAS_ViewBox );
868 [ + - ]: 183 : aProp.Value <<= aRect;
869 [ + - ]: 183 : mrCustomShapeGeometry.push_back( aProp );
870 : : }
871 : 183 : break;
872 : : case EAS_text_rotate_angle :
873 [ # # ]: 0 : GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle );
874 : 0 : break;
875 : : case EAS_extrusion_allowed :
876 [ # # ]: 0 : GetBool( maPath, rValue, EAS_ExtrusionAllowed );
877 : 0 : break;
878 : : case EAS_text_path_allowed :
879 [ # # ]: 0 : GetBool( maPath, rValue, EAS_TextPathAllowed );
880 : 0 : break;
881 : : case EAS_concentric_gradient_fill_allowed :
882 [ # # ]: 0 : GetBool( maPath, rValue, EAS_ConcentricGradientFillAllowed );
883 : 0 : break;
884 : : case EAS_extrusion :
885 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_Extrusion );
886 : 0 : break;
887 : : case EAS_extrusion_brightness :
888 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_Brightness );
889 : 0 : break;
890 : : case EAS_extrusion_depth :
891 : : {
892 : 3 : sal_Int32 nIndex = 0;
893 : 3 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair;
894 : 3 : com::sun::star::drawing::EnhancedCustomShapeParameter& rDepth = aParameterPair.First;
895 : 3 : com::sun::star::drawing::EnhancedCustomShapeParameter& rFraction = aParameterPair.Second;
896 [ + - ][ + - ]: 3 : if ( GetNextParameter( rDepth, nIndex, rValue ) )
897 : : {
898 : : // try to catch the unit for the depth
899 : : sal_Int16 const eSrcUnit(
900 : : ::sax::Converter::GetUnitFromString(
901 [ + - ]: 3 : rValue, util::MeasureUnit::MM_100TH));
902 : :
903 : 3 : rtl::OUStringBuffer aUnitStr;
904 : : double fFactor = ::sax::Converter::GetConversionFactor(
905 [ + - ]: 3 : aUnitStr, util::MeasureUnit::MM_100TH, eSrcUnit);
906 [ + - ][ + - ]: 3 : if ( ( fFactor != 1.0 ) && ( fFactor != 0.0 ) )
907 : : {
908 : 3 : double fDepth(0.0);
909 [ + - ]: 3 : if ( rDepth.Value >>= fDepth )
910 : : {
911 : 3 : fDepth /= fFactor;
912 [ + - ]: 3 : rDepth.Value <<= fDepth;
913 : : }
914 : : }
915 [ + - ]: 3 : if ( rValue.matchIgnoreAsciiCase( aUnitStr.toString(), nIndex ) )
916 : 3 : nIndex += aUnitStr.getLength();
917 : :
918 : : // skipping white spaces
919 [ + - ][ + + ]: 6 : while( ( nIndex < rValue.getLength() ) && rValue[ nIndex ] == (sal_Unicode)' ' )
[ + + ]
920 : 3 : nIndex++;
921 : :
922 [ + - ][ + - ]: 3 : if ( GetNextParameter( rFraction, nIndex, rValue ) )
923 : : {
924 : 3 : beans::PropertyValue aProp;
925 [ + - ]: 3 : aProp.Name = EASGet( EAS_Depth );
926 [ + - ]: 3 : aProp.Value <<= aParameterPair;
927 [ + - ]: 3 : maExtrusion.push_back( aProp );
928 : 3 : }
929 : 3 : }
930 : : }
931 : 3 : break;
932 : : case EAS_extrusion_diffusion :
933 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_Diffusion );
934 : 0 : break;
935 : : case EAS_extrusion_number_of_line_segments :
936 [ # # ]: 0 : GetInt32( maExtrusion, rValue, EAS_NumberOfLineSegments );
937 : 0 : break;
938 : : case EAS_extrusion_light_face :
939 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_LightFace );
940 : 0 : break;
941 : : case EAS_extrusion_first_light_harsh :
942 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_FirstLightHarsh );
943 : 0 : break;
944 : : case EAS_extrusion_second_light_harsh :
945 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_SecondLightHarsh );
946 : 0 : break;
947 : : case EAS_extrusion_first_light_level :
948 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_FirstLightLevel );
949 : 0 : break;
950 : : case EAS_extrusion_second_light_level :
951 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_SecondLightLevel );
952 : 0 : break;
953 : : case EAS_extrusion_first_light_direction :
954 [ # # ]: 0 : GetB3DVector( maExtrusion, rValue, EAS_FirstLightDirection );
955 : 0 : break;
956 : : case EAS_extrusion_second_light_direction :
957 [ # # ]: 0 : GetB3DVector( maExtrusion, rValue, EAS_SecondLightDirection );
958 : 0 : break;
959 : : case EAS_extrusion_metal :
960 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_Metal );
961 : 0 : break;
962 : : case EAS_shade_mode :
963 : : {
964 : 0 : drawing::ShadeMode eShadeMode( drawing::ShadeMode_FLAT );
965 [ # # ][ # # ]: 0 : if( IsXMLToken( rValue, XML_PHONG ) )
966 : 0 : eShadeMode = drawing::ShadeMode_PHONG;
967 [ # # ][ # # ]: 0 : else if ( IsXMLToken( rValue, XML_GOURAUD ) )
968 : 0 : eShadeMode = drawing::ShadeMode_SMOOTH;
969 [ # # ][ # # ]: 0 : else if ( IsXMLToken( rValue, XML_DRAFT ) )
970 : 0 : eShadeMode = drawing::ShadeMode_DRAFT;
971 : :
972 : 0 : beans::PropertyValue aProp;
973 [ # # ]: 0 : aProp.Name = EASGet( EAS_ShadeMode );
974 [ # # ]: 0 : aProp.Value <<= eShadeMode;
975 [ # # ]: 0 : maExtrusion.push_back( aProp );
976 : : }
977 : 0 : break;
978 : : case EAS_extrusion_rotation_angle :
979 [ # # ]: 0 : GetEnhancedParameterPair( maExtrusion, rValue, EAS_RotateAngle );
980 : 0 : break;
981 : : case EAS_extrusion_rotation_center :
982 [ # # ]: 0 : GetB3DVector( maExtrusion, rValue, EAS_RotationCenter );
983 : 0 : break;
984 : : case EAS_extrusion_shininess :
985 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_Shininess );
986 : 0 : break;
987 : : case EAS_extrusion_skew :
988 [ + - ]: 3 : GetEnhancedParameterPair( maExtrusion, rValue, EAS_Skew );
989 : 3 : break;
990 : : case EAS_extrusion_specularity :
991 [ # # ]: 0 : GetDoublePercentage( maExtrusion, rValue, EAS_Specularity );
992 : 0 : break;
993 : : case EAS_projection :
994 : : {
995 : 3 : drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PERSPECTIVE );
996 [ + - ][ - + ]: 3 : if( IsXMLToken( rValue, XML_PARALLEL ) )
997 : 0 : eProjectionMode = drawing::ProjectionMode_PARALLEL;
998 : :
999 : 3 : beans::PropertyValue aProp;
1000 [ + - ]: 3 : aProp.Name = EASGet( EAS_ProjectionMode );
1001 [ + - ]: 3 : aProp.Value <<= eProjectionMode;
1002 [ + - ]: 3 : maExtrusion.push_back( aProp );
1003 : : }
1004 : 3 : break;
1005 : : case EAS_extrusion_viewpoint :
1006 [ + - ]: 3 : GetPosition3D( maExtrusion, rValue, EAS_ViewPoint, mrUnitConverter );
1007 : 3 : break;
1008 : : case EAS_extrusion_origin :
1009 [ + - ]: 3 : GetEnhancedParameterPair( maExtrusion, rValue, EAS_Origin );
1010 : 3 : break;
1011 : : case EAS_extrusion_color :
1012 [ # # ]: 0 : GetBool( maExtrusion, rValue, EAS_Color );
1013 : 0 : break;
1014 : : case EAS_enhanced_path :
1015 [ + - ]: 186 : GetEnhancedPath( maPath, rValue );
1016 : 186 : break;
1017 : : case EAS_path_stretchpoint_x :
1018 : : {
1019 [ + - ][ + - ]: 54 : if (::sax::Converter::convertNumber(nAttrNumber, rValue))
1020 : : {
1021 : 54 : beans::PropertyValue aProp;
1022 [ + - ]: 54 : aProp.Name = EASGet( EAS_StretchX );
1023 [ + - ]: 54 : aProp.Value <<= nAttrNumber;
1024 [ + - ]: 54 : maPath.push_back( aProp );
1025 : : }
1026 : : }
1027 : 54 : break;
1028 : : case EAS_path_stretchpoint_y :
1029 : : {
1030 [ + - ][ + - ]: 48 : if (::sax::Converter::convertNumber(nAttrNumber, rValue))
1031 : : {
1032 : 48 : beans::PropertyValue aProp;
1033 [ + - ]: 48 : aProp.Name = EASGet( EAS_StretchY );
1034 [ + - ]: 48 : aProp.Value <<= nAttrNumber;
1035 [ + - ]: 48 : maPath.push_back( aProp );
1036 : : }
1037 : : }
1038 : 48 : break;
1039 : : case EAS_text_areas :
1040 [ + - ]: 156 : GetEnhancedRectangleSequence( maPath, rValue, EAS_TextFrames );
1041 : 156 : break;
1042 : : case EAS_glue_points :
1043 : : {
1044 [ + - ]: 99 : sal_Int32 i, nPairs = GetEnhancedParameterPairSequence( maPath, rValue, EAS_GluePoints );
1045 [ + - ][ + - ]: 99 : GetImport().GetShapeImport()->moveGluePointMapping( mrxShape, nPairs );
[ + - ][ + - ]
1046 [ + + ]: 606 : for ( i = 0; i < nPairs; i++ )
1047 [ + - ][ + - ]: 507 : GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 );
[ + - ][ + - ]
1048 : : }
1049 : 99 : break;
1050 : : case EAS_glue_point_type :
1051 [ + - ]: 6 : GetEnum( maPath, rValue, EAS_GluePointType, *aXML_GluePointEnumMap );
1052 : 6 : break;
1053 : : case EAS_glue_point_leaving_directions :
1054 [ # # ]: 0 : GetDoubleSequence( maPath, rValue, EAS_GluePointLeavingDirections );
1055 : 0 : break;
1056 : : case EAS_text_path :
1057 [ # # ]: 0 : GetBool( maTextPath, rValue, EAS_TextPath );
1058 : 0 : break;
1059 : : case EAS_text_path_mode :
1060 : : {
1061 : 0 : com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode( com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL );
1062 [ # # ][ # # ]: 0 : if( IsXMLToken( rValue, XML_PATH ) )
1063 : 0 : eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH;
1064 [ # # ][ # # ]: 0 : else if ( IsXMLToken( rValue, XML_SHAPE ) )
1065 : 0 : eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE;
1066 : :
1067 : 0 : beans::PropertyValue aProp;
1068 [ # # ]: 0 : aProp.Name = EASGet( EAS_TextPathMode );
1069 [ # # ]: 0 : aProp.Value <<= eTextPathMode;
1070 [ # # ]: 0 : maTextPath.push_back( aProp );
1071 : : }
1072 : 0 : break;
1073 : : case EAS_text_path_scale :
1074 : : {
1075 [ # # ]: 0 : sal_Bool bScaleX = IsXMLToken( rValue, XML_SHAPE );
1076 : 0 : beans::PropertyValue aProp;
1077 [ # # ]: 0 : aProp.Name = EASGet( EAS_ScaleX );
1078 [ # # ]: 0 : aProp.Value <<= bScaleX;
1079 [ # # ]: 0 : maTextPath.push_back( aProp );
1080 : : }
1081 : 0 : break;
1082 : : case EAS_text_path_same_letter_heights :
1083 [ # # ]: 0 : GetBool( maTextPath, rValue, EAS_SameLetterHeights );
1084 : 0 : break;
1085 : : case EAS_modifiers :
1086 [ + - ]: 129 : GetAdjustmentValues( mrCustomShapeGeometry, rValue );
1087 : 129 : break;
1088 : : default:
1089 : 0 : break;
1090 : : }
1091 : 1077 : }
1092 : : }
1093 : 186 : }
1094 : :
1095 : 129 : void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
1096 : : const std::vector< beans::PropertyValues >& rElement,
1097 : : const rtl::OUString& rElementName )
1098 : : {
1099 [ + - ]: 129 : if ( !rElement.empty() )
1100 : : {
1101 [ + - ]: 129 : uno::Sequence< beans::PropertyValues > aPropSeq( rElement.size() );
1102 : 129 : std::vector< beans::PropertyValues >::const_iterator aIter = rElement.begin();
1103 : 129 : std::vector< beans::PropertyValues >::const_iterator aEnd = rElement.end();
1104 [ + - ]: 129 : beans::PropertyValues* pValues = aPropSeq.getArray();
1105 : :
1106 [ + - ][ + + ]: 267 : while ( aIter != aEnd )
1107 [ + - ][ + - ]: 138 : *pValues++ = *aIter++;
1108 : :
1109 : 129 : beans::PropertyValue aProp;
1110 : 129 : aProp.Name = rElementName;
1111 [ + - ]: 129 : aProp.Value <<= aPropSeq;
1112 [ + - ][ + - ]: 129 : rPropVec.push_back( aProp );
1113 : : }
1114 : 129 : }
1115 : :
1116 : 186 : void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
1117 : : const std::vector< rtl::OUString >& rElement,
1118 : : const rtl::OUString& rElementName )
1119 : : {
1120 [ + + ]: 186 : if ( !rElement.empty() )
1121 : : {
1122 [ + - ]: 129 : uno::Sequence< rtl::OUString > aPropSeq( rElement.size() );
1123 : 129 : std::vector< rtl::OUString >::const_iterator aIter = rElement.begin();
1124 : 129 : std::vector< rtl::OUString >::const_iterator aEnd = rElement.end();
1125 [ + - ]: 129 : rtl::OUString* pValues = aPropSeq.getArray();
1126 : :
1127 [ + - ][ + + ]: 2121 : while ( aIter != aEnd )
1128 [ + - ]: 1992 : *pValues++ = *aIter++;
1129 : :
1130 : 129 : beans::PropertyValue aProp;
1131 : 129 : aProp.Name = rElementName;
1132 [ + - ]: 129 : aProp.Value <<= aPropSeq;
1133 [ + - ][ + - ]: 129 : rPropVec.push_back( aProp );
1134 : : }
1135 : 186 : }
1136 : :
1137 : 558 : void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec,
1138 : : const std::vector< com::sun::star::beans::PropertyValue >& rElement,
1139 : : const rtl::OUString& rElementName )
1140 : : {
1141 [ + + ]: 558 : if ( !rElement.empty() )
1142 : : {
1143 [ + - ]: 189 : uno::Sequence< beans::PropertyValue > aPropSeq( rElement.size() );
1144 : 189 : std::vector< beans::PropertyValue >::const_iterator aIter = rElement.begin();
1145 : 189 : std::vector< beans::PropertyValue >::const_iterator aEnd = rElement.end();
1146 [ + - ]: 189 : beans::PropertyValue* pValues = aPropSeq.getArray();
1147 : :
1148 [ + - ][ + + ]: 939 : while ( aIter != aEnd )
1149 [ + - ]: 750 : *pValues++ = *aIter++;
1150 : :
1151 : 189 : beans::PropertyValue aProp;
1152 : 189 : aProp.Name = rElementName;
1153 [ + - ]: 189 : aProp.Value <<= aPropSeq;
1154 [ + - ][ + - ]: 189 : rPropVec.push_back( aProp );
1155 : : }
1156 : 558 : }
1157 : :
1158 : : typedef boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash, OUStringEqFunc> EquationHashMap;
1159 : :
1160 : : /* if rPara.Type is from type EnhancedCustomShapeParameterType::EQUATION, the name of the equation
1161 : : will be converted from rtl::OUString to index */
1162 : 5916 : void CheckAndResolveEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rPara, EquationHashMap* pH )
1163 : : {
1164 [ + + ]: 5916 : if ( rPara.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION )
1165 : : {
1166 : 3159 : rtl::OUString aEquationName;
1167 [ + - ]: 3159 : if ( rPara.Value >>= aEquationName )
1168 : : {
1169 : 3159 : sal_Int32 nIndex = 0;
1170 [ + - ]: 3159 : EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
1171 [ + - ][ + - ]: 3159 : if ( aHashIter != pH->end() )
1172 [ + - ]: 3159 : nIndex = (*aHashIter).second;
1173 [ + - ]: 3159 : rPara.Value <<= nIndex;
1174 : 3159 : }
1175 : : }
1176 : 5916 : }
1177 : :
1178 : 186 : void XMLEnhancedCustomShapeContext::EndElement()
1179 : : {
1180 : : // resolve properties that are indexing a Equation
1181 [ + + ]: 186 : if ( !maEquations.empty() )
1182 : : {
1183 : : // creating hash map containing the name and index of each equation
1184 [ + - ][ + - ]: 129 : EquationHashMap* pH = new EquationHashMap;
1185 : 129 : std::vector< rtl::OUString >::iterator aEquationNameIter = maEquationNames.begin();
1186 : 129 : std::vector< rtl::OUString >::iterator aEquationNameEnd = maEquationNames.end();
1187 [ + - ][ + + ]: 2121 : while( aEquationNameIter != aEquationNameEnd )
1188 : : {
1189 [ + - ][ + - ]: 1992 : (*pH)[ *aEquationNameIter ] = (sal_Int32)( aEquationNameIter - maEquationNames.begin() );
1190 : 1992 : ++aEquationNameIter;
1191 : : }
1192 : :
1193 : : // resolve equation
1194 : 129 : std::vector< rtl::OUString >::iterator aEquationIter = maEquations.begin();
1195 : 129 : std::vector< rtl::OUString >::iterator aEquationEnd = maEquations.end();
1196 [ + - ][ + + ]: 2121 : while( aEquationIter != aEquationEnd )
1197 : : {
1198 : 1992 : sal_Int32 nIndexOf = 0;
1199 [ + + ]: 3393 : do
1200 : : {
1201 : 3393 : nIndexOf = aEquationIter->indexOf( '?', nIndexOf );
1202 [ + + ]: 3393 : if ( nIndexOf != -1 )
1203 : : {
1204 : 1401 : rtl::OUString aEquationName;
1205 [ + - ]: 1401 : if ( GetEquationName( *aEquationIter, nIndexOf + 1, aEquationName ) )
1206 : : {
1207 : : // copying first characters inclusive '?'
1208 : 1401 : rtl::OUString aNew( aEquationIter->copy( 0, nIndexOf + 1 ) );
1209 : 1401 : sal_Int32 nIndex = 0;
1210 [ + - ]: 1401 : EquationHashMap::iterator aHashIter( pH->find( aEquationName ) );
1211 [ + - ][ + - ]: 1401 : if ( aHashIter != pH->end() )
1212 [ + - ]: 1401 : nIndex = (*aHashIter).second;
1213 : 1401 : aNew += rtl::OUString::valueOf( nIndex );
1214 : 1401 : aNew += aEquationIter->copy( nIndexOf + aEquationName.getLength() + 1 );
1215 : 1401 : *aEquationIter = aNew;
1216 : : }
1217 : 1401 : nIndexOf++;
1218 : : }
1219 : : }
1220 : : while( nIndexOf != -1 );
1221 : 1992 : ++aEquationIter;
1222 : : }
1223 : :
1224 : : // Path
1225 : : sal_Int32 i;
1226 : 129 : std::vector< beans::PropertyValue >::iterator aPathIter = maPath.begin();
1227 : 129 : std::vector< beans::PropertyValue >::iterator aPathEnd = maPath.end();
1228 [ + - ][ + + ]: 696 : while ( aPathIter != aPathEnd )
1229 : : {
1230 [ + - ]: 567 : switch( EASGet( aPathIter->Name ) )
[ + + + ]
1231 : : {
1232 : : case EAS_Coordinates :
1233 : : case EAS_GluePoints :
1234 : : {
1235 : : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rSeq =
1236 : : *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >*)
1237 : 207 : aPathIter->Value.getValue());
1238 [ + + ]: 2625 : for ( i = 0; i < rSeq.getLength(); i++ )
1239 : : {
1240 [ + - ][ + - ]: 2418 : CheckAndResolveEquationParameter( rSeq[ i ].First, pH );
1241 [ + - ][ + - ]: 2418 : CheckAndResolveEquationParameter( rSeq[ i ].Second, pH );
1242 : : }
1243 : : }
1244 : 207 : break;
1245 : : case EAS_TextFrames :
1246 : : {
1247 : : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >& rSeq =
1248 : : *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >*)
1249 : 123 : aPathIter->Value.getValue());
1250 [ + + ]: 249 : for ( i = 0; i < rSeq.getLength(); i++ )
1251 : : {
1252 [ + - ][ + - ]: 126 : CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.First, pH );
1253 [ + - ][ + - ]: 126 : CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.Second, pH );
1254 [ + - ][ + - ]: 126 : CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.First, pH );
1255 [ + - ][ + - ]: 126 : CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.Second, pH );
1256 : : }
1257 : : }
1258 : 123 : break;
1259 : : default:
1260 : 237 : break;
1261 : : }
1262 : 567 : ++aPathIter;
1263 : : }
1264 : 129 : std::vector< beans::PropertyValues >::iterator aHandleIter = maHandles.begin();
1265 : 129 : std::vector< beans::PropertyValues >::iterator aHandleEnd = maHandles.end();
1266 [ + - ][ + + ]: 267 : while ( aHandleIter != aHandleEnd )
1267 : : {
1268 [ + - ]: 138 : beans::PropertyValue* pValues = aHandleIter->getArray();
1269 [ + + ]: 606 : for ( i = 0; i < aHandleIter->getLength(); i++ )
1270 : : {
1271 [ + - ]: 468 : switch( EASGet( pValues->Name ) )
[ + + + ]
1272 : : {
1273 : : case EAS_RangeYMinimum :
1274 : : case EAS_RangeYMaximum :
1275 : : case EAS_RangeXMinimum :
1276 : : case EAS_RangeXMaximum :
1277 : : case EAS_RadiusRangeMinimum :
1278 : : case EAS_RadiusRangeMaximum :
1279 : : {
1280 : : CheckAndResolveEquationParameter( *((com::sun::star::drawing::EnhancedCustomShapeParameter*)
1281 [ + - ]: 282 : pValues->Value.getValue()), pH );
1282 : : }
1283 : 282 : break;
1284 : :
1285 : : case EAS_Position :
1286 : : case EAS_Polar :
1287 : : {
1288 : : CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
1289 [ + - ]: 147 : pValues->Value.getValue())).First, pH );
1290 : : CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*)
1291 [ + - ]: 147 : pValues->Value.getValue())).Second, pH );
1292 : : }
1293 : 147 : break;
1294 : : default:
1295 : 39 : break;
1296 : : }
1297 : 468 : pValues++;
1298 : : }
1299 : 138 : ++aHandleIter;
1300 : : }
1301 [ + - ][ + - ]: 129 : delete pH;
1302 : : }
1303 : :
1304 [ + - ]: 186 : SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) );
1305 [ + - ]: 186 : SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath, EASGet( EAS_Path ) );
1306 [ + - ]: 186 : SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath, EASGet( EAS_TextPath ) );
1307 [ + - ]: 186 : SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maEquations, EASGet( EAS_Equations ) );
1308 [ + + ]: 186 : if ( !maHandles.empty() )
1309 [ + - ]: 129 : SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maHandles, EASGet( EAS_Handles ) );
1310 : 186 : }
1311 : :
1312 : 2130 : SvXMLImportContext* XMLEnhancedCustomShapeContext::CreateChildContext( sal_uInt16 nPrefix,const rtl::OUString& rLocalName,
1313 : : const uno::Reference< xml::sax::XAttributeList> & xAttrList )
1314 : : {
1315 : 2130 : EnhancedCustomShapeTokenEnum aTokenEnum = EASGet( rLocalName );
1316 [ + + ]: 2130 : if ( aTokenEnum == EAS_equation )
1317 : : {
1318 : 1992 : sal_Int16 nLength = xAttrList->getLength();
1319 [ + - ]: 1992 : if ( nLength )
1320 : : {
1321 : 1992 : rtl::OUString aFormula;
1322 : 1992 : rtl::OUString aFormulaName;
1323 [ + + ]: 5976 : for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
1324 : : {
1325 : 3984 : rtl::OUString aLocalName;
1326 [ + - ][ + - ]: 3984 : const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
1327 [ + - ][ + - ]: 3984 : /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
[ + - ]
1328 : :
1329 [ + + - ]: 3984 : switch( EASGet( aLocalName ) )
[ + - ]
1330 : : {
1331 : : case EAS_formula :
1332 : 1992 : aFormula = rValue;
1333 : 1992 : break;
1334 : : case EAS_name :
1335 : 1992 : aFormulaName = rValue;
1336 : 1992 : break;
1337 : : default:
1338 : 0 : break;
1339 : : }
1340 : 3984 : }
1341 [ - + ][ # # ]: 1992 : if ( !aFormulaName.isEmpty() || !aFormula.isEmpty() )
[ + - ]
1342 : : {
1343 [ + - ]: 1992 : maEquations.push_back( aFormula );
1344 [ + - ]: 1992 : maEquationNames.push_back( aFormulaName );
1345 : 1992 : }
1346 : : }
1347 : : }
1348 [ + - ]: 138 : else if ( aTokenEnum == EAS_handle )
1349 : : {
1350 [ + - ]: 138 : std::vector< com::sun::star::beans::PropertyValue > aHandle;
1351 [ + - ][ + - ]: 138 : const sal_Int16 nLength = xAttrList->getLength();
1352 [ + + ]: 606 : for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ )
1353 : : {
1354 : 468 : rtl::OUString aLocalName;
1355 [ + - ][ + - ]: 468 : const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr );
1356 [ + - ][ + - ]: 468 : /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName );
[ + - ]
1357 [ - - + + : 468 : switch( EASGet( aLocalName ) )
+ + + + +
+ + - ]
[ + - ]
1358 : : {
1359 : : case EAS_handle_mirror_vertical :
1360 [ # # ]: 0 : GetBool( aHandle, rValue, EAS_MirroredY );
1361 : 0 : break;
1362 : : case EAS_handle_mirror_horizontal :
1363 [ # # ]: 0 : GetBool( aHandle, rValue, EAS_MirroredX );
1364 : 0 : break;
1365 : : case EAS_handle_switched :
1366 [ + - ]: 39 : GetBool( aHandle, rValue, EAS_Switched );
1367 : 39 : break;
1368 : : case EAS_handle_position :
1369 [ + - ]: 138 : GetEnhancedParameterPair( aHandle, rValue, EAS_Position );
1370 : 138 : break;
1371 : : case EAS_handle_range_x_minimum :
1372 [ + - ]: 81 : GetEnhancedParameter( aHandle, rValue, EAS_RangeXMinimum );
1373 : 81 : break;
1374 : : case EAS_handle_range_x_maximum :
1375 [ + - ]: 81 : GetEnhancedParameter( aHandle, rValue, EAS_RangeXMaximum );
1376 : 81 : break;
1377 : : case EAS_handle_range_y_minimum :
1378 [ + - ]: 51 : GetEnhancedParameter( aHandle, rValue, EAS_RangeYMinimum );
1379 : 51 : break;
1380 : : case EAS_handle_range_y_maximum :
1381 [ + - ]: 51 : GetEnhancedParameter( aHandle, rValue, EAS_RangeYMaximum );
1382 : 51 : break;
1383 : : case EAS_handle_polar :
1384 [ + - ]: 9 : GetEnhancedParameterPair( aHandle, rValue, EAS_Polar );
1385 : 9 : break;
1386 : : case EAS_handle_radius_range_minimum :
1387 [ + - ]: 9 : GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMinimum );
1388 : 9 : break;
1389 : : case EAS_handle_radius_range_maximum :
1390 [ + - ]: 9 : GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMaximum );
1391 : 9 : break;
1392 : : default:
1393 : 0 : break;
1394 : : }
1395 : 468 : }
1396 [ + - ]: 138 : beans::PropertyValues aPropSeq( aHandle.size() );
1397 [ + - ]: 138 : std::vector< beans::PropertyValue >::const_iterator aIter = aHandle.begin();
1398 [ + - ]: 138 : std::vector< beans::PropertyValue >::const_iterator aEnd = aHandle.end();
1399 [ + - ]: 138 : beans::PropertyValue* pValues = aPropSeq.getArray();
1400 : :
1401 [ + - ][ + + ]: 606 : while ( aIter != aEnd )
1402 [ + - ]: 468 : *pValues++ = *aIter++;
1403 : :
1404 [ + - ][ + - ]: 138 : maHandles.push_back( aPropSeq );
1405 : : }
1406 : 2130 : return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
1407 : : }
1408 : :
1409 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|