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 #include "ChartDocumentWrapper.hxx" 31 #include "macros.hxx" 32 #include "servicenames.hxx" 33 #include "PropertyHelper.hxx" 34 #include "TitleHelper.hxx" 35 #include "LegendHelper.hxx" 36 #include "ControllerLockGuard.hxx" 37 #include "ModifyListenerHelper.hxx" 38 #include "DisposeHelper.hxx" 39 #include "DataSeriesPointWrapper.hxx" 40 #include "chartview/ExplicitValueProvider.hxx" 41 #include "chartview/DrawModelWrapper.hxx" 42 #include "Chart2ModelContact.hxx" 43 44 #include "DiagramHelper.hxx" 45 #include "DataSourceHelper.hxx" 46 #include "ChartModelHelper.hxx" 47 #include "ContainerHelper.hxx" 48 #include "AxisHelper.hxx" 49 #include "ThreeDHelper.hxx" 50 51 #include "TitleWrapper.hxx" 52 #include "ChartDataWrapper.hxx" 53 #include "DiagramWrapper.hxx" 54 #include "LegendWrapper.hxx" 55 #include "AreaWrapper.hxx" 56 #include "WrappedAddInProperty.hxx" 57 #include "WrappedIgnoreProperty.hxx" 58 #include "ChartRenderer.hxx" 59 #include <com/sun/star/chart2/XTitled.hpp> 60 #include <com/sun/star/chart2/data/XDataReceiver.hpp> 61 #include <com/sun/star/chart/ChartDataRowSource.hpp> 62 #include <comphelper/InlineContainer.hxx> 63 // header for function SvxShapeCollection_NewInstance 64 #include <svx/unoshcol.hxx> 65 // header for define DBG_ASSERT 66 #include <tools/debug.hxx> 67 #include <vcl/svapp.hxx> 68 69 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> 70 #include <com/sun/star/beans/PropertyAttribute.hpp> 71 #include <com/sun/star/lang/DisposedException.hpp> 72 #include <com/sun/star/lang/XInitialization.hpp> 73 #include <com/sun/star/util/DateTime.hpp> 74 75 #include <vector> 76 #include <algorithm> 77 #include <functional> 78 79 using namespace ::com::sun::star; 80 using namespace ::com::sun::star::chart; 81 82 using ::com::sun::star::uno::Any; 83 using ::com::sun::star::uno::UNO_QUERY_THROW; 84 using ::com::sun::star::uno::Reference; 85 using ::com::sun::star::uno::Sequence; 86 using ::com::sun::star::beans::Property; 87 using ::osl::MutexGuard; 88 using ::rtl::OUString; 89 90 namespace 91 { 92 enum eServiceType 93 { 94 SERVICE_NAME_AREA_DIAGRAM = 0, 95 SERVICE_NAME_BAR_DIAGRAM, 96 SERVICE_NAME_DONUT_DIAGRAM, 97 SERVICE_NAME_LINE_DIAGRAM, 98 SERVICE_NAME_NET_DIAGRAM, 99 SERVICE_NAME_FILLED_NET_DIAGRAM, 100 SERVICE_NAME_PIE_DIAGRAM, 101 SERVICE_NAME_STOCK_DIAGRAM, 102 SERVICE_NAME_XY_DIAGRAM, 103 SERVICE_NAME_BUBBLE_DIAGRAM, 104 105 SERVICE_NAME_DASH_TABLE, 106 SERVICE_NAME_GARDIENT_TABLE, 107 SERVICE_NAME_HATCH_TABLE, 108 SERVICE_NAME_BITMAP_TABLE, 109 SERVICE_NAME_TRANSP_GRADIENT_TABLE, 110 SERVICE_NAME_MARKER_TABLE, 111 112 SERVICE_NAME_NAMESPACE_MAP, 113 SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER, 114 SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER 115 }; 116 117 typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap; 118 typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap; 119 120 tServiceNameMap & lcl_getStaticServiceNameMap() 121 { 122 static tServiceNameMap aServiceNameMap( 123 tMakeServiceNameMap 124 ( C2U( "com.sun.star.chart.AreaDiagram" ), SERVICE_NAME_AREA_DIAGRAM ) 125 ( C2U( "com.sun.star.chart.BarDiagram" ), SERVICE_NAME_BAR_DIAGRAM ) 126 ( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM ) 127 ( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM ) 128 ( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM ) 129 ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM ) 130 ( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM ) 131 ( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM ) 132 ( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM ) 133 ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM ) 134 135 ( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE ) 136 ( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE ) 137 ( C2U( "com.sun.star.drawing.HatchTable" ), SERVICE_NAME_HATCH_TABLE ) 138 ( C2U( "com.sun.star.drawing.BitmapTable" ), SERVICE_NAME_BITMAP_TABLE ) 139 ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ), SERVICE_NAME_TRANSP_GRADIENT_TABLE ) 140 ( C2U( "com.sun.star.drawing.MarkerTable" ), SERVICE_NAME_MARKER_TABLE ) 141 142 ( C2U( "com.sun.star.xml.NamespaceMap" ), SERVICE_NAME_NAMESPACE_MAP ) 143 ( C2U( "com.sun.star.document.ExportGraphicObjectResolver" ), SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER ) 144 ( C2U( "com.sun.star.document.ImportGraphicObjectResolver" ), SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER ) 145 ); 146 147 return aServiceNameMap; 148 } 149 150 enum 151 { 152 PROP_DOCUMENT_HAS_MAIN_TITLE, 153 PROP_DOCUMENT_HAS_SUB_TITLE, 154 PROP_DOCUMENT_HAS_LEGEND, 155 PROP_DOCUMENT_LABELS_IN_FIRST_ROW, 156 PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN, 157 PROP_DOCUMENT_ADDIN, 158 PROP_DOCUMENT_BASEDIAGRAM, 159 PROP_DOCUMENT_ADDITIONAL_SHAPES, 160 PROP_DOCUMENT_UPDATE_ADDIN, 161 PROP_DOCUMENT_NULL_DATE, 162 PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES, 163 PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG 164 }; 165 166 void lcl_AddPropertiesToVector( 167 ::std::vector< Property > & rOutProperties ) 168 { 169 rOutProperties.push_back( 170 Property( C2U( "HasMainTitle" ), 171 PROP_DOCUMENT_HAS_MAIN_TITLE, 172 ::getBooleanCppuType(), 173 //#i111967# no PropertyChangeEvent is fired on change so far 174 beans::PropertyAttribute::MAYBEDEFAULT )); 175 rOutProperties.push_back( 176 Property( C2U( "HasSubTitle" ), 177 PROP_DOCUMENT_HAS_SUB_TITLE, 178 ::getBooleanCppuType(), 179 //#i111967# no PropertyChangeEvent is fired on change so far 180 beans::PropertyAttribute::MAYBEDEFAULT )); 181 rOutProperties.push_back( 182 Property( C2U( "HasLegend" ), 183 PROP_DOCUMENT_HAS_LEGEND, 184 ::getBooleanCppuType(), 185 //#i111967# no PropertyChangeEvent is fired on change so far 186 beans::PropertyAttribute::MAYBEDEFAULT )); 187 188 // really needed? 189 rOutProperties.push_back( 190 Property( C2U( "DataSourceLabelsInFirstRow" ), 191 PROP_DOCUMENT_LABELS_IN_FIRST_ROW, 192 ::getBooleanCppuType(), 193 beans::PropertyAttribute::BOUND 194 | beans::PropertyAttribute::MAYBEDEFAULT )); 195 rOutProperties.push_back( 196 Property( C2U( "DataSourceLabelsInFirstColumn" ), 197 PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN, 198 ::getBooleanCppuType(), 199 //#i111967# no PropertyChangeEvent is fired on change so far 200 beans::PropertyAttribute::MAYBEDEFAULT )); 201 202 //add-in 203 rOutProperties.push_back( 204 Property( C2U( "AddIn" ), 205 PROP_DOCUMENT_ADDIN, 206 ::getCppuType( reinterpret_cast< Reference< util::XRefreshable > * >(0)), 207 beans::PropertyAttribute::BOUND 208 | beans::PropertyAttribute::MAYBEVOID )); 209 rOutProperties.push_back( 210 Property( C2U( "BaseDiagram" ), 211 PROP_DOCUMENT_BASEDIAGRAM, 212 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)), 213 beans::PropertyAttribute::BOUND 214 | beans::PropertyAttribute::MAYBEVOID )); 215 rOutProperties.push_back( 216 Property( C2U( "AdditionalShapes" ), 217 PROP_DOCUMENT_ADDITIONAL_SHAPES, 218 ::getCppuType( reinterpret_cast< Reference< drawing::XShapes > * >(0)), 219 beans::PropertyAttribute::BOUND 220 | beans::PropertyAttribute::MAYBEVOID 221 | beans::PropertyAttribute::READONLY )); 222 rOutProperties.push_back( 223 Property( C2U( "RefreshAddInAllowed" ), 224 PROP_DOCUMENT_UPDATE_ADDIN, 225 ::getBooleanCppuType(), 226 //#i111967# no PropertyChangeEvent is fired on change so far 227 beans::PropertyAttribute::TRANSIENT )); 228 229 // table:null-date // i99104 230 rOutProperties.push_back( 231 Property( C2U( "NullDate" ), 232 PROP_DOCUMENT_NULL_DATE, 233 ::getCppuType( static_cast< const ::com::sun::star::util::DateTime * >(0)), 234 beans::PropertyAttribute::MAYBEVOID )); 235 236 rOutProperties.push_back( 237 Property( C2U( "DisableComplexChartTypes" ), 238 PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES, 239 ::getBooleanCppuType(), 240 //#i112666# no PropertyChangeEvent is fired on change so far 241 beans::PropertyAttribute::MAYBEDEFAULT ) ); 242 rOutProperties.push_back( 243 Property( C2U( "DisableDataTableDialog" ), 244 PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG, 245 ::getBooleanCppuType(), 246 //#i112666# no PropertyChangeEvent is fired on change so far 247 beans::PropertyAttribute::MAYBEDEFAULT ) ); 248 } 249 250 struct StaticChartDocumentWrapperPropertyArray_Initializer 251 { 252 Sequence< Property >* operator()() 253 { 254 static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); 255 return &aPropSeq; 256 } 257 258 private: 259 uno::Sequence< Property > lcl_GetPropertySequence() 260 { 261 ::std::vector< ::com::sun::star::beans::Property > aProperties; 262 lcl_AddPropertiesToVector( aProperties ); 263 264 ::std::sort( aProperties.begin(), aProperties.end(), 265 ::chart::PropertyNameLess() ); 266 267 return ::chart::ContainerHelper::ContainerToSequence( aProperties ); 268 } 269 }; 270 271 struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer > 272 { 273 }; 274 275 } // anonymous namespace 276 277 namespace chart 278 { 279 namespace wrapper 280 { 281 //----------------------------------------------------------------------------------------------------------------- 282 //----------------------------------------------------------------------------------------------------------------- 283 //----------------------------------------------------------------------------------------------------------------- 284 285 //PROP_DOCUMENT_LABELS_IN_FIRST_ROW 286 class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty 287 { 288 public: 289 WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 290 virtual ~WrappedDataSourceLabelsInFirstRowProperty(); 291 292 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 293 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 294 295 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 296 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 297 298 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 299 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 300 301 private: //member 302 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 303 mutable Any m_aOuterValue; 304 }; 305 306 WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 307 : WrappedProperty(C2U("DataSourceLabelsInFirstRow"),OUString()) 308 , m_spChart2ModelContact( spChart2ModelContact ) 309 , m_aOuterValue() 310 { 311 m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( 0 ); 312 } 313 314 WrappedDataSourceLabelsInFirstRowProperty::~WrappedDataSourceLabelsInFirstRowProperty() 315 { 316 } 317 318 void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 319 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 320 { 321 sal_Bool bLabelsInFirstRow = sal_True; 322 if( ! (rOuterValue >>= bLabelsInFirstRow) ) 323 throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 ); 324 325 m_aOuterValue = rOuterValue; 326 bool bNewValue = bLabelsInFirstRow; 327 328 ::rtl::OUString aRangeString; 329 bool bUseColumns = true; 330 bool bFirstCellAsLabel = true; 331 bool bHasCategories = true; 332 uno::Sequence< sal_Int32 > aSequenceMapping; 333 334 if( DataSourceHelper::detectRangeSegmentation( 335 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 336 , bFirstCellAsLabel, bHasCategories ) ) 337 { 338 if( bUseColumns && bNewValue != bFirstCellAsLabel ) 339 { 340 DataSourceHelper::setRangeSegmentation( 341 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories ); 342 } 343 else if( !bUseColumns && bNewValue != bHasCategories ) 344 { 345 DataSourceHelper::setRangeSegmentation( 346 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue ); 347 } 348 } 349 } 350 351 Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 352 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 353 { 354 ::rtl::OUString aRangeString; 355 bool bUseColumns = true; 356 bool bFirstCellAsLabel = true; 357 bool bHasCategories = true; 358 uno::Sequence< sal_Int32 > aSequenceMapping; 359 360 if( DataSourceHelper::detectRangeSegmentation( 361 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 362 , bFirstCellAsLabel, bHasCategories ) ) 363 { 364 sal_Bool bLabelsInFirstRow = sal_True; 365 if( bUseColumns ) 366 bLabelsInFirstRow = bFirstCellAsLabel; 367 else 368 bLabelsInFirstRow = bHasCategories; 369 370 m_aOuterValue <<= bLabelsInFirstRow; 371 } 372 return m_aOuterValue; 373 } 374 375 Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 376 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 377 { 378 Any aRet; 379 aRet <<= sal_True; 380 return aRet; 381 } 382 383 //----------------------------------------------------------------------------------------------------------------- 384 //----------------------------------------------------------------------------------------------------------------- 385 //----------------------------------------------------------------------------------------------------------------- 386 387 //PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN 388 class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty 389 { 390 public: 391 WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 392 virtual ~WrappedDataSourceLabelsInFirstColumnProperty(); 393 394 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 395 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 396 397 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 398 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 399 400 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 401 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 402 403 private: //member 404 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 405 mutable Any m_aOuterValue; 406 }; 407 408 WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 409 : WrappedProperty(C2U("DataSourceLabelsInFirstColumn"),OUString()) 410 , m_spChart2ModelContact( spChart2ModelContact ) 411 , m_aOuterValue() 412 { 413 m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( 0 ); 414 } 415 416 WrappedDataSourceLabelsInFirstColumnProperty::~WrappedDataSourceLabelsInFirstColumnProperty() 417 { 418 } 419 420 void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 421 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 422 { 423 sal_Bool bLabelsInFirstRow = sal_True; 424 if( ! (rOuterValue >>= bLabelsInFirstRow) ) 425 throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 ); 426 427 m_aOuterValue = rOuterValue; 428 bool bNewValue = bLabelsInFirstRow; 429 430 ::rtl::OUString aRangeString; 431 bool bUseColumns = true; 432 bool bFirstCellAsLabel = true; 433 bool bHasCategories = true; 434 uno::Sequence< sal_Int32 > aSequenceMapping; 435 436 if( DataSourceHelper::detectRangeSegmentation( 437 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 438 , bFirstCellAsLabel, bHasCategories ) ) 439 { 440 if( bUseColumns && bNewValue != bHasCategories ) 441 { 442 DataSourceHelper::setRangeSegmentation( 443 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue ); 444 } 445 else if( !bUseColumns && bNewValue != bFirstCellAsLabel ) 446 { 447 DataSourceHelper::setRangeSegmentation( 448 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories ); 449 } 450 } 451 } 452 453 Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 454 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 455 { 456 ::rtl::OUString aRangeString; 457 bool bUseColumns = true; 458 bool bFirstCellAsLabel = true; 459 bool bHasCategories = true; 460 uno::Sequence< sal_Int32 > aSequenceMapping; 461 462 if( DataSourceHelper::detectRangeSegmentation( 463 m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 464 , bFirstCellAsLabel, bHasCategories ) ) 465 { 466 sal_Bool bLabelsInFirstColumn = sal_True; 467 if( bUseColumns ) 468 bLabelsInFirstColumn = bHasCategories; 469 else 470 bLabelsInFirstColumn = bFirstCellAsLabel; 471 472 m_aOuterValue <<= bLabelsInFirstColumn; 473 } 474 return m_aOuterValue; 475 } 476 477 Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 478 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 479 { 480 Any aRet; 481 aRet <<= sal_True; 482 return aRet; 483 } 484 485 //----------------------------------------------------------------------------------------------------------------- 486 //----------------------------------------------------------------------------------------------------------------- 487 //----------------------------------------------------------------------------------------------------------------- 488 489 //PROP_DOCUMENT_HAS_LEGEND 490 class WrappedHasLegendProperty : public WrappedProperty 491 { 492 public: 493 WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 494 virtual ~WrappedHasLegendProperty(); 495 496 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 497 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 498 499 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 500 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 501 502 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 503 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 504 505 private: //member 506 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 507 }; 508 509 WrappedHasLegendProperty::WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 510 : WrappedProperty(C2U("HasLegend"),OUString()) 511 , m_spChart2ModelContact( spChart2ModelContact ) 512 { 513 } 514 515 WrappedHasLegendProperty::~WrappedHasLegendProperty() 516 { 517 } 518 519 void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 520 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 521 { 522 sal_Bool bNewValue = sal_True; 523 if( ! (rOuterValue >>= bNewValue) ) 524 throw lang::IllegalArgumentException( C2U("Property HasLegend requires value of type boolean"), 0, 0 ); 525 526 try 527 { 528 Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext,bNewValue )); 529 if(xLegend.is()) 530 { 531 Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW ); 532 sal_Bool bOldValue = sal_True; 533 Any aAOld = xLegendProp->getPropertyValue( C2U("Show") ); 534 aAOld >>= bOldValue; 535 if( bOldValue != bNewValue ) 536 xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( bNewValue )); 537 } 538 } 539 catch( uno::Exception & ex ) 540 { 541 ASSERT_EXCEPTION( ex ); 542 } 543 } 544 545 Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 546 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 547 { 548 Any aRet; 549 try 550 { 551 Reference< beans::XPropertySet > xLegendProp( 552 LegendHelper::getLegend( m_spChart2ModelContact->getChartModel() ), uno::UNO_QUERY ); 553 if( xLegendProp.is()) 554 aRet = xLegendProp->getPropertyValue( C2U("Show")); 555 else 556 aRet <<= sal_False; 557 } 558 catch( uno::Exception & ex ) 559 { 560 ASSERT_EXCEPTION( ex ); 561 } 562 return aRet; 563 } 564 565 Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 566 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 567 { 568 Any aRet; 569 aRet <<= sal_False; 570 return aRet; 571 } 572 573 //----------------------------------------------------------------------------------------------------------------- 574 //----------------------------------------------------------------------------------------------------------------- 575 //----------------------------------------------------------------------------------------------------------------- 576 577 //PROP_DOCUMENT_HAS_MAIN_TITLE 578 class WrappedHasMainTitleProperty : public WrappedProperty 579 { 580 public: 581 WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 582 virtual ~WrappedHasMainTitleProperty(); 583 584 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 585 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 586 587 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 588 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 589 590 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 591 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 592 593 private: //member 594 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 595 }; 596 597 WrappedHasMainTitleProperty::WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 598 : WrappedProperty(C2U("HasMainTitle"),OUString()) 599 , m_spChart2ModelContact( spChart2ModelContact ) 600 { 601 } 602 603 WrappedHasMainTitleProperty::~WrappedHasMainTitleProperty() 604 { 605 } 606 607 void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 608 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 609 { 610 sal_Bool bNewValue = sal_True; 611 if( ! (rOuterValue >>= bNewValue) ) 612 throw lang::IllegalArgumentException( C2U("Property HasMainTitle requires value of type boolean"), 0, 0 ); 613 614 try 615 { 616 if( bNewValue ) 617 TitleHelper::createTitle( TitleHelper::MAIN_TITLE, C2U("main-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext ); 618 else 619 TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ); 620 } 621 catch( uno::Exception & ex ) 622 { 623 ASSERT_EXCEPTION( ex ); 624 } 625 } 626 627 Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 628 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 629 { 630 Any aRet; 631 try 632 { 633 aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ).is() ); 634 } 635 catch( uno::Exception & ex ) 636 { 637 ASSERT_EXCEPTION( ex ); 638 } 639 return aRet; 640 } 641 642 Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 643 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 644 { 645 Any aRet; 646 aRet <<= sal_False; 647 return aRet; 648 } 649 650 //----------------------------------------------------------------------------------------------------------------- 651 //----------------------------------------------------------------------------------------------------------------- 652 //----------------------------------------------------------------------------------------------------------------- 653 654 //PROP_DOCUMENT_HAS_SUB_TITLE 655 class WrappedHasSubTitleProperty : public WrappedProperty 656 { 657 public: 658 WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 659 virtual ~WrappedHasSubTitleProperty(); 660 661 virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 662 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 663 664 virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 665 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 666 667 virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 668 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 669 670 private: //member 671 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 672 }; 673 674 WrappedHasSubTitleProperty::WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 675 : WrappedProperty(C2U("HasSubTitle"),OUString()) 676 , m_spChart2ModelContact( spChart2ModelContact ) 677 { 678 } 679 680 WrappedHasSubTitleProperty::~WrappedHasSubTitleProperty() 681 { 682 } 683 684 void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 685 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 686 { 687 sal_Bool bNewValue = sal_True; 688 if( ! (rOuterValue >>= bNewValue) ) 689 throw lang::IllegalArgumentException( C2U("Property HasSubTitle requires value of type boolean"), 0, 0 ); 690 691 692 try 693 { 694 if( bNewValue ) 695 TitleHelper::createTitle( TitleHelper::SUB_TITLE, C2U("sub-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext ); 696 else 697 TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ); 698 } 699 catch( uno::Exception & ex ) 700 { 701 ASSERT_EXCEPTION( ex ); 702 } 703 } 704 705 Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 706 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 707 { 708 Any aRet; 709 try 710 { 711 aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ).is() ); 712 } 713 catch( uno::Exception & ex ) 714 { 715 ASSERT_EXCEPTION( ex ); 716 } 717 return aRet; 718 } 719 720 Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 721 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 722 { 723 Any aRet; 724 aRet <<= sal_False; 725 return aRet; 726 } 727 728 //----------------------------------------------------------------------------------------------------------------- 729 //----------------------------------------------------------------------------------------------------------------- 730 //----------------------------------------------------------------------------------------------------------------- 731 ChartDocumentWrapper::ChartDocumentWrapper( 732 const Reference< uno::XComponentContext > & xContext ) : 733 m_spChart2ModelContact( new Chart2ModelContact( xContext ) ), 734 m_bUpdateAddIn( sal_True ), 735 m_bIsDisposed( false ) 736 { 737 } 738 739 ChartDocumentWrapper::~ChartDocumentWrapper() 740 { 741 stopAllComponentListening(); 742 } 743 744 // ____ XInterface (for new interfaces) ____ 745 uno::Any SAL_CALL ChartDocumentWrapper::queryInterface( const uno::Type& aType ) 746 throw (uno::RuntimeException) 747 { 748 if( m_xDelegator.is()) 749 // calls queryAggregation if the delegator doesn't know aType 750 return m_xDelegator->queryInterface( aType ); 751 else 752 return queryAggregation( aType ); 753 } 754 755 // ____ chart::XChartDocument (old API wrapper) ____ 756 Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle() 757 throw (uno::RuntimeException) 758 { 759 if( !m_xTitle.is() ) 760 { 761 ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY )); 762 m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact ); 763 } 764 return m_xTitle; 765 } 766 767 Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle() 768 throw (uno::RuntimeException) 769 { 770 if( !m_xSubTitle.is() ) 771 { 772 ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY )); 773 m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact ); 774 } 775 return m_xSubTitle; 776 } 777 778 Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getLegend() 779 throw (uno::RuntimeException) 780 { 781 if( ! m_xLegend.is()) 782 { 783 m_xLegend = new LegendWrapper( m_spChart2ModelContact ); 784 Reference< lang::XComponent > xComp( m_xLegend, uno::UNO_QUERY ); 785 } 786 787 return m_xLegend; 788 } 789 790 Reference< beans::XPropertySet > SAL_CALL ChartDocumentWrapper::getArea() 791 throw (uno::RuntimeException) 792 { 793 if( ! m_xArea.is()) 794 { 795 m_xArea.set( new AreaWrapper( m_spChart2ModelContact ) ); 796 Reference< lang::XComponent > xComp( m_xArea, uno::UNO_QUERY ); 797 } 798 799 return m_xArea; 800 } 801 802 Reference< XDiagram > SAL_CALL ChartDocumentWrapper::getDiagram() 803 throw (uno::RuntimeException) 804 { 805 if( !m_xDiagram.is() ) 806 { 807 try 808 { 809 m_xDiagram = new DiagramWrapper( m_spChart2ModelContact ); 810 } 811 catch( uno::Exception & ex ) 812 { 813 ASSERT_EXCEPTION( ex ); 814 } 815 } 816 817 return m_xDiagram; 818 } 819 820 void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDiagram ) 821 throw (uno::RuntimeException) 822 { 823 uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY ); 824 if( xAddIn.is() ) 825 { 826 setAddIn( xAddIn ); 827 } 828 else if( xDiagram.is() && xDiagram != m_xDiagram ) 829 { 830 // set new wrapped diagram at new chart. This requires the old 831 // diagram given as parameter to implement the new interface. If 832 // this is not possible throw an exception 833 Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW ); 834 Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram()); 835 836 try 837 { 838 Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); 839 if( xChartDoc.is() ) 840 { 841 // set the new diagram 842 xChartDoc->setFirstDiagram( xNewDia ); 843 m_xDiagram = xDiagram; 844 } 845 } 846 catch( uno::Exception & ex ) 847 { 848 ASSERT_EXCEPTION( ex ); 849 } 850 } 851 } 852 853 Reference< XChartData > SAL_CALL ChartDocumentWrapper::getData() 854 throw (uno::RuntimeException) 855 { 856 if( !m_xChartData.is() ) 857 { 858 m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact ) ); 859 } 860 //@todo: check hasInternalDataProvider also in else? 861 862 return m_xChartData; 863 } 864 865 void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& xNewData ) 866 throw (uno::RuntimeException) 867 { 868 if( !xNewData.is() ) 869 return; 870 871 // /-- locked controllers 872 ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY )); 873 m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact, xNewData ) ); 874 // \-- locked controllers 875 } 876 877 // ____ XModel ____ 878 sal_Bool SAL_CALL ChartDocumentWrapper::attachResource( 879 const ::rtl::OUString& URL, 880 const Sequence< beans::PropertyValue >& Arguments ) 881 throw (uno::RuntimeException) 882 { 883 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 884 if( xModel.is() ) 885 return xModel->attachResource( URL, Arguments ); 886 return sal_False; 887 } 888 889 ::rtl::OUString SAL_CALL ChartDocumentWrapper::getURL() 890 throw (uno::RuntimeException) 891 { 892 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 893 if( xModel.is() ) 894 return xModel->getURL(); 895 return ::rtl::OUString(); 896 } 897 898 Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs() 899 throw (uno::RuntimeException) 900 { 901 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 902 if( xModel.is() ) 903 return xModel->getArgs(); 904 return Sequence< beans::PropertyValue >(); 905 } 906 907 void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::XController >& Controller ) 908 throw (uno::RuntimeException) 909 { 910 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 911 if( xModel.is() ) 912 xModel->connectController( Controller ); 913 } 914 915 void SAL_CALL ChartDocumentWrapper::disconnectController( 916 const Reference< frame::XController >& Controller ) 917 throw (uno::RuntimeException) 918 { 919 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 920 if( xModel.is() ) 921 xModel->disconnectController( Controller ); 922 } 923 924 void SAL_CALL ChartDocumentWrapper::lockControllers() 925 throw (uno::RuntimeException) 926 { 927 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 928 if( xModel.is() ) 929 xModel->lockControllers(); 930 } 931 932 void SAL_CALL ChartDocumentWrapper::unlockControllers() 933 throw (uno::RuntimeException) 934 { 935 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 936 if( xModel.is() ) 937 xModel->unlockControllers(); 938 } 939 940 sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked() 941 throw (uno::RuntimeException) 942 { 943 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 944 if( xModel.is() ) 945 return xModel->hasControllersLocked(); 946 return sal_False; 947 } 948 949 Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentController() 950 throw (uno::RuntimeException) 951 { 952 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 953 if( xModel.is() ) 954 return xModel->getCurrentController(); 955 return 0; 956 } 957 958 void SAL_CALL ChartDocumentWrapper::setCurrentController( 959 const Reference< frame::XController >& Controller ) 960 throw (container::NoSuchElementException, 961 uno::RuntimeException) 962 { 963 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 964 if( xModel.is() ) 965 xModel->setCurrentController( Controller ); 966 } 967 968 Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection() 969 throw (uno::RuntimeException) 970 { 971 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 972 if( xModel.is() ) 973 return xModel->getCurrentSelection(); 974 return 0; 975 } 976 977 978 // ____ XComponent ____ 979 void SAL_CALL ChartDocumentWrapper::dispose() 980 throw (uno::RuntimeException) 981 { 982 if( m_bIsDisposed ) 983 throw lang::DisposedException( 984 C2U("ChartDocumentWrapper is disposed" ), 985 static_cast< ::cppu::OWeakObject* >( this )); 986 987 m_bIsDisposed = true; 988 989 try 990 { 991 Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY ); 992 DisposeHelper::DisposeAndClear( m_xTitle ); 993 DisposeHelper::DisposeAndClear( m_xSubTitle ); 994 DisposeHelper::DisposeAndClear( m_xLegend ); 995 DisposeHelper::DisposeAndClear( m_xChartData ); 996 DisposeHelper::DisposeAndClear( m_xDiagram ); 997 DisposeHelper::DisposeAndClear( m_xArea ); 998 m_xChartView.set( 0 ); 999 m_xShapeFactory.set( 0 ); 1000 m_xDelegator.set( 0 ); 1001 1002 clearWrappedPropertySet(); 1003 m_spChart2ModelContact->clear(); 1004 impl_resetAddIn(); 1005 1006 stopAllComponentListening(); 1007 1008 try 1009 { 1010 if( xFormerDelegator.is()) 1011 xFormerDelegator->dispose(); 1012 } 1013 catch( lang::DisposedException ) 1014 { 1015 // this is ok, don't panic 1016 } 1017 } 1018 catch( uno::Exception &ex ) 1019 { 1020 ASSERT_EXCEPTION( ex ); 1021 } 1022 } 1023 1024 void ChartDocumentWrapper::impl_resetAddIn() 1025 { 1026 Reference< util::XRefreshable > xAddIn( m_xAddIn ); 1027 m_xAddIn.set( 0 ); 1028 1029 if( xAddIn.is() ) 1030 { 1031 try 1032 { 1033 //make sure that the add-in does not hold a refernce to us anymore: 1034 Reference< lang::XComponent > xComp( xAddIn, uno::UNO_QUERY ); 1035 if( xComp.is()) 1036 xComp->dispose(); 1037 else 1038 { 1039 uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY ); 1040 if( xInit.is() ) 1041 { 1042 uno::Any aParam; 1043 uno::Reference< com::sun::star::chart::XChartDocument > xDoc( 0 ); 1044 aParam <<= xDoc; 1045 uno::Sequence< uno::Any > aSeq( &aParam, 1 ); 1046 xInit->initialize( aSeq ); 1047 } 1048 } 1049 } 1050 catch( const uno::RuntimeException& ex ) 1051 { 1052 ASSERT_EXCEPTION( ex ); 1053 } 1054 catch( const uno::Exception& ex ) 1055 { 1056 ASSERT_EXCEPTION( ex ); 1057 } 1058 } 1059 } 1060 1061 void ChartDocumentWrapper::setBaseDiagram( const rtl::OUString& rBaseDiagram ) 1062 { 1063 ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 1064 m_aBaseDiagram = rBaseDiagram; 1065 1066 uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY ); 1067 if( xDiagram.is() ) 1068 this->setDiagram( xDiagram ); 1069 } 1070 1071 rtl::OUString ChartDocumentWrapper::getBaseDiagram() const 1072 { 1073 return m_aBaseDiagram; 1074 } 1075 1076 Reference< util::XRefreshable > ChartDocumentWrapper::getAddIn() const 1077 { 1078 return m_xAddIn; 1079 } 1080 1081 void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAddIn ) 1082 { 1083 if( m_xAddIn == xAddIn ) 1084 return; 1085 1086 ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 1087 impl_resetAddIn(); 1088 m_xAddIn = xAddIn; 1089 // initialize AddIn with this as chart document 1090 uno::Reference< lang::XInitialization > xInit( m_xAddIn, uno::UNO_QUERY ); 1091 if( xInit.is() ) 1092 { 1093 uno::Any aParam; 1094 uno::Reference< XChartDocument > xDoc( (XChartDocument*)this, uno::UNO_QUERY ); 1095 aParam <<= xDoc; 1096 uno::Sequence< uno::Any > aSeq( &aParam, 1 ); 1097 xInit->initialize( aSeq ); 1098 } 1099 } 1100 1101 void ChartDocumentWrapper::setUpdateAddIn( sal_Bool bUpdateAddIn ) 1102 { 1103 m_bUpdateAddIn = bUpdateAddIn; 1104 } 1105 sal_Bool ChartDocumentWrapper::getUpdateAddIn() const 1106 { 1107 return m_bUpdateAddIn; 1108 } 1109 1110 Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const 1111 { 1112 // get additional non-chart shapes for XML export 1113 uno::Reference< drawing::XShapes > xFoundShapes; 1114 uno::Reference< drawing::XDrawPage > xDrawPage( this->impl_getDrawPage() ); 1115 1116 uno::Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY ); 1117 if( !xDrawPageShapes.is() ) 1118 return xFoundShapes; 1119 1120 uno::Reference<drawing::XShapes> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) ); 1121 1122 // iterate 'flat' over all top-level objects 1123 // and determine all that are no chart objects 1124 ::std::vector< uno::Reference< drawing::XShape > > aShapeVector; 1125 sal_Int32 nSubCount = xDrawPageShapes->getCount(); 1126 uno::Reference< drawing::XShape > xShape; 1127 for( sal_Int32 nS = 0; nS < nSubCount; nS++ ) 1128 { 1129 if( xDrawPageShapes->getByIndex( nS ) >>= xShape ) 1130 { 1131 if( xShape.is() && xChartRoot!=xShape ) 1132 aShapeVector.push_back( xShape ); 1133 } 1134 } 1135 1136 if( !aShapeVector.empty() ) 1137 { 1138 // create a shape collection 1139 xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY ); 1140 1141 DBG_ASSERT( xFoundShapes.is(), "Couldn't create a shape collection!" ); 1142 if( xFoundShapes.is()) 1143 { 1144 ::std::vector< uno::Reference< drawing::XShape > >::iterator aIter; 1145 for( aIter = aShapeVector.begin(); aIter != aShapeVector.end(); ++aIter ) 1146 xFoundShapes->add( *aIter ); 1147 } 1148 } 1149 1150 return xFoundShapes; 1151 } 1152 1153 void SAL_CALL ChartDocumentWrapper::addEventListener( const Reference< lang::XEventListener >& xListener ) 1154 throw (uno::RuntimeException) 1155 { 1156 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 1157 if( xModel.is() ) 1158 xModel->addEventListener( xListener ); 1159 } 1160 1161 void SAL_CALL ChartDocumentWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener ) 1162 throw (uno::RuntimeException) 1163 { 1164 Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() ); 1165 if( xModel.is() ) 1166 xModel->removeEventListener( aListener ); 1167 } 1168 1169 // ____ XDrawPageSupplier ____ 1170 uno::Reference< drawing::XDrawPage > SAL_CALL ChartDocumentWrapper::getDrawPage() 1171 throw (uno::RuntimeException) 1172 { 1173 return this->impl_getDrawPage(); 1174 } 1175 1176 uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() const 1177 throw (uno::RuntimeException) 1178 { 1179 return m_spChart2ModelContact->getDrawPage(); 1180 } 1181 1182 // ____ XMultiServiceFactory ____ 1183 uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( 1184 const ::rtl::OUString& aServiceSpecifier ) 1185 throw (uno::Exception, 1186 uno::RuntimeException) 1187 { 1188 uno::Reference< uno::XInterface > xResult; 1189 1190 Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); 1191 if( !xChartDoc.is() ) 1192 return xResult; 1193 1194 bool bServiceFound = false; 1195 tServiceNameMap & rMap = lcl_getStaticServiceNameMap(); 1196 1197 tServiceNameMap::const_iterator aIt( rMap.find( aServiceSpecifier )); 1198 if( aIt != rMap.end()) 1199 { 1200 bool bCreateDiagram = false; 1201 uno::Reference< lang::XMultiServiceFactory > xManagerFact( 1202 xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); 1203 uno::Reference< chart2::XChartTypeTemplate > xTemplate; 1204 1205 switch( (*aIt).second ) 1206 { 1207 case SERVICE_NAME_AREA_DIAGRAM: 1208 if( xManagerFact.is()) 1209 { 1210 xTemplate.set( 1211 xManagerFact->createInstance( 1212 C2U( "com.sun.star.chart2.template.Area" )), uno::UNO_QUERY ); 1213 bCreateDiagram = true; 1214 } 1215 break; 1216 case SERVICE_NAME_BAR_DIAGRAM: 1217 if( xManagerFact.is()) 1218 { 1219 // this is for bar and column (the latter is the default if 1220 // no "Vertical=false" property was set) 1221 xTemplate.set( 1222 xManagerFact->createInstance( 1223 C2U( "com.sun.star.chart2.template.Column" )), uno::UNO_QUERY ); 1224 bCreateDiagram = true; 1225 } 1226 break; 1227 case SERVICE_NAME_DONUT_DIAGRAM: 1228 if( xManagerFact.is()) 1229 { 1230 xTemplate.set( 1231 xManagerFact->createInstance( 1232 C2U( "com.sun.star.chart2.template.Donut" )), uno::UNO_QUERY ); 1233 bCreateDiagram = true; 1234 } 1235 break; 1236 case SERVICE_NAME_LINE_DIAGRAM: 1237 if( xManagerFact.is()) 1238 { 1239 xTemplate.set( 1240 xManagerFact->createInstance( 1241 C2U( "com.sun.star.chart2.template.Line" )), uno::UNO_QUERY ); 1242 bCreateDiagram = true; 1243 } 1244 break; 1245 case SERVICE_NAME_NET_DIAGRAM: 1246 if( xManagerFact.is()) 1247 { 1248 xTemplate.set( 1249 xManagerFact->createInstance( 1250 C2U( "com.sun.star.chart2.template.Net" )), uno::UNO_QUERY ); 1251 bCreateDiagram = true; 1252 } 1253 break; 1254 case SERVICE_NAME_FILLED_NET_DIAGRAM: 1255 if( xManagerFact.is()) 1256 { 1257 xTemplate.set( 1258 xManagerFact->createInstance( 1259 C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY ); 1260 bCreateDiagram = true; 1261 } 1262 case SERVICE_NAME_PIE_DIAGRAM: 1263 if( xManagerFact.is()) 1264 { 1265 xTemplate.set( 1266 xManagerFact->createInstance( 1267 C2U( "com.sun.star.chart2.template.Pie" )), uno::UNO_QUERY ); 1268 bCreateDiagram = true; 1269 } 1270 break; 1271 case SERVICE_NAME_STOCK_DIAGRAM: 1272 if( xManagerFact.is()) 1273 { 1274 xTemplate.set( 1275 xManagerFact->createInstance( 1276 C2U( "com.sun.star.chart2.template.StockLowHighClose" )), uno::UNO_QUERY ); 1277 bCreateDiagram = true; 1278 } 1279 break; 1280 case SERVICE_NAME_XY_DIAGRAM: 1281 if( xManagerFact.is()) 1282 { 1283 xTemplate.set( 1284 xManagerFact->createInstance( 1285 C2U( "com.sun.star.chart2.template.ScatterLineSymbol" )), uno::UNO_QUERY ); 1286 bCreateDiagram = true; 1287 } 1288 break; 1289 1290 case SERVICE_NAME_BUBBLE_DIAGRAM: 1291 if( xManagerFact.is()) 1292 { 1293 xTemplate.set( 1294 xManagerFact->createInstance( 1295 C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY ); 1296 bCreateDiagram = true; 1297 } 1298 break; 1299 1300 case SERVICE_NAME_DASH_TABLE: 1301 case SERVICE_NAME_GARDIENT_TABLE: 1302 case SERVICE_NAME_HATCH_TABLE: 1303 case SERVICE_NAME_BITMAP_TABLE: 1304 case SERVICE_NAME_TRANSP_GRADIENT_TABLE: 1305 case SERVICE_NAME_MARKER_TABLE: 1306 { 1307 uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartDoc, uno::UNO_QUERY ); 1308 DBG_ASSERT( xTableFactory.get() != this, "new model is expected to implement service factory for gradient table etc" ); 1309 if( xTableFactory.is() && xTableFactory.get() != this ) 1310 xResult.set( xTableFactory->createInstance( aIt->first ), uno::UNO_QUERY ); 1311 } 1312 break; 1313 1314 case SERVICE_NAME_NAMESPACE_MAP: 1315 // xResult = svx::NamespaceMap_createInstance( aWhichIds, &m_pModel->GetPool() ); 1316 break; 1317 case SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER: 1318 // xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE )); 1319 break; 1320 case SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER: 1321 // xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ )); 1322 break; 1323 } 1324 1325 if( bCreateDiagram && xTemplate.is() ) 1326 { 1327 try 1328 { 1329 uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram()); 1330 if( xDia.is()) 1331 { 1332 // /-- locked controllers 1333 Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY ); 1334 ControllerLockGuard aCtrlLockGuard( xModel ); 1335 Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel ); 1336 ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram ); 1337 Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); 1338 DiagramHelper::tTemplateWithServiceName aTemplateWithService( 1339 DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager )); 1340 if( aTemplateWithService.first.is()) 1341 aTemplateWithService.first->resetStyles( xDiagram );//#i109371# 1342 xTemplate->changeDiagram( xDiagram ); 1343 if( Application::GetSettings().GetLayoutRTL() ) 1344 AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) ); 1345 ThreeDHelper::setScheme( xDiagram, e3DScheme ); 1346 // \-- locked controllers 1347 } 1348 else 1349 { 1350 // /-- locked controllers 1351 ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY )); 1352 xDia.set( xTemplate->createDiagramByDataSource( 1353 uno::Reference< chart2::data::XDataSource >(), 1354 uno::Sequence< beans::PropertyValue >())); 1355 xChartDoc->setFirstDiagram( xDia ); 1356 // \-- locked controllers 1357 } 1358 1359 xResult = static_cast< ::cppu::OWeakObject* >( new DiagramWrapper( m_spChart2ModelContact )); 1360 } 1361 catch( uno::Exception & ex ) 1362 { 1363 ASSERT_EXCEPTION( ex ); 1364 } 1365 } 1366 1367 bServiceFound = true; 1368 } 1369 else if( aServiceSpecifier.equals( CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ) ) 1370 { 1371 Reference< lang::XUnoTunnel > xChartRenderer( new ChartRenderer( m_spChart2ModelContact->getChartModel() ) ); 1372 xResult.set( xChartRenderer ); 1373 bServiceFound = true; 1374 } 1375 else if( aServiceSpecifier.equals( C2U("com.sun.star.comp.chart2.DataSeriesWrapper") ) ) 1376 { 1377 Reference< beans::XPropertySet > xDataSeries( new DataSeriesPointWrapper( m_spChart2ModelContact ) ); 1378 xResult.set( xDataSeries ); 1379 bServiceFound = true; 1380 } 1381 else if( aServiceSpecifier.equals( CHART_VIEW_SERVICE_NAME ) ) 1382 { 1383 if( !m_xChartView.is() ) 1384 { 1385 Reference< lang::XMultiServiceFactory > xFact( 1386 m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); 1387 if( xFact.is() ) 1388 { 1389 Reference< lang::XInitialization > xViewInit( xFact->createInstance( 1390 CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); 1391 if(xViewInit.is()) 1392 { 1393 try 1394 { 1395 m_xChartView = xViewInit; 1396 1397 Sequence< Any > aArguments(2); 1398 Reference<frame::XModel> xModel(this); 1399 aArguments[0]=uno::makeAny(xModel); 1400 sal_Bool bRefreshAddIn = sal_True; 1401 aArguments[1]=uno::makeAny(bRefreshAddIn); 1402 xViewInit->initialize(aArguments); 1403 } 1404 catch( uno::Exception & ex ) 1405 { 1406 ASSERT_EXCEPTION( ex ); 1407 } 1408 } 1409 } 1410 } 1411 xResult.set( m_xChartView ); 1412 bServiceFound = true; 1413 } 1414 else 1415 { 1416 // try to create a shape 1417 try 1418 { 1419 if( !m_xShapeFactory.is() && m_xChartView.is() ) 1420 { 1421 Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY); 1422 if(xUnoTunnel.is()) 1423 { 1424 ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething( 1425 ExplicitValueProvider::getUnoTunnelId() )); 1426 if( pProvider ) 1427 m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() ); 1428 } 1429 } 1430 if( m_xShapeFactory.is() ) 1431 { 1432 xResult = m_xShapeFactory->createInstance( aServiceSpecifier ); 1433 bServiceFound = true; 1434 } 1435 } 1436 catch( const uno::Exception ) 1437 { 1438 // couldn't create shape 1439 } 1440 } 1441 1442 // finally, try to create an addin 1443 if( !bServiceFound ) 1444 { 1445 try 1446 { 1447 Reference< lang::XMultiServiceFactory > xFact( 1448 m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); 1449 if( xFact.is() ) 1450 { 1451 uno::Reference< util::XRefreshable > xAddIn( 1452 xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY ); 1453 if( xAddIn.is() ) 1454 { 1455 xResult = xAddIn; 1456 bServiceFound = true; 1457 } 1458 } 1459 } 1460 catch( const uno::Exception& ex ) 1461 { 1462 (void)ex; 1463 // couldn't create service 1464 } 1465 } 1466 1467 return xResult; 1468 } 1469 1470 uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceWithArguments( 1471 const ::rtl::OUString& ServiceSpecifier, 1472 const uno::Sequence< uno::Any >& Arguments ) 1473 throw (uno::Exception, 1474 uno::RuntimeException) 1475 { 1476 OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" ); 1477 (void)(Arguments); 1478 1479 return createInstance( ServiceSpecifier ); 1480 } 1481 1482 uno::Sequence< ::rtl::OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames() 1483 throw (uno::RuntimeException) 1484 { 1485 tServiceNameMap & rMap = lcl_getStaticServiceNameMap(); 1486 uno::Sequence< ::rtl::OUString > aResult( rMap.size()); 1487 1488 ::std::transform( rMap.begin(), rMap.end(), 1489 aResult.getArray(), 1490 ::std::select1st< tServiceNameMap::value_type >() ); 1491 1492 return aResult; 1493 1494 // // shapes 1495 // // uno::Sequence< OUString > aDrawServices( SvxUnoDrawMSFactory::getAvailableServiceNames() ); 1496 // // const OUString * pArr = aDrawServices.getConstArray(); 1497 // // aServices.insert( aServices.end(), pArr, pArr + aDrawServices.getLength() ); 1498 // } 1499 1500 1501 // add-ins 1502 // uno::Sequence< OUString > aAddIns( GetAddInCollection().GetAddInNames() ); 1503 // pArr = aAddIns.getConstArray(); 1504 // aServices.insert( aServices.end(), pArr, pArr + aAddIns.getLength() ); 1505 1506 // return ContainerToSequence( aServices ); 1507 } 1508 1509 // ____ XAggregation ____ 1510 void SAL_CALL ChartDocumentWrapper::setDelegator( 1511 const uno::Reference< uno::XInterface >& rDelegator ) 1512 throw (uno::RuntimeException) 1513 { 1514 if( m_bIsDisposed ) 1515 { 1516 if( rDelegator.is() ) 1517 throw lang::DisposedException( 1518 C2U("ChartDocumentWrapper is disposed" ), 1519 static_cast< ::cppu::OWeakObject* >( this )); 1520 else 1521 return; 1522 } 1523 1524 if( rDelegator.is()) 1525 { 1526 m_xDelegator = rDelegator; 1527 m_spChart2ModelContact->setModel( uno::Reference< frame::XModel >(m_xDelegator, uno::UNO_QUERY) ); 1528 } 1529 else 1530 { 1531 // this is a sort of dispose() from the new model,so release ressources here 1532 try 1533 { 1534 this->dispose(); 1535 } 1536 catch( uno::Exception &ex ) 1537 { 1538 ASSERT_EXCEPTION( ex ); 1539 } 1540 } 1541 } 1542 1543 uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType ) 1544 throw (uno::RuntimeException) 1545 { 1546 return ChartDocumentWrapper_Base::queryInterface( rType ); 1547 } 1548 1549 // ____ ::utl::OEventListenerAdapter ____ 1550 void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource ) 1551 { 1552 if( rSource.Source == m_xTitle ) 1553 m_xTitle.set( 0 ); 1554 else if( rSource.Source == m_xSubTitle ) 1555 m_xSubTitle.set( 0 ); 1556 else if( rSource.Source == m_xLegend ) 1557 m_xLegend.set( 0 ); 1558 else if( rSource.Source == m_xChartData ) 1559 m_xChartData.set( 0 ); 1560 else if( rSource.Source == m_xDiagram ) 1561 m_xDiagram.set( 0 ); 1562 else if( rSource.Source == m_xArea ) 1563 m_xArea.set( 0 ); 1564 else if( rSource.Source == m_xAddIn ) 1565 m_xAddIn.set( 0 ); 1566 else if( rSource.Source == m_xChartView ) 1567 m_xChartView.set( 0 ); 1568 } 1569 1570 // ================================================================================ 1571 1572 // WrappedPropertySet 1573 Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet() 1574 { 1575 return 0; 1576 } 1577 const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence() 1578 { 1579 return *StaticChartDocumentWrapperPropertyArray::get(); 1580 } 1581 1582 const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties() 1583 { 1584 ::std::vector< ::chart::WrappedProperty* > aWrappedProperties; 1585 aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstRowProperty( m_spChart2ModelContact ) ); 1586 aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstColumnProperty( m_spChart2ModelContact ) ); 1587 aWrappedProperties.push_back( new WrappedHasLegendProperty( m_spChart2ModelContact ) ); 1588 aWrappedProperties.push_back( new WrappedHasMainTitleProperty( m_spChart2ModelContact ) ); 1589 aWrappedProperties.push_back( new WrappedHasSubTitleProperty( m_spChart2ModelContact ) ); 1590 aWrappedProperties.push_back( new WrappedAddInProperty( *this ) ); 1591 aWrappedProperties.push_back( new WrappedBaseDiagramProperty( *this ) ); 1592 aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) ); 1593 aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) ); 1594 aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U("NullDate"),Any() ) ); // i99104 1595 aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableComplexChartTypes" ), uno::makeAny( sal_False ) ) ); 1596 aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableDataTableDialog" ), uno::makeAny( sal_False ) ) ); 1597 1598 return aWrappedProperties; 1599 } 1600 1601 // ================================================================================ 1602 1603 uno::Sequence< ::rtl::OUString > ChartDocumentWrapper::getSupportedServiceNames_Static() 1604 { 1605 uno::Sequence< ::rtl::OUString > aServices( 4 ); 1606 aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDocument" ); 1607 aServices[ 1 ] = CHART_CHARTAPIWRAPPER_SERVICE_NAME; 1608 aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" ); 1609 aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" ); 1610 return aServices; 1611 } 1612 1613 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static 1614 APPHELPER_XSERVICEINFO_IMPL( ChartDocumentWrapper, CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME ); 1615 1616 } // namespace wrapper 1617 } // namespace chart 1618