summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documen5.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/documen5.cxx')
-rw-r--r--sc/source/core/data/documen5.cxx80
1 files changed, 51 insertions, 29 deletions
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 4a6136fa2e3c..a737a5966764 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -130,11 +130,11 @@ void ScDocument::UpdateAllCharts()
if ( !pDrawLayer || !pShell )
return;
- USHORT nDataCount = pChartCollection->GetCount();
+ sal_uInt16 nDataCount = pChartCollection->GetCount();
if ( !nDataCount )
return ; // nothing to do
- USHORT nPos;
+ sal_uInt16 nPos;
for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
{
@@ -204,7 +204,7 @@ void ScDocument::UpdateAllCharts()
pChartCollection->FreeAll();
}
-BOOL ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName )
+sal_Bool ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName )
{
if (pDrawLayer && pTab[nTab])
{
@@ -224,7 +224,7 @@ BOOL ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName )
{
if (pName)
*pName = ((SdrOle2Obj*)pObject)->GetPersistName();
- return TRUE;
+ return sal_True;
}
}
pObject = aIter.Next();
@@ -233,12 +233,12 @@ BOOL ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName )
if (pName)
pName->Erase();
- return FALSE; // nothing found
+ return false; // nothing found
}
void ScDocument::UpdateChartArea( const String& rChartName,
- const ScRange& rNewArea, BOOL bColHeaders, BOOL bRowHeaders,
- BOOL bAdd )
+ const ScRange& rNewArea, sal_Bool bColHeaders, sal_Bool bRowHeaders,
+ sal_Bool bAdd )
{
ScRangeListRef aRLR( new ScRangeList );
aRLR->Append( rNewArea );
@@ -309,7 +309,7 @@ void ScDocument::SetChartRanges( const String& rChartName, const ::std::vector<
}
void ScDocument::GetOldChartParameters( const String& rName,
- ScRangeList& rRanges, BOOL& rColHeaders, BOOL& rRowHeaders )
+ ScRangeList& rRanges, sal_Bool& rColHeaders, sal_Bool& rRowHeaders )
{
// used for undo of changing chart source area
@@ -358,8 +358,8 @@ void ScDocument::GetOldChartParameters( const String& rName,
}
void ScDocument::UpdateChartArea( const String& rChartName,
- const ScRangeListRef& rNewList, BOOL bColHeaders, BOOL bRowHeaders,
- BOOL bAdd )
+ const ScRangeListRef& rNewList, sal_Bool bColHeaders, sal_Bool bRowHeaders,
+ sal_Bool bAdd )
{
if (!pDrawLayer)
return;
@@ -461,9 +461,12 @@ void ScDocument::UpdateChart( const String& rChartName )
}
// After the update, chart keeps track of its own data source ranges,
- // the listener doesn't need to listen anymore.
- if(pChartListenerCollection)
+ // the listener doesn't need to listen anymore, except the chart has
+ // an internal data provider.
+ if ( !( xChartDoc.is() && xChartDoc->hasInternalDataProvider() ) && pChartListenerCollection )
+ {
pChartListenerCollection->ChangeListening( rChartName, new ScRangeList );
+ }
}
void ScDocument::RestoreChartListener( const String& rName )
@@ -503,15 +506,15 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
if (!pDrawLayer)
return;
- USHORT nChartCount = pChartListenerCollection->GetCount();
- for ( USHORT nIndex = 0; nIndex < nChartCount; nIndex++ )
+ sal_uInt16 nChartCount = pChartListenerCollection->GetCount();
+ for ( sal_uInt16 nIndex = 0; nIndex < nChartCount; nIndex++ )
{
ScChartListener* pChartListener =
(ScChartListener*) (pChartListenerCollection->At(nIndex));
ScRangeListRef aRLR( pChartListener->GetRangeList() );
ScRangeListRef aNewRLR( new ScRangeList );
- BOOL bChanged = FALSE;
- BOOL bDataChanged = FALSE;
+ sal_Bool bChanged = false;
+ sal_Bool bDataChanged = false;
for ( size_t i = 0, nListSize = aRLR->size(); i < nListSize; ++i )
{
ScRange* pR = (*aRLR)[i];
@@ -529,7 +532,7 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
theCol2,theRow2,theTab2 );
if ( eRes != UR_NOTHING )
{
- bChanged = TRUE;
+ bChanged = sal_True;
aNewRLR->Append( ScRange(
theCol1, theRow1, theTab1,
theCol2, theRow2, theTab2 ));
@@ -543,7 +546,7 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
|| (pR->aEnd.Tab() - pR->aStart.Tab()
!= theTab2 - theTab1))) )
{
- bDataChanged = TRUE;
+ bDataChanged = sal_True;
}
}
else
@@ -560,9 +563,28 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
svt::EmbeddedObjectRef::TryRunningState( xIPObj );
// After the change, chart keeps track of its own data source ranges,
- // the listener doesn't need to listen anymore.
-
- pChartListener->ChangeListening( new ScRangeList, bDataChanged );
+ // the listener doesn't need to listen anymore, except the chart has
+ // an internal data provider.
+ bool bInternalDataProvider = false;
+ if ( xIPObj.is() )
+ {
+ try
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( xIPObj->getComponent(), uno::UNO_QUERY_THROW );
+ bInternalDataProvider = xChartDoc->hasInternalDataProvider();
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ if ( bInternalDataProvider )
+ {
+ pChartListener->ChangeListening( aNewRLR, bDataChanged );
+ }
+ else
+ {
+ pChartListener->ChangeListening( new ScRangeList, bDataChanged );
+ }
}
}
}
@@ -615,12 +637,12 @@ void ScDocument::SetChartRangeList( const String& rChartName,
}
-BOOL ScDocument::HasData( SCCOL nCol, SCROW nRow, SCTAB nTab )
+sal_Bool ScDocument::HasData( SCCOL nCol, SCROW nRow, SCTAB nTab )
{
if (pTab[nTab])
return pTab[nTab]->HasData( nCol, nRow );
else
- return FALSE;
+ return false;
}
uno::Reference< embed::XEmbeddedObject >
@@ -659,19 +681,19 @@ uno::Reference< embed::XEmbeddedObject >
return uno::Reference< embed::XEmbeddedObject >();
}
-BOOL lcl_StringInCollection( const ScStrCollection* pColl, const String& rStr )
+sal_Bool lcl_StringInCollection( const ScStrCollection* pColl, const String& rStr )
{
if ( !pColl )
- return FALSE;
+ return false;
StrData aData( rStr );
- USHORT nDummy;
+ sal_uInt16 nDummy;
return pColl->Search( &aData, nDummy );
}
void ScDocument::UpdateChartListenerCollection()
{
- bChartListenerCollectionNeedsUpdate = FALSE;
+ bChartListenerCollectionNeedsUpdate = false;
if (!pDrawLayer)
return;
else
@@ -697,11 +719,11 @@ void ScDocument::UpdateChartListenerCollection()
{
String aObjName = ((SdrOle2Obj*)pObject)->GetPersistName();
aCLSearcher.SetString( aObjName );
- USHORT nIndex;
+ sal_uInt16 nIndex;
if ( pChartListenerCollection->Search( &aCLSearcher, nIndex ) )
{
((ScChartListener*) (pChartListenerCollection->
- At( nIndex )))->SetUsed( TRUE );
+ At( nIndex )))->SetUsed( sal_True );
}
else if ( lcl_StringInCollection( pOtherObjects, aObjName ) )
{