[Libreoffice-commits] .: sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Nov 11 09:16:45 PST 2011
sc/inc/queryparam.hxx | 1 +
sc/source/core/data/dociter.cxx | 4 ++++
sc/source/core/data/table3.cxx | 17 +++++++++++++++++
sc/source/core/tool/doubleref.cxx | 1 +
sc/source/core/tool/interpr1.cxx | 3 +++
sc/source/core/tool/queryparam.cxx | 6 ++++--
6 files changed, 30 insertions(+), 2 deletions(-)
New commits:
commit 7d7036c235a92268f23cc04eab8abcb08cddeb3f
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Fri Nov 11 12:16:06 2011 -0500
Revert "Removing the mixed comparison flag, which is no longer needed."
This reverts commit eaea417bfdf8d06df2b7f2e42c904c32ce77e871.
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 49fa2bc..d04f7b4 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -45,6 +45,7 @@ struct ScQueryParamBase
bool bCaseSens;
bool bRegExp;
bool bDuplicate;
+ bool bMixedComparison; // whether numbers are smaller than strings
virtual ~ScQueryParamBase();
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 689e68e..5efe016 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -865,6 +865,10 @@ bool ScDBQueryDataIterator::DataAccessMatrix::isValidQuery(SCROW nRow, const ScM
}
while (false);
}
+ else if (mpParam->bMixedComparison)
+ {
+ // Not used at the moment.
+ }
if (aResults.empty())
// First query entry.
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 4539055..16c4793 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1442,6 +1442,23 @@ bool ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
}
}
}
+ else if (rParam.bMixedComparison)
+ {
+ if (rItem.meType == ScQueryEntry::ByString &&
+ (rEntry.eOp == SC_LESS || rEntry.eOp == SC_LESS_EQUAL) &&
+ (pCell ? pCell->HasValueData() :
+ HasValueData( static_cast<SCCOL>(rEntry.nField), nRow)))
+ {
+ bOk = true;
+ }
+ else if (rItem.meType != ScQueryEntry::ByString &&
+ (rEntry.eOp == SC_GREATER || rEntry.eOp == SC_GREATER_EQUAL) &&
+ (pCell ? pCell->HasStringData() :
+ HasStringData( static_cast<SCCOL>(rEntry.nField), nRow)))
+ {
+ bOk = true;
+ }
+ }
if (nPos == -1)
{
diff --git a/sc/source/core/tool/doubleref.cxx b/sc/source/core/tool/doubleref.cxx
index a7414aa..15e6d53 100644
--- a/sc/source/core/tool/doubleref.cxx
+++ b/sc/source/core/tool/doubleref.cxx
@@ -276,6 +276,7 @@ void ScDBRangeBase::fillQueryOptions(ScQueryParamBase* pParam)
pParam->bCaseSens = false;
pParam->bRegExp = false;
pParam->bDuplicate = true;
+ pParam->bMixedComparison = false;
}
ScDocument* ScDBRangeBase::getDoc() const
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index bc33bf8..a0a577f 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4473,6 +4473,7 @@ void ScInterpreter::ScMatch()
rParam.nRow1 = nRow1;
rParam.nCol2 = nCol2;
rParam.nTab = nTab1;
+ rParam.bMixedComparison = true;
ScQueryEntry& rEntry = rParam.GetEntry(0);
ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
@@ -5804,6 +5805,7 @@ void ScInterpreter::ScLookup()
aParam.nCol2 = bVertical ? nCol1 : nCol2;
aParam.nRow2 = bVertical ? nRow2 : nRow1;
aParam.bByRow = bVertical;
+ aParam.bMixedComparison = true;
rEntry.bDoQuery = true;
rEntry.eOp = SC_LESS_EQUAL;
@@ -6024,6 +6026,7 @@ void ScInterpreter::CalculateLookup(bool HLookup)
rParam.nRow2 = nRow2;
rParam.nTab = nTab1;
}
+ rParam.bMixedComparison = true;
ScQueryEntry& rEntry = rParam.GetEntry(0);
rEntry.bDoQuery = true;
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index a1df6a2..4012f13 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -48,7 +48,7 @@ ScQueryParamBase::ScQueryParamBase()
ScQueryParamBase::ScQueryParamBase(const ScQueryParamBase& r) :
bHasHeader(r.bHasHeader), bByRow(r.bByRow), bInplace(r.bInplace), bCaseSens(r.bCaseSens),
- bRegExp(r.bRegExp), bDuplicate(r.bDuplicate),
+ bRegExp(r.bRegExp), bDuplicate(r.bDuplicate), bMixedComparison(r.bMixedComparison),
maEntries(r.maEntries)
{
}
@@ -226,7 +226,7 @@ void ScQueryParam::Clear()
nCol1=nCol2 = 0;
nRow1=nRow2 = 0;
nTab = SCTAB_MAX;
- bHasHeader = bCaseSens = bRegExp = false;
+ bHasHeader = bCaseSens = bRegExp = bMixedComparison = false;
bInplace = bByRow = bDuplicate = sal_True;
boost::ptr_vector<ScQueryEntry>::iterator itr = maEntries.begin(), itrEnd = maEntries.end();
@@ -260,6 +260,7 @@ ScQueryParam& ScQueryParam::operator=( const ScQueryParam& r )
bInplace = r.bInplace;
bCaseSens = r.bCaseSens;
bRegExp = r.bRegExp;
+ bMixedComparison = r.bMixedComparison;
bDuplicate = r.bDuplicate;
bByRow = r.bByRow;
bDestPers = r.bDestPers;
@@ -296,6 +297,7 @@ bool ScQueryParam::operator==( const ScQueryParam& rOther ) const
&& (bInplace == rOther.bInplace)
&& (bCaseSens == rOther.bCaseSens)
&& (bRegExp == rOther.bRegExp)
+ && (bMixedComparison == rOther.bMixedComparison)
&& (bDuplicate == rOther.bDuplicate)
&& (bDestPers == rOther.bDestPers)
&& (nDestTab == rOther.nDestTab)
More information about the Libreoffice-commits
mailing list