1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 
31 // include PropertyMap.hxx with this define
32 // to create the maps
33 #ifndef _PROPERTYMAP_HXX_
34 #define XML_SCH_CREATE_GLOBAL_MAPS
35 #include "PropertyMap.hxx"
36 #undef XML_SCH_CREATE_GLOBAL_MAPS
37 #endif
38 
39 #include "XMLChartPropertySetMapper.hxx"
40 #include "SchXMLTools.hxx"
41 #include <xmloff/EnumPropertyHdl.hxx>
42 #include <xmloff/XMLConstantsPropertyHandler.hxx>
43 #include <xmloff/attrlist.hxx>
44 #include <xmloff/nmspmap.hxx>
45 #include <xmloff/xmluconv.hxx>
46 #include <xmloff/shapeimport.hxx>
47 #include <xmloff/NamedBoolPropertyHdl.hxx>
48 #include <xmloff/xmlexp.hxx>
49 #include <xmloff/xmltoken.hxx>
50 #include "XMLErrorIndicatorPropertyHdl.hxx"
51 #include "XMLErrorBarStylePropertyHdl.hxx"
52 #include "XMLTextOrientationHdl.hxx"
53 #include "XMLSymbolTypePropertyHdl.hxx"
54 #include "XMLAxisPositionPropertyHdl.hxx"
55 #include <com/sun/star/chart/ChartAxisMarks.hpp>
56 #include <com/sun/star/chart/ChartDataCaption.hpp>
57 #include <com/sun/star/chart/ChartSymbolType.hpp>
58 #include <com/sun/star/drawing/LineStyle.hpp>
59 #include <com/sun/star/drawing/FillStyle.hpp>
60 #include <com/sun/star/drawing/LineJoint.hpp>
61 #include <com/sun/star/chart/ChartDataRowSource.hpp>
62 #include <com/sun/star/chart/ChartAxisPosition.hpp>
63 
64 // header for any2enum
65 #include <comphelper/extract.hxx>
66 #include <rtl/ustrbuf.hxx>
67 #include <rtl/math.hxx>
68 
69 #define SCH_XML_SETFLAG( status, flag )   	(status)|= (flag)
70 #define SCH_XML_UNSETFLAG( status, flag )   (status) = ((status) | (flag)) - (flag)
71 
72 using namespace com::sun::star;
73 using namespace ::xmloff::token;
74 
75 // the following class implementations are in this file:
76 //
77 // * XMLChartPropHdlFactory
78 // * XMLChartPropertySetMapper
79 // * XMLChartExportPropertyMapper
80 // * XMLChartImportPropertyMapper
81 // * SchXMLStyleExport
82 
83 // ----------------------------------------
84 
85 XMLChartPropHdlFactory::~XMLChartPropHdlFactory()
86 {
87 }
88 
89 const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
90 {
91 	const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
92 	if( ! pHdl )
93 	{
94 		switch( nType )
95 		{
96             case XML_SCH_TYPE_AXIS_POSITION:
97                 pHdl = new XMLAxisPositionPropertyHdl( false );
98                 break;
99             case XML_SCH_TYPE_AXIS_POSITION_VALUE:
100                 pHdl = new XMLAxisPositionPropertyHdl( true );
101                 break;
102 
103             case XML_SCH_TYPE_AXIS_LABEL_POSITION:
104                 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisLabelPositionEnumMap,
105 											   ::getCppuType((const chart::ChartAxisLabelPosition*)0) );
106                 break;
107 
108             case XML_SCH_TYPE_TICK_MARK_POSITION:
109                 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisMarkPositionEnumMap,
110 											   ::getCppuType((const chart::ChartAxisMarkPosition*)0) );
111                 break;
112 
113 			case XML_SCH_TYPE_AXIS_ARRANGEMENT:
114 				pHdl = new XMLEnumPropertyHdl( aXMLChartAxisArrangementEnumMap,
115 											   ::getCppuType((const chart::ChartAxisArrangeOrderType*)0) );
116 				break;
117 
118 			case XML_SCH_TYPE_ERROR_BAR_STYLE:
119 				// here we have a constant rather than an enum
120 				pHdl = new XMLErrorBarStylePropertyHdl( aXMLChartErrorBarStyleEnumMap,
121                                                ::getCppuType((const sal_Int32*)0) );
122 				break;
123 
124 			case XML_SCH_TYPE_REGRESSION_TYPE:
125 				pHdl = new XMLEnumPropertyHdl( aXMLChartRegressionCurveTypeEnumMap,
126 											   ::getCppuType((const chart::ChartRegressionCurveType*)0) );
127 				break;
128 
129 			case XML_SCH_TYPE_ERROR_INDICATOR_LOWER:
130 				pHdl = new XMLErrorIndicatorPropertyHdl( sal_False );
131 				break;
132 			case XML_SCH_TYPE_ERROR_INDICATOR_UPPER:
133 				pHdl = new XMLErrorIndicatorPropertyHdl( sal_True );
134 				break;
135 
136 			case XML_SCH_TYPE_SOLID_TYPE:
137 				// here we have a constant rather than an enum
138 				pHdl = new XMLEnumPropertyHdl( aXMLChartSolidTypeEnumMap,
139                                                ::getCppuType((const sal_Int32*)0) );
140 				break;
141             case XML_SCH_TYPE_LABEL_PLACEMENT_TYPE:
142                 // here we have a constant rather than an enum
143                 pHdl = new XMLEnumPropertyHdl( aXMLChartDataLabelPlacementEnumMap,
144                                                 ::getCppuType((const sal_Int32*)0) );
145                 break;
146             case XML_SCH_TYPE_DATAROWSOURCE:
147                 pHdl = new XMLEnumPropertyHdl( aXMLChartDataRowSourceTypeEnumMap,
148                                                ::getCppuType((const chart::ChartDataRowSource*)0) );
149                 break;
150             case XML_SCH_TYPE_TEXT_ORIENTATION:
151                 pHdl = new XMLTextOrientationHdl();
152                 break;
153 
154             case XML_SCH_TYPE_INTERPOLATION:
155                 pHdl = new XMLEnumPropertyHdl( aXMLChartInterpolationTypeEnumMap,
156                                                ::getCppuType((const sal_Int32*)0) );
157                 break;
158             case XML_SCH_TYPE_SYMBOL_TYPE:
159                 pHdl = new XMLSymbolTypePropertyHdl( false );
160                 break;
161 
162             case XML_SCH_TYPE_NAMED_SYMBOL:
163                 pHdl = new XMLSymbolTypePropertyHdl( true );
164                 break;
165 
166             case XML_SCH_TYPE_MISSING_VALUE_TREATMENT:
167                 pHdl = new XMLEnumPropertyHdl( aXMLChartMissingValueTreatmentEnumMap,
168                                                ::getCppuType((const sal_Int32*)0) );
169                 break;
170         }
171 		if( pHdl )
172 			PutHdlCache( nType, pHdl );
173 	}
174 
175 	return pHdl;
176 }
177 
178 // ----------------------------------------
179 
180 XMLChartPropertySetMapper::XMLChartPropertySetMapper() :
181 		XMLPropertySetMapper( aXMLChartPropMap, new XMLChartPropHdlFactory )
182 {
183 }
184 
185 XMLChartPropertySetMapper::~XMLChartPropertySetMapper()
186 {
187 }
188 
189 // ----------------------------------------
190 
191 XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
192                                                             SvXMLExport& rExport) :
193 		SvXMLExportPropertyMapper( rMapper ),
194 		msTrue( GetXMLToken( XML_TRUE )),
195 		msFalse( GetXMLToken( XML_FALSE )),
196         mrExport( rExport )
197 {
198 	// chain draw properties
199 	ChainExportMapper( XMLShapeExport::CreateShapePropMapper( rExport ));
200 
201 	// chain text properties
202 	ChainExportMapper( XMLTextParagraphExport::CreateParaExtPropMapper( rExport ));
203 }
204 
205 XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper()
206 {
207 }
208 
209 void XMLChartExportPropertyMapper::ContextFilter(
210 	std::vector< XMLPropertyState >& rProperties,
211 	uno::Reference< beans::XPropertySet > rPropSet ) const
212 {
213 	::rtl::OUString aAutoPropName;
214 	sal_Bool bCheckAuto = sal_False;
215 
216 	// filter properties
217 	for( std::vector< XMLPropertyState >::iterator property = rProperties.begin();
218 		 property != rProperties.end();
219 		 property++ )
220 	{
221 		// find properties with context
222 		// to prevent writing this property set mnIndex member to -1
223 		switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
224 		{
225 			// if Auto... is set the corresponding properties mustn't be exported
226 			case XML_SCH_CONTEXT_MIN:
227 				bCheckAuto = sal_True;
228 				aAutoPropName = ::rtl::OUString::createFromAscii( "AutoMin" );
229 				break;
230 			case XML_SCH_CONTEXT_MAX:
231 				bCheckAuto = sal_True;
232 				aAutoPropName = ::rtl::OUString::createFromAscii( "AutoMax" );
233 				break;
234 			case XML_SCH_CONTEXT_STEP_MAIN:
235 				bCheckAuto = sal_True;
236 				aAutoPropName = ::rtl::OUString::createFromAscii( "AutoStepMain" );
237 				break;
238             case XML_SCH_CONTEXT_STEP_HELP_COUNT:
239                 bCheckAuto = sal_True;
240                 aAutoPropName = ::rtl::OUString::createFromAscii( "AutoStepHelp" );
241                 break;
242 
243             case XML_SCH_CONTEXT_ORIGIN:
244 				bCheckAuto = sal_True;
245 				aAutoPropName = ::rtl::OUString::createFromAscii( "AutoOrigin" );
246 				break;
247 
248             // the following property is deprecated
249             // elemet-item symbol-image is used now
250             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
251                 property->mnIndex = -1;
252                 break;
253 
254             case XML_SCH_CONTEXT_STOCK_WITH_VOLUME:
255             case XML_SCH_CONTEXT_LINES_USED:
256                 // note this avoids export of the properties in OASIS format,
257                 // but also for the OOo XML Flat format (used by binfilter),
258                 // because there, the transformation to OOo is done after the
259                 // complete export of the chart in OASIS format.
260                 if( mrExport.getExportFlags() & EXPORT_OASIS )
261                     property->mnIndex = -1;
262                 break;
263 		}
264 
265 		if( bCheckAuto )
266 		{
267 			if( rPropSet.is())
268 			{
269 				try
270 				{
271 					sal_Bool bAuto = false;
272 					uno::Any aAny = rPropSet->getPropertyValue( aAutoPropName );
273 					aAny >>= bAuto;
274 					if( bAuto )
275 						property->mnIndex = -1;
276 				}
277 				catch( beans::UnknownPropertyException )
278 				{
279 				}
280 			}
281 			bCheckAuto = sal_False;
282 		}
283 	}
284 
285 	SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
286 }
287 
288 void XMLChartExportPropertyMapper::handleElementItem(
289     SvXMLExport& rExport,
290 	const XMLPropertyState& rProperty, sal_uInt16 nFlags,
291 	const ::std::vector< XMLPropertyState > *pProperties,
292 	sal_uInt32 nIdx ) const
293 {
294     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ))
295     {
296         case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
297             {
298                 ::rtl::OUString aURLStr;
299                 rProperty.maValue >>= aURLStr;
300 
301                 // export as XLink reference into the package
302                 // if embedding is off
303                 ::rtl::OUString sTempURL( mrExport.AddEmbeddedGraphicObject( aURLStr ));
304                 if( sTempURL.getLength() )
305                 {
306                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL );
307                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
308                                               XML_SIMPLE );
309                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
310                                               XML_ONLOAD );
311                 }
312 
313                 {
314                     sal_uInt32 nPropIndex = rProperty.mnIndex;
315                     // this is the element that has to live until the next statement
316                     SvXMLElementExport aElem( mrExport,
317                                               getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
318                                               getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
319                                               sal_True, sal_True );
320 
321                     // export as Base64 embedded graphic
322                     // if embedding is on
323                     if( aURLStr.getLength())
324                         mrExport.AddEmbeddedGraphicObjectAsBase64( aURLStr );
325                 }
326             }
327             break;
328 
329         case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
330             {
331                 ::rtl::OUString aSeparator;
332                 rProperty.maValue >>= aSeparator;
333 
334                 if( aSeparator.getLength() )
335                 {
336                     sal_uInt32 nPropIndex = rProperty.mnIndex;
337                     SvXMLElementExport aElem( mrExport,
338                                               getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
339                                               getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
340                                               sal_True, sal_True );
341 
342                     SchXMLTools::exportText( mrExport, aSeparator, true );
343                 }
344             }
345             break;
346 
347         default:
348             // call parent
349             SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty,
350                                                           nFlags, pProperties, nIdx );
351             break;
352     }
353 }
354 
355 void XMLChartExportPropertyMapper::handleSpecialItem(
356 	SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
357 	const SvXMLUnitConverter& rUnitConverter,
358 	const SvXMLNamespaceMap& rNamespaceMap,
359 	const ::std::vector< XMLPropertyState > *pProperties,
360 	sal_uInt32 nIdx ) const
361 {
362 	sal_Bool bHandled = sal_False;
363 
364 	sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
365 
366 	if( nContextId )
367 	{
368 		bHandled = sal_True;
369 
370 		rtl::OUString sAttrName = maPropMapper->GetEntryXMLName( rProperty.mnIndex );
371 		sal_uInt16 nNameSpace = maPropMapper->GetEntryNameSpace( rProperty.mnIndex );
372 		rtl::OUStringBuffer sValueBuffer;
373 		rtl::OUString sValue;
374 
375 		sal_Int32 nValue = 0;
376 		sal_Bool bValue = sal_False;
377 
378 		switch( nContextId )
379 		{
380 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
381 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
382 				rProperty.maValue >>= nValue;
383 				bValue = (( nValue & chart::ChartAxisMarks::INNER ) == chart::ChartAxisMarks::INNER );
384 				SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
385 				break;
386 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
387 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
388 				rProperty.maValue >>= nValue;
389 				bValue = (( nValue & chart::ChartAxisMarks::OUTER ) == chart::ChartAxisMarks::OUTER );
390 				SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
391 				break;
392 			case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
393 				{
394 					// convert from 100th degrees to degrees (double)
395 					rProperty.maValue >>= nValue;
396 					double fVal = (double)(nValue) / 100.0;
397 					SvXMLUnitConverter::convertDouble( sValueBuffer, fVal );
398 				}
399 				break;
400 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
401 				{
402 					rProperty.maValue >>= nValue;
403 					if((( nValue & chart::ChartDataCaption::VALUE ) == chart::ChartDataCaption::VALUE ))
404                     {
405                         if( ( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
406                         {
407                             const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
408                             if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
409                                 sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
410                             else
411 						        sValueBuffer.append( GetXMLToken( XML_VALUE_AND_PERCENTAGE ));
412                         }
413                         else
414 						    sValueBuffer.append( GetXMLToken( XML_VALUE ));
415                     }
416 					else if(( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
417 						sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
418 					else
419 						sValueBuffer.append( GetXMLToken( XML_NONE ));
420 				}
421 				break;
422 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
423 				rProperty.maValue >>= nValue;
424 				bValue = (( nValue & chart::ChartDataCaption::TEXT ) == chart::ChartDataCaption::TEXT );
425 				SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
426 				break;
427 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
428 				rProperty.maValue >>= nValue;
429 				bValue = (( nValue & chart::ChartDataCaption::SYMBOL ) == chart::ChartDataCaption::SYMBOL );
430 				SvXMLUnitConverter::convertBool( sValueBuffer, bValue );
431 				break;
432 
433             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
434             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
435                 {
436                     awt::Size aSize;
437                     rProperty.maValue >>= aSize;
438                     rUnitConverter.convertMeasure( sValueBuffer,
439                                                    nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
440                                                    ? aSize.Width
441                                                    : aSize.Height );
442                 }
443                 break;
444 
445 			case XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT:
446 				{
447 					// just for import
448 					break;
449 				}
450 
451 			default:
452 				bHandled = sal_False;
453 				break;
454 		}
455 
456 		if( sValueBuffer.getLength())
457 		{
458 			sValue = sValueBuffer.makeStringAndClear();
459 			sAttrName = rNamespaceMap.GetQNameByKey( nNameSpace, sAttrName );
460 			rAttrList.AddAttribute( sAttrName, sValue );
461 		}
462 	}
463 
464 	if( !bHandled )
465 	{
466 		// call parent
467 		SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
468 	}
469 }
470 
471 // ----------------------------------------
472 
473 XMLChartImportPropertyMapper::XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
474                                                             const SvXMLImport& _rImport ) :
475         SvXMLImportPropertyMapper( rMapper, const_cast< SvXMLImport & >( _rImport )),
476         mrImport( const_cast< SvXMLImport & > ( _rImport ))
477 {
478 	// chain shape mapper for drawing properties
479 
480 	// give an empty model. It is only used for numbering rules that don't exist in chart
481 	uno::Reference< frame::XModel > xEmptyModel;
482 	ChainImportMapper( XMLShapeImportHelper::CreateShapePropMapper( xEmptyModel, mrImport ));
483 
484     //#i14365# save and load writing-mode for chart elements
485     //The property TextWritingMode is mapped wrongly in the underlying draw mapper, but for draw it is necessary
486     //We remove that property here only for chart thus the chart can use the correct mapping from the writer paragraph settings (attribute 'writing-mode' <-> property 'WritingMode')
487     sal_Int32 nUnwantedWrongEntry = maPropMapper->FindEntryIndex( "TextWritingMode", XML_NAMESPACE_STYLE, GetXMLToken(XML_WRITING_MODE) );
488     maPropMapper->RemoveEntry(nUnwantedWrongEntry);
489 
490 	// do not chain text properties: on import this is done by shape mapper
491     // to import old documents
492 //  	ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper());
493 }
494 
495 XMLChartImportPropertyMapper::~XMLChartImportPropertyMapper()
496 {
497 }
498 
499 sal_Bool XMLChartImportPropertyMapper::handleSpecialItem(
500 	XMLPropertyState& rProperty,
501 	::std::vector< XMLPropertyState >& rProperties,
502 	const ::rtl::OUString& rValue,
503 	const SvXMLUnitConverter& rUnitConverter,
504 	const SvXMLNamespaceMap& rNamespaceMap ) const
505 {
506     static const ::rtl::OUString sPackageProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
507 	sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
508 	sal_Bool bRet = (nContextId != 0);
509 
510 	if( nContextId )
511 	{
512 		sal_Int32 nValue = 0;
513 		sal_Bool bValue = sal_False;
514 
515 		switch( nContextId )
516 		{
517 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
518 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
519 				SvXMLUnitConverter::convertBool( bValue, rValue );
520 				// modify old value
521 				rProperty.maValue >>= nValue;
522 				if( bValue )
523 					SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::INNER );
524 				else
525 					SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::INNER );
526 				rProperty.maValue <<= nValue;
527 				break;
528 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
529 			case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
530 				SvXMLUnitConverter::convertBool( bValue, rValue );
531 				// modify old value
532 				rProperty.maValue >>= nValue;
533 				if( bValue )
534 					SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::OUTER );
535 				else
536 					SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::OUTER );
537 				rProperty.maValue <<= nValue;
538 				break;
539 			case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
540 				{
541 					// convert from degrees (double) to 100th degrees (integer)
542 					double fVal;
543 					SvXMLUnitConverter::convertDouble( fVal, rValue );
544 					nValue = (sal_Int32)( fVal * 100.0 );
545 					rProperty.maValue <<= nValue;
546 				}
547 				break;
548 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
549 				{
550 					// modify old value
551 					rProperty.maValue >>= nValue;
552 					if( IsXMLToken( rValue, XML_NONE ))
553 						SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
554                     else if( IsXMLToken( rValue, XML_VALUE_AND_PERCENTAGE ) )
555 						SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
556                     else if( IsXMLToken( rValue, XML_VALUE ) )
557 						SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE );
558 					else // must be XML_PERCENTAGE
559 						SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::PERCENT );
560 					rProperty.maValue <<= nValue;
561 				}
562 				break;
563 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
564 				rProperty.maValue >>= nValue;
565 				SvXMLUnitConverter::convertBool( bValue, rValue );
566 				if( bValue )
567 					SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::TEXT );
568 				else
569 					SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::TEXT );
570 				rProperty.maValue <<= nValue;
571 				break;
572 			case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
573 				rProperty.maValue >>= nValue;
574 				SvXMLUnitConverter::convertBool( bValue, rValue );
575 				if( bValue )
576 					SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
577 				else
578 					SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
579 				rProperty.maValue <<= nValue;
580 				break;
581             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
582             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
583                 {
584                     awt::Size aSize;
585                     rProperty.maValue >>= aSize;
586                     rUnitConverter.convertMeasure( nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
587                                                    ? aSize.Width
588                                                    : aSize.Height,
589                                                    rValue );
590                     rProperty.maValue <<= aSize;
591                 }
592                 break;
593 
594             // deprecated from 6.0 beta on
595             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
596                 rProperty.maValue <<= mrImport.ResolveGraphicObjectURL( rValue, sal_False );
597                 break;
598 
599             default:
600 				bRet = sal_False;
601 				break;
602 		}
603 	}
604 
605 
606 	// if we didn't handle it, the parent should
607 	if( !bRet )
608 	{
609 		// call parent
610 		bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, rProperties, rValue, rUnitConverter, rNamespaceMap );
611 	}
612 
613 	return bRet;
614 }
615 
616 void XMLChartImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& /*rProperties*/, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
617 {
618 }
619