LibreOffice Module chart2 (master) 1
ChartDocumentWrapper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21#include <ChartView.hxx>
22#include <ChartTypeManager.hxx>
23#include <ChartTypeTemplate.hxx>
24#include <servicenames.hxx>
25#include <PropertyHelper.hxx>
26#include <TitleHelper.hxx>
27#include <Legend.hxx>
28#include <LegendHelper.hxx>
30#include <DisposeHelper.hxx>
36
37#include <ChartModel.hxx>
38
39#include <DiagramHelper.hxx>
40#include <DataSourceHelper.hxx>
41#include <ChartModelHelper.hxx>
42#include <AxisHelper.hxx>
43#include <ThreeDHelper.hxx>
44
45#include "TitleWrapper.hxx"
46#include "ChartDataWrapper.hxx"
47#include "DiagramWrapper.hxx"
48#include "LegendWrapper.hxx"
49#include "AreaWrapper.hxx"
56#include <utility>
57#include <vcl/settings.hxx>
58
59#include <com/sun/star/drawing/ShapeCollection.hpp>
60#include <com/sun/star/beans/PropertyAttribute.hpp>
61#include <com/sun/star/lang/DisposedException.hpp>
62#include <com/sun/star/lang/XInitialization.hpp>
63#include <com/sun/star/util/XRefreshable.hpp>
65
66#include <algorithm>
67#include <map>
68
69using namespace ::com::sun::star;
70using namespace ::com::sun::star::chart;
71
72using ::com::sun::star::uno::Any;
73using ::com::sun::star::uno::UNO_QUERY_THROW;
74using ::com::sun::star::uno::Reference;
75using ::com::sun::star::uno::Sequence;
76using ::com::sun::star::beans::Property;
77
78namespace
79{
80enum eServiceType
81{
82 SERVICE_NAME_AREA_DIAGRAM = 0,
83 SERVICE_NAME_BAR_DIAGRAM,
84 SERVICE_NAME_DONUT_DIAGRAM,
85 SERVICE_NAME_LINE_DIAGRAM,
86 SERVICE_NAME_NET_DIAGRAM,
87 SERVICE_NAME_FILLED_NET_DIAGRAM,
88 SERVICE_NAME_PIE_DIAGRAM,
89 SERVICE_NAME_STOCK_DIAGRAM,
90 SERVICE_NAME_XY_DIAGRAM,
91 SERVICE_NAME_BUBBLE_DIAGRAM,
92
93 SERVICE_NAME_DASH_TABLE,
94 SERVICE_NAME_GRADIENT_TABLE,
95 SERVICE_NAME_HATCH_TABLE,
96 SERVICE_NAME_BITMAP_TABLE,
97 SERVICE_NAME_TRANSP_GRADIENT_TABLE,
98 SERVICE_NAME_MARKER_TABLE,
99
100 SERVICE_NAME_NAMESPACE_MAP,
101 SERVICE_NAME_EXPORT_GRAPHIC_STORAGE_RESOLVER,
102 SERVICE_NAME_IMPORT_GRAPHIC_STORAGE_RESOLVER
103};
104
105typedef std::map< OUString, enum eServiceType > tServiceNameMap;
106
107tServiceNameMap & lcl_getStaticServiceNameMap()
108{
109 static tServiceNameMap aServiceNameMap {
110 {"com.sun.star.chart.AreaDiagram", SERVICE_NAME_AREA_DIAGRAM},
111 {"com.sun.star.chart.BarDiagram", SERVICE_NAME_BAR_DIAGRAM},
112 {"com.sun.star.chart.DonutDiagram", SERVICE_NAME_DONUT_DIAGRAM},
113 {"com.sun.star.chart.LineDiagram", SERVICE_NAME_LINE_DIAGRAM},
114 {"com.sun.star.chart.NetDiagram", SERVICE_NAME_NET_DIAGRAM},
115 {"com.sun.star.chart.FilledNetDiagram", SERVICE_NAME_FILLED_NET_DIAGRAM},
116 {"com.sun.star.chart.PieDiagram", SERVICE_NAME_PIE_DIAGRAM},
117 {"com.sun.star.chart.StockDiagram", SERVICE_NAME_STOCK_DIAGRAM},
118 {"com.sun.star.chart.XYDiagram", SERVICE_NAME_XY_DIAGRAM},
119 {"com.sun.star.chart.BubbleDiagram", SERVICE_NAME_BUBBLE_DIAGRAM},
120
121 {"com.sun.star.drawing.DashTable", SERVICE_NAME_DASH_TABLE},
122 {"com.sun.star.drawing.GradientTable", SERVICE_NAME_GRADIENT_TABLE},
123 {"com.sun.star.drawing.HatchTable", SERVICE_NAME_HATCH_TABLE},
124 {"com.sun.star.drawing.BitmapTable", SERVICE_NAME_BITMAP_TABLE},
125 {"com.sun.star.drawing.TransparencyGradientTable", SERVICE_NAME_TRANSP_GRADIENT_TABLE},
126 {"com.sun.star.drawing.MarkerTable", SERVICE_NAME_MARKER_TABLE},
127
128 {"com.sun.star.xml.NamespaceMap", SERVICE_NAME_NAMESPACE_MAP},
129 {"com.sun.star.document.ExportGraphicStorageHandler", SERVICE_NAME_EXPORT_GRAPHIC_STORAGE_RESOLVER},
130 {"com.sun.star.document.ImportGraphicStorageHandler", SERVICE_NAME_IMPORT_GRAPHIC_STORAGE_RESOLVER}
131 };
132
133 return aServiceNameMap;
134}
135
136enum
137{
138 PROP_DOCUMENT_HAS_MAIN_TITLE,
139 PROP_DOCUMENT_HAS_SUB_TITLE,
140 PROP_DOCUMENT_HAS_LEGEND,
141 PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
142 PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
143 PROP_DOCUMENT_ADDIN,
144 PROP_DOCUMENT_BASEDIAGRAM,
145 PROP_DOCUMENT_ADDITIONAL_SHAPES,
146 PROP_DOCUMENT_UPDATE_ADDIN,
147 PROP_DOCUMENT_NULL_DATE,
148 PROP_DOCUMENT_ENABLE_COMPLEX_CHARTTYPES,
149 PROP_DOCUMENT_ENABLE_DATATABLE_DIALOG
150};
151
152void lcl_AddPropertiesToVector(
153 std::vector< Property > & rOutProperties )
154{
155 rOutProperties.emplace_back( "HasMainTitle",
156 PROP_DOCUMENT_HAS_MAIN_TITLE,
158 //#i111967# no PropertyChangeEvent is fired on change so far
159 beans::PropertyAttribute::MAYBEDEFAULT );
160 rOutProperties.emplace_back( "HasSubTitle",
161 PROP_DOCUMENT_HAS_SUB_TITLE,
163 //#i111967# no PropertyChangeEvent is fired on change so far
164 beans::PropertyAttribute::MAYBEDEFAULT );
165 rOutProperties.emplace_back( "HasLegend",
166 PROP_DOCUMENT_HAS_LEGEND,
168 //#i111967# no PropertyChangeEvent is fired on change so far
169 beans::PropertyAttribute::MAYBEDEFAULT );
170
171 // really needed?
172 rOutProperties.emplace_back( "DataSourceLabelsInFirstRow",
173 PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
175 beans::PropertyAttribute::BOUND
176 | beans::PropertyAttribute::MAYBEDEFAULT );
177 rOutProperties.emplace_back( "DataSourceLabelsInFirstColumn",
178 PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
180 //#i111967# no PropertyChangeEvent is fired on change so far
181 beans::PropertyAttribute::MAYBEDEFAULT );
182
183 //add-in
184 rOutProperties.emplace_back( "AddIn",
185 PROP_DOCUMENT_ADDIN,
187 beans::PropertyAttribute::BOUND
188 | beans::PropertyAttribute::MAYBEVOID );
189 rOutProperties.emplace_back( "BaseDiagram",
190 PROP_DOCUMENT_BASEDIAGRAM,
192 beans::PropertyAttribute::BOUND
193 | beans::PropertyAttribute::MAYBEVOID );
194 rOutProperties.emplace_back( "AdditionalShapes",
195 PROP_DOCUMENT_ADDITIONAL_SHAPES,
197 beans::PropertyAttribute::BOUND
198 | beans::PropertyAttribute::MAYBEVOID
199 | beans::PropertyAttribute::READONLY );
200 rOutProperties.emplace_back( "RefreshAddInAllowed",
201 PROP_DOCUMENT_UPDATE_ADDIN,
203 //#i111967# no PropertyChangeEvent is fired on change so far
204 beans::PropertyAttribute::TRANSIENT );
205
206 // table:null-date // i99104
207 rOutProperties.emplace_back( "NullDate",
208 PROP_DOCUMENT_NULL_DATE,
210 beans::PropertyAttribute::MAYBEVOID );
211
212 rOutProperties.emplace_back( "EnableComplexChartTypes",
213 PROP_DOCUMENT_ENABLE_COMPLEX_CHARTTYPES,
215 //#i112666# no PropertyChangeEvent is fired on change so far
216 beans::PropertyAttribute::MAYBEDEFAULT );
217 rOutProperties.emplace_back( "EnableDataTableDialog",
218 PROP_DOCUMENT_ENABLE_DATATABLE_DIALOG,
220 //#i112666# no PropertyChangeEvent is fired on change so far
221 beans::PropertyAttribute::MAYBEDEFAULT );
222}
223
224const Sequence< Property > & StaticChartDocumentWrapperPropertyArray()
225{
226 static Sequence< Property > aPropSeq = []()
227 {
228 std::vector< css::beans::Property > aProperties;
229 lcl_AddPropertiesToVector( aProperties );
230
231 std::sort( aProperties.begin(), aProperties.end(),
233
234 return comphelper::containerToSequence( aProperties );
235 }();
236 return aPropSeq;
237}
238
239} // anonymous namespace
240
241namespace chart::wrapper
242{
243
244namespace {
245
246//PROP_DOCUMENT_LABELS_IN_FIRST_ROW
247class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty
248{
249public:
250 explicit WrappedDataSourceLabelsInFirstRowProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
251
252 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
253
254 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
255
256 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
257
258private: //member
259 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
261};
262
263}
264
265WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
266 : WrappedProperty("DataSourceLabelsInFirstRow",OUString())
267 , m_spChart2ModelContact(std::move( spChart2ModelContact ))
268{
269 m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( nullptr );
270}
271
272void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
273{
274 bool bLabelsInFirstRow = true;
275 if( ! (rOuterValue >>= bLabelsInFirstRow) )
276 throw lang::IllegalArgumentException("Property DataSourceLabelsInFirstRow requires value of type boolean", nullptr, 0 );
277
278 m_aOuterValue = rOuterValue;
279 bool bNewValue = bLabelsInFirstRow;
280
281 OUString aRangeString;
282 bool bUseColumns = true;
283 bool bFirstCellAsLabel = true;
284 bool bHasCategories = true;
285 uno::Sequence< sal_Int32 > aSequenceMapping;
286
287 if( !DataSourceHelper::detectRangeSegmentation(
288 m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
289 , bFirstCellAsLabel, bHasCategories ) )
290 return;
291
292 if( bUseColumns && bNewValue != bFirstCellAsLabel )
293 {
294 DataSourceHelper::setRangeSegmentation(
295 m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
296 }
297 else if( !bUseColumns && bNewValue != bHasCategories )
298 {
299 DataSourceHelper::setRangeSegmentation(
300 m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
301 }
302}
303
304Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
305{
306 OUString aRangeString;
307 bool bUseColumns = true;
308 bool bFirstCellAsLabel = true;
309 bool bHasCategories = true;
310 uno::Sequence< sal_Int32 > aSequenceMapping;
311
312 if( DataSourceHelper::detectRangeSegmentation(
313 m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
314 , bFirstCellAsLabel, bHasCategories ) )
315 {
316 bool bLabelsInFirstRow = true;
317 if( bUseColumns )
318 bLabelsInFirstRow = bFirstCellAsLabel;
319 else
320 bLabelsInFirstRow = bHasCategories;
321
322 m_aOuterValue <<= bLabelsInFirstRow;
323 }
324 return m_aOuterValue;
325}
326
327Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
328{
329 Any aRet;
330 aRet <<= true;
331 return aRet;
332}
333
334namespace {
335
336//PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN
337class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty
338{
339public:
340 explicit WrappedDataSourceLabelsInFirstColumnProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
341
342 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
343
344 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
345
346 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
347
348private: //member
349 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
350 mutable Any m_aOuterValue;
351};
352
353}
354
355WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
356 : WrappedProperty("DataSourceLabelsInFirstColumn",OUString())
357 , m_spChart2ModelContact(std::move( spChart2ModelContact ))
358{
359 m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( nullptr );
360}
361
362void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
363{
364 bool bLabelsInFirstRow = true;
365 if( ! (rOuterValue >>= bLabelsInFirstRow) )
366 throw lang::IllegalArgumentException("Property DataSourceLabelsInFirstRow requires value of type boolean", nullptr, 0 );
367
368 m_aOuterValue = rOuterValue;
369 bool bNewValue = bLabelsInFirstRow;
370
371 OUString aRangeString;
372 bool bUseColumns = true;
373 bool bFirstCellAsLabel = true;
374 bool bHasCategories = true;
375 uno::Sequence< sal_Int32 > aSequenceMapping;
376
377 if( !DataSourceHelper::detectRangeSegmentation(
378 m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
379 , bFirstCellAsLabel, bHasCategories ) )
380 return;
381
382 if( bUseColumns && bNewValue != bHasCategories )
383 {
384 DataSourceHelper::setRangeSegmentation(
385 m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
386 }
387 else if( !bUseColumns && bNewValue != bFirstCellAsLabel )
388 {
389 DataSourceHelper::setRangeSegmentation(
390 m_spChart2ModelContact->getDocumentModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
391 }
392}
393
394Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
395{
396 OUString aRangeString;
397 bool bUseColumns = true;
398 bool bFirstCellAsLabel = true;
399 bool bHasCategories = true;
400 uno::Sequence< sal_Int32 > aSequenceMapping;
401
402 if( DataSourceHelper::detectRangeSegmentation(
403 m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns
404 , bFirstCellAsLabel, bHasCategories ) )
405 {
406 bool bLabelsInFirstColumn = true;
407 if( bUseColumns )
408 bLabelsInFirstColumn = bHasCategories;
409 else
410 bLabelsInFirstColumn = bFirstCellAsLabel;
411
412 m_aOuterValue <<= bLabelsInFirstColumn;
413 }
414 return m_aOuterValue;
415}
416
417Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
418{
419 Any aRet;
420 aRet <<= true;
421 return aRet;
422}
423
424namespace {
425
426//PROP_DOCUMENT_HAS_LEGEND
427class WrappedHasLegendProperty : public WrappedProperty
428{
429public:
430 explicit WrappedHasLegendProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
431
432 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
433
434 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
435
436 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
437
438private: //member
439 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
440};
441
442}
443
444WrappedHasLegendProperty::WrappedHasLegendProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
445 : WrappedProperty("HasLegend",OUString())
446 , m_spChart2ModelContact(std::move( spChart2ModelContact ))
447{
448}
449
450void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
451{
452 bool bNewValue = true;
453 if( ! (rOuterValue >>= bNewValue) )
454 throw lang::IllegalArgumentException("Property HasLegend requires value of type boolean", nullptr, 0 );
455
456 try
457 {
458 rtl::Reference< Legend > xLegend = LegendHelper::getLegend( *m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext,bNewValue );
459 if(xLegend.is())
460 {
461 bool bOldValue = true;
462 Any aAOld = xLegend->getPropertyValue("Show");
463 aAOld >>= bOldValue;
464 if( bOldValue != bNewValue )
465 xLegend->setPropertyValue("Show", uno::Any( bNewValue ));
466 }
467 }
468 catch (const uno::Exception&)
469 {
470 DBG_UNHANDLED_EXCEPTION("chart2");
471 }
472}
473
474Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
475{
476 Any aRet;
477 try
478 {
480 LegendHelper::getLegend( *m_spChart2ModelContact->getDocumentModel() );
481 if( xLegend.is())
482 aRet = xLegend->getPropertyValue("Show");
483 else
484 aRet <<= false;
485 }
486 catch (const uno::Exception&)
487 {
488 DBG_UNHANDLED_EXCEPTION("chart2");
489 }
490 return aRet;
491}
492
493Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
494{
495 Any aRet;
496 aRet <<= false;
497 return aRet;
498}
499
500namespace {
501
502//PROP_DOCUMENT_HAS_MAIN_TITLE
503class WrappedHasMainTitleProperty : public WrappedProperty
504{
505public:
506 explicit WrappedHasMainTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
507
508 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
509
510 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
511
512 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
513
514private: //member
515 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
516};
517
518}
519
520WrappedHasMainTitleProperty::WrappedHasMainTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
521 : WrappedProperty("HasMainTitle",OUString())
522 , m_spChart2ModelContact(std::move( spChart2ModelContact ))
523{
524}
525
526void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
527{
528 bool bNewValue = true;
529 if( ! (rOuterValue >>= bNewValue) )
530 throw lang::IllegalArgumentException("Property HasMainTitle requires value of type boolean", nullptr, 0 );
531
532 try
533 {
534 if( bNewValue )
535 TitleHelper::createTitle( TitleHelper::MAIN_TITLE, "main-title", m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
536 else
537 TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getDocumentModel() );
538 }
539 catch (const uno::Exception&)
540 {
541 DBG_UNHANDLED_EXCEPTION("chart2");
542 }
543}
544
545Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
546{
547 Any aRet;
548 try
549 {
550 aRet <<= TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getDocumentModel() ).is();
551 }
552 catch (const uno::Exception&)
553 {
554 DBG_UNHANDLED_EXCEPTION("chart2");
555 }
556 return aRet;
557}
558
559Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
560{
561 Any aRet;
562 aRet <<= false;
563 return aRet;
564}
565
566namespace {
567
568//PROP_DOCUMENT_HAS_SUB_TITLE
569class WrappedHasSubTitleProperty : public WrappedProperty
570{
571public:
572 explicit WrappedHasSubTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact);
573
574 virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
575
576 virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override;
577
578 virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override;
579
580private: //member
581 std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
582};
583
584}
585
586WrappedHasSubTitleProperty::WrappedHasSubTitleProperty(std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
587 : WrappedProperty("HasSubTitle",OUString())
588 , m_spChart2ModelContact(std::move( spChart2ModelContact ))
589{
590}
591
592void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
593{
594 bool bNewValue = true;
595 if( ! (rOuterValue >>= bNewValue) )
596 throw lang::IllegalArgumentException("Property HasSubTitle requires value of type boolean", nullptr, 0 );
597
598 try
599 {
600 if( bNewValue )
601 TitleHelper::createTitle( TitleHelper::SUB_TITLE, "", m_spChart2ModelContact->getDocumentModel(), m_spChart2ModelContact->m_xContext );
602 else
603 TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getDocumentModel() );
604 }
605 catch (const uno::Exception&)
606 {
607 DBG_UNHANDLED_EXCEPTION("chart2");
608 }
609}
610
611Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
612{
613 Any aRet;
614 try
615 {
616 aRet <<= TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getDocumentModel() ).is();
617 }
618 catch (const uno::Exception&)
619 {
620 DBG_UNHANDLED_EXCEPTION("chart2");
621 }
622 return aRet;
623}
624
625Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
626{
627 Any aRet;
628 aRet <<= false;
629 return aRet;
630}
631
632ChartDocumentWrapper::ChartDocumentWrapper(
633 const Reference< uno::XComponentContext > & xContext ) :
635 m_bUpdateAddIn( true ),
636 m_bIsDisposed( false )
637{
638}
639
641{
643}
644
645// ____ XInterface (for new interfaces) ____
646// [-loplugin:unoaggregation]
648{
649 if( m_xDelegator.is())
650 // calls queryAggregation if the delegator doesn't know aType
651 return m_xDelegator->queryInterface( aType );
652 else
653 return queryAggregation( aType );
654}
655
656// ____ chart::XChartDocument (old API wrapper) ____
658{
659 if( !m_xTitle.is() )
660 {
661 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
663 }
664 return m_xTitle;
665}
666
668{
669 if( !m_xSubTitle.is() )
670 {
671 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
673 }
674 return m_xSubTitle;
675}
676
678{
679 if( ! m_xLegend.is())
680 {
682 }
683
684 return m_xLegend;
685}
686
688{
689 if( ! m_xArea.is())
690 {
692 }
693
694 return m_xArea;
695}
696
698{
699 if( !m_xDiagram.is() )
700 {
701 try
702 {
704 }
705 catch (const uno::Exception&)
706 {
707 DBG_UNHANDLED_EXCEPTION("chart2");
708 }
709 }
710
711 return m_xDiagram;
712}
713
715{
716 uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY );
717 if( xAddIn.is() )
718 {
719 setAddIn( xAddIn );
720 }
721 else if( xDiagram.is() && xDiagram != m_xDiagram )
722 {
723 // set new wrapped diagram at new chart. This requires the old
724 // diagram given as parameter to implement the new interface. If
725 // this is not possible throw an exception
726 Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW );
727 Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram());
728
729 try
730 {
731 rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
732 if( xChartDoc.is() )
733 {
734 // set the new diagram
735 xChartDoc->setFirstDiagram( xNewDia );
736 m_xDiagram = xDiagram;
737 }
738 }
739 catch (const uno::Exception&)
740 {
741 DBG_UNHANDLED_EXCEPTION("chart2");
742 }
743 }
744}
745
747{
748 if( !m_xChartData.is() )
749 {
751 }
752 //@todo: check hasInternalDataProvider also in else?
753
754 return m_xChartData;
755}
756
758{
759 if( !xNewData.is() )
760 return;
761
762 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
764}
765
766// ____ XModel ____
768 const OUString& URL,
769 const Sequence< beans::PropertyValue >& Arguments )
770{
772 if( xModel.is() )
773 return xModel->attachResource( URL, Arguments );
774 return false;
775}
776
778{
780 if( xModel.is() )
781 return xModel->getURL();
782 return OUString();
783}
784
786{
788 if( xModel.is() )
789 return xModel->getArgs();
791}
792
794{
796 if( xModel.is() )
797 xModel->connectController( Controller );
798}
799
801 const Reference< frame::XController >& Controller )
802{
804 if( xModel.is() )
805 xModel->disconnectController( Controller );
806}
807
809{
811 if( xModel.is() )
812 xModel->lockControllers();
813}
814
816{
818 if( xModel.is() )
819 xModel->unlockControllers();
820}
821
823{
825 if( xModel.is() )
826 return xModel->hasControllersLocked();
827 return false;
828}
829
831{
833 if( xModel.is() )
834 return xModel->getCurrentController();
835 return nullptr;
836}
837
839 const Reference< frame::XController >& Controller )
840{
842 if( xModel.is() )
843 xModel->setCurrentController( Controller );
844}
845
847{
849 if( xModel.is() )
850 return xModel->getCurrentSelection();
851 return nullptr;
852}
853
854// ____ XComponent ____
856{
857 if( m_bIsDisposed )
858 return;
859
860 m_bIsDisposed = true;
861
862 try
863 {
864 Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY );
871 m_xChartView.set( nullptr );
872 m_xShapeFactory.set( nullptr );
873 m_xDelegator.set( nullptr );
874
875 clearWrappedPropertySet();
876 m_spChart2ModelContact->clear();
878
880
881 try
882 {
883 if( xFormerDelegator.is())
884 xFormerDelegator->dispose();
885 }
886 catch (const lang::DisposedException&)
887 {
888 // this is ok, don't panic
889 }
890 }
891 catch (const uno::Exception &)
892 {
893 DBG_UNHANDLED_EXCEPTION("chart2");
894 }
895}
896
898{
900 m_xAddIn.set( nullptr );
901
902 if( !xAddIn.is() )
903 return;
904
905 try
906 {
907 //make sure that the add-in does not hold a references to us anymore:
908 Reference< lang::XComponent > xComp( xAddIn, uno::UNO_QUERY );
909 if( xComp.is())
910 xComp->dispose();
911 else
912 {
913 uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY );
914 if( xInit.is() )
915 {
916 uno::Any aParam;
918 aParam <<= xDoc;
919 uno::Sequence< uno::Any > aSeq( &aParam, 1 );
920 xInit->initialize( aSeq );
921 }
922 }
923 }
924 catch (const uno::RuntimeException&)
925 {
926 DBG_UNHANDLED_EXCEPTION("chart2");
927 }
928 catch (const uno::Exception&)
929 {
930 DBG_UNHANDLED_EXCEPTION("chart2");
931 }
932}
933
934void ChartDocumentWrapper::setBaseDiagram( const OUString& rBaseDiagram )
935{
936 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
937 m_aBaseDiagram = rBaseDiagram;
938
939 uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
940 if( xDiagram.is() )
941 setDiagram( xDiagram );
942}
943
945{
946 if( m_xAddIn == xAddIn )
947 return;
948
949 ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getDocumentModel() );
951 m_xAddIn = xAddIn;
952 // initialize AddIn with this as chart document
953 uno::Reference< lang::XInitialization > xInit( m_xAddIn, uno::UNO_QUERY );
954 if( xInit.is() )
955 {
956 uno::Any aParam;
958 aParam <<= xDoc;
959 uno::Sequence< uno::Any > aSeq( &aParam, 1 );
960 xInit->initialize( aSeq );
961 }
962}
963
965{
966 m_bUpdateAddIn = bUpdateAddIn;
967}
968
970{
971 // get additional non-chart shapes for XML export
974
975 if( !xDrawPage.is() )
976 return xFoundShapes;
977
979
980 // iterate 'flat' over all top-level objects
981 // and determine all that are no chart objects
982 std::vector< uno::Reference< drawing::XShape > > aShapeVector;
983 sal_Int32 nSubCount = xDrawPage->getCount();
985 for( sal_Int32 nS = 0; nS < nSubCount; nS++ )
986 {
987 if( xDrawPage->getByIndex( nS ) >>= xShape )
988 {
989 if( xShape.is() && xChartRoot!=xShape )
990 aShapeVector.push_back( xShape );
991 }
992 }
993
994 if( !aShapeVector.empty() )
995 {
996 // create a shape collection
997 xFoundShapes = drawing::ShapeCollection::create(
999
1000 OSL_ENSURE( xFoundShapes.is(), "Couldn't create a shape collection!" );
1001 if( xFoundShapes.is())
1002 {
1003 for (auto const& shape : aShapeVector)
1004 xFoundShapes->add(shape);
1005 }
1006 }
1007
1008 return xFoundShapes;
1009}
1010
1012{
1014 if( xModel.is() )
1015 xModel->addEventListener( xListener );
1016}
1017
1019{
1021 if( xModel.is() )
1022 xModel->removeEventListener( aListener );
1023}
1024
1025// ____ XDrawPageSupplier ____
1027{
1028 return impl_getDrawPage();
1029}
1030
1032{
1033 return m_spChart2ModelContact->getDrawPage();
1034}
1035
1036namespace {
1037
1039{
1040 if( xChartView )
1041 return xChartView->getDrawModelWrapper()->getShapeFactory();
1042
1044}
1045
1046}
1047
1048// ____ XMultiServiceFactory ____
1050 const OUString& aServiceSpecifier )
1051{
1053
1054 rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() );
1055 if( !xChartDoc.is() )
1056 return xResult;
1057
1058 bool bServiceFound = false;
1059 tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
1060
1061 tServiceNameMap::const_iterator aIt( rMap.find( aServiceSpecifier ));
1062 if( aIt != rMap.end())
1063 {
1064 bool bCreateDiagram = false;
1066 xChartDoc->getTypeManager();
1068
1069 switch( (*aIt).second )
1070 {
1071 case SERVICE_NAME_AREA_DIAGRAM:
1072 if( xChartTypeManager.is())
1073 {
1074 xTemplate =
1075 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Area");
1076 bCreateDiagram = true;
1077 }
1078 break;
1079 case SERVICE_NAME_BAR_DIAGRAM:
1080 if( xChartTypeManager.is())
1081 {
1082 // this is for bar and column (the latter is the default if
1083 // no "Vertical=false" property was set)
1084 xTemplate =
1085 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Column");
1086 bCreateDiagram = true;
1087 }
1088 break;
1089 case SERVICE_NAME_DONUT_DIAGRAM:
1090 if( xChartTypeManager.is())
1091 {
1092 xTemplate =
1093 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Donut");
1094 bCreateDiagram = true;
1095 }
1096 break;
1097 case SERVICE_NAME_LINE_DIAGRAM:
1098 if( xChartTypeManager.is())
1099 {
1100 xTemplate =
1101 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Line");
1102 bCreateDiagram = true;
1103 }
1104 break;
1105 case SERVICE_NAME_NET_DIAGRAM:
1106 if( xChartTypeManager.is())
1107 {
1108 xTemplate =
1109 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Net");
1110 bCreateDiagram = true;
1111 }
1112 break;
1113 case SERVICE_NAME_FILLED_NET_DIAGRAM:
1114 if( xChartTypeManager.is())
1115 {
1116 xTemplate =
1117 xChartTypeManager->createTemplate("com.sun.star.chart2.template.FilledNet");
1118 bCreateDiagram = true;
1119 }
1120 break;
1121 case SERVICE_NAME_PIE_DIAGRAM:
1122 if( xChartTypeManager.is())
1123 {
1124 xTemplate =
1125 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Pie");
1126 bCreateDiagram = true;
1127 }
1128 break;
1129 case SERVICE_NAME_STOCK_DIAGRAM:
1130 if( xChartTypeManager.is())
1131 {
1132 xTemplate =
1133 xChartTypeManager->createTemplate("com.sun.star.chart2.template.StockLowHighClose");
1134 bCreateDiagram = true;
1135 }
1136 break;
1137 case SERVICE_NAME_XY_DIAGRAM:
1138 if( xChartTypeManager.is())
1139 {
1140 xTemplate =
1141 xChartTypeManager->createTemplate("com.sun.star.chart2.template.ScatterLineSymbol");
1142 bCreateDiagram = true;
1143 }
1144 break;
1145
1146 case SERVICE_NAME_BUBBLE_DIAGRAM:
1147 if( xChartTypeManager.is())
1148 {
1149 xTemplate =
1150 xChartTypeManager->createTemplate("com.sun.star.chart2.template.Bubble");
1151 bCreateDiagram = true;
1152 }
1153 break;
1154
1155 case SERVICE_NAME_DASH_TABLE:
1156 case SERVICE_NAME_GRADIENT_TABLE:
1157 case SERVICE_NAME_HATCH_TABLE:
1158 case SERVICE_NAME_BITMAP_TABLE:
1159 case SERVICE_NAME_TRANSP_GRADIENT_TABLE:
1160 case SERVICE_NAME_MARKER_TABLE:
1161 xResult.set( xChartDoc->createInstance( aIt->first ), uno::UNO_QUERY );
1162 break;
1163
1164 case SERVICE_NAME_NAMESPACE_MAP:
1165 break;
1166 case SERVICE_NAME_EXPORT_GRAPHIC_STORAGE_RESOLVER:
1167 break;
1168 case SERVICE_NAME_IMPORT_GRAPHIC_STORAGE_RESOLVER:
1169 break;
1170 }
1171
1172 if( bCreateDiagram && xTemplate.is() )
1173 {
1174 try
1175 {
1176 uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
1177 if( xDia.is())
1178 {
1179 // locked controllers
1180 ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
1181 rtl::Reference< Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
1182 ThreeDLookScheme e3DScheme = xDiagram->detectScheme();
1183 rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = xChartDoc->getTypeManager();
1184 Diagram::tTemplateWithServiceName aTemplateWithService(
1185 xDiagram->getTemplate( xTemplateManager ));
1186 if( aTemplateWithService.xChartTypeTemplate.is())
1187 aTemplateWithService.xChartTypeTemplate->resetStyles2( xDiagram );//#i109371#
1188 xTemplate->changeDiagram( xDiagram );
1191 xDiagram->setScheme( e3DScheme );
1192 }
1193 else
1194 {
1195 // locked controllers
1196 ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
1197 xDia.set( xTemplate->createDiagramByDataSource(
1200 xChartDoc->setFirstDiagram( xDia );
1201 }
1202
1203 xResult = static_cast< ::cppu::OWeakObject* >( new DiagramWrapper( m_spChart2ModelContact ));
1204 }
1205 catch (const uno::Exception&)
1206 {
1207 DBG_UNHANDLED_EXCEPTION("chart2");
1208 }
1209 }
1210
1211 bServiceFound = true;
1212 }
1213 else if( aServiceSpecifier == "com.sun.star.comp.chart2.DataSeriesWrapper" )
1214 {
1216 xResult.set( xDataSeries );
1217 bServiceFound = true;
1218 }
1219 else if( aServiceSpecifier == CHART_VIEW_SERVICE_NAME )
1220 {
1221 if( !m_xChartView.is() )
1222 {
1223 rtl::Reference<::chart::ChartModel> pChartModel = new ::chart::ChartModel(m_spChart2ModelContact->m_xContext);
1224 rtl::Reference<ChartView> xChartView = new ::chart::ChartView(m_spChart2ModelContact->m_xContext, *pChartModel);
1225
1226 try
1227 {
1228 m_xChartView = xChartView;
1229
1231 Any(true) }; // bRefreshAddIn
1232 xChartView->initialize(aArguments);
1233 }
1234 catch (const uno::Exception&)
1235 {
1236 DBG_UNHANDLED_EXCEPTION("chart2");
1237 }
1238 }
1239 xResult.set( static_cast<cppu::OWeakObject*>(m_xChartView.get()) );
1240 bServiceFound = true;
1241 }
1242 else
1243 {
1244 // try to create a shape
1245 try
1246 {
1247 if( !m_xShapeFactory.is() && m_xChartView.is() )
1248 {
1249 m_xShapeFactory = getShapeFactory( m_xChartView );
1250 }
1251 else
1252 {
1253 rtl::Reference<ChartModel> pModel = m_spChart2ModelContact->getDocumentModel();
1254 if(pModel)
1255 {
1256 m_xChartView = pModel->getChartView();
1257 m_xShapeFactory = getShapeFactory( m_xChartView );
1258 }
1259 }
1260
1261 if( m_xShapeFactory.is() )
1262 {
1263 xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
1264 bServiceFound = true;
1265 }
1266 }
1267 catch (const uno::Exception&)
1268 {
1269 // couldn't create shape
1270 }
1271 }
1272
1273 // finally, try to create an addin
1274 if( !bServiceFound )
1275 {
1276 try
1277 {
1279 m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
1281 xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
1282 if( xAddIn.is() )
1283 {
1284 xResult = xAddIn;
1285 }
1286 }
1287 catch (const uno::Exception&)
1288 {
1289 // couldn't create service
1290 }
1291 }
1292
1293 return xResult;
1294}
1295
1297 const OUString& ServiceSpecifier,
1298 const uno::Sequence< uno::Any >& Arguments )
1299{
1300 OSL_ENSURE( Arguments.hasElements(), "createInstanceWithArguments: Warning: Arguments are ignored" );
1301
1302 return createInstance( ServiceSpecifier );
1303}
1304
1306{
1307 return comphelper::mapKeysToSequence( lcl_getStaticServiceNameMap() );
1308}
1309
1310// ____ XAggregation ____
1312 const uno::Reference< uno::XInterface >& rDelegator )
1313{
1314 if( m_bIsDisposed )
1315 {
1316 if( rDelegator.is() )
1317 throw lang::DisposedException("ChartDocumentWrapper is disposed",
1318 static_cast< ::cppu::OWeakObject* >( this ));
1319 return;
1320 }
1321
1322 if( rDelegator.is())
1323 {
1324 m_xDelegator = rDelegator;
1325 ChartModel* pChartModel = dynamic_cast<ChartModel*>(rDelegator.get());
1326 assert(pChartModel);
1327 m_spChart2ModelContact->setDocumentModel( pChartModel );
1328 }
1329 else
1330 {
1331 // this is a sort of dispose() from the new model,so release resources here
1332 try
1333 {
1334 dispose();
1335 }
1336 catch (const uno::Exception&)
1337 {
1338 DBG_UNHANDLED_EXCEPTION("chart2");
1339 }
1340 }
1341}
1342
1344{
1345 return ChartDocumentWrapper_Base::queryInterface( rType );
1346}
1347
1348// ____ ::utl::OEventListenerAdapter ____
1349void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
1350{
1351 if( rSource.Source == m_xTitle )
1352 m_xTitle.set( nullptr );
1353 else if( rSource.Source == m_xSubTitle )
1354 m_xSubTitle.set( nullptr );
1355 else if( rSource.Source == m_xLegend )
1356 m_xLegend.set( nullptr );
1357 else if( rSource.Source == m_xChartData )
1358 m_xChartData.set( nullptr );
1359 else if( rSource.Source == m_xDiagram )
1360 m_xDiagram.set( nullptr );
1361 else if( rSource.Source == m_xArea )
1362 m_xArea.set( nullptr );
1363 else if( rSource.Source == m_xAddIn )
1364 m_xAddIn.set( nullptr );
1365 else if( rSource.Source == static_cast<cppu::OWeakObject*>(m_xChartView.get()) )
1366 m_xChartView.set( nullptr );
1367}
1368
1369// WrappedPropertySet
1371{
1372 return nullptr;
1373}
1375{
1376 return StaticChartDocumentWrapperPropertyArray();
1377}
1378
1379std::vector< std::unique_ptr<WrappedProperty> > ChartDocumentWrapper::createWrappedProperties()
1380{
1381 std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
1382 aWrappedProperties.emplace_back( new WrappedDataSourceLabelsInFirstRowProperty( m_spChart2ModelContact ) );
1383 aWrappedProperties.emplace_back( new WrappedDataSourceLabelsInFirstColumnProperty( m_spChart2ModelContact ) );
1384 aWrappedProperties.emplace_back( new WrappedHasLegendProperty( m_spChart2ModelContact ) );
1385 aWrappedProperties.emplace_back( new WrappedHasMainTitleProperty( m_spChart2ModelContact ) );
1386 aWrappedProperties.emplace_back( new WrappedHasSubTitleProperty( m_spChart2ModelContact ) );
1387 aWrappedProperties.emplace_back( new WrappedAddInProperty( *this ) );
1388 aWrappedProperties.emplace_back( new WrappedBaseDiagramProperty( *this ) );
1389 aWrappedProperties.emplace_back( new WrappedAdditionalShapesProperty( *this ) );
1390 aWrappedProperties.emplace_back( new WrappedRefreshAddInAllowedProperty( *this ) );
1391 aWrappedProperties.emplace_back( new WrappedIgnoreProperty("NullDate",Any() ) ); // i99104
1392 aWrappedProperties.emplace_back( new WrappedIgnoreProperty("EnableComplexChartTypes", uno::Any(true) ) );
1393 aWrappedProperties.emplace_back( new WrappedIgnoreProperty("EnableDataTableDialog", uno::Any(true) ) );
1394
1395 return aWrappedProperties;
1396}
1397
1399{
1401}
1402
1403sal_Bool SAL_CALL ChartDocumentWrapper::supportsService( const OUString& rServiceName )
1404{
1405 return cppu::supportsService(this, rServiceName);
1406}
1407
1408css::uno::Sequence< OUString > SAL_CALL ChartDocumentWrapper::getSupportedServiceNames()
1409{
1410 return {
1411 "com.sun.star.chart.ChartDocument",
1413 "com.sun.star.xml.UserDefinedAttributesSupplier",
1414 "com.sun.star.beans.PropertySet"
1415 };
1416}
1417
1418} // namespace chart::wrapper
1419
1420extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1422 css::uno::Sequence<css::uno::Any> const &)
1423{
1424 return cppu::acquire(new ::chart::wrapper::ChartDocumentWrapper(context));
1425}
1426
1427/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Any m_aOuterValue
PropertiesInfo aProperties
static bool GetMathLayoutRTL()
static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemByIndex(const rtl::Reference< ::chart::Diagram > &xDiagram, sal_Int32 nIndex)
Definition: AxisHelper.cxx:550
static void setRTLAxisLayout(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys)
This guard calls lockControllers at the given Model in the CTOR and unlockControllers in the DTOR.
static rtl::Reference< SvxShapeGroupAnyD > getChartRootShape(const rtl::Reference< SvxDrawPage > &xPage)
virtual void SAL_CALL lockControllers() override
virtual void SAL_CALL setDelegator(const css::uno::Reference< css::uno::XInterface > &rDelegator) override
virtual OUString SAL_CALL getURL() override
void setAddIn(const css::uno::Reference< css::util::XRefreshable > &xAddIn)
css::uno::Reference< css::uno::XInterface > m_xDelegator
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo declarations.
css::uno::Reference< css::lang::XMultiServiceFactory > m_xShapeFactory
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
css::uno::Reference< css::drawing::XShape > m_xSubTitle
virtual css::uno::Reference< css::chart::XChartData > SAL_CALL getData() override
rtl::Reference< SvxDrawPage > impl_getDrawPage() const
void setBaseDiagram(const OUString &rBaseDiagram)
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getArea() override
css::uno::Reference< css::chart::XDiagram > m_xDiagram
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getSubTitle() override
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getLegend() override
virtual void SAL_CALL connectController(const css::uno::Reference< css::frame::XController > &Controller) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() override
virtual sal_Bool SAL_CALL hasControllersLocked() override
virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() override
css::uno::Reference< css::drawing::XShape > m_xTitle
virtual void SAL_CALL setDiagram(const css::uno::Reference< css::chart::XDiagram > &xDiagram) override
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getTitle() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual sal_Bool SAL_CALL attachResource(const OUString &URL, const css::uno::Sequence< css::beans::PropertyValue > &Arguments) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
css::uno::Reference< css::util::XRefreshable > m_xAddIn
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override
css::uno::Reference< css::beans::XPropertySet > m_xArea
css::uno::Reference< css::drawing::XShape > m_xLegend
virtual std::vector< std::unique_ptr< WrappedProperty > > createWrappedProperties() override
virtual void SAL_CALL setCurrentController(const css::uno::Reference< css::frame::XController > &Controller) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL dispose() override
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
virtual void SAL_CALL unlockControllers() override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() override
rtl::Reference< ChartView > m_xChartView
css::uno::Reference< css::drawing::XShapes > getAdditionalShapes() const
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::chart::XDiagram > SAL_CALL getDiagram() override
virtual void SAL_CALL attachData(const css::uno::Reference< css::chart::XChartData > &xData) override
css::uno::Reference< css::chart::XChartData > m_xChartData
virtual const css::uno::Sequence< css::beans::Property > & getPropertySequence() override
virtual void SAL_CALL disconnectController(const css::uno::Reference< css::frame::XController > &Controller) override
virtual void _disposing(const css::lang::EventObject &rSource) override
#define DBG_UNHANDLED_EXCEPTION(...)
Sequence< PropertyValue > aArguments
Sequence< sal_Int8 > aSeq
void DisposeAndClear(css::uno::Reference< T > &rInterface)
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
ThreeDLookScheme
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< T > make_shared(Args &&... args)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
constexpr OUStringLiteral CHART_VIEW_SERVICE_NAME
constexpr OUStringLiteral CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME
constexpr OUStringLiteral CHART_CHARTAPIWRAPPER_SERVICE_NAME
rtl::Reference< ::chart::ChartTypeTemplate > xChartTypeTemplate
Definition: Diagram.hxx:314
Reference< XModel > xModel
unsigned char sal_Bool