diff options
-rw-r--r-- | sc/inc/queryparam.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/queryparam.cxx | 10 |
3 files changed, 23 insertions, 5 deletions
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx index 77108abe97b5..27d121c19443 100644 --- a/sc/inc/queryparam.hxx +++ b/sc/inc/queryparam.hxx @@ -60,10 +60,18 @@ struct ScQueryParamBase void FillInExcelSyntax(const rtl::OUString& aCellStr, SCSIZE nIndex); protected: + typedef boost::ptr_vector<ScQueryEntry> EntriesType; + +public: + typedef EntriesType::const_iterator const_iterator; + + const_iterator begin() const; + const_iterator end() const; + +protected: ScQueryParamBase(); ScQueryParamBase(const ScQueryParamBase& r); - typedef boost::ptr_vector<ScQueryEntry> EntriesType; EntriesType maEntries; }; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 4e7e874ed201..85354f3bb27d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1530,14 +1530,14 @@ bool ScTable::ValidQuery( long nPos = -1; QueryEvaluator aEval(*pDocument, *this, rParam, pbTestEqualCondition); - - for (size_t i = 0; i < nEntryCount && rParam.GetEntry(i).bDoQuery; ++i) + ScQueryParam::const_iterator it, itBeg = rParam.begin(), itEnd = rParam.end(); + for (it = itBeg; it != itEnd && it->bDoQuery; ++it) { - const ScQueryEntry& rEntry = rParam.GetEntry(i); + const ScQueryEntry& rEntry = *it; SCCOL nCol = static_cast<SCCOL>(rEntry.nField); // we can only handle one single direct query - if ( !pCell || i > 0 ) + if (!pCell || it != itBeg) pCell = GetCell(nCol, nRow); std::pair<bool,bool> aRes(false, false); diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx index b814b2788c42..e6059ab1ac9c 100644 --- a/sc/source/core/tool/queryparam.cxx +++ b/sc/source/core/tool/queryparam.cxx @@ -57,6 +57,16 @@ struct FindUnused : public std::unary_function<ScQueryEntry, bool> } +ScQueryParamBase::const_iterator ScQueryParamBase::begin() const +{ + return maEntries.begin(); +} + +ScQueryParamBase::const_iterator ScQueryParamBase::end() const +{ + return maEntries.end(); +} + ScQueryParamBase::ScQueryParamBase() : bHasHeader(true), bByRow(true), |