summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-27 21:18:29 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-28 01:12:51 -0400
commit0c0191cfb7ffaa3631fc9556bfda7fdecf5b00e7 (patch)
tree12d851f58ccfa4849ff7110d8500e0af5cc4c658 /sc
parentd832acf33debc09d8d869d8db354049b69af2a6c (diff)
Some followup cleanup now that these methods are in the formula cell only.
Change-Id: I796bf379f004a1371c86362e57eaac4a511f34cd
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/cell2.cxx275
1 files changed, 138 insertions, 137 deletions
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 6369e18df8f7..7603b05d6520 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -1820,82 +1820,83 @@ bool ScFormulaCell::InterpretFormulaGroup()
void ScFormulaCell::StartListeningTo( ScDocument* pDoc )
{
- if (!pDoc->IsClipOrUndo() && !pDoc->GetNoListening() && !IsInChangeTrack())
+ if (pDoc->IsClipOrUndo() || pDoc->GetNoListening() || IsInChangeTrack())
+ return;
+
+ pDoc->SetDetectiveDirty(true); // It has changed something
+
+ ScTokenArray* pArr = GetCode();
+ if( pArr->IsRecalcModeAlways() )
{
- pDoc->SetDetectiveDirty(true); // It has changed something
+ pDoc->StartListeningArea(BCA_LISTEN_ALWAYS, this);
+ SetNeedsListening( false);
+ return;
+ }
- ScFormulaCell* pFormCell = (ScFormulaCell*)this;
- ScTokenArray* pArr = pFormCell->GetCode();
- if( pArr->IsRecalcModeAlways() )
- pDoc->StartListeningArea( BCA_LISTEN_ALWAYS, pFormCell );
- else
+ pArr->Reset();
+ ScToken* t;
+ while ( ( t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()) ) != NULL )
+ {
+ StackVar eType = t->GetType();
+ ScSingleRefData& rRef1 = t->GetSingleRef();
+ ScSingleRefData& rRef2 = (eType == svDoubleRef ?
+ t->GetDoubleRef().Ref2 : rRef1);
+ switch( eType )
{
- pArr->Reset();
- ScToken* t;
- while ( ( t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()) ) != NULL )
- {
- StackVar eType = t->GetType();
- ScSingleRefData& rRef1 = t->GetSingleRef();
- ScSingleRefData& rRef2 = (eType == svDoubleRef ?
- t->GetDoubleRef().Ref2 : rRef1);
- switch( eType )
+ case svSingleRef:
+ rRef1.CalcAbsIfRel(aPos);
+ if ( rRef1.Valid() )
{
- case svSingleRef:
- rRef1.CalcAbsIfRel( pFormCell->aPos );
- if ( rRef1.Valid() )
- {
- pDoc->StartListeningCell(
- ScAddress( rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab ), pFormCell );
+ pDoc->StartListeningCell(
+ ScAddress( rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab ), this );
+ }
+ break;
+ case svDoubleRef:
+ t->CalcAbsIfRel(aPos);
+ if ( rRef1.Valid() && rRef2.Valid() )
+ {
+ if ( t->GetOpCode() == ocColRowNameAuto )
+ { // automagically
+ if ( rRef1.IsColRel() )
+ { // ColName
+ pDoc->StartListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ rRef2.nCol,
+ MAXROW,
+ rRef2.nTab ), this );
}
- break;
- case svDoubleRef:
- t->CalcAbsIfRel( pFormCell->aPos );
- if ( rRef1.Valid() && rRef2.Valid() )
- {
- if ( t->GetOpCode() == ocColRowNameAuto )
- { // automagically
- if ( rRef1.IsColRel() )
- { // ColName
- pDoc->StartListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- rRef2.nCol,
- MAXROW,
- rRef2.nTab ), pFormCell );
- }
- else
- { // RowName
- pDoc->StartListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- MAXCOL,
- rRef2.nRow,
- rRef2.nTab ), pFormCell );
- }
- }
- else
- {
- pDoc->StartListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- rRef2.nCol,
- rRef2.nRow,
- rRef2.nTab ), pFormCell );
- }
+ else
+ { // RowName
+ pDoc->StartListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ MAXCOL,
+ rRef2.nRow,
+ rRef2.nTab ), this );
}
- break;
- default:
- ; // nothing
+ }
+ else
+ {
+ pDoc->StartListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ rRef2.nCol,
+ rRef2.nRow,
+ rRef2.nTab ), this );
+ }
}
- }
+ break;
+ default:
+ ; // nothing
}
- pFormCell->SetNeedsListening( false);
}
+ SetNeedsListening( false);
}
// pArr gesetzt -> Referenzen von anderer Zelle nehmen
@@ -1904,83 +1905,83 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc )
void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr,
ScAddress aCellPos )
{
- if (!pDoc->IsClipOrUndo() && !IsInChangeTrack())
+ if (pDoc->IsClipOrUndo() || IsInChangeTrack())
+ return;
+
+ pDoc->SetDetectiveDirty(true); // It has changed something
+
+ if ( GetCode()->IsRecalcModeAlways() )
{
- pDoc->SetDetectiveDirty(true); // It has changed something
+ pDoc->EndListeningArea( BCA_LISTEN_ALWAYS, this );
+ return;
+ }
- ScFormulaCell* pFormCell = (ScFormulaCell*)this;
- if( pFormCell->GetCode()->IsRecalcModeAlways() )
- pDoc->EndListeningArea( BCA_LISTEN_ALWAYS, pFormCell );
- else
+ if (!pArr)
+ {
+ pArr = GetCode();
+ aCellPos = aPos;
+ }
+ pArr->Reset();
+ ScToken* t;
+ while ( ( t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()) ) != NULL )
+ {
+ StackVar eType = t->GetType();
+ ScSingleRefData& rRef1 = t->GetSingleRef();
+ ScSingleRefData& rRef2 = (eType == svDoubleRef ?
+ t->GetDoubleRef().Ref2 : rRef1);
+ switch( eType )
{
- if (!pArr)
- {
- pArr = pFormCell->GetCode();
- aCellPos = pFormCell->aPos;
- }
- pArr->Reset();
- ScToken* t;
- while ( ( t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()) ) != NULL )
- {
- StackVar eType = t->GetType();
- ScSingleRefData& rRef1 = t->GetSingleRef();
- ScSingleRefData& rRef2 = (eType == svDoubleRef ?
- t->GetDoubleRef().Ref2 : rRef1);
- switch( eType )
+ case svSingleRef:
+ rRef1.CalcAbsIfRel( aCellPos );
+ if ( rRef1.Valid() )
{
- case svSingleRef:
- rRef1.CalcAbsIfRel( aCellPos );
- if ( rRef1.Valid() )
- {
- pDoc->EndListeningCell(
- ScAddress( rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab ), pFormCell );
+ pDoc->EndListeningCell(
+ ScAddress( rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab ), this );
+ }
+ break;
+ case svDoubleRef:
+ t->CalcAbsIfRel( aCellPos );
+ if ( rRef1.Valid() && rRef2.Valid() )
+ {
+ if ( t->GetOpCode() == ocColRowNameAuto )
+ { // automagically
+ if ( rRef1.IsColRel() )
+ { // ColName
+ pDoc->EndListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ rRef2.nCol,
+ MAXROW,
+ rRef2.nTab ), this );
}
- break;
- case svDoubleRef:
- t->CalcAbsIfRel( aCellPos );
- if ( rRef1.Valid() && rRef2.Valid() )
- {
- if ( t->GetOpCode() == ocColRowNameAuto )
- { // automagically
- if ( rRef1.IsColRel() )
- { // ColName
- pDoc->EndListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- rRef2.nCol,
- MAXROW,
- rRef2.nTab ), pFormCell );
- }
- else
- { // RowName
- pDoc->EndListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- MAXCOL,
- rRef2.nRow,
- rRef2.nTab ), pFormCell );
- }
- }
- else
- {
- pDoc->EndListeningArea( ScRange (
- rRef1.nCol,
- rRef1.nRow,
- rRef1.nTab,
- rRef2.nCol,
- rRef2.nRow,
- rRef2.nTab ), pFormCell );
- }
+ else
+ { // RowName
+ pDoc->EndListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ MAXCOL,
+ rRef2.nRow,
+ rRef2.nTab ), this );
}
- break;
- default:
- ; // nothing
+ }
+ else
+ {
+ pDoc->EndListeningArea( ScRange (
+ rRef1.nCol,
+ rRef1.nRow,
+ rRef1.nTab,
+ rRef2.nCol,
+ rRef2.nRow,
+ rRef2.nTab ), this );
+ }
}
- }
+ break;
+ default:
+ ; // nothing
}
}
}