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