diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-25 12:15:59 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-26 01:41:19 -0400 |
commit | 3bfaa277f1a6d78cc5f58f8a1fb510a08c183e50 (patch) | |
tree | 623de3c33c04d3e090e23f39924d5d32266aafba /sc | |
parent | Remove the last use of GetFirst() & GetNext(). (diff) | |
download | core-3bfaa277f1a6d78cc5f58f8a1fb510a08c183e50.tar.gz core-3bfaa277f1a6d78cc5f58f8a1fb510a08c183e50.zip |
Query content cell type directly from ScCellIterator.
Change-Id: I0ab93d140f1864ca67ec42d0ac9e133dbc4b6660
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/chgtrack.hxx | 2 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dociter.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/chgtrack.cxx | 36 |
4 files changed, 42 insertions, 2 deletions
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index df5edd5c7cfe..5e5c867ee5bc 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -37,6 +37,7 @@ class ScBaseCell; class ScDocument; class ScFormulaCell; +class ScCellIterator; enum ScChangeActionType { @@ -813,6 +814,7 @@ public: rtl::OUString& rStr, ScDocument* pDoc, bool bFlag3D = false ) const; static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* ); + static ScChangeActionContentCellType GetContentCellType( const ScCellIterator& rIter ); // NewCell bool IsMatrixOrigin() const; diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 141a1bae9023..a7994a62d5e2 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -245,6 +245,7 @@ public: OUString getString(); const EditTextObject* getEditText() const; ScFormulaCell* getFormulaCell(); + const ScFormulaCell* getFormulaCell() const; double getValue() const; bool hasString() const; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 3a39454008b3..1ee51bcb395b 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1102,6 +1102,11 @@ ScFormulaCell* ScCellIterator::getFormulaCell() return mpCurFormula; } +const ScFormulaCell* ScCellIterator::getFormulaCell() const +{ + return mpCurFormula; +} + double ScCellIterator::getValue() const { switch (meCurType) diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 7e06debe02b3..655246576780 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1753,6 +1753,37 @@ ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const S return SC_CACCT_NONE; } +ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const ScCellIterator& rIter ) +{ + switch (rIter.getType()) + { + case CELLTYPE_VALUE: + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + return SC_CACCT_NORMAL; + case CELLTYPE_FORMULA: + { + const ScFormulaCell* pCell = rIter.getFormulaCell(); + switch (pCell->GetMatrixFlag()) + { + case MM_NONE : + return SC_CACCT_NORMAL; + case MM_FORMULA : + case MM_FAKE : + return SC_CACCT_MATORG; + case MM_REFERENCE : + return SC_CACCT_MATREF; + default: + ; + } + return SC_CACCT_NORMAL; + } + default: + ; + } + + return SC_CACCT_NONE; +} bool ScChangeActionContent::NeedsNumberFormat( const ScBaseCell* pCell ) { @@ -2657,8 +2688,7 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange, ScCellIterator aIter( pRefDoc, rOrgRange ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { - ScBaseCell* pCell = aIter.getHackedBaseCell(); - if ( ScChangeActionContent::GetContentCellType( pCell ) ) + if (ScChangeActionContent::GetContentCellType(aIter)) { aBigPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy, aIter.GetPos().Tab() + nDz ); @@ -2667,6 +2697,8 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange, { // nicht getrackte Contents aPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy, aIter.GetPos().Tab() + nDz ); + + ScBaseCell* pCell = aIter.getHackedBaseCell(); GenerateDelContent( aPos, pCell, pRefDoc ); //! der Content wird hier _nicht_ per AddContent hinzugefuegt, //! sondern in UpdateReference, um z.B. auch kreuzende Deletes |