diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-01-07 23:28:47 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-01-07 23:28:47 -0500 |
commit | bdc5a09defa9ce72e642acb13341daba62471e50 (patch) | |
tree | 261791f6c8768c6812460213551d125ce891c1df | |
parent | 3f1ac2e3c881a55cf00280f65501d87b31083e04 (diff) |
kohei03: Worked around a build error on MacIntel.
The version of gcc that Mac uses does not grant private access to
friend classes from a nested class, even though its parent class
has friend privilage to that class. I worked around it by having
the nested class call functions of its parent class in order to
access private members of ScColumn/ScTable/ScDocument.
-rw-r--r-- | sc/inc/dociter.hxx | 4 | ||||
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/inc/table.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dociter.cxx | 35 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 5 |
6 files changed, 46 insertions, 7 deletions
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 350c6110b..8355a05e9 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -146,6 +146,10 @@ public: }; private: + static SCROW GetRowByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow); + static ScBaseCell* GetCellByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow); + static ScAttrArray* GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol); + class DataAccess { public: diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4ff8ca72a..3b8002c79 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -420,6 +420,7 @@ private: public: SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen + SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const; ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet ULONG GetCodeCount() const; // RPN-Code in Formeln DECL_LINK( GetUserDefinedColor, USHORT * ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index a08aa40ac..d821b540e 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -177,6 +177,7 @@ public: ScOutlineTable* GetOutlineTable() { return pOutlineTable; } + SCSIZE GetCellCount(SCCOL nCol) const; ULONG GetCellCount() const; ULONG GetWeightedCount() const; ULONG GetCodeCount() const; // RPN-Code in Formeln diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index da2c66b87..b23b868b6 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -507,6 +507,24 @@ ScDBQueryDataIterator::DataAccess::~DataAccess() { } +SCROW ScDBQueryDataIterator::GetRowByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow) +{ + 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]; + return pCol->pItems[nColRow].pCell; +} + +ScAttrArray* ScDBQueryDataIterator::GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol) +{ + ScColumn* pCol = &(rDoc.pTab[nTab])->aCol[nCol]; + return pCol->pAttrArray; +} + // ---------------------------------------------------------------------------- ScDBQueryDataIterator::DataAccessInternal::DataAccessInternal(const ScDBQueryDataIterator* pParent, ScDBQueryParamInternal* pParam, ScDocument* pDoc) : @@ -539,7 +557,6 @@ ScDBQueryDataIterator::DataAccessInternal::~DataAccessInternal() bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue) { - ScColumn* pCol = &(mpDoc->pTab[nTab])->aCol[nCol]; SCCOLROW nFirstQueryField = mpParam->GetEntry(0).nField; for ( ;; ) { @@ -550,13 +567,15 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue) return false; } - while ( (nColRow < pCol->nCount) && (pCol->pItems[nColRow].nRow < nRow) ) - nColRow++; + SCSIZE nCellCount = mpDoc->GetCellCount(nTab, nCol); + SCROW nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, nColRow); + while ( (nColRow < nCellCount) && (nThisRow < nRow) ) + nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, ++nColRow); - if ( nColRow < pCol->nCount && pCol->pItems[nColRow].nRow <= mpParam->nRow2 ) + if ( nColRow < nCellCount && nThisRow <= mpParam->nRow2 ) { - nRow = pCol->pItems[nColRow].nRow; - ScBaseCell* pCell = pCol->pItems[nColRow].pCell; + 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) ) ) { @@ -568,8 +587,10 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue) rValue.mbIsNumber = true; if ( bCalcAsShown ) { + const ScAttrArray* pNewAttrArray = + ScDBQueryDataIterator::GetAttrArrayByCol(*mpDoc, nTab, nCol); lcl_IterGetNumberFormat( nNumFormat, pAttrArray, - nAttrEndRow, pCol->pAttrArray, nRow, mpDoc ); + nAttrEndRow, pNewAttrArray, nRow, mpDoc ); rValue.mfValue = mpDoc->RoundValueAsShown( rValue.mfValue, nNumFormat ); } nNumFmtType = NUMBERFORMAT_NUMBER; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a2f35773c..19e36a5ec 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4644,6 +4644,13 @@ ULONG ScDocument::GetCellCount() const return nCellCount; } +SCSIZE ScDocument::GetCellCount(SCTAB nTab, SCCOL nCol) const +{ + if (!ValidTab(nTab) || !pTab[nTab]) + return 0; + + return pTab[nTab]->GetCellCount(nCol); +} ULONG ScDocument::GetCodeCount() const { diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index b770bbba7..1525f0c62 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1819,6 +1819,11 @@ BOOL ScTable::GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStri return aCol[nCol].GetDataEntries( nRow, rStrings, bLimit ); } +SCSIZE ScTable::GetCellCount(SCCOL nCol) const +{ + return aCol[nCol].GetCellCount(); +} + ULONG ScTable::GetCellCount() const { ULONG nCellCount = 0; |