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