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