bump product version to 4.1.6.2
[LibreOffice.git] / xmloff / source / chart / PropertyMaps.cxx
blobdd7b59ac1f62cf8f3683b1151fefce02aad4805a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 // include PropertyMap.hxx with this define
22 // to create the maps
23 #ifndef _PROPERTYMAP_HXX_
24 #define XML_SCH_CREATE_GLOBAL_MAPS
25 #include "PropertyMap.hxx"
26 #undef XML_SCH_CREATE_GLOBAL_MAPS
27 #endif
29 #include <sax/tools/converter.hxx>
31 #include "XMLChartPropertySetMapper.hxx"
32 #include "SchXMLTools.hxx"
33 #include <xmloff/EnumPropertyHdl.hxx>
34 #include <xmloff/XMLConstantsPropertyHandler.hxx>
35 #include <xmloff/attrlist.hxx>
36 #include <xmloff/nmspmap.hxx>
37 #include <xmloff/xmluconv.hxx>
38 #include <xmloff/shapeimport.hxx>
39 #include <xmloff/NamedBoolPropertyHdl.hxx>
40 #include <xmloff/xmlexp.hxx>
41 #include <xmloff/xmltoken.hxx>
42 #include "XMLErrorIndicatorPropertyHdl.hxx"
43 #include "XMLErrorBarStylePropertyHdl.hxx"
44 #include "XMLTextOrientationHdl.hxx"
45 #include "XMLSymbolTypePropertyHdl.hxx"
46 #include "XMLAxisPositionPropertyHdl.hxx"
47 #include <com/sun/star/chart/ChartAxisMarks.hpp>
48 #include <com/sun/star/chart/ChartDataCaption.hpp>
49 #include <com/sun/star/chart/ChartSymbolType.hpp>
50 #include <com/sun/star/drawing/LineStyle.hpp>
51 #include <com/sun/star/drawing/FillStyle.hpp>
52 #include <com/sun/star/drawing/LineJoint.hpp>
53 #include <com/sun/star/chart/ChartDataRowSource.hpp>
54 #include <com/sun/star/chart/ChartAxisPosition.hpp>
55 #include <com/sun/star/chart2/XChartDocument.hpp>
56 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
58 // header for any2enum
59 #include <comphelper/extract.hxx>
60 #include <rtl/ustrbuf.hxx>
61 #include <rtl/math.hxx>
63 #define SCH_XML_SETFLAG( status, flag ) (status)|= (flag)
64 #define SCH_XML_UNSETFLAG( status, flag ) (status) = ((status) | (flag)) - (flag)
66 using namespace com::sun::star;
67 using namespace ::xmloff::token;
69 // the following class implementations are in this file:
71 // * XMLChartPropHdlFactory
72 // * XMLChartPropertySetMapper
73 // * XMLChartExportPropertyMapper
74 // * XMLChartImportPropertyMapper
75 // * SchXMLStyleExport
77 // ----------------------------------------
79 XMLChartPropHdlFactory::~XMLChartPropHdlFactory()
83 const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
85 const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
86 if( ! pHdl )
88 switch( nType )
90 case XML_SCH_TYPE_AXIS_POSITION:
91 pHdl = new XMLAxisPositionPropertyHdl( false );
92 break;
93 case XML_SCH_TYPE_AXIS_POSITION_VALUE:
94 pHdl = new XMLAxisPositionPropertyHdl( true );
95 break;
97 case XML_SCH_TYPE_AXIS_LABEL_POSITION:
98 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisLabelPositionEnumMap,
99 ::getCppuType((const chart::ChartAxisLabelPosition*)0) );
100 break;
102 case XML_SCH_TYPE_TICK_MARK_POSITION:
103 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisMarkPositionEnumMap,
104 ::getCppuType((const chart::ChartAxisMarkPosition*)0) );
105 break;
107 case XML_SCH_TYPE_AXIS_ARRANGEMENT:
108 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisArrangementEnumMap,
109 ::getCppuType((const chart::ChartAxisArrangeOrderType*)0) );
110 break;
112 case XML_SCH_TYPE_ERROR_BAR_STYLE:
113 // here we have a constant rather than an enum
114 pHdl = new XMLErrorBarStylePropertyHdl( aXMLChartErrorBarStyleEnumMap,
115 ::getCppuType((const sal_Int32*)0) );
116 break;
118 case XML_SCH_TYPE_REGRESSION_TYPE:
119 pHdl = new XMLEnumPropertyHdl( aXMLChartRegressionCurveTypeEnumMap,
120 ::getCppuType((const chart::ChartRegressionCurveType*)0) );
121 break;
123 case XML_SCH_TYPE_ERROR_INDICATOR_LOWER:
124 pHdl = new XMLErrorIndicatorPropertyHdl( sal_False );
125 break;
126 case XML_SCH_TYPE_ERROR_INDICATOR_UPPER:
127 pHdl = new XMLErrorIndicatorPropertyHdl( sal_True );
128 break;
130 case XML_SCH_TYPE_SOLID_TYPE:
131 // here we have a constant rather than an enum
132 pHdl = new XMLEnumPropertyHdl( aXMLChartSolidTypeEnumMap,
133 ::getCppuType((const sal_Int32*)0) );
134 break;
135 case XML_SCH_TYPE_LABEL_PLACEMENT_TYPE:
136 // here we have a constant rather than an enum
137 pHdl = new XMLEnumPropertyHdl( aXMLChartDataLabelPlacementEnumMap,
138 ::getCppuType((const sal_Int32*)0) );
139 break;
140 case XML_SCH_TYPE_DATAROWSOURCE:
141 pHdl = new XMLEnumPropertyHdl( aXMLChartDataRowSourceTypeEnumMap,
142 ::getCppuType((const chart::ChartDataRowSource*)0) );
143 break;
144 case XML_SCH_TYPE_TEXT_ORIENTATION:
145 pHdl = new XMLTextOrientationHdl();
146 break;
148 case XML_SCH_TYPE_INTERPOLATION:
149 pHdl = new XMLEnumPropertyHdl( aXMLChartInterpolationTypeEnumMap,
150 ::getCppuType((const sal_Int32*)0) );
151 break;
152 case XML_SCH_TYPE_SYMBOL_TYPE:
153 pHdl = new XMLSymbolTypePropertyHdl( false );
154 break;
156 case XML_SCH_TYPE_NAMED_SYMBOL:
157 pHdl = new XMLSymbolTypePropertyHdl( true );
158 break;
160 case XML_SCH_TYPE_MISSING_VALUE_TREATMENT:
161 pHdl = new XMLEnumPropertyHdl( aXMLChartMissingValueTreatmentEnumMap,
162 ::getCppuType((const sal_Int32*)0) );
163 break;
165 if( pHdl )
166 PutHdlCache( nType, pHdl );
169 return pHdl;
172 // ----------------------------------------
174 XMLChartPropertySetMapper::XMLChartPropertySetMapper( bool bForExport ) :
175 XMLPropertySetMapper( aXMLChartPropMap, new XMLChartPropHdlFactory, bForExport )
179 XMLChartPropertySetMapper::~XMLChartPropertySetMapper()
183 // ----------------------------------------
185 XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
186 SvXMLExport& rExport) :
187 SvXMLExportPropertyMapper( rMapper ),
188 msTrue( GetXMLToken( XML_TRUE )),
189 msFalse( GetXMLToken( XML_FALSE )),
190 mrExport( rExport )
192 // chain draw properties
193 ChainExportMapper( XMLShapeExport::CreateShapePropMapper( rExport ));
195 // chain text properties
196 ChainExportMapper( XMLTextParagraphExport::CreateParaExtPropMapper( rExport ));
199 XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper()
203 void XMLChartExportPropertyMapper::ContextFilter(
204 bool bEnableFoFontFamily,
205 std::vector< XMLPropertyState >& rProperties,
206 uno::Reference< beans::XPropertySet > rPropSet ) const
208 OUString aAutoPropName;
209 sal_Bool bCheckAuto = sal_False;
211 // filter properties
212 for( std::vector< XMLPropertyState >::iterator property = rProperties.begin();
213 property != rProperties.end();
214 ++property )
216 // find properties with context
217 // to prevent writing this property set mnIndex member to -1
218 switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
220 // if Auto... is set the corresponding properties mustn't be exported
221 case XML_SCH_CONTEXT_MIN:
222 bCheckAuto = sal_True;
223 aAutoPropName = "AutoMin";
224 break;
225 case XML_SCH_CONTEXT_MAX:
226 bCheckAuto = sal_True;
227 aAutoPropName = "AutoMax";
228 break;
229 case XML_SCH_CONTEXT_STEP_MAIN:
230 bCheckAuto = sal_True;
231 aAutoPropName = "AutoStepMain";
232 break;
233 case XML_SCH_CONTEXT_STEP_HELP_COUNT:
234 bCheckAuto = sal_True;
235 aAutoPropName = "AutoStepHelp";
236 break;
238 case XML_SCH_CONTEXT_ORIGIN:
239 bCheckAuto = sal_True;
240 aAutoPropName = "AutoOrigin";
241 break;
243 // the following property is deprecated
244 // elemet-item symbol-image is used now
245 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
246 property->mnIndex = -1;
247 break;
249 case XML_SCH_CONTEXT_STOCK_WITH_VOLUME:
250 case XML_SCH_CONTEXT_LINES_USED:
251 // note this avoids export of the properties in OASIS format,
252 // but also for the OOo XML Flat format (used by binfilter),
253 // because there, the transformation to OOo is done after the
254 // complete export of the chart in OASIS format.
255 if( mrExport.getExportFlags() & EXPORT_OASIS )
256 property->mnIndex = -1;
257 break;
260 if( bCheckAuto )
262 if( rPropSet.is())
266 sal_Bool bAuto = false;
267 uno::Any aAny = rPropSet->getPropertyValue( aAutoPropName );
268 aAny >>= bAuto;
269 if( bAuto )
270 property->mnIndex = -1;
272 catch(const beans::UnknownPropertyException&)
276 bCheckAuto = sal_False;
280 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
283 void XMLChartExportPropertyMapper::handleElementItem(
284 SvXMLExport& rExport,
285 const XMLPropertyState& rProperty, sal_uInt16 nFlags,
286 const ::std::vector< XMLPropertyState > *pProperties,
287 sal_uInt32 nIdx ) const
289 switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ))
291 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
293 OUString aURLStr;
294 rProperty.maValue >>= aURLStr;
296 // export as XLink reference into the package
297 // if embedding is off
298 OUString sTempURL( mrExport.AddEmbeddedGraphicObject( aURLStr ));
299 if( !sTempURL.isEmpty() )
301 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL );
302 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
303 XML_SIMPLE );
304 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
305 XML_ONLOAD );
309 sal_uInt32 nPropIndex = rProperty.mnIndex;
310 // this is the element that has to live until the next statement
311 SvXMLElementExport aElem( mrExport,
312 getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
313 getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
314 sal_True, sal_True );
316 // export as Base64 embedded graphic
317 // if embedding is on
318 if( !aURLStr.isEmpty())
319 mrExport.AddEmbeddedGraphicObjectAsBase64( aURLStr );
322 break;
324 case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
326 OUString aSeparator;
327 rProperty.maValue >>= aSeparator;
329 if( !aSeparator.isEmpty() )
331 sal_uInt32 nPropIndex = rProperty.mnIndex;
332 SvXMLElementExport aElem( mrExport,
333 getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
334 getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
335 sal_True, sal_True );
337 SchXMLTools::exportText( mrExport, aSeparator, true );
340 break;
342 default:
343 // call parent
344 SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty,
345 nFlags, pProperties, nIdx );
346 break;
350 namespace {
352 OUString convertRange( const OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
354 OUString aResult = rRange;
355 if( !xDoc.is() )
356 return aResult;
357 uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
358 xDoc->getDataProvider(), uno::UNO_QUERY );
359 if( xConversion.is())
360 aResult = xConversion->convertRangeToXML( rRange );
361 return aResult;
366 void XMLChartExportPropertyMapper::handleSpecialItem(
367 SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
368 const SvXMLUnitConverter& rUnitConverter,
369 const SvXMLNamespaceMap& rNamespaceMap,
370 const ::std::vector< XMLPropertyState > *pProperties,
371 sal_uInt32 nIdx ) const
373 sal_Bool bHandled = sal_False;
375 sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
377 if( nContextId )
379 bHandled = sal_True;
381 OUString sAttrName = maPropMapper->GetEntryXMLName( rProperty.mnIndex );
382 sal_uInt16 nNameSpace = maPropMapper->GetEntryNameSpace( rProperty.mnIndex );
383 OUStringBuffer sValueBuffer;
384 OUString sValue;
386 sal_Int32 nValue = 0;
387 sal_Bool bValue = sal_False;
389 switch( nContextId )
391 case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
392 case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
393 rProperty.maValue >>= nValue;
394 bValue = (( nValue & chart::ChartAxisMarks::INNER ) == chart::ChartAxisMarks::INNER );
395 ::sax::Converter::convertBool( sValueBuffer, bValue );
396 break;
397 case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
398 case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
399 rProperty.maValue >>= nValue;
400 bValue = (( nValue & chart::ChartAxisMarks::OUTER ) == chart::ChartAxisMarks::OUTER );
401 ::sax::Converter::convertBool( sValueBuffer, bValue );
402 break;
403 case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
405 // convert from 100th degrees to degrees (double)
406 rProperty.maValue >>= nValue;
407 double fVal = (double)(nValue) / 100.0;
408 ::sax::Converter::convertDouble( sValueBuffer, fVal );
410 break;
411 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
413 rProperty.maValue >>= nValue;
414 if((( nValue & chart::ChartDataCaption::VALUE ) == chart::ChartDataCaption::VALUE ))
416 if( ( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
418 const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
419 if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
420 sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
421 else
422 sValueBuffer.append( GetXMLToken( XML_VALUE_AND_PERCENTAGE ));
424 else
425 sValueBuffer.append( GetXMLToken( XML_VALUE ));
427 else if(( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
428 sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
429 else
430 sValueBuffer.append( GetXMLToken( XML_NONE ));
432 break;
433 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
434 rProperty.maValue >>= nValue;
435 bValue = (( nValue & chart::ChartDataCaption::TEXT ) == chart::ChartDataCaption::TEXT );
436 ::sax::Converter::convertBool( sValueBuffer, bValue );
437 break;
438 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
439 rProperty.maValue >>= nValue;
440 bValue = (( nValue & chart::ChartDataCaption::SYMBOL ) == chart::ChartDataCaption::SYMBOL );
441 ::sax::Converter::convertBool( sValueBuffer, bValue );
442 break;
444 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
445 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
447 awt::Size aSize;
448 rProperty.maValue >>= aSize;
449 rUnitConverter.convertMeasureToXML( sValueBuffer,
450 nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
451 ? aSize.Width
452 : aSize.Height );
454 break;
456 case XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT:
458 // just for import
459 break;
462 case XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE:
464 OUString aRangeStr;
465 rProperty.maValue >>= aRangeStr;
466 sValueBuffer.append(convertRange(aRangeStr, mxChartDoc));
468 break;
470 default:
471 bHandled = sal_False;
472 break;
475 if( sValueBuffer.getLength())
477 sValue = sValueBuffer.makeStringAndClear();
478 sAttrName = rNamespaceMap.GetQNameByKey( nNameSpace, sAttrName );
479 rAttrList.AddAttribute( sAttrName, sValue );
483 if( !bHandled )
485 // call parent
486 SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
490 void XMLChartExportPropertyMapper::setChartDoc( uno::Reference< chart2::XChartDocument > xChartDoc )
492 mxChartDoc = xChartDoc;
495 // ----------------------------------------
497 XMLChartImportPropertyMapper::XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
498 const SvXMLImport& _rImport ) :
499 SvXMLImportPropertyMapper( rMapper, const_cast< SvXMLImport & >( _rImport )),
500 mrImport( const_cast< SvXMLImport & > ( _rImport ))
502 // chain shape mapper for drawing properties
504 // give an empty model. It is only used for numbering rules that don't exist in chart
505 uno::Reference< frame::XModel > xEmptyModel;
506 ChainImportMapper( XMLShapeImportHelper::CreateShapePropMapper( xEmptyModel, mrImport ));
508 //#i14365# save and load writing-mode for chart elements
509 //The property TextWritingMode is mapped wrongly in the underlying draw mapper, but for draw it is necessary
510 //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')
511 sal_Int32 nUnwantedWrongEntry = maPropMapper->FindEntryIndex( "TextWritingMode", XML_NAMESPACE_STYLE, GetXMLToken(XML_WRITING_MODE) );
512 maPropMapper->RemoveEntry(nUnwantedWrongEntry);
514 // do not chain text properties: on import this is done by shape mapper
515 // to import old documents
518 XMLChartImportPropertyMapper::~XMLChartImportPropertyMapper()
522 bool XMLChartImportPropertyMapper::handleSpecialItem(
523 XMLPropertyState& rProperty,
524 ::std::vector< XMLPropertyState >& rProperties,
525 const OUString& rValue,
526 const SvXMLUnitConverter& rUnitConverter,
527 const SvXMLNamespaceMap& rNamespaceMap ) const
529 sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
530 sal_Bool bRet = (nContextId != 0);
532 if( nContextId )
534 sal_Int32 nValue = 0;
535 bool bValue = false;
537 switch( nContextId )
539 case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
540 case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
541 ::sax::Converter::convertBool( bValue, rValue );
542 // modify old value
543 rProperty.maValue >>= nValue;
544 if( bValue )
545 SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::INNER );
546 else
547 SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::INNER );
548 rProperty.maValue <<= nValue;
549 break;
550 case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
551 case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
552 ::sax::Converter::convertBool( bValue, rValue );
553 // modify old value
554 rProperty.maValue >>= nValue;
555 if( bValue )
556 SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::OUTER );
557 else
558 SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::OUTER );
559 rProperty.maValue <<= nValue;
560 break;
561 case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
563 // convert from degrees (double) to 100th degrees (integer)
564 double fVal;
565 ::sax::Converter::convertDouble( fVal, rValue );
566 nValue = (sal_Int32)( fVal * 100.0 );
567 rProperty.maValue <<= nValue;
569 break;
570 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
572 // modify old value
573 rProperty.maValue >>= nValue;
574 if( IsXMLToken( rValue, XML_NONE ))
575 SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
576 else if( IsXMLToken( rValue, XML_VALUE_AND_PERCENTAGE ) )
577 SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
578 else if( IsXMLToken( rValue, XML_VALUE ) )
579 SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE );
580 else // must be XML_PERCENTAGE
581 SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::PERCENT );
582 rProperty.maValue <<= nValue;
584 break;
585 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
586 rProperty.maValue >>= nValue;
587 ::sax::Converter::convertBool( bValue, rValue );
588 if( bValue )
589 SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::TEXT );
590 else
591 SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::TEXT );
592 rProperty.maValue <<= nValue;
593 break;
594 case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
595 rProperty.maValue >>= nValue;
596 ::sax::Converter::convertBool( bValue, rValue );
597 if( bValue )
598 SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
599 else
600 SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
601 rProperty.maValue <<= nValue;
602 break;
603 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
604 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
606 awt::Size aSize;
607 rProperty.maValue >>= aSize;
608 rUnitConverter.convertMeasureToCore(
609 (nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH)
610 ? aSize.Width
611 : aSize.Height,
612 rValue );
613 rProperty.maValue <<= aSize;
615 break;
617 case XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE:
619 rProperty.maValue <<= rValue;
621 break;
623 // deprecated from 6.0 beta on
624 case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
625 rProperty.maValue <<= mrImport.ResolveGraphicObjectURL( rValue, sal_False );
626 break;
628 default:
629 bRet = sal_False;
630 break;
635 // if we didn't handle it, the parent should
636 if( !bRet )
638 // call parent
639 bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, rProperties, rValue, rUnitConverter, rNamespaceMap );
642 return bRet;
645 void XMLChartImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& /*rProperties*/, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
649 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */