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