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 "SchXMLAxisContext.hxx" 32 #include "SchXMLChartContext.hxx" 33 #include "SchXMLTools.hxx" 34 #include <xmloff/xmlnmspe.hxx> 35 #include <xmloff/xmlement.hxx> 36 #include <xmloff/xmlstyle.hxx> 37 #include <xmloff/prstylei.hxx> 38 #include <xmloff/nmspmap.hxx> 39 #include <xmloff/xmluconv.hxx> 40 41 #include <tools/debug.hxx> 42 43 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> 44 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> 45 #include <com/sun/star/chart/ChartAxisPosition.hpp> 46 #include <com/sun/star/chart/ChartAxisType.hpp> 47 #include <com/sun/star/chart/TimeIncrement.hpp> 48 #include <com/sun/star/chart/TimeInterval.hpp> 49 #include <com/sun/star/chart/TimeUnit.hpp> 50 #include <com/sun/star/chart/XAxis.hpp> 51 #include <com/sun/star/chart/XAxisSupplier.hpp> 52 #include <com/sun/star/chart2/AxisType.hpp> 53 #include <com/sun/star/chart2/XChartDocument.hpp> 54 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> 55 56 #include <com/sun/star/drawing/LineStyle.hpp> 57 58 using namespace ::xmloff::token; 59 using namespace com::sun::star; 60 61 using rtl::OUString; 62 using com::sun::star::uno::Reference; 63 64 //---------------------------------------- 65 //---------------------------------------- 66 67 static SvXMLEnumMapEntry aXMLAxisDimensionMap[] = 68 { 69 { XML_X, SCH_XML_AXIS_X }, 70 { XML_Y, SCH_XML_AXIS_Y }, 71 { XML_Z, SCH_XML_AXIS_Z }, 72 { XML_TOKEN_INVALID, 0 } 73 }; 74 75 static SvXMLEnumMapEntry aXMLAxisTypeMap[] = 76 { 77 { XML_AUTO, ::com::sun::star::chart::ChartAxisType::AUTOMATIC }, 78 { XML_TEXT, ::com::sun::star::chart::ChartAxisType::CATEGORY }, 79 { XML_DATE, ::com::sun::star::chart::ChartAxisType::DATE }, 80 { XML_TOKEN_INVALID, 0 } 81 }; 82 83 //---------------------------------------- 84 //---------------------------------------- 85 86 class SchXMLCategoriesContext : public SvXMLImportContext 87 { 88 private: 89 SchXMLImportHelper& m_rImportHelper; 90 OUString& mrAddress; 91 92 public: 93 SchXMLCategoriesContext( SchXMLImportHelper& rImpHelper, 94 SvXMLImport& rImport, 95 sal_uInt16 nPrefix, 96 const OUString& rLocalName, 97 OUString& rAddress ); 98 virtual ~SchXMLCategoriesContext(); 99 virtual void StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 100 }; 101 102 //---------------------------------------- 103 //---------------------------------------- 104 105 106 class DateScaleContext : public SvXMLImportContext 107 { 108 public: 109 DateScaleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, 110 sal_uInt16 nPrefix, const OUString& rLocalName, 111 const Reference< beans::XPropertySet > xAxisProps ); 112 113 virtual ~DateScaleContext(); 114 virtual void StartElement( const Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 115 116 private: 117 SchXMLImportHelper& m_rImportHelper; 118 Reference< beans::XPropertySet > m_xAxisProps; 119 }; 120 121 122 //---------------------------------------- 123 //---------------------------------------- 124 125 SchXMLAxisContext::SchXMLAxisContext( SchXMLImportHelper& rImpHelper, 126 SvXMLImport& rImport, const OUString& rLocalName, 127 Reference< chart::XDiagram > xDiagram, 128 std::vector< SchXMLAxis >& rAxes, 129 OUString & rCategoriesAddress, 130 bool bAddMissingXAxisForNetCharts, 131 bool bAdaptWrongPercentScaleValues, 132 bool bAdaptXAxisOrientationForOld2DBarCharts, 133 bool& rbAxisPositionAttributeImported ) : 134 SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ), 135 m_rImportHelper( rImpHelper ), 136 m_xDiagram( xDiagram ), 137 m_rAxes( rAxes ), 138 m_rCategoriesAddress( rCategoriesAddress ), 139 m_nAxisType(chart::ChartAxisType::AUTOMATIC), 140 m_bAxisTypeImported(false), 141 m_bDateScaleImported(false), 142 m_bAddMissingXAxisForNetCharts( bAddMissingXAxisForNetCharts ), 143 m_bAdaptWrongPercentScaleValues( bAdaptWrongPercentScaleValues ), 144 m_bAdaptXAxisOrientationForOld2DBarCharts( bAdaptXAxisOrientationForOld2DBarCharts ), 145 m_rbAxisPositionAttributeImported( rbAxisPositionAttributeImported ) 146 { 147 } 148 149 SchXMLAxisContext::~SchXMLAxisContext() 150 {} 151 152 Reference< chart::XAxis > lcl_getChartAxis( SchXMLAxis aCurrentAxis, const Reference< chart::XDiagram > xDiagram ) 153 { 154 Reference< chart::XAxis > xAxis; 155 Reference< chart::XAxisSupplier > xAxisSuppl( xDiagram, uno::UNO_QUERY ); 156 if( !xAxisSuppl.is() ) 157 return xAxis; 158 if( aCurrentAxis.nAxisIndex == 0 ) 159 xAxis = xAxisSuppl->getAxis(aCurrentAxis.eDimension); 160 else 161 xAxis = xAxisSuppl->getSecondaryAxis(aCurrentAxis.eDimension); 162 return xAxis; 163 } 164 165 /* returns a shape for the current axis's title. The property 166 "Has...AxisTitle" is set to "True" to get the shape 167 */ 168 Reference< drawing::XShape > SchXMLAxisContext::getTitleShape() 169 { 170 Reference< drawing::XShape > xResult; 171 Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY ); 172 Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) ); 173 if( !xDiaProp.is() || !xAxis.is() ) 174 return xResult; 175 176 rtl::OUString aPropName; 177 switch( m_aCurrentAxis.eDimension ) 178 { 179 case SCH_XML_AXIS_X: 180 if( m_aCurrentAxis.nAxisIndex == 0 ) 181 aPropName = OUString::createFromAscii( "HasXAxisTitle" ); 182 else 183 aPropName = OUString::createFromAscii( "HasSecondaryXAxisTitle" ); 184 break; 185 case SCH_XML_AXIS_Y: 186 if( m_aCurrentAxis.nAxisIndex == 0 ) 187 aPropName = OUString::createFromAscii( "HasYAxisTitle" ); 188 else 189 aPropName = OUString::createFromAscii( "HasSecondaryYAxisTitle" ); 190 break; 191 case SCH_XML_AXIS_Z: 192 aPropName = OUString::createFromAscii( "HasZAxisTitle" ); 193 break; 194 case SCH_XML_AXIS_UNDEF: 195 DBG_ERROR( "Invalid axis" ); 196 break; 197 } 198 xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) ); 199 xResult = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 200 return xResult; 201 } 202 203 void SchXMLAxisContext::CreateGrid( OUString sAutoStyleName, bool bIsMajor ) 204 { 205 Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY ); 206 Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) ); 207 if( !xDiaProp.is() || !xAxis.is() ) 208 return; 209 210 rtl::OUString aPropName; 211 switch( m_aCurrentAxis.eDimension ) 212 { 213 case SCH_XML_AXIS_X: 214 if( bIsMajor ) 215 aPropName = OUString::createFromAscii("HasXAxisGrid"); 216 else 217 aPropName = OUString::createFromAscii("HasXAxisHelpGrid"); 218 break; 219 case SCH_XML_AXIS_Y: 220 if( bIsMajor ) 221 aPropName = OUString::createFromAscii("HasYAxisGrid"); 222 else 223 aPropName = OUString::createFromAscii("HasYAxisHelpGrid"); 224 break; 225 case SCH_XML_AXIS_Z: 226 if( bIsMajor ) 227 aPropName = OUString::createFromAscii("HasZAxisGrid"); 228 else 229 aPropName = OUString::createFromAscii("HasZAxisHelpGrid"); 230 break; 231 case SCH_XML_AXIS_UNDEF: 232 DBG_ERROR( "Invalid axis" ); 233 break; 234 } 235 xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) ); 236 237 Reference< beans::XPropertySet > xGridProp; 238 if( bIsMajor ) 239 xGridProp = xAxis->getMajorGrid(); 240 else 241 xGridProp = xAxis->getMinorGrid(); 242 243 // set properties 244 if( xGridProp.is()) 245 { 246 // the line color is black as default, in the model it is a light gray 247 xGridProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )), 248 uno::makeAny( COL_BLACK )); 249 if( sAutoStyleName.getLength()) 250 { 251 const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext(); 252 if( pStylesCtxt ) 253 { 254 const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( 255 m_rImportHelper.GetChartFamilyID(), sAutoStyleName ); 256 257 if( pStyle && pStyle->ISA( XMLPropStyleContext )) 258 (( XMLPropStyleContext* )pStyle )->FillPropertySet( xGridProp ); 259 } 260 } 261 } 262 } 263 264 namespace 265 { 266 enum AxisAttributeTokens 267 { 268 XML_TOK_AXIS_DIMENSION, 269 XML_TOK_AXIS_NAME, 270 XML_TOK_AXIS_STYLE_NAME, 271 XML_TOK_AXIS_TYPE, 272 XML_TOK_AXIS_TYPE_EXT 273 }; 274 275 SvXMLTokenMapEntry aAxisAttributeTokenMap[] = 276 { 277 { XML_NAMESPACE_CHART, XML_DIMENSION, XML_TOK_AXIS_DIMENSION }, 278 { XML_NAMESPACE_CHART, XML_NAME, XML_TOK_AXIS_NAME }, 279 { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_AXIS_STYLE_NAME }, 280 { XML_NAMESPACE_CHART, XML_AXIS_TYPE, XML_TOK_AXIS_TYPE }, 281 { XML_NAMESPACE_CHART_EXT, XML_AXIS_TYPE, XML_TOK_AXIS_TYPE_EXT }, 282 XML_TOKEN_MAP_END 283 }; 284 285 class AxisAttributeTokenMap : public SvXMLTokenMap 286 { 287 public: 288 AxisAttributeTokenMap(): SvXMLTokenMap( aAxisAttributeTokenMap ) {} 289 virtual ~AxisAttributeTokenMap() {} 290 }; 291 292 //a AxisAttributeTokenMap Singleton 293 struct theAxisAttributeTokenMap : public rtl::Static< AxisAttributeTokenMap, theAxisAttributeTokenMap > {}; 294 } 295 296 void SchXMLAxisContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) 297 { 298 // parse attributes 299 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; 300 SchXMLImport& rImport = ( SchXMLImport& )GetImport(); 301 const SvXMLTokenMap& rAttrTokenMap = theAxisAttributeTokenMap::get(); 302 303 for( sal_Int16 i = 0; i < nAttrCount; i++ ) 304 { 305 OUString sAttrName = xAttrList->getNameByIndex( i ); 306 OUString aLocalName; 307 OUString aValue = xAttrList->getValueByIndex( i ); 308 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 309 310 switch( rAttrTokenMap.Get( nPrefix, aLocalName )) 311 { 312 case XML_TOK_AXIS_DIMENSION: 313 { 314 sal_uInt16 nEnumVal; 315 if( rImport.GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLAxisDimensionMap )) 316 m_aCurrentAxis.eDimension = ( SchXMLAxisDimension )nEnumVal; 317 } 318 break; 319 case XML_TOK_AXIS_NAME: 320 m_aCurrentAxis.aName = aValue; 321 break; 322 case XML_TOK_AXIS_TYPE: 323 case XML_TOK_AXIS_TYPE_EXT: 324 sal_uInt16 nEnumVal; 325 if( rImport.GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLAxisTypeMap )) 326 { 327 m_nAxisType = nEnumVal; 328 m_bAxisTypeImported = true; 329 } 330 break; 331 case XML_TOK_AXIS_STYLE_NAME: 332 m_aAutoStyleName = aValue; 333 break; 334 } 335 } 336 337 // check for number of axes with same dimension 338 m_aCurrentAxis.nAxisIndex = 0; 339 sal_Int32 nNumOfAxes = m_rAxes.size(); 340 for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ ) 341 { 342 if( m_rAxes[ nCurrent ].eDimension == m_aCurrentAxis.eDimension ) 343 m_aCurrentAxis.nAxisIndex++; 344 } 345 CreateAxis(); 346 } 347 namespace 348 { 349 350 Reference< chart2::XAxis > lcl_getAxis( const Reference< frame::XModel >& xChartModel, 351 sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) 352 { 353 Reference< chart2::XAxis > xAxis; 354 355 try 356 { 357 Reference< chart2::XChartDocument > xChart2Document( xChartModel, uno::UNO_QUERY ); 358 if( xChart2Document.is() ) 359 { 360 Reference< chart2::XDiagram > xDiagram( xChart2Document->getFirstDiagram()); 361 Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); 362 uno::Sequence< Reference< chart2::XCoordinateSystem > > 363 aCooSysSeq( xCooSysCnt->getCoordinateSystems()); 364 sal_Int32 nCooSysIndex = 0; 365 if( nCooSysIndex < aCooSysSeq.getLength() ) 366 { 367 Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] ); 368 if( xCooSys.is() && nDimensionIndex < xCooSys->getDimension() ) 369 { 370 const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex); 371 if( nAxisIndex <= nMaxAxisIndex ) 372 xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ); 373 } 374 } 375 } 376 } 377 catch( uno::Exception & ) 378 { 379 DBG_ERROR( "Couldn't get axis" ); 380 } 381 382 return xAxis; 383 } 384 385 bool lcl_divideBy100( uno::Any& rDoubleAny ) 386 { 387 bool bChanged = false; 388 double fValue=0.0; 389 if( (rDoubleAny>>=fValue) && (fValue!=0.0) ) 390 { 391 fValue/=100.0; 392 rDoubleAny = uno::makeAny(fValue); 393 bChanged = true; 394 } 395 return bChanged; 396 } 397 398 bool lcl_AdaptWrongPercentScaleValues(chart2::ScaleData& rScaleData) 399 { 400 bool bChanged = lcl_divideBy100( rScaleData.Minimum ); 401 bChanged = lcl_divideBy100( rScaleData.Maximum ) || bChanged; 402 bChanged = lcl_divideBy100( rScaleData.Origin ) || bChanged; 403 bChanged = lcl_divideBy100( rScaleData.IncrementData.Distance ) || bChanged; 404 return bChanged; 405 } 406 407 }//end anonymous namespace 408 409 void SchXMLAxisContext::CreateAxis() 410 { 411 m_rAxes.push_back( m_aCurrentAxis ); 412 413 Reference< beans::XPropertySet > xDiaProp( m_rImportHelper.GetChartDocument()->getDiagram(), uno::UNO_QUERY ); 414 if( !xDiaProp.is() ) 415 return; 416 rtl::OUString aPropName; 417 switch( m_aCurrentAxis.eDimension ) 418 { 419 case SCH_XML_AXIS_X: 420 if( m_aCurrentAxis.nAxisIndex == 0 ) 421 aPropName = OUString::createFromAscii("HasXAxis"); 422 else 423 aPropName = OUString::createFromAscii("HasSecondaryXAxis"); 424 break; 425 case SCH_XML_AXIS_Y: 426 if( m_aCurrentAxis.nAxisIndex == 0 ) 427 aPropName = OUString::createFromAscii("HasYAxis"); 428 else 429 aPropName = OUString::createFromAscii("HasSecondaryYAxis"); 430 break; 431 case SCH_XML_AXIS_Z: 432 if( m_aCurrentAxis.nAxisIndex == 0 ) 433 aPropName = OUString::createFromAscii("HasXAxis"); 434 else 435 aPropName = OUString::createFromAscii("HasSecondaryXAxis"); 436 break; 437 case SCH_XML_AXIS_UNDEF: 438 DBG_ERROR( "Invalid axis" ); 439 break; 440 } 441 try 442 { 443 xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) ); 444 } 445 catch( beans::UnknownPropertyException & ) 446 { 447 DBG_ERROR( "Couldn't turn on axis" ); 448 } 449 if( m_aCurrentAxis.eDimension==SCH_XML_AXIS_Z ) 450 { 451 bool bSettingZAxisSuccedded = false; 452 try 453 { 454 xDiaProp->getPropertyValue( aPropName ) >>= bSettingZAxisSuccedded; 455 } 456 catch( beans::UnknownPropertyException & ) 457 { 458 DBG_ERROR( "Couldn't turn on z axis" ); 459 } 460 if( !bSettingZAxisSuccedded ) 461 return; 462 } 463 464 465 m_xAxisProps = Reference<beans::XPropertySet>( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ), uno::UNO_QUERY ); 466 467 if( m_bAddMissingXAxisForNetCharts && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y && m_aCurrentAxis.nAxisIndex==0 ) 468 { 469 try 470 { 471 xDiaProp->setPropertyValue( OUString::createFromAscii( "HasXAxis" ), uno::makeAny(sal_True) ); 472 } 473 catch( beans::UnknownPropertyException & ) 474 { 475 DBG_ERROR( "Couldn't turn on x axis" ); 476 } 477 } 478 479 // set properties 480 if( m_xAxisProps.is()) 481 { 482 uno::Any aTrueBool( uno::makeAny( sal_True )); 483 uno::Any aFalseBool( uno::makeAny( sal_False )); 484 485 // #i109879# the line color is black as default, in the model it is a light gray 486 m_xAxisProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )), 487 uno::makeAny( COL_BLACK )); 488 489 m_xAxisProps->setPropertyValue( OUString::createFromAscii( "DisplayLabels" ), aFalseBool ); 490 491 // #88077# AutoOrigin 'on' is default 492 m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AutoOrigin" ), aTrueBool ); 493 494 if( m_bAxisTypeImported ) 495 m_xAxisProps->setPropertyValue( OUString::createFromAscii( "AxisType" ), uno::makeAny(m_nAxisType) ); 496 497 if( m_aAutoStyleName.getLength()) 498 { 499 const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext(); 500 if( pStylesCtxt ) 501 { 502 const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( 503 m_rImportHelper.GetChartFamilyID(), m_aAutoStyleName ); 504 505 if( pStyle && pStyle->ISA( XMLPropStyleContext )) 506 { 507 // note: SvXMLStyleContext::FillPropertySet is not const 508 XMLPropStyleContext * pPropStyleContext = const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle )); 509 if( pPropStyleContext ) 510 pPropStyleContext->FillPropertySet( m_xAxisProps ); 511 512 if( m_bAdaptWrongPercentScaleValues && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y ) 513 { 514 //set scale data of added x axis back to default 515 Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(), 516 m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) ); 517 if( xAxis.is() ) 518 { 519 chart2::ScaleData aScaleData( xAxis->getScaleData()); 520 if( lcl_AdaptWrongPercentScaleValues(aScaleData) ) 521 xAxis->setScaleData( aScaleData ); 522 } 523 } 524 525 if( m_bAddMissingXAxisForNetCharts ) 526 { 527 //copy style from y axis to added x axis: 528 529 Reference< chart::XAxisSupplier > xAxisSuppl( xDiaProp, uno::UNO_QUERY ); 530 if( xAxisSuppl.is() ) 531 { 532 Reference< beans::XPropertySet > xXAxisProp( xAxisSuppl->getAxis(0), uno::UNO_QUERY ); 533 (( XMLPropStyleContext* )pStyle )->FillPropertySet( xXAxisProp ); 534 } 535 536 //set scale data of added x axis back to default 537 Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(), 538 0 /*nDimensionIndex*/, 0 /*nAxisIndex*/ ) ); 539 if( xAxis.is() ) 540 { 541 chart2::ScaleData aScaleData; 542 aScaleData.AxisType = chart2::AxisType::CATEGORY; 543 aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL; 544 xAxis->setScaleData( aScaleData ); 545 } 546 547 //set line style of added x axis to invisible 548 Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY ); 549 if( xNewAxisProp.is() ) 550 { 551 xNewAxisProp->setPropertyValue( OUString::createFromAscii("LineStyle") 552 , uno::makeAny(drawing::LineStyle_NONE)); 553 } 554 } 555 556 if( m_bAdaptXAxisOrientationForOld2DBarCharts && m_aCurrentAxis.eDimension == SCH_XML_AXIS_X ) 557 { 558 bool bIs3DChart = false; 559 if( xDiaProp.is() && ( xDiaProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3DChart ) 560 && !bIs3DChart ) 561 { 562 Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY ); 563 if( xChart2Document.is() ) 564 { 565 Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY ); 566 if( xCooSysCnt.is() ) 567 { 568 uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); 569 if( aCooSysSeq.getLength() ) 570 { 571 bool bSwapXandYAxis = false; 572 Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); 573 Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); 574 if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXandYAxis ) 575 && bSwapXandYAxis ) 576 { 577 Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, m_aCurrentAxis.nAxisIndex ); 578 if( xAxis.is() ) 579 { 580 chart2::ScaleData aScaleData = xAxis->getScaleData(); 581 aScaleData.Orientation = chart2::AxisOrientation_REVERSE; 582 xAxis->setScaleData( aScaleData ); 583 } 584 } 585 } 586 } 587 } 588 } 589 } 590 591 m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext( 592 OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")), pPropStyleContext, pStylesCtxt ).hasValue(); 593 } 594 } 595 } 596 } 597 } 598 599 void SchXMLAxisContext::SetAxisTitle() 600 { 601 if( !m_aCurrentAxis.aTitle.getLength() ) 602 return; 603 604 Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) ); 605 if( !xAxis.is() ) 606 return; 607 608 Reference< beans::XPropertySet > xTitleProp( xAxis->getAxisTitle() ); 609 if( xTitleProp.is() ) 610 { 611 try 612 { 613 xTitleProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), uno::makeAny(m_aCurrentAxis.aTitle) ); 614 } 615 catch( beans::UnknownPropertyException & ) 616 { 617 DBG_ERROR( "Property String for Title not available" ); 618 } 619 } 620 } 621 622 //----------------------------------------------------------------------- 623 namespace 624 { 625 enum AxisChildTokens 626 { 627 XML_TOK_AXIS_TITLE, 628 XML_TOK_AXIS_CATEGORIES, 629 XML_TOK_AXIS_GRID, 630 XML_TOK_AXIS_DATE_SCALE, 631 XML_TOK_AXIS_DATE_SCALE_EXT 632 }; 633 634 SvXMLTokenMapEntry aAxisChildTokenMap[] = 635 { 636 { XML_NAMESPACE_CHART, XML_TITLE, XML_TOK_AXIS_TITLE }, 637 { XML_NAMESPACE_CHART, XML_CATEGORIES, XML_TOK_AXIS_CATEGORIES }, 638 { XML_NAMESPACE_CHART, XML_GRID, XML_TOK_AXIS_GRID }, 639 { XML_NAMESPACE_CHART, XML_DATE_SCALE, XML_TOK_AXIS_DATE_SCALE }, 640 { XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, XML_TOK_AXIS_DATE_SCALE_EXT }, 641 XML_TOKEN_MAP_END 642 }; 643 644 class AxisChildTokenMap : public SvXMLTokenMap 645 { 646 public: 647 AxisChildTokenMap(): SvXMLTokenMap( aAxisChildTokenMap ) {} 648 virtual ~AxisChildTokenMap() {} 649 }; 650 651 //a AxisChildTokenMap Singleton 652 struct theAxisChildTokenMap : public rtl::Static< AxisChildTokenMap, theAxisChildTokenMap > {}; 653 } 654 655 SvXMLImportContext* SchXMLAxisContext::CreateChildContext( 656 sal_uInt16 p_nPrefix, 657 const OUString& rLocalName, 658 const Reference< xml::sax::XAttributeList >& xAttrList ) 659 { 660 SvXMLImportContext* pContext = 0; 661 const SvXMLTokenMap& rTokenMap = theAxisChildTokenMap::get(); 662 663 switch( rTokenMap.Get( p_nPrefix, rLocalName )) 664 { 665 case XML_TOK_AXIS_TITLE: 666 { 667 Reference< drawing::XShape > xTitleShape = getTitleShape(); 668 pContext = new SchXMLTitleContext( m_rImportHelper, GetImport(), rLocalName, 669 m_aCurrentAxis.aTitle, 670 xTitleShape ); 671 } 672 break; 673 674 case XML_TOK_AXIS_CATEGORIES: 675 pContext = new SchXMLCategoriesContext( m_rImportHelper, GetImport(), 676 p_nPrefix, rLocalName, 677 m_rCategoriesAddress ); 678 m_aCurrentAxis.bHasCategories = true; 679 break; 680 681 case XML_TOK_AXIS_DATE_SCALE: 682 case XML_TOK_AXIS_DATE_SCALE_EXT: 683 pContext = new DateScaleContext( m_rImportHelper, GetImport(), 684 p_nPrefix, rLocalName, m_xAxisProps ); 685 m_bDateScaleImported = true; 686 break; 687 688 case XML_TOK_AXIS_GRID: 689 { 690 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; 691 bool bIsMajor = true; // default value for class is "major" 692 OUString sAutoStyleName; 693 694 for( sal_Int16 i = 0; i < nAttrCount; i++ ) 695 { 696 OUString sAttrName = xAttrList->getNameByIndex( i ); 697 OUString aLocalName; 698 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 699 700 if( nPrefix == XML_NAMESPACE_CHART ) 701 { 702 if( IsXMLToken( aLocalName, XML_CLASS ) ) 703 { 704 if( IsXMLToken( xAttrList->getValueByIndex( i ), XML_MINOR ) ) 705 bIsMajor = false; 706 } 707 else if( IsXMLToken( aLocalName, XML_STYLE_NAME ) ) 708 sAutoStyleName = xAttrList->getValueByIndex( i ); 709 } 710 } 711 712 CreateGrid( sAutoStyleName, bIsMajor ); 713 714 // don't create a context => use default context. grid elements are empty 715 pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName ); 716 } 717 break; 718 719 default: 720 pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName ); 721 break; 722 } 723 724 return pContext; 725 } 726 727 void SchXMLAxisContext::EndElement() 728 { 729 if( !m_bDateScaleImported && m_nAxisType==chart::ChartAxisType::AUTOMATIC ) 730 { 731 Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) ); 732 if( xAxis.is() ) 733 { 734 chart2::ScaleData aScaleData( xAxis->getScaleData()); 735 aScaleData.AutoDateAxis = false;//different default for older documents 736 xAxis->setScaleData( aScaleData ); 737 } 738 } 739 740 SetAxisTitle(); 741 } 742 743 // ======================================== 744 745 namespace 746 { 747 748 Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem > xCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) 749 { 750 Reference< chart2::XAxis > xAxis; 751 try 752 { 753 xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ); 754 } 755 catch( uno::Exception & ) 756 { 757 } 758 return xAxis; 759 } 760 761 } // anonymous namespace 762 763 void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDocument >& xNewDoc, 764 const OUString& rChartTypeServiceName, 765 const OUString& rODFVersionOfFile, 766 bool bAxisPositionAttributeImported ) 767 { 768 if( ( !rODFVersionOfFile.getLength() || rODFVersionOfFile.equalsAscii("1.0") 769 || rODFVersionOfFile.equalsAscii("1.1") 770 || ( rODFVersionOfFile.equalsAscii("1.2") && !bAxisPositionAttributeImported ) ) ) 771 { 772 try 773 { 774 Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW ); 775 uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); 776 if( aCooSysSeq.getLength() ) 777 { 778 Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); 779 if( xCooSys.is() ) 780 { 781 Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 ); 782 Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 ); 783 //Reference< chart2::XAxis > xMajorZAxis = lcl_getAxis( xCooSys, 2, 0 ); 784 Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 ); 785 Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 ); 786 787 Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY ); 788 Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY ); 789 Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY ); 790 Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY ); 791 792 if( xMainXAxisProp.is() && xMainYAxisProp.is() ) 793 { 794 chart2::ScaleData aMainXScale = xMainXAxis->getScaleData(); 795 if( 0 == rChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) ) 796 { 797 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 798 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); 799 double fCrossoverValue = 0.0; 800 aMainXScale.Origin >>= fCrossoverValue; 801 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue") 802 , uno::makeAny( fCrossoverValue ) ); 803 804 if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) 805 { 806 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") 807 , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); 808 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") 809 , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); 810 if( xSecondaryYAxisProp.is() ) 811 xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 812 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); 813 } 814 else 815 { 816 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") 817 , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); 818 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") 819 , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); 820 if( xSecondaryYAxisProp.is() ) 821 xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 822 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); 823 } 824 } 825 else 826 { 827 if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) 828 { 829 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 830 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); 831 if( xSecondaryYAxisProp.is() ) 832 xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 833 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); 834 } 835 else 836 { 837 xMainYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 838 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); 839 if( xSecondaryYAxisProp.is() ) 840 xSecondaryYAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 841 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); 842 } 843 } 844 845 chart2::ScaleData aMainYScale = xMainYAxis->getScaleData(); 846 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 847 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); 848 double fCrossoverValue = 0.0; 849 aMainYScale.Origin >>= fCrossoverValue; 850 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverValue") 851 , uno::makeAny( fCrossoverValue ) ); 852 853 if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE ) 854 { 855 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") 856 , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); 857 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") 858 , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); 859 if( xSecondaryXAxisProp.is() ) 860 xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 861 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); 862 } 863 else 864 { 865 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("LabelPosition") 866 , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); 867 xMainXAxisProp->setPropertyValue( OUString::createFromAscii("MarkPosition") 868 , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); 869 if( xSecondaryXAxisProp.is() ) 870 xSecondaryXAxisProp->setPropertyValue( OUString::createFromAscii("CrossoverPosition") 871 , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); 872 } 873 } 874 } 875 } 876 } 877 catch( uno::Exception & ) 878 { 879 } 880 } 881 } 882 883 // ======================================== 884 885 SchXMLCategoriesContext::SchXMLCategoriesContext( 886 SchXMLImportHelper& rImpHelper, 887 SvXMLImport& rImport, 888 sal_uInt16 nPrefix, 889 const OUString& rLocalName, 890 OUString& rAddress ) : 891 SvXMLImportContext( rImport, nPrefix, rLocalName ), 892 m_rImportHelper( rImpHelper ), 893 mrAddress( rAddress ) 894 { 895 } 896 897 SchXMLCategoriesContext::~SchXMLCategoriesContext() 898 { 899 } 900 901 void SchXMLCategoriesContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) 902 { 903 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; 904 905 for( sal_Int16 i = 0; i < nAttrCount; i++ ) 906 { 907 OUString sAttrName = xAttrList->getNameByIndex( i ); 908 OUString aLocalName; 909 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 910 911 if( nPrefix == XML_NAMESPACE_TABLE && 912 IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) ) 913 { 914 Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY ); 915 mrAddress = xAttrList->getValueByIndex( i ); 916 } 917 } 918 } 919 920 // ======================================== 921 922 DateScaleContext::DateScaleContext( 923 SchXMLImportHelper& rImpHelper, 924 SvXMLImport& rImport, 925 sal_uInt16 nPrefix, 926 const OUString& rLocalName, 927 const Reference< beans::XPropertySet > xAxisProps ) : 928 SvXMLImportContext( rImport, nPrefix, rLocalName ), 929 m_rImportHelper( rImpHelper ), 930 m_xAxisProps( xAxisProps ) 931 { 932 } 933 934 DateScaleContext::~DateScaleContext() 935 { 936 } 937 938 namespace 939 { 940 enum DateScaleAttributeTokens 941 { 942 XML_TOK_DATESCALE_BASE_TIME_UNIT, 943 XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE, 944 XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT, 945 XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE, 946 XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT 947 }; 948 949 SvXMLTokenMapEntry aDateScaleAttributeTokenMap[] = 950 { 951 { XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, XML_TOK_DATESCALE_BASE_TIME_UNIT }, 952 { XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE }, 953 { XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT }, 954 { XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE }, 955 { XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT }, 956 XML_TOKEN_MAP_END 957 }; 958 959 class DateScaleAttributeTokenMap : public SvXMLTokenMap 960 { 961 public: 962 DateScaleAttributeTokenMap(): SvXMLTokenMap( aDateScaleAttributeTokenMap ) {} 963 virtual ~DateScaleAttributeTokenMap() {} 964 }; 965 966 struct theDateScaleAttributeTokenMap : public rtl::Static< DateScaleAttributeTokenMap, theDateScaleAttributeTokenMap > {}; 967 968 sal_Int32 lcl_getTimeUnit( const OUString& rValue ) 969 { 970 sal_Int32 nTimeUnit = ::com::sun::star::chart::TimeUnit::DAY; 971 if( IsXMLToken( rValue, XML_DAYS ) ) 972 nTimeUnit = ::com::sun::star::chart::TimeUnit::DAY; 973 else if( IsXMLToken( rValue, XML_MONTHS ) ) 974 nTimeUnit = ::com::sun::star::chart::TimeUnit::MONTH; 975 else if( IsXMLToken( rValue, XML_YEARS ) ) 976 nTimeUnit = ::com::sun::star::chart::TimeUnit::YEAR; 977 return nTimeUnit; 978 } 979 980 } 981 982 void DateScaleContext::StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ) 983 { 984 if( !m_xAxisProps.is() ) 985 return; 986 987 // parse attributes 988 sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; 989 const SvXMLTokenMap& rAttrTokenMap = theDateScaleAttributeTokenMap::get(); 990 991 bool bSetNewIncrement=false; 992 chart::TimeIncrement aIncrement; 993 m_xAxisProps->getPropertyValue( OUString::createFromAscii( "TimeIncrement" )) >>= aIncrement; 994 995 for( sal_Int16 i = 0; i < nAttrCount; i++ ) 996 { 997 OUString sAttrName = xAttrList->getNameByIndex( i ); 998 OUString aLocalName; 999 OUString aValue = xAttrList->getValueByIndex( i ); 1000 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 1001 1002 switch( rAttrTokenMap.Get( nPrefix, aLocalName )) 1003 { 1004 case XML_TOK_DATESCALE_BASE_TIME_UNIT: 1005 { 1006 aIncrement.TimeResolution = uno::makeAny( lcl_getTimeUnit(aValue) ); 1007 bSetNewIncrement = true; 1008 } 1009 break; 1010 case XML_TOK_DATESCALE_MAJOR_INTERVAL_VALUE: 1011 { 1012 chart::TimeInterval aInterval(1,0); 1013 aIncrement.MajorTimeInterval >>= aInterval; 1014 SvXMLUnitConverter::convertNumber( aInterval.Number, aValue ); 1015 aIncrement.MajorTimeInterval = uno::makeAny(aInterval); 1016 bSetNewIncrement = true; 1017 } 1018 break; 1019 case XML_TOK_DATESCALE_MAJOR_INTERVAL_UNIT: 1020 { 1021 chart::TimeInterval aInterval(1,0); 1022 aIncrement.MajorTimeInterval >>= aInterval; 1023 aInterval.TimeUnit = lcl_getTimeUnit(aValue); 1024 aIncrement.MajorTimeInterval = uno::makeAny(aInterval); 1025 bSetNewIncrement = true; 1026 } 1027 break; 1028 case XML_TOK_DATESCALE_MINOR_INTERVAL_VALUE: 1029 { 1030 chart::TimeInterval aInterval(1,0); 1031 aIncrement.MinorTimeInterval >>= aInterval; 1032 SvXMLUnitConverter::convertNumber( aInterval.Number, aValue ); 1033 aIncrement.MinorTimeInterval = uno::makeAny(aInterval); 1034 bSetNewIncrement = true; 1035 } 1036 break; 1037 case XML_TOK_DATESCALE_MINOR_INTERVAL_UNIT: 1038 { 1039 chart::TimeInterval aInterval(1,0); 1040 aIncrement.MinorTimeInterval >>= aInterval; 1041 aInterval.TimeUnit = lcl_getTimeUnit(aValue); 1042 aIncrement.MinorTimeInterval = uno::makeAny(aInterval); 1043 bSetNewIncrement = true; 1044 } 1045 break; 1046 } 1047 } 1048 1049 if( bSetNewIncrement ) 1050 m_xAxisProps->setPropertyValue( OUString::createFromAscii( "TimeIncrement" ), uno::makeAny( aIncrement ) ); 1051 } 1052 1053 // ======================================== 1054