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