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_chart2.hxx" 30 31 #include "WrappedSymbolProperties.hxx" 32 #include "WrappedSeriesOrDiagramProperty.hxx" 33 #include "macros.hxx" 34 #include "FastPropertyIdRanges.hxx" 35 #include "ChartTypeHelper.hxx" 36 #include <com/sun/star/chart2/Symbol.hpp> 37 #include <com/sun/star/chart2/SymbolStyle.hpp> 38 #include <com/sun/star/awt/Size.hpp> 39 #include <com/sun/star/beans/PropertyAttribute.hpp> 40 #include <com/sun/star/chart/ChartSymbolType.hpp> 41 #include <com/sun/star/drawing/LineStyle.hpp> 42 43 #include <com/sun/star/graphic/XGraphicProvider.hpp> 44 45 // for UNO_NAME_GRAPHOBJ_URLPREFIX 46 #include <editeng/unoprnms.hxx> 47 48 // for Graphic 49 #include <vcl/graph.hxx> 50 // for GraphicObject 51 #include <svtools/grfmgr.hxx> 52 #include <vcl/outdev.hxx> 53 54 #include <comphelper/processfactory.hxx> 55 56 using namespace ::com::sun::star; 57 using ::com::sun::star::uno::Any; 58 using ::com::sun::star::uno::Reference; 59 using ::com::sun::star::uno::Sequence; 60 using ::com::sun::star::beans::Property; 61 using ::rtl::OUString; 62 63 //............................................................................. 64 namespace chart 65 { 66 namespace wrapper 67 { 68 69 70 //----------------------------------------------------------------------------- 71 //----------------------------------------------------------------------------- 72 //----------------------------------------------------------------------------- 73 74 class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 > 75 { 76 public: 77 virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const; 78 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const; 79 80 virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const 81 throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException); 82 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const 83 throw (beans::UnknownPropertyException, uno::RuntimeException); 84 85 explicit WrappedSymbolTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 86 tSeriesOrDiagramPropertyType ePropertyType ); 87 virtual ~WrappedSymbolTypeProperty(); 88 }; 89 90 class WrappedSymbolBitmapURLProperty : public WrappedSeriesOrDiagramProperty< OUString > 91 { 92 public: 93 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const; 94 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewGraphicURL ) const; 95 96 explicit WrappedSymbolBitmapURLProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 97 tSeriesOrDiagramPropertyType ePropertyType ); 98 virtual ~WrappedSymbolBitmapURLProperty(); 99 }; 100 101 // this operator is not defined by default 102 bool operator!=( const awt::Size & rSize1, const awt::Size & rSize2 ) 103 { 104 return (rSize1.Width != rSize2.Width) || (rSize1.Height != rSize2.Height); 105 } 106 107 class WrappedSymbolSizeProperty : public WrappedSeriesOrDiagramProperty< awt::Size > 108 { 109 public: 110 virtual awt::Size getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const; 111 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, awt::Size aNewSize ) const; 112 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const 113 throw (beans::UnknownPropertyException, uno::RuntimeException); 114 115 explicit WrappedSymbolSizeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 116 tSeriesOrDiagramPropertyType ePropertyType ); 117 virtual ~WrappedSymbolSizeProperty(); 118 }; 119 120 class WrappedSymbolAndLinesProperty : public WrappedSeriesOrDiagramProperty< sal_Bool > 121 { 122 public: 123 virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const; 124 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool bDrawLines ) const; 125 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const 126 throw (beans::UnknownPropertyException, uno::RuntimeException); 127 128 explicit WrappedSymbolAndLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 129 tSeriesOrDiagramPropertyType ePropertyType ); 130 virtual ~WrappedSymbolAndLinesProperty(); 131 }; 132 133 namespace 134 { 135 enum 136 { 137 //symbol properties 138 PROP_CHART_SYMBOL_TYPE = FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP, 139 PROP_CHART_SYMBOL_BITMAP_URL, 140 PROP_CHART_SYMBOL_SIZE, 141 PROP_CHART_SYMBOL_AND_LINES 142 }; 143 144 sal_Int32 lcl_getSymbolType( const ::com::sun::star::chart2::Symbol& rSymbol ) 145 { 146 sal_Int32 nSymbol = ::com::sun::star::chart::ChartSymbolType::NONE; 147 switch( rSymbol.Style ) 148 { 149 case chart2::SymbolStyle_NONE: 150 break; 151 case chart2::SymbolStyle_AUTO: 152 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO; 153 break; 154 case chart2::SymbolStyle_STANDARD: 155 nSymbol = rSymbol.StandardSymbol%8; 156 break; 157 case chart2::SymbolStyle_POLYGON://new feature 158 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO; 159 break; 160 case chart2::SymbolStyle_GRAPHIC: 161 nSymbol = ::com::sun::star::chart::ChartSymbolType::BITMAPURL; 162 break; 163 default: 164 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO; 165 break; 166 } 167 return nSymbol; 168 } 169 void lcl_setSymbolTypeToSymbol( sal_Int32 nSymbolType, chart2::Symbol& rSymbol ) 170 { 171 switch( nSymbolType ) 172 { 173 case ::com::sun::star::chart::ChartSymbolType::NONE: 174 rSymbol.Style = chart2::SymbolStyle_NONE; 175 break; 176 case ::com::sun::star::chart::ChartSymbolType::AUTO: 177 rSymbol.Style = chart2::SymbolStyle_AUTO; 178 break; 179 case ::com::sun::star::chart::ChartSymbolType::BITMAPURL: 180 rSymbol.Style = chart2::SymbolStyle_GRAPHIC; 181 break; 182 default: 183 rSymbol.Style = chart2::SymbolStyle_STANDARD; 184 rSymbol.StandardSymbol = nSymbolType; 185 break; 186 } 187 } 188 189 void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList 190 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact 191 , tSeriesOrDiagramPropertyType ePropertyType ) 192 { 193 rList.push_back( new WrappedSymbolTypeProperty( spChart2ModelContact, ePropertyType ) ); 194 rList.push_back( new WrappedSymbolBitmapURLProperty( spChart2ModelContact, ePropertyType ) ); 195 rList.push_back( new WrappedSymbolSizeProperty( spChart2ModelContact, ePropertyType ) ); 196 rList.push_back( new WrappedSymbolAndLinesProperty( spChart2ModelContact, ePropertyType ) ); 197 } 198 199 }//anonymous namespace 200 201 //----------------------------------------------------------------------------- 202 //----------------------------------------------------------------------------- 203 //----------------------------------------------------------------------------- 204 void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutProperties ) 205 { 206 rOutProperties.push_back( 207 Property( C2U( "SymbolType" ), 208 PROP_CHART_SYMBOL_TYPE, 209 ::getCppuType( reinterpret_cast< sal_Int32 * >(0)), 210 beans::PropertyAttribute::BOUND 211 | beans::PropertyAttribute::MAYBEDEFAULT )); 212 213 rOutProperties.push_back( 214 Property( C2U( "SymbolBitmapURL" ), 215 PROP_CHART_SYMBOL_BITMAP_URL, 216 ::getCppuType( reinterpret_cast< ::rtl::OUString * >(0)), 217 beans::PropertyAttribute::BOUND 218 | beans::PropertyAttribute::MAYBEDEFAULT )); 219 220 rOutProperties.push_back( 221 Property( C2U( "SymbolSize" ), 222 PROP_CHART_SYMBOL_SIZE, 223 ::getCppuType( reinterpret_cast< awt::Size * >(0)), 224 beans::PropertyAttribute::BOUND 225 | beans::PropertyAttribute::MAYBEDEFAULT )); 226 227 rOutProperties.push_back( 228 Property( C2U( "Lines" ), 229 PROP_CHART_SYMBOL_AND_LINES, 230 ::getBooleanCppuType(), 231 beans::PropertyAttribute::BOUND 232 | beans::PropertyAttribute::MAYBEDEFAULT )); 233 } 234 235 //----------------------------------------------------------------------------- 236 //----------------------------------------------------------------------------- 237 238 void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList 239 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 240 { 241 lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES ); 242 } 243 244 //----------------------------------------------------------------------------- 245 //----------------------------------------------------------------------------- 246 247 void WrappedSymbolProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList 248 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 249 { 250 lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM ); 251 } 252 253 //----------------------------------------------------------------------------- 254 //----------------------------------------------------------------------------- 255 //----------------------------------------------------------------------------- 256 257 WrappedSymbolTypeProperty::WrappedSymbolTypeProperty( 258 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 259 tSeriesOrDiagramPropertyType ePropertyType ) 260 : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("SymbolType") 261 , uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE ) 262 , spChart2ModelContact 263 , ePropertyType ) 264 { 265 } 266 WrappedSymbolTypeProperty::~WrappedSymbolTypeProperty() 267 { 268 } 269 270 sal_Int32 WrappedSymbolTypeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const 271 { 272 sal_Int32 aRet = 0; 273 m_aDefaultValue >>= aRet; 274 chart2::Symbol aSymbol; 275 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) ) 276 aRet = lcl_getSymbolType( aSymbol ); 277 return aRet; 278 } 279 280 void WrappedSymbolTypeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nSymbolType ) const 281 { 282 if(!xSeriesPropertySet.is()) 283 return; 284 285 chart2::Symbol aSymbol; 286 xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol; 287 288 lcl_setSymbolTypeToSymbol( nSymbolType, aSymbol ); 289 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) ); 290 } 291 292 Any WrappedSymbolTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const 293 throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 294 { 295 //the old chart (< OOo 2.3) needs symbol-type="automatic" at the plot-area if any of the series should be able to have symbols 296 if( m_ePropertyType == DIAGRAM ) 297 { 298 bool bHasAmbiguousValue = false; 299 sal_Int32 aValue = 0; 300 if( detectInnerValue( aValue, bHasAmbiguousValue ) ) 301 { 302 if(bHasAmbiguousValue) 303 { 304 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO ); 305 } 306 else 307 { 308 if( ::com::sun::star::chart::ChartSymbolType::NONE == aValue ) 309 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE ); 310 else 311 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO ); 312 } 313 } 314 return m_aOuterValue; 315 } 316 else 317 { 318 ::com::sun::star::uno::Any aRet( m_aDefaultValue ); 319 aRet <<= getValueFromSeries( xInnerPropertySet ); 320 return aRet; 321 } 322 } 323 324 beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const 325 throw (beans::UnknownPropertyException, uno::RuntimeException) 326 { 327 //the special situation for this property here is that the diagram default can be 328 //different from the normal default and different from all sinlges series values 329 //so we need to return PropertyState_DIRECT_VALUE for more cases 330 331 if( m_ePropertyType == DATA_SERIES && //single series or point 332 m_spChart2ModelContact.get()) 333 { 334 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 335 Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY ); 336 Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); 337 if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) ) 338 return beans::PropertyState_DIRECT_VALUE; 339 } 340 return WrappedProperty::getPropertyState( xInnerPropertyState ); 341 } 342 343 //----------------------------------------------------------------------------- 344 //----------------------------------------------------------------------------- 345 //----------------------------------------------------------------------------- 346 347 WrappedSymbolBitmapURLProperty::WrappedSymbolBitmapURLProperty( 348 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 349 tSeriesOrDiagramPropertyType ePropertyType ) 350 : WrappedSeriesOrDiagramProperty< OUString >( C2U("SymbolBitmapURL") 351 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType ) 352 { 353 } 354 355 WrappedSymbolBitmapURLProperty::~WrappedSymbolBitmapURLProperty() 356 { 357 } 358 359 OUString WrappedSymbolBitmapURLProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const 360 { 361 OUString aRet; 362 m_aDefaultValue >>= aRet; 363 chart2::Symbol aSymbol; 364 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) 365 && aSymbol.Graphic.is()) 366 { 367 GraphicObject aGrObj( Graphic( aSymbol.Graphic )); 368 aRet = OUString( RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX )); 369 aRet += OUString::createFromAscii( aGrObj.GetUniqueID().GetBuffer()); 370 } 371 return aRet; 372 } 373 374 void WrappedSymbolBitmapURLProperty::setValueToSeries( 375 const Reference< beans::XPropertySet >& xSeriesPropertySet, 376 OUString aNewGraphicURL ) const 377 { 378 if(!xSeriesPropertySet.is()) 379 return; 380 381 chart2::Symbol aSymbol; 382 if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) 383 { 384 bool bMatchesPrefix = 385 aNewGraphicURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX )); 386 if( bMatchesPrefix ) 387 { 388 GraphicObject aGrObj = GraphicObject( 389 ByteString( U2C( aNewGraphicURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 )))); 390 aSymbol.Graphic.set( aGrObj.GetGraphic().GetXGraphic()); 391 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) ); 392 } 393 else 394 { 395 try 396 { 397 // @todo: get factory from some context? 398 Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); 399 Reference< graphic::XGraphicProvider > xGraphProv( 400 xFact->createInstance( C2U("com.sun.star.graphic.GraphicProvider")), uno::UNO_QUERY_THROW ); 401 Sequence< beans::PropertyValue > aArgs(1); 402 aArgs[0] = beans::PropertyValue( 403 C2U("URL"), -1, uno::makeAny( aNewGraphicURL ), 404 beans::PropertyState_DIRECT_VALUE ); 405 aSymbol.Graphic.set( xGraphProv->queryGraphic( aArgs )); 406 OSL_ENSURE( aSymbol.Graphic.is(), "Invalid URL for Symbol Bitmap" ); 407 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) ); 408 } 409 catch( const uno::Exception & ex ) 410 { 411 ASSERT_EXCEPTION( ex ); 412 } 413 } 414 } 415 } 416 417 418 //----------------------------------------------------------------------------- 419 //----------------------------------------------------------------------------- 420 //----------------------------------------------------------------------------- 421 422 namespace 423 { 424 425 void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol ) 426 { 427 if( rSymbol.Style != chart2::SymbolStyle_GRAPHIC ) 428 return; 429 if( rSymbol.Size.Width != -1 ) 430 return; 431 if( rSymbol.Size.Height != -1 ) 432 return; 433 434 //find a good automatic size 435 try 436 { 437 const awt::Size aDefaultSize(250,250); 438 awt::Size aSize = aDefaultSize; 439 uno::Reference< beans::XPropertySet > xProp( rSymbol.Graphic, uno::UNO_QUERY ); 440 if( xProp.is() ) 441 { 442 bool bFoundSize = false; 443 try 444 { 445 if( (xProp->getPropertyValue( C2U( "Size100thMM" ) ) >>= aSize) ) 446 { 447 if( aSize.Width == 0 && aSize.Height == 0 ) 448 aSize = aDefaultSize; 449 else 450 bFoundSize = true; 451 } 452 } 453 catch( uno::Exception& e ) 454 { 455 ASSERT_EXCEPTION( e ); 456 } 457 458 if(!bFoundSize) 459 { 460 awt::Size aAWTPixelSize(10,10); 461 if( (xProp->getPropertyValue( C2U( "SizePixel" ) ) >>= aAWTPixelSize) ) 462 { 463 Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height); 464 Size aNewSize = ( OutputDevice::LogicToLogic( aPixelSize, MAP_PIXEL, MAP_100TH_MM )); 465 aSize = awt::Size( aNewSize.Width(), aNewSize.Height() ); 466 467 if( aSize.Width == 0 && aSize.Height == 0 ) 468 aSize = aDefaultSize; 469 } 470 } 471 } 472 rSymbol.Size = aSize; 473 } 474 catch( uno::Exception& e ) 475 { 476 ASSERT_EXCEPTION( e ); 477 } 478 } 479 480 }//end anonymous namespace 481 482 WrappedSymbolSizeProperty::WrappedSymbolSizeProperty( 483 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 484 tSeriesOrDiagramPropertyType ePropertyType ) 485 : WrappedSeriesOrDiagramProperty< awt::Size >( C2U("SymbolSize") 486 , uno::makeAny( awt::Size(250,250) ), spChart2ModelContact, ePropertyType ) 487 { 488 } 489 490 WrappedSymbolSizeProperty::~WrappedSymbolSizeProperty() 491 { 492 } 493 494 awt::Size WrappedSymbolSizeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const 495 { 496 awt::Size aRet; 497 m_aDefaultValue >>= aRet; 498 chart2::Symbol aSymbol; 499 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )) 500 aRet = aSymbol.Size; 501 return aRet; 502 } 503 504 void WrappedSymbolSizeProperty::setValueToSeries( 505 const Reference< beans::XPropertySet >& xSeriesPropertySet, 506 awt::Size aNewSize ) const 507 { 508 if(!xSeriesPropertySet.is()) 509 return; 510 511 chart2::Symbol aSymbol; 512 if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) 513 { 514 aSymbol.Size = aNewSize; 515 lcl_correctSymbolSizeForBitmaps(aSymbol); 516 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) ); 517 } 518 } 519 520 beans::PropertyState WrappedSymbolSizeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const 521 throw (beans::UnknownPropertyException, uno::RuntimeException) 522 { 523 //only export symbol size if necessary 524 if( m_ePropertyType == DIAGRAM ) 525 return beans::PropertyState_DEFAULT_VALUE; 526 527 try 528 { 529 chart2::Symbol aSymbol; 530 Reference< beans::XPropertySet > xSeriesPropertySet( xInnerPropertyState, uno::UNO_QUERY ); 531 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )) 532 { 533 if( chart2::SymbolStyle_NONE != aSymbol.Style ) 534 return beans::PropertyState_DIRECT_VALUE; 535 } 536 } 537 catch( const uno::Exception & ex ) 538 { 539 ASSERT_EXCEPTION( ex ); 540 } 541 return beans::PropertyState_DEFAULT_VALUE; 542 } 543 544 //----------------------------------------------------------------------------- 545 //----------------------------------------------------------------------------- 546 //----------------------------------------------------------------------------- 547 548 WrappedSymbolAndLinesProperty::WrappedSymbolAndLinesProperty( 549 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact, 550 tSeriesOrDiagramPropertyType ePropertyType ) 551 : WrappedSeriesOrDiagramProperty< sal_Bool >( C2U("Lines") 552 , uno::makeAny( sal_True ), spChart2ModelContact, ePropertyType ) 553 { 554 } 555 556 WrappedSymbolAndLinesProperty::~WrappedSymbolAndLinesProperty() 557 { 558 } 559 560 sal_Bool WrappedSymbolAndLinesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& /*xSeriesPropertySet*/ ) const 561 { 562 //do not export this property anymore, instead use a linestyle none for no lines 563 return sal_True; 564 } 565 566 void WrappedSymbolAndLinesProperty::setValueToSeries( 567 const Reference< beans::XPropertySet >& xSeriesPropertySet, 568 sal_Bool bDrawLines ) const 569 { 570 if(!xSeriesPropertySet.is()) 571 return; 572 573 drawing::LineStyle eOldLineStyle( drawing::LineStyle_SOLID ); 574 xSeriesPropertySet->getPropertyValue( C2U("LineStyle") ) >>= eOldLineStyle; 575 if( bDrawLines ) 576 { 577 //#i114298# don't overwrite dashed lines with solid lines here 578 if( eOldLineStyle == drawing::LineStyle_NONE ) 579 xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ) ); 580 } 581 else 582 { 583 if( eOldLineStyle != drawing::LineStyle_NONE ) 584 xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ) ); 585 } 586 } 587 588 beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 589 throw (beans::UnknownPropertyException, uno::RuntimeException) 590 { 591 //do not export this property anymore, instead use a linestyle none for no lines 592 return beans::PropertyState_DEFAULT_VALUE; 593 } 594 595 //----------------------------------------------------------------------------- 596 //----------------------------------------------------------------------------- 597 //----------------------------------------------------------------------------- 598 599 } //namespace wrapper 600 } //namespace chart 601 //............................................................................. 602