diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-01-08 12:02:13 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-01-08 12:02:13 -0500 |
commit | 9efb385d86bceb725aa70eba493a351a99b31f20 (patch) | |
tree | 1e5427e9637a4e3bfd2992382d18a9ed0b0ea23c /sc/source | |
parent | 2af8520b931e81633559f5f9ea46903d60535ede (diff) |
kohei03: A little more change to keep MacIntel happy.
There were still some parts that were illegally accessing private members.
I hope this commit will finally eliminiate all of such cases.
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/dociter.cxx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 169692097cfb..0b4d1134a6b2 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -509,22 +509,35 @@ ScDBQueryDataIterator::DataAccess::~DataAccess() SCROW ScDBQueryDataIterator::GetRowByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow) { - ScColumn* pCol = &(rDoc.pTab[nTab])->aCol[nCol]; + ScColumn* pCol = &rDoc.pTab[nTab]->aCol[nCol]; return pCol->pItems[nColRow].nRow; } ScBaseCell* ScDBQueryDataIterator::GetCellByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow) { - ScColumn* pCol = &(rDoc.pTab[nTab])->aCol[nCol]; + ScColumn* pCol = &rDoc.pTab[nTab]->aCol[nCol]; return pCol->pItems[nColRow].pCell; } ScAttrArray* ScDBQueryDataIterator::GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol) { - ScColumn* pCol = &(rDoc.pTab[nTab])->aCol[nCol]; + ScColumn* pCol = &rDoc.pTab[nTab]->aCol[nCol]; return pCol->pAttrArray; } +bool ScDBQueryDataIterator::IsQueryValid(ScDocument& rDoc, const ScQueryParam& rParam, SCTAB nTab, SCROW nRow, ScBaseCell* pCell) +{ + return rDoc.pTab[nTab]->ValidQuery(nRow, rParam, NULL, pCell); +} + +SCSIZE ScDBQueryDataIterator::SearchColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCROW nRow, SCCOL nCol) +{ + ScColumn* pCol = &rDoc.pTab[nTab]->aCol[nCol]; + SCSIZE nColRow; + pCol->Search(nRow, nColRow); + return nColRow; +} + // ---------------------------------------------------------------------------- ScDBQueryDataIterator::DataAccessInternal::DataAccessInternal(const ScDBQueryDataIterator* pParent, ScDBQueryParamInternal* pParam, ScDocument* pDoc) : @@ -575,9 +588,11 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue) if ( nColRow < nCellCount && nThisRow <= mpParam->nRow2 ) { nRow = nThisRow; - ScBaseCell* pCell = ScDBQueryDataIterator::GetCellByColEntryIndex(*mpDoc, nTab, nCol, nColRow); - if ( (mpDoc->pTab[nTab])->ValidQuery( nRow, *mpParam, NULL, - (nCol == static_cast<SCCOL>(nFirstQueryField) ? pCell : NULL) ) ) + ScBaseCell* pCell = NULL; + if (nCol == static_cast<SCCOL>(nFirstQueryField)) + pCell = ScDBQueryDataIterator::GetCellByColEntryIndex(*mpDoc, nTab, nCol, nColRow); + + if (ScDBQueryDataIterator::IsQueryValid(*mpDoc, *mpParam, nTab, nRow, pCell)) { switch (pCell->GetCellType()) { @@ -647,8 +662,7 @@ bool ScDBQueryDataIterator::DataAccessInternal::getFirst(Value& rValue) if (mpParam->bHasHeader) nRow++; // nColRow = 0; - ScColumn* pCol = &(mpDoc->pTab[nTab])->aCol[nCol]; - pCol->Search( nRow, nColRow ); + nColRow = ScDBQueryDataIterator::SearchColEntryIndex(*mpDoc, nTab, nRow, nCol); return getCurrent(rValue); } |