1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chartuno.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
35 #include <com/sun/star/embed/Aspects.hpp>
36 #include <com/sun/star/awt/Size.hpp>
37 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
38 #include <com/sun/star/chart/ChartDataRowSource.hpp>
39 #include <com/sun/star/chart2/XChartDocument.hpp>
40 #include <com/sun/star/embed/Aspects.hpp>
42 #include <svx/svditer.hxx>
43 #include <svx/svdoole2.hxx>
44 #include <svx/svdpage.hxx>
45 #include <svx/svdundo.hxx>
46 #include <sfx2/app.hxx>
47 #include <svtools/moduleoptions.hxx>
48 #include <sot/clsids.hxx>
49 #include <toolkit/helper/vclunohelper.hxx>
51 #include "chartuno.hxx"
52 #include "miscuno.hxx"
54 #include "drwlayer.hxx"
55 #include "undodat.hxx"
56 #include "chartarr.hxx"
57 #include "chartlis.hxx"
58 #include "unoguard.hxx"
59 #include "chart2uno.hxx"
61 using namespace com::sun::star
;
63 //------------------------------------------------------------------------
65 SC_SIMPLE_SERVICE_INFO( ScChartObj
, "ScChartObj", "com.sun.star.table.TableChart" )
66 SC_SIMPLE_SERVICE_INFO( ScChartsObj
, "ScChartsObj", "com.sun.star.table.TableCharts" )
68 //------------------------------------------------------------------------
70 SdrOle2Obj
* lcl_FindChartObj( ScDocShell
* pDocShell
, SCTAB nTab
, const String
& rName
)
74 ScDocument
* pDoc
= pDocShell
->GetDocument();
75 ScDrawLayer
* pDrawLayer
= pDoc
->GetDrawLayer();
78 SdrPage
* pPage
= pDrawLayer
->GetPage(static_cast<sal_uInt16
>(nTab
));
79 DBG_ASSERT(pPage
, "Page nicht gefunden");
82 SdrObjListIter
aIter( *pPage
, IM_DEEPNOGROUPS
);
83 SdrObject
* pObject
= aIter
.Next();
86 if ( pObject
->GetObjIdentifier() == OBJ_OLE2
&& pDoc
->IsChart(pObject
) )
88 uno::Reference
< embed::XEmbeddedObject
> xObj
= ((SdrOle2Obj
*)pObject
)->GetObjRef();
91 String aObjName
= pDocShell
->GetEmbeddedObjectContainer().GetEmbeddedObjectName( xObj
);
92 if ( aObjName
== rName
)
93 return (SdrOle2Obj
*)pObject
;
96 pObject
= aIter
.Next();
104 //------------------------------------------------------------------------
106 ScChartsObj::ScChartsObj(ScDocShell
* pDocSh
, SCTAB nT
) :
110 pDocShell
->GetDocument()->AddUnoObject(*this);
113 ScChartsObj::~ScChartsObj()
116 pDocShell
->GetDocument()->RemoveUnoObject(*this);
119 void ScChartsObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
123 if ( rHint
.ISA( SfxSimpleHint
) &&
124 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
126 pDocShell
= NULL
; // ungueltig geworden
130 ScChartObj
* ScChartsObj::GetObjectByIndex_Impl(long nIndex
) const
135 ScDocument
* pDoc
= pDocShell
->GetDocument();
136 ScDrawLayer
* pDrawLayer
= pDoc
->GetDrawLayer();
139 SdrPage
* pPage
= pDrawLayer
->GetPage(static_cast<sal_uInt16
>(nTab
));
140 DBG_ASSERT(pPage
, "Page nicht gefunden");
144 SdrObjListIter
aIter( *pPage
, IM_DEEPNOGROUPS
);
145 SdrObject
* pObject
= aIter
.Next();
148 if ( pObject
->GetObjIdentifier() == OBJ_OLE2
&& pDoc
->IsChart(pObject
) )
150 if ( nPos
== nIndex
)
152 uno::Reference
< embed::XEmbeddedObject
> xObj
= ((SdrOle2Obj
*)pObject
)->GetObjRef();
154 aName
= pDocShell
->GetEmbeddedObjectContainer().GetEmbeddedObjectName( xObj
);
155 break; // nicht weitersuchen
159 pObject
= aIter
.Next();
166 return new ScChartObj( pDocShell
, nTab
, aName
);
170 ScChartObj
* ScChartsObj::GetObjectByName_Impl(const rtl::OUString
& aName
) const
172 String
aNameString(aName
);
173 if ( lcl_FindChartObj( pDocShell
, nTab
, aNameString
) )
174 return new ScChartObj( pDocShell
, nTab
, aNameString
);
180 void SAL_CALL
ScChartsObj::addNewByName( const rtl::OUString
& aName
,
181 const awt::Rectangle
& aRect
,
182 const uno::Sequence
<table::CellRangeAddress
>& aRanges
,
183 sal_Bool bColumnHeaders
, sal_Bool bRowHeaders
)
184 throw(::com::sun::star::uno::RuntimeException
)
190 ScDocument
* pDoc
= pDocShell
->GetDocument();
191 ScDrawLayer
* pModel
= pDocShell
->MakeDrawLayer();
192 SdrPage
* pPage
= pModel
->GetPage(static_cast<sal_uInt16
>(nTab
));
193 DBG_ASSERT(pPage
,"addChart: keine Page");
197 // chart can't be inserted if any ole object with that name exists on any table
198 // (empty string: generate valid name)
200 String
aNameString(aName
);
202 if ( aNameString
.Len() && pModel
->GetNamedObject( aNameString
, OBJ_OLE2
, nDummy
) )
204 // object exists - only RuntimeException is specified
205 throw uno::RuntimeException();
208 ScRangeList
* pList
= new ScRangeList
;
209 USHORT nRangeCount
= (USHORT
)aRanges
.getLength();
212 const table::CellRangeAddress
* pAry
= aRanges
.getConstArray();
213 for (USHORT i
=0; i
<nRangeCount
; i
++)
215 ScRange
aRange( static_cast<SCCOL
>(pAry
[i
].StartColumn
), pAry
[i
].StartRow
, pAry
[i
].Sheet
,
216 static_cast<SCCOL
>(pAry
[i
].EndColumn
), pAry
[i
].EndRow
, pAry
[i
].Sheet
);
217 pList
->Append( aRange
);
220 ScRangeListRef
xNewRanges( pList
);
222 uno::Reference
< embed::XEmbeddedObject
> xObj
;
223 ::rtl::OUString
aTmp( aNameString
);
224 if ( SvtModuleOptions().IsChart() )
225 xObj
= pDocShell
->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID
).GetByteSequence(), aTmp
);
228 String aObjName
= aNameString
; // wirklich eingefuegter Name...
231 //! Fehler/Exception, wenn leer/ungueltig ???
232 Point
aRectPos( aRect
.X
, aRect
.Y
);
233 if (aRectPos
.X() < 0) aRectPos
.X() = 0;
234 if (aRectPos
.Y() < 0) aRectPos
.Y() = 0;
235 Size
aRectSize( aRect
.Width
, aRect
.Height
);
236 if (aRectSize
.Width() <= 0) aRectSize
.Width() = 5000; // Default-Groesse
237 if (aRectSize
.Height() <= 0) aRectSize
.Height() = 5000;
238 Rectangle
aInsRect( aRectPos
, aRectSize
);
240 sal_Int64
nAspect(embed::Aspects::MSOLE_CONTENT
);
241 MapUnit
aMapUnit(VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj
->getMapUnit( nAspect
) ));
242 Size
aSize(aInsRect
.GetSize());
243 aSize
= Window::LogicToLogic( aSize
, MapMode( MAP_100TH_MM
), MapMode( aMapUnit
) );
245 aSz
.Width
= aSize
.Width();
246 aSz
.Height
= aSize
.Height();
248 // Calc -> DataProvider
249 uno::Reference
< chart2::data::XDataProvider
> xDataProvider
= new
250 ScChart2DataProvider( pDoc
);
251 // Chart -> DataReceiver
252 uno::Reference
< chart2::data::XDataReceiver
> xReceiver
;
253 uno::Reference
< embed::XComponentSupplier
> xCompSupp( xObj
, uno::UNO_QUERY
);
255 xReceiver
.set( xCompSupp
->getComponent(), uno::UNO_QUERY
);
259 xNewRanges
->Format(sRangeStr
, SCR_ABS_3D
, pDoc
);
262 if( sRangeStr
.Len() )
263 xReceiver
->attachDataProvider( xDataProvider
);
265 sRangeStr
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "all" ) );
267 uno::Reference
< util::XNumberFormatsSupplier
> xNumberFormatsSupplier( pDocShell
->GetModel(), uno::UNO_QUERY
);
268 xReceiver
->attachNumberFormatsSupplier( xNumberFormatsSupplier
);
271 uno::Sequence
< beans::PropertyValue
> aArgs( 4 );
272 aArgs
[0] = beans::PropertyValue(
273 ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
274 uno::makeAny( ::rtl::OUString( sRangeStr
)), beans::PropertyState_DIRECT_VALUE
);
275 aArgs
[1] = beans::PropertyValue(
276 ::rtl::OUString::createFromAscii("HasCategories"), -1,
277 uno::makeAny( bRowHeaders
), beans::PropertyState_DIRECT_VALUE
);
278 aArgs
[2] = beans::PropertyValue(
279 ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1,
280 uno::makeAny( bColumnHeaders
), beans::PropertyState_DIRECT_VALUE
);
281 aArgs
[3] = beans::PropertyValue(
282 ::rtl::OUString::createFromAscii("DataRowSource"), -1,
283 uno::makeAny( chart::ChartDataRowSource_COLUMNS
), beans::PropertyState_DIRECT_VALUE
);
284 xReceiver
->setArguments( aArgs
);
287 ScChartListener
* pChartListener
=
288 new ScChartListener( aObjName
, pDoc
, xNewRanges
);
289 pDoc
->GetChartListenerCollection()->Insert( pChartListener
);
290 pChartListener
->StartListeningTo();
292 SdrOle2Obj
* pObj
= new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj
, embed::Aspects::MSOLE_CONTENT
), aObjName
, aInsRect
);
296 xObj
->setVisualAreaSize( nAspect
, aSz
);
298 pPage
->InsertObject( pObj
);
299 pModel
->AddUndo( new SdrUndoInsertObj( *pObj
) ); //! Undo-Kommentar?
301 // Dies veranlaesst Chart zum sofortigen Update
303 //aIPObj->SendDataChanged( aEmpty );
307 void SAL_CALL
ScChartsObj::removeByName( const rtl::OUString
& aName
)
308 throw(uno::RuntimeException
)
311 String
aNameString(aName
);
312 SdrOle2Obj
* pObj
= lcl_FindChartObj( pDocShell
, nTab
, aNameString
);
315 ScDocument
* pDoc
= pDocShell
->GetDocument();
316 ScDrawLayer
* pModel
= pDoc
->GetDrawLayer(); // ist nicht 0
317 SdrPage
* pPage
= pModel
->GetPage(static_cast<sal_uInt16
>(nTab
)); // ist nicht 0
319 pModel
->AddUndo( new SdrUndoRemoveObj( *pObj
) ); //! Undo-Kommentar?
320 pPage
->RemoveObject( pObj
->GetOrdNum() );
326 // XEnumerationAccess
328 uno::Reference
<container::XEnumeration
> SAL_CALL
ScChartsObj::createEnumeration()
329 throw(uno::RuntimeException
)
332 return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.table.TableChartsEnumeration")));
337 sal_Int32 SAL_CALL
ScChartsObj::getCount() throw(uno::RuntimeException
)
343 ScDocument
* pDoc
= pDocShell
->GetDocument();
344 ScDrawLayer
* pDrawLayer
= pDoc
->GetDrawLayer();
347 SdrPage
* pPage
= pDrawLayer
->GetPage(static_cast<sal_uInt16
>(nTab
));
348 DBG_ASSERT(pPage
, "Page nicht gefunden");
351 SdrObjListIter
aIter( *pPage
, IM_DEEPNOGROUPS
);
352 SdrObject
* pObject
= aIter
.Next();
355 if ( pObject
->GetObjIdentifier() == OBJ_OLE2
&& pDoc
->IsChart(pObject
) )
357 pObject
= aIter
.Next();
365 uno::Any SAL_CALL
ScChartsObj::getByIndex( sal_Int32 nIndex
)
366 throw(lang::IndexOutOfBoundsException
,
367 lang::WrappedTargetException
, uno::RuntimeException
)
370 uno::Reference
<table::XTableChart
> xChart(GetObjectByIndex_Impl(nIndex
));
372 return uno::makeAny(xChart
);
374 throw lang::IndexOutOfBoundsException();
375 // return uno::Any();
378 uno::Type SAL_CALL
ScChartsObj::getElementType() throw(uno::RuntimeException
)
381 return getCppuType((uno::Reference
<table::XTableChart
>*)0);
384 sal_Bool SAL_CALL
ScChartsObj::hasElements() throw(uno::RuntimeException
)
387 return getCount() != 0;
390 uno::Any SAL_CALL
ScChartsObj::getByName( const rtl::OUString
& aName
)
391 throw(container::NoSuchElementException
,
392 lang::WrappedTargetException
, uno::RuntimeException
)
395 uno::Reference
<table::XTableChart
> xChart(GetObjectByName_Impl(aName
));
397 return uno::makeAny(xChart
);
399 throw container::NoSuchElementException();
400 // return uno::Any();
403 uno::Sequence
<rtl::OUString
> SAL_CALL
ScChartsObj::getElementNames() throw(uno::RuntimeException
)
408 ScDocument
* pDoc
= pDocShell
->GetDocument();
410 long nCount
= getCount();
411 uno::Sequence
<rtl::OUString
> aSeq(nCount
);
412 rtl::OUString
* pAry
= aSeq
.getArray();
415 ScDrawLayer
* pDrawLayer
= pDoc
->GetDrawLayer();
418 SdrPage
* pPage
= pDrawLayer
->GetPage(static_cast<sal_uInt16
>(nTab
));
419 DBG_ASSERT(pPage
, "Page nicht gefunden");
422 SdrObjListIter
aIter( *pPage
, IM_DEEPNOGROUPS
);
423 SdrObject
* pObject
= aIter
.Next();
426 if ( pObject
->GetObjIdentifier() == OBJ_OLE2
&& pDoc
->IsChart(pObject
) )
429 uno::Reference
< embed::XEmbeddedObject
> xObj
= ((SdrOle2Obj
*)pObject
)->GetObjRef();
431 aName
= pDocShell
->GetEmbeddedObjectContainer().GetEmbeddedObjectName( xObj
);
433 DBG_ASSERT(nPos
<nCount
, "huch, verzaehlt?");
434 pAry
[nPos
++] = aName
;
436 pObject
= aIter
.Next();
440 DBG_ASSERT(nPos
==nCount
, "nanu, verzaehlt?");
444 return uno::Sequence
<rtl::OUString
>(0);
447 sal_Bool SAL_CALL
ScChartsObj::hasByName( const rtl::OUString
& aName
)
448 throw(uno::RuntimeException
)
451 String
aNameString(aName
);
452 return ( lcl_FindChartObj( pDocShell
, nTab
, aNameString
) != NULL
);
455 //------------------------------------------------------------------------
457 ScChartObj::ScChartObj(ScDocShell
* pDocSh
, SCTAB nT
, const String
& rN
) :
462 pDocShell
->GetDocument()->AddUnoObject(*this);
465 ScChartObj::~ScChartObj()
468 pDocShell
->GetDocument()->RemoveUnoObject(*this);
471 void ScChartObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
475 if ( rHint
.ISA( SfxSimpleHint
) &&
476 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
478 pDocShell
= NULL
; // ungueltig geworden
482 void ScChartObj::GetData_Impl( ScRangeListRef
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
) const
485 ScDocument
* pDoc
= (pDocShell
? pDocShell
->GetDocument(): 0);
486 uno::Reference
< embed::XEmbeddedObject
> xIPObj
;
488 xIPObj
.set( pDoc
->FindOleObjectByName( aChartName
), uno::UNO_QUERY
);
491 //make sure that the chart is loaded
492 svt::EmbeddedObjectRef::TryRunningState( xIPObj
);
494 uno::Reference
< chart2::XChartDocument
> xChartDoc( xIPObj
->getComponent(), uno::UNO_QUERY
);
495 uno::Reference
< chart2::data::XDataReceiver
> xReceiver( xChartDoc
, uno::UNO_QUERY
);
498 uno::Reference
< chart2::data::XDataProvider
> xProvider
= xChartDoc
->getDataProvider();
501 uno::Sequence
< beans::PropertyValue
> aArgs( xProvider
->detectArguments( xReceiver
->getUsedData() ) );
503 rtl::OUString aRanges
;
504 chart::ChartDataRowSource eDataRowSource
= chart::ChartDataRowSource_COLUMNS
;
505 bool bHasCategories
=false;
506 bool bFirstCellAsLabel
=false;
507 const beans::PropertyValue
* pPropArray
= aArgs
.getConstArray();
508 long nPropCount
= aArgs
.getLength();
509 for (long i
= 0; i
< nPropCount
; i
++)
511 const beans::PropertyValue
& rProp
= pPropArray
[i
];
512 String
aPropName(rProp
.Name
);
514 if (aPropName
.EqualsAscii( "CellRangeRepresentation" ))
515 rProp
.Value
>>= aRanges
;
516 else if (aPropName
.EqualsAscii( "DataRowSource" ))
517 eDataRowSource
= (chart::ChartDataRowSource
)ScUnoHelpFunctions::GetEnumFromAny( rProp
.Value
);
518 else if (aPropName
.EqualsAscii( "HasCategories" ))
519 bHasCategories
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
520 else if (aPropName
.EqualsAscii( "FirstCellAsLabel" ))
521 bFirstCellAsLabel
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
524 if( chart::ChartDataRowSource_COLUMNS
== eDataRowSource
)
526 rColHeaders
=bFirstCellAsLabel
;
527 rRowHeaders
=bHasCategories
;
531 rColHeaders
=bHasCategories
;
532 rRowHeaders
=bFirstCellAsLabel
;
534 rRanges
->Parse( aRanges
, pDoc
);
547 void ScChartObj::Update_Impl( const ScRangeListRef
& rRanges
, bool bColHeaders
, bool bRowHeaders
)
551 ScDocument
* pDoc
= pDocShell
->GetDocument();
552 BOOL
bUndo(pDoc
->IsUndoEnabled());
556 pDocShell
->GetUndoManager()->AddUndoAction(
557 new ScUndoChartData( pDocShell
, aChartName
, rRanges
, bColHeaders
, bRowHeaders
, FALSE
) );
559 pDoc
->UpdateChartArea( aChartName
, rRanges
, bColHeaders
, bRowHeaders
, FALSE
);
565 sal_Bool SAL_CALL
ScChartObj::getHasColumnHeaders() throw(uno::RuntimeException
)
568 ScRangeListRef xRanges
= new ScRangeList
;
569 bool bColHeaders
, bRowHeaders
;
570 GetData_Impl( xRanges
, bColHeaders
, bRowHeaders
);
574 void SAL_CALL
ScChartObj::setHasColumnHeaders( sal_Bool bHasColumnHeaders
)
575 throw(uno::RuntimeException
)
578 ScRangeListRef xRanges
= new ScRangeList
;
579 bool bOldColHeaders
, bOldRowHeaders
;
580 GetData_Impl( xRanges
, bOldColHeaders
, bOldRowHeaders
);
581 if ( bOldColHeaders
!= (bHasColumnHeaders
!= sal_False
) )
582 Update_Impl( xRanges
, bHasColumnHeaders
, bOldRowHeaders
);
585 sal_Bool SAL_CALL
ScChartObj::getHasRowHeaders() throw(uno::RuntimeException
)
588 ScRangeListRef xRanges
= new ScRangeList
;
589 bool bColHeaders
, bRowHeaders
;
590 GetData_Impl( xRanges
, bColHeaders
, bRowHeaders
);
594 void SAL_CALL
ScChartObj::setHasRowHeaders( sal_Bool bHasRowHeaders
)
595 throw(uno::RuntimeException
)
598 ScRangeListRef xRanges
= new ScRangeList
;
599 bool bOldColHeaders
, bOldRowHeaders
;
600 GetData_Impl( xRanges
, bOldColHeaders
, bOldRowHeaders
);
601 if ( bOldRowHeaders
!= (bHasRowHeaders
!= sal_False
) )
602 Update_Impl( xRanges
, bOldColHeaders
, bHasRowHeaders
);
605 uno::Sequence
<table::CellRangeAddress
> SAL_CALL
ScChartObj::getRanges() throw(uno::RuntimeException
)
608 ScRangeListRef xRanges
= new ScRangeList
;
609 bool bColHeaders
, bRowHeaders
;
610 GetData_Impl( xRanges
, bColHeaders
, bRowHeaders
);
613 ULONG nCount
= xRanges
->Count();
615 table::CellRangeAddress aRangeAddress
;
616 uno::Sequence
<table::CellRangeAddress
> aSeq(nCount
);
617 table::CellRangeAddress
* pAry
= aSeq
.getArray();
618 for (USHORT i
=0; i
<nCount
; i
++)
620 ScRange
aRange(*xRanges
->GetObject(i
));
622 aRangeAddress
.Sheet
= aRange
.aStart
.Tab();
623 aRangeAddress
.StartColumn
= aRange
.aStart
.Col();
624 aRangeAddress
.StartRow
= aRange
.aStart
.Row();
625 aRangeAddress
.EndColumn
= aRange
.aEnd
.Col();
626 aRangeAddress
.EndRow
= aRange
.aEnd
.Row();
628 pAry
[i
] = aRangeAddress
;
633 DBG_ERROR("ScChartObj::getRanges: keine Ranges");
634 return uno::Sequence
<table::CellRangeAddress
>();
637 void SAL_CALL
ScChartObj::setRanges( const uno::Sequence
<table::CellRangeAddress
>& aRanges
)
638 throw(uno::RuntimeException
)
641 ScRangeListRef xOldRanges
= new ScRangeList
;
642 bool bColHeaders
, bRowHeaders
;
643 GetData_Impl( xOldRanges
, bColHeaders
, bRowHeaders
);
645 ScRangeList
* pList
= new ScRangeList
;
646 USHORT nRangeCount
= (USHORT
)aRanges
.getLength();
649 const table::CellRangeAddress
* pAry
= aRanges
.getConstArray();
650 for (USHORT i
=0; i
<nRangeCount
; i
++)
652 ScRange
aRange( static_cast<SCCOL
>(pAry
[i
].StartColumn
), pAry
[i
].StartRow
, pAry
[i
].Sheet
,
653 static_cast<SCCOL
>(pAry
[i
].EndColumn
), pAry
[i
].EndRow
, pAry
[i
].Sheet
);
654 pList
->Append( aRange
);
657 ScRangeListRef
xNewRanges( pList
);
659 if ( !xOldRanges
.Is() || *xOldRanges
!= *xNewRanges
)
660 Update_Impl( xNewRanges
, bColHeaders
, bRowHeaders
);
663 // XEmbeddedObjectSupplier
665 uno::Reference
<lang::XComponent
> SAL_CALL
ScChartObj::getEmbeddedObject() throw(uno::RuntimeException
)
668 SdrOle2Obj
* pObject
= lcl_FindChartObj( pDocShell
, nTab
, aChartName
);
669 if ( pObject
&& svt::EmbeddedObjectRef::TryRunningState( pObject
->GetObjRef() ) )
671 //TODO/LATER: is it OK that something is returned for *all* objects, not only own objects?
672 return uno::Reference
< lang::XComponent
> ( pObject
->GetObjRef()->getComponent(), uno::UNO_QUERY
);
680 rtl::OUString SAL_CALL
ScChartObj::getName() throw(uno::RuntimeException
)
686 void SAL_CALL
ScChartObj::setName( const rtl::OUString
& /* aName */ ) throw(uno::RuntimeException
)
689 throw uno::RuntimeException(); // name cannot be changed
692 //------------------------------------------------------------------------