LibreOffice Module sc (master) 1
chartuno.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
20#include <com/sun/star/embed/Aspects.hpp>
21#include <com/sun/star/embed/XEmbeddedObject.hpp>
22#include <com/sun/star/awt/Size.hpp>
23#include <com/sun/star/beans/PropertyAttribute.hpp>
24#include <com/sun/star/chart2/data/XDataReceiver.hpp>
25#include <com/sun/star/chart/ChartDataRowSource.hpp>
26#include <com/sun/star/chart2/XChartDocument.hpp>
27#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28#include <com/sun/star/table/CellRangeAddress.hpp>
29
30#include <osl/diagnose.h>
31#include <svx/svditer.hxx>
32#include <svx/svdoole2.hxx>
33#include <svx/svdpage.hxx>
34#include <svx/svdundo.hxx>
38#include <tools/globname.hxx>
39#include <svtools/embedhlp.hxx>
40#include <utility>
41#include <vcl/svapp.hxx>
42
43#include <ChartTools.hxx>
44#include <chartuno.hxx>
45#include <miscuno.hxx>
46#include <docsh.hxx>
47#include <drwlayer.hxx>
48#include <undodat.hxx>
49#include <chartlis.hxx>
50#include <chart2uno.hxx>
51#include <convuno.hxx>
52
53using namespace css;
54
55#define PROP_HANDLE_RELATED_CELLRANGES 1
56
57SC_SIMPLE_SERVICE_INFO( ScChartObj, "ScChartObj", "com.sun.star.table.TableChart" )
58SC_SIMPLE_SERVICE_INFO( ScChartsObj, "ScChartsObj", "com.sun.star.table.TableCharts" )
59
61 pDocShell( pDocSh ),
62 nTab( nT )
63{
64 pDocShell->GetDocument().AddUnoObject(*this);
65}
66
68{
70
71 if (pDocShell)
73}
74
76{
78
79 if ( rHint.GetId() == SfxHintId::Dying )
80 {
81 pDocShell = nullptr;
82 }
83}
84
86{
87 if ( pDocShell )
88 {
89 OUString aName;
90
92 ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
93 if (pDrawLayer)
94 {
95 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
96 OSL_ENSURE(pPage, "Page not found");
97 if (pPage)
98 {
99 tools::Long nPos = 0;
100 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
101 SdrObject* pObject = aIter.Next();
102 while (pObject)
103 {
104 if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) )
105 {
106 if ( nPos == nIndex )
107 {
108 uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(pObject)->GetObjRef();
109 if ( xObj.is() )
111 break; // stop searching
112 }
113 ++nPos;
114 }
115 pObject = aIter.Next();
116 }
117 }
118 }
119
120 if (!aName.isEmpty())
121 return new ScChartObj( pDocShell, nTab, aName );
122 }
123
124 return nullptr;
125}
126
128{
130 return new ScChartObj( pDocShell, nTab, aName );
132 return new ScChartObj( pDocShell, nTab, aName );
133 return nullptr;
134}
135
136// XTableCharts
137
138void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
139 const awt::Rectangle& aRect,
140 const uno::Sequence<table::CellRangeAddress>& aRanges,
141 sal_Bool bColumnHeaders, sal_Bool bRowHeaders )
142{
143 SolarMutexGuard aGuard;
144 if (!pDocShell)
145 return;
146
149 SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab));
150 OSL_ENSURE(pPage,"addChart: no Page");
151 if (!pPage)
152 return;
153
154 // chart can't be inserted if any ole object with that name exists on any table
155 // (empty string: generate valid name)
156
157 OUString aName = rName;
158 SCTAB nDummy;
159 if ( !aName.isEmpty() && pModel->GetNamedObject( aName, SdrObjKind::OLE2, nDummy ) )
160 {
161 // object exists - only RuntimeException is specified
162 throw uno::RuntimeException();
163 }
164
165 ScRangeList* pList = new ScRangeList;
166 for (const table::CellRangeAddress& rRange : aRanges)
167 {
168 ScRange aRange( static_cast<SCCOL>(rRange.StartColumn), rRange.StartRow, rRange.Sheet,
169 static_cast<SCCOL>(rRange.EndColumn), rRange.EndRow, rRange.Sheet );
170 pList->push_back( aRange );
171 }
172 ScRangeListRef xNewRanges( pList );
173
174 uno::Reference < embed::XEmbeddedObject > xObj;
175 if ( SvtModuleOptions().IsChart() )
177 if ( !xObj.is() )
178 return;
179
180 // adjust rectangle
182 Point aRectPos( aRect.X, aRect.Y );
183 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
184 if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) )
185 aRectPos.setX( 0 );
186
187 if (aRectPos.Y() < 0)
188 aRectPos.setY( 0 );
189
190 Size aRectSize( aRect.Width, aRect.Height );
191 if (aRectSize.Width() <= 0)
192 aRectSize.setWidth( 5000 ); // default size
193
194 if (aRectSize.Height() <= 0)
195 aRectSize.setHeight( 5000 );
196 tools::Rectangle aInsRect( aRectPos, aRectSize );
197
198 sal_Int64 nAspect(embed::Aspects::MSOLE_CONTENT);
199 MapUnit aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ));
200 Size aSize(aInsRect.GetSize());
201 aSize = OutputDevice::LogicToLogic( aSize, MapMode( MapUnit::Map100thMM ), MapMode( aMapUnit ) );
202 awt::Size aSz;
203 aSz.Width = aSize.Width();
204 aSz.Height = aSize.Height();
205
206 // Calc -> DataProvider
207 uno::Reference< chart2::data::XDataProvider > xDataProvider = new
208 ScChart2DataProvider( &rDoc );
209 // Chart -> DataReceiver
210 uno::Reference< chart2::data::XDataReceiver > xReceiver;
211 if( xObj.is())
212 xReceiver.set( xObj->getComponent(), uno::UNO_QUERY );
213 if( xReceiver.is())
214 {
215 // Range in UI representation.
216 OUString sRangeStr;
217 xNewRanges->Format(sRangeStr, ScRefFlags::RANGE_ABS_3D, rDoc, rDoc.GetAddressConvention());
218
219 // connect
220 if( !sRangeStr.isEmpty() )
221 xReceiver->attachDataProvider( xDataProvider );
222 else
223 sRangeStr = "all";
224
225 uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast<cppu::OWeakObject*>(pDocShell->GetModel()), uno::UNO_QUERY );
226 xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
227
228 // set arguments
229 uno::Sequence< beans::PropertyValue > aArgs{
230 beans::PropertyValue(
231 "CellRangeRepresentation", -1,
232 uno::Any( sRangeStr ), beans::PropertyState_DIRECT_VALUE ),
233 beans::PropertyValue(
234 "HasCategories", -1,
235 uno::Any( bRowHeaders ), beans::PropertyState_DIRECT_VALUE ),
236 beans::PropertyValue(
237 "FirstCellAsLabel", -1,
238 uno::Any( bColumnHeaders ), beans::PropertyState_DIRECT_VALUE ),
239 beans::PropertyValue(
240 "DataRowSource", -1,
241 uno::Any( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE )
242 };
243 xReceiver->setArguments( aArgs );
244 }
245
246 ScChartListener* pChartListener =
247 new ScChartListener( aName, rDoc, xNewRanges );
248 rDoc.GetChartListenerCollection()->insert( pChartListener );
249 pChartListener->StartListeningTo();
250
252 *pModel,
253 ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
254 aName,
255 aInsRect);
256
257 // set VisArea
258 if( xObj.is())
259 xObj->setVisualAreaSize( nAspect, aSz );
260
261 // #i121334# This call will change the chart's default background fill from white to transparent.
262 // Add here again if this is wanted (see task description for details)
263 // ChartHelper::AdaptDefaultsForChart( xObj );
264
265 pPage->InsertObject( pObj.get() );
266 pModel->AddUndo( std::make_unique<SdrUndoInsertObj>( *pObj ) );
267}
268
269void SAL_CALL ScChartsObj::removeByName( const OUString& aName )
270{
271 SolarMutexGuard aGuard;
273 if (pObj)
274 {
277 ScDrawLayer* pModel = rDoc.GetDrawLayer(); // is not zero
278 SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // is not zero
279
280 pModel->AddUndo( std::make_unique<SdrUndoDelObj>( *pObj ) );
281 pPage->RemoveObject( pObj->GetOrdNum() );
282
284 }
285}
286
287// XEnumerationAccess
288
289uno::Reference<container::XEnumeration> SAL_CALL ScChartsObj::createEnumeration()
290{
291 SolarMutexGuard aGuard;
292 return new ScIndexEnumeration(this, "com.sun.star.table.TableChartsEnumeration");
293}
294
295// XIndexAccess
296
297sal_Int32 SAL_CALL ScChartsObj::getCount()
298{
299 SolarMutexGuard aGuard;
300 sal_Int32 nCount = 0;
301 if ( pDocShell )
302 {
304 ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
305 if (pDrawLayer)
306 {
307 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
308 OSL_ENSURE(pPage, "Page not found");
309 if (pPage)
310 {
311 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
312 SdrObject* pObject = aIter.Next();
313 while (pObject)
314 {
315 if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) )
316 ++nCount;
317 pObject = aIter.Next();
318 }
319 }
320 }
321 }
322 return nCount;
323}
324
325uno::Any SAL_CALL ScChartsObj::getByIndex( sal_Int32 nIndex )
326{
327 SolarMutexGuard aGuard;
328 uno::Reference<table::XTableChart> xChart(GetObjectByIndex_Impl(nIndex));
329 if (!xChart.is())
330 throw lang::IndexOutOfBoundsException();
331
332 return uno::Any(xChart);
333}
334
336{
338}
339
341{
342 SolarMutexGuard aGuard;
343 return getCount() != 0;
344}
345
346uno::Any SAL_CALL ScChartsObj::getByName( const OUString& aName )
347{
348 SolarMutexGuard aGuard;
349 uno::Reference<table::XTableChart> xChart(GetObjectByName_Impl(aName));
350 if (!xChart.is())
351 throw container::NoSuchElementException();
352
353 return uno::Any(xChart);
354}
355
356uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames()
357{
358 SolarMutexGuard aGuard;
359 if (pDocShell)
360 {
362
364 uno::Sequence<OUString> aSeq(nCount);
365 OUString* pAry = aSeq.getArray();
366
367 tools::Long nPos = 0;
368 ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
369 if (pDrawLayer)
370 {
371 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
372 OSL_ENSURE(pPage, "Page not found");
373 if (pPage)
374 {
375 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
376 SdrObject* pObject = aIter.Next();
377 while (pObject)
378 {
379 if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject) )
380 {
381 OUString aName;
382 uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(pObject)->GetObjRef();
383 if ( xObj.is() )
385
386 OSL_ENSURE(nPos<nCount, "oops, miscounted?");
387 pAry[nPos++] = aName;
388 }
389 pObject = aIter.Next();
390 }
391 }
392 }
393 OSL_ENSURE(nPos==nCount, "hey, miscounted?");
394
395 return aSeq;
396 }
397 return {};
398}
399
400sal_Bool SAL_CALL ScChartsObj::hasByName( const OUString& aName )
401{
402 SolarMutexGuard aGuard;
405 return aOle2Obj != nullptr;
406}
407
408ScChartObj::ScChartObj(ScDocShell* pDocSh, SCTAB nT, OUString aN)
411 ,pDocShell( pDocSh )
412 ,nTab( nT )
413 ,aChartName(std::move( aN ))
414{
416
417 registerPropertyNoMember( "RelatedCellRanges",
418 PROP_HANDLE_RELATED_CELLRANGES, beans::PropertyAttribute::MAYBEVOID,
419 cppu::UnoType<uno::Sequence<table::CellRangeAddress>>::get(),
420 css::uno::Any(uno::Sequence<table::CellRangeAddress>()) );
421}
422
424{
426
427 if (pDocShell)
429}
430
432{
434
435 if ( rHint.GetId() == SfxHintId::Dying )
436 {
437 pDocShell = nullptr;
438 }
439}
440
441void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const
442{
443 bool bFound = false;
444
445 if( pDocShell )
446 {
448 uno::Reference< chart2::XChartDocument > xChartDoc( rDoc.GetChartByName( aChartName ) );
449 if( xChartDoc.is() )
450 {
451 uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY );
452 uno::Reference< chart2::data::XDataProvider > xProvider = xChartDoc->getDataProvider();
453 if( xReceiver.is() && xProvider.is() )
454 {
455 const uno::Sequence< beans::PropertyValue > aArgs( xProvider->detectArguments( xReceiver->getUsedData() ) );
456
457 OUString aRanges;
458 chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS;
459 bool bHasCategories=false;
460 bool bFirstCellAsLabel=false;
461 for (const beans::PropertyValue& rProp : aArgs)
462 {
463 OUString aPropName(rProp.Name);
464
465 if (aPropName == "CellRangeRepresentation")
466 rProp.Value >>= aRanges;
467 else if (aPropName == "DataRowSource")
468 eDataRowSource = static_cast<chart::ChartDataRowSource>(ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ));
469 else if (aPropName == "HasCategories")
470 bHasCategories = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
471 else if (aPropName == "FirstCellAsLabel")
472 bFirstCellAsLabel = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
473 }
474
475 if( chart::ChartDataRowSource_COLUMNS == eDataRowSource )
476 {
477 rColHeaders=bFirstCellAsLabel;
478 rRowHeaders=bHasCategories;
479 }
480 else
481 {
482 rColHeaders=bHasCategories;
483 rRowHeaders=bFirstCellAsLabel;
484 }
485 // Range in UI representation.
486 rRanges->Parse( aRanges, rDoc, rDoc.GetAddressConvention());
487 }
488 bFound = true;
489 }
490 }
491 if( !bFound )
492 {
493 rRanges = nullptr;
494 rColHeaders = false;
495 rRowHeaders = false;
496 }
497}
498
499void ScChartObj::Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders )
500{
501 if (pDocShell)
502 {
504 bool bUndo(rDoc.IsUndoEnabled());
505
506 if (bUndo)
507 {
509 std::make_unique<ScUndoChartData>( pDocShell, aChartName, rRanges, bColHeaders, bRowHeaders, false ) );
510 }
511 rDoc.UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false );
512 }
513}
514
515// ::comphelper::OPropertySetHelper
516
518{
520}
521
522void ScChartObj::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue )
523{
524 switch ( nHandle )
525 {
527 {
528 uno::Sequence< table::CellRangeAddress > aCellRanges;
529 if ( rValue >>= aCellRanges )
530 {
531 ScRangeListRef rRangeList = new ScRangeList();
532 for ( table::CellRangeAddress const & aCellRange : std::as_const(aCellRanges) )
533 {
534 ScRange aRange;
535 ScUnoConversion::FillScRange( aRange, aCellRange );
536 rRangeList->push_back( aRange );
537 }
538 if ( pDocShell )
539 {
541 if ( pCollection )
542 {
543 pCollection->ChangeListening( aChartName, rRangeList );
544 }
545 }
546 }
547 }
548 break;
549 default:
550 break;
551 }
552}
553
554void ScChartObj::getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) const
555{
556 switch ( nHandle )
557 {
559 {
560 if (!pDocShell)
561 break;
563
565 if (!pCollection)
566 break;
567
568 ScChartListener* pListener = pCollection->findByName(aChartName);
569 if (!pListener)
570 break;
571
572 const ScRangeListRef& rRangeList = pListener->GetRangeList();
573 if (!rRangeList.is())
574 break;
575
576 size_t nCount = rRangeList->size();
577 uno::Sequence<table::CellRangeAddress> aCellRanges(nCount);
578 table::CellRangeAddress* pCellRanges = aCellRanges.getArray();
579 for (size_t i = 0; i < nCount; ++i)
580 {
581 ScRange const & rRange = (*rRangeList)[i];
582 table::CellRangeAddress aCellRange;
583 ScUnoConversion::FillApiRange(aCellRange, rRange);
584 pCellRanges[i] = aCellRange;
585 }
586 rValue <<= aCellRanges;
587 }
588 break;
589 default:
590 ;
591 }
592}
593
594// ::comphelper::OPropertyArrayUsageHelper
595
597{
598 uno::Sequence< beans::Property > aProps;
599 describeProperties( aProps );
600 return new ::cppu::OPropertyArrayHelper( aProps );
601}
602
603// XInterface
604
606
607// XTypeProvider
608
610
611// XTableChart
612
613sal_Bool SAL_CALL ScChartObj::getHasColumnHeaders()
614{
615 SolarMutexGuard aGuard;
616 ScRangeListRef xRanges = new ScRangeList;
617 bool bColHeaders, bRowHeaders;
618 GetData_Impl( xRanges, bColHeaders, bRowHeaders );
619 return bColHeaders;
620}
621
622void SAL_CALL ScChartObj::setHasColumnHeaders( sal_Bool bHasColumnHeaders )
623{
624 SolarMutexGuard aGuard;
625 ScRangeListRef xRanges = new ScRangeList;
626 bool bOldColHeaders, bOldRowHeaders;
627 GetData_Impl( xRanges, bOldColHeaders, bOldRowHeaders );
628 if ( bOldColHeaders != bool(bHasColumnHeaders) )
629 Update_Impl( xRanges, bHasColumnHeaders, bOldRowHeaders );
630}
631
633{
634 SolarMutexGuard aGuard;
635 ScRangeListRef xRanges = new ScRangeList;
636 bool bColHeaders, bRowHeaders;
637 GetData_Impl( xRanges, bColHeaders, bRowHeaders );
638 return bRowHeaders;
639}
640
641void SAL_CALL ScChartObj::setHasRowHeaders( sal_Bool bHasRowHeaders )
642{
643 SolarMutexGuard aGuard;
644 ScRangeListRef xRanges = new ScRangeList;
645 bool bOldColHeaders, bOldRowHeaders;
646 GetData_Impl( xRanges, bOldColHeaders, bOldRowHeaders );
647 if ( bOldRowHeaders != bool(bHasRowHeaders) )
648 Update_Impl( xRanges, bOldColHeaders, bHasRowHeaders );
649}
650
651uno::Sequence<table::CellRangeAddress> SAL_CALL ScChartObj::getRanges()
652{
653 SolarMutexGuard aGuard;
654 ScRangeListRef xRanges = new ScRangeList;
655 bool bColHeaders, bRowHeaders;
656 GetData_Impl( xRanges, bColHeaders, bRowHeaders );
657 if ( xRanges.is() )
658 {
659 size_t nCount = xRanges->size();
660
661 table::CellRangeAddress aRangeAddress;
662 uno::Sequence<table::CellRangeAddress> aSeq(nCount);
663 table::CellRangeAddress* pAry = aSeq.getArray();
664 for (size_t i = 0; i < nCount; i++)
665 {
666 ScRange const & rRange = (*xRanges)[i];
667
668 aRangeAddress.Sheet = rRange.aStart.Tab();
669 aRangeAddress.StartColumn = rRange.aStart.Col();
670 aRangeAddress.StartRow = rRange.aStart.Row();
671 aRangeAddress.EndColumn = rRange.aEnd.Col();
672 aRangeAddress.EndRow = rRange.aEnd.Row();
673
674 pAry[i] = aRangeAddress;
675 }
676 return aSeq;
677 }
678
679 OSL_FAIL("ScChartObj::getRanges: no Ranges");
680 return uno::Sequence<table::CellRangeAddress>();
681}
682
683void SAL_CALL ScChartObj::setRanges( const uno::Sequence<table::CellRangeAddress>& aRanges )
684{
685 SolarMutexGuard aGuard;
686 ScRangeListRef xOldRanges = new ScRangeList;
687 bool bColHeaders, bRowHeaders;
688 GetData_Impl( xOldRanges, bColHeaders, bRowHeaders );
689
690 ScRangeList* pList = new ScRangeList;
691 for (const table::CellRangeAddress& rRange : aRanges)
692 {
693 ScRange aRange( static_cast<SCCOL>(rRange.StartColumn), rRange.StartRow, rRange.Sheet,
694 static_cast<SCCOL>(rRange.EndColumn), rRange.EndRow, rRange.Sheet );
695 pList->push_back( aRange );
696 }
697 ScRangeListRef xNewRanges( pList );
698
699 if ( !xOldRanges.is() || *xOldRanges != *xNewRanges )
700 Update_Impl( xNewRanges, bColHeaders, bRowHeaders );
701}
702
703// XEmbeddedObjectSupplier
704
705uno::Reference<lang::XComponent> SAL_CALL ScChartObj::getEmbeddedObject()
706{
707 SolarMutexGuard aGuard;
711 {
712 //TODO/LATER: is it OK that something is returned for *all* objects, not only own objects?
713 return uno::Reference < lang::XComponent > ( pObject->GetObjRef()->getComponent(), uno::UNO_QUERY );
714 }
715
716 return nullptr;
717}
718
719// XNamed
720
721OUString SAL_CALL ScChartObj::getName()
722{
723 SolarMutexGuard aGuard;
724 return aChartName;
725}
726
727void SAL_CALL ScChartObj::setName( const OUString& /* aName */ )
728{
729 throw uno::RuntimeException(); // name cannot be changed
730}
731
732// XPropertySet
733
734uno::Reference< beans::XPropertySetInfo > ScChartObj::getPropertySetInfo()
735{
736 return createPropertySetInfo( getInfoHelper() ) ;
737}
738
739/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define PROP_HANDLE_RELATED_CELLRANGES
Definition: chartuno.cxx:55
::cppu::WeakComponentImplHelper< css::table::XTableChart, css::document::XEmbeddedObjectSupplier, css::container::XNamed, css::lang::XServiceInfo > ScChartObj_Base
Definition: chartuno.hxx:96
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
ScChartListener * findByName(const OUString &rName)
Definition: chartlis.cxx:403
bool insert(ScChartListener *pListener)
Definition: chartlis.cxx:388
void removeByName(const OUString &rName)
Definition: chartlis.cxx:396
void ChangeListening(const OUString &rName, const ScRangeListRef &rRangeListRef)
Definition: chartlis.cxx:431
void StartListeningTo()
Definition: chartlis.cxx:264
ScRangeListRef GetRangeList() const
Definition: chartlis.cxx:186
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: chartuno.cxx:522
void GetData_Impl(ScRangeListRef &rRanges, bool &rColHeaders, bool &rRowHeaders) const
Definition: chartuno.cxx:441
virtual void SAL_CALL setHasRowHeaders(sal_Bool bHasRowHeaders) override
Definition: chartuno.cxx:641
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: chartuno.cxx:734
virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL getRanges() override
Definition: chartuno.cxx:651
OUString aChartName
Definition: chartuno.hxx:110
virtual void SAL_CALL setName(const OUString &aName) override
Definition: chartuno.cxx:727
void Update_Impl(const ScRangeListRef &rRanges, bool bColHeaders, bool bRowHeaders)
Definition: chartuno.cxx:499
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmbeddedObject() override
Definition: chartuno.cxx:705
ScDocShell * pDocShell
Definition: chartuno.hxx:108
ScChartObj(ScDocShell *pDocSh, SCTAB nT, OUString aN)
Definition: chartuno.cxx:408
virtual sal_Bool SAL_CALL getHasRowHeaders() override
Definition: chartuno.cxx:632
virtual OUString SAL_CALL getName() override
Definition: chartuno.cxx:721
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: chartuno.cxx:517
virtual void SAL_CALL setRanges(const css::uno::Sequence< css::table::CellRangeAddress > &aRanges) override
Definition: chartuno.cxx:683
SCTAB nTab
Definition: chartuno.hxx:109
virtual ~ScChartObj() override
Definition: chartuno.cxx:423
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: chartuno.cxx:596
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: chartuno.cxx:554
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: chartuno.cxx:431
virtual void SAL_CALL setHasColumnHeaders(sal_Bool bHasColumnHeaders) override
Definition: chartuno.cxx:622
SCTAB nTab
Definition: chartuno.hxx:51
rtl::Reference< ScChartObj > GetObjectByName_Impl(const OUString &aName) const
Definition: chartuno.cxx:127
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: chartuno.cxx:269
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: chartuno.cxx:289
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: chartuno.cxx:400
rtl::Reference< ScChartObj > GetObjectByIndex_Impl(tools::Long nIndex) const
Definition: chartuno.cxx:85
virtual sal_Bool SAL_CALL hasElements() override
Definition: chartuno.cxx:340
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: chartuno.cxx:346
virtual void SAL_CALL addNewByName(const OUString &aName, const css::awt::Rectangle &aRect, const css::uno::Sequence< css::table::CellRangeAddress > &aRanges, sal_Bool bColumnHeaders, sal_Bool bRowHeaders) override
Definition: chartuno.cxx:138
virtual ~ScChartsObj() override
Definition: chartuno.cxx:67
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: chartuno.cxx:356
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: chartuno.cxx:325
virtual sal_Int32 SAL_CALL getCount() override
Definition: chartuno.cxx:297
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: chartuno.cxx:75
ScDocShell * pDocShell
Definition: chartuno.hxx:50
virtual css::uno::Type SAL_CALL getElementType() override
Definition: chartuno.cxx:335
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
ScModelObj * GetModel() const
Definition: docsh.hxx:434
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2945
css::uno::Reference< css::chart2::XChartDocument > GetChartByName(std::u16string_view rChartName)
Definition: documen5.cxx:138
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:500
SC_DLLPUBLIC ScChartListenerCollection * GetChartListenerCollection() const
Definition: document.hxx:2228
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:907
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1082
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:203
void UpdateChartArea(const OUString &rChartName, const ScRange &rNewArea, bool bColHeaders, bool bRowHeaders, bool bAdd)
Definition: documen5.cxx:130
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:915
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:998
bool IsUndoEnabled() const
Definition: document.hxx:1593
SdrObject * GetNamedObject(std::u16string_view rName, SdrObjKind nId, SCTAB &rFoundTab) const
Definition: drwlayer.cxx:2179
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
static sal_Int32 GetEnumFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:161
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:139
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrObject * Next()
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
sal_uInt32 GetOrdNum() const
SfxHintId GetId() const
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
OUString GetEmbeddedObjectName(const css::uno::Reference< css::embed::XEmbeddedObject > &) const
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
::cppu::IPropertyArrayHelper * getArrayHelper()
void registerPropertyNoMember(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const css::uno::Type &_rType, css::uno::Any const &_pInitialValue)
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
css::uno::Type const & get()
#define SO3_SCH_CLASSID
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
constexpr Size GetSize() const
bool is() const
int nCount
EmbeddedObjectRef * pObject
std::mutex m_aMutex
sal_Int32 nIndex
OUString aName
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
MapUnit
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
int i
OUString aPropName
SdrOle2Obj * findChartsByName(ScDocShell *pDocShell, SCTAB nTab, std::u16string_view rName, ChartSourceType eChartSourceType)
Definition: ChartTools.cxx:98
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
long Long
sal_Int32 nHandle
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21