summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/queryparam.hxx1
-rw-r--r--sc/source/core/data/dociter.cxx4
-rw-r--r--sc/source/core/data/table3.cxx17
-rw-r--r--sc/source/core/tool/doubleref.cxx1
-rw-r--r--sc/source/core/tool/interpr1.cxx3
-rw-r--r--sc/source/core/tool/queryparam.cxx6
6 files changed, 30 insertions, 2 deletions
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 49fa2bceaabd..d04f7b4a4f21 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 689e68e2e6b4..5efe0163e384 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 453905549f10..16c4793d546d 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 a7414aa75de9..15e6d53c871b 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 bc33bf8ce137..a0a577ffacd9 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 a1df6a2404a5..4012f13eaa73 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)