#81844# scheduled series ranges update

This commit is contained in:
Eike Rathke 2000-12-13 11:43:43 +00:00
parent aa5e8f75bf
commit ced875b715
5 changed files with 92 additions and 24 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: chartlis.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:44:48 $
* last change: $Author: er $ $Date: 2000-12-13 12:37:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -95,6 +95,7 @@ private:
ScDocument* pDoc;
BOOL bUsed; // fuer ScChartListenerCollection::FreeUnused
BOOL bDirty;
BOOL bSeriesRangesScheduled;
// not implemented
ScChartListener& operator=( const ScChartListener& );
@ -129,6 +130,12 @@ public:
BOOL IsDirty() const { return bDirty; }
void SetDirty( BOOL bFlg ) { bDirty = bFlg; }
// if chart series ranges are to be updated later on (e.g. DeleteTab, InsertTab)
void ScheduleSeriesRanges() { bSeriesRangesScheduled = TRUE; }
void UpdateScheduledSeriesRanges();
void UpdateSeriesRangesIntersecting( const ScRange& rRange );
void UpdateSeriesRanges();
BOOL operator==( const ScChartListener& );
BOOL operator!=( const ScChartListener& r )
{ return !operator==( r ); }
@ -168,6 +175,9 @@ public:
void SetRangeDirty( const ScRange& rRange ); // z.B. Zeilen/Spalten
void UpdateScheduledSeriesRanges();
void UpdateSeriesRangesContainingTab( USHORT nTab );
BOOL operator==( const ScChartListenerCollection& );
};

View file

@ -2,9 +2,9 @@
*
* $RCSfile: documen2.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: nn $ $Date: 2000-11-26 15:23:59 $
* last change: $Author: er $ $Date: 2000-12-13 12:43:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -1493,6 +1493,8 @@ BOOL ScDocument::MoveTab( USHORT nOldPos, USHORT nNewPos )
for (i = 0; i <= MAXTAB; i++)
if (pTab[i])
pTab[i]->StartAllListeners();
// #81844# sheet names of references may not be valid until sheet is moved
pChartListenerCollection->UpdateScheduledSeriesRanges();
SetDirty();
SetAutoCalc( bOldAutoCalc );
@ -1581,6 +1583,8 @@ BOOL ScDocument::CopyTab( USHORT nOldPos, USHORT nNewPos, const ScMarkData* pOnl
// update conditional formats after table is inserted
if ( pCondFormList )
pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
// #81844# sheet names of references may not be valid until sheet is copied
pChartListenerCollection->UpdateScheduledSeriesRanges();
}
else
bValid = FALSE;

View file

@ -2,9 +2,9 @@
*
* $RCSfile: documen5.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: nn $ $Date: 2000-12-10 14:13:21 $
* last change: $Author: er $ $Date: 2000-12-13 12:43:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -550,8 +550,17 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
}
if ( bChanged )
{
SetChartRangeList( pChartListener->GetString(), aNewRLR );
pChartListener->ChangeListening( aNewRLR, bDataChanged );
if ( nDz != 0 )
{ // #81844# sheet to be deleted or inserted or moved
// => no valid sheet names for references right now
pChartListener->ChangeListening( aNewRLR, bDataChanged );
pChartListener->ScheduleSeriesRanges();
}
else
{
SetChartRangeList( pChartListener->GetString(), aNewRLR );
pChartListener->ChangeListening( aNewRLR, bDataChanged );
}
}
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: nn $ $Date: 2000-11-30 18:29:31 $
* last change: $Author: er $ $Date: 2000-12-13 12:43:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -306,6 +306,8 @@ BOOL ScDocument::InsertTab( USHORT nPos, const String& rName,
// update conditional formats after table is inserted
if ( pCondFormList )
pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
// #81844# sheet names of references are not valid until sheet is inserted
pChartListenerCollection->UpdateScheduledSeriesRanges();
SetDirty();
bValid = TRUE;
@ -375,6 +377,8 @@ BOOL ScDocument::DeleteTab( USHORT nTab, ScDocument* pRefUndoDoc )
pTab[i]->StartAllListeners();
SetDirty();
}
// #81844# sheet names of references are not valid until sheet is deleted
pChartListenerCollection->UpdateScheduledSeriesRanges();
SetAutoCalc( bOldAutoCalc );
bValid = TRUE;
}
@ -407,15 +411,8 @@ BOOL ScDocument::RenameTab( USHORT nTab, const String& rName, BOOL bUpdateRef,
if (bValid)
{
pTab[nTab]->SetName(rName);
/* kann das nicht weg?
if (bUpdateRef)
{
for (i = 0; i <= MAXTAB; i++)
if (pTab[i])
pTab[i]->UpdateCompile();
SetDirty();
}
*/
if ( pChartListenerCollection )
pChartListenerCollection->UpdateSeriesRangesContainingTab( nTab );
}
}
return bValid;

View file

@ -2,9 +2,9 @@
*
* $RCSfile: chartlis.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-19 00:16:17 $
* last change: $Author: er $ $Date: 2000-12-13 12:38:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -104,7 +104,8 @@ ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
pDoc( pDocP ),
pUnoData( NULL ),
bUsed( FALSE ),
bDirty( FALSE )
bDirty( FALSE ),
bSeriesRangesScheduled( FALSE )
{
SetRangeList( rRange );
}
@ -116,7 +117,8 @@ ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
pDoc( pDocP ),
pUnoData( NULL ),
bUsed( FALSE ),
bDirty( FALSE )
bDirty( FALSE ),
bSeriesRangesScheduled( FALSE )
{
}
@ -125,7 +127,8 @@ ScChartListener::ScChartListener( const ScChartListener& r ) :
pDoc( r.pDoc ),
pUnoData( NULL ),
bUsed( FALSE ),
bDirty( r.bDirty )
bDirty( r.bDirty ),
bSeriesRangesScheduled( r.bSeriesRangesScheduled )
{
if ( r.pUnoData )
pUnoData = new ScChartUnoData( *r.pUnoData );
@ -252,6 +255,29 @@ void ScChartListener::SetRangeList( const ScRange& rRange )
}
void ScChartListener::UpdateScheduledSeriesRanges()
{
if ( bSeriesRangesScheduled )
{
bSeriesRangesScheduled = FALSE;
UpdateSeriesRanges();
}
}
void ScChartListener::UpdateSeriesRangesIntersecting( const ScRange& rRange )
{
if ( aRangeListRef->Intersects( rRange ) )
UpdateSeriesRanges();
}
void ScChartListener::UpdateSeriesRanges()
{
pDoc->SetChartRangeList( GetString(), aRangeListRef );
}
BOOL ScChartListener::operator==( const ScChartListener& r )
{
BOOL b1 = aRangeListRef.Is();
@ -260,6 +286,7 @@ BOOL ScChartListener::operator==( const ScChartListener& r )
pDoc == r.pDoc &&
bUsed == r.bUsed &&
bDirty == r.bDirty &&
bSeriesRangesScheduled == r.bSeriesRangesScheduled &&
GetString() == r.GetString() &&
b1 == b2 &&
((!b1 && !b2) || (*aRangeListRef == *r.aRangeListRef))
@ -448,6 +475,27 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
}
void ScChartListenerCollection::UpdateScheduledSeriesRanges()
{
for ( USHORT nIndex = 0; nIndex < nCount; nIndex++ )
{
ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
pCL->UpdateScheduledSeriesRanges();
}
}
void ScChartListenerCollection::UpdateSeriesRangesContainingTab( USHORT nTab )
{
ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
for ( USHORT nIndex = 0; nIndex < nCount; nIndex++ )
{
ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
pCL->UpdateSeriesRangesIntersecting( aRange );
}
}
BOOL ScChartListenerCollection::operator==( const ScChartListenerCollection& r )
{
// hier nicht StrCollection::operator==() verwenden, der umstaendlich via