summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/dbcolect.hxx1
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/inc/global.hxx1
-rw-r--r--sc/inc/table.hxx4
-rw-r--r--sc/source/core/data/column3.cxx17
-rw-r--r--sc/source/core/data/documen3.cxx11
-rw-r--r--sc/source/core/data/global2.cxx51
-rw-r--r--sc/source/core/data/table3.cxx61
-rw-r--r--sc/source/core/tool/dbcolect.cxx4
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx10
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx3
-rw-r--r--sc/source/ui/inc/filtdlg.hxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx13
15 files changed, 138 insertions, 47 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 3f1fbfc1c88f..a7f0637b8135 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -374,7 +374,7 @@ public:
/// Including current, may return -1
SCsROW GetNextUnprotected( SCROW nRow, BOOL bUp ) const;
- void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings);
+ void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates);
BOOL GetDataEntries(SCROW nRow, TypedScStrCollection& rStrings, BOOL bLimit);
//UNUSED2008-05 SCROW NoteCount( SCROW nMaxRow = MAXROW ) const;
diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx
index 3d9d357b512b..eedf43b9041f 100644
--- a/sc/inc/dbcolect.hxx
+++ b/sc/inc/dbcolect.hxx
@@ -87,6 +87,7 @@ private:
SCCOLROW nQueryField[MAXQUERY];
ScQueryOp eQueryOp[MAXQUERY];
BOOL bQueryByString[MAXQUERY];
+ bool bQueryByDate[MAXQUERY];
String* pQueryStr[MAXQUERY];
double nQueryVal[MAXQUERY];
ScQueryConnect eQueryConnect[MAXQUERY];
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 116d25ee901e..dd5b208ef6f3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1385,9 +1385,9 @@ public:
void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr);
BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
- TypedScStrCollection& rStrings, bool bFilter = false );
+ bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates);
SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
- SCTAB nTab, TypedScStrCollection& rStrings );
+ SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates );
BOOL GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
TypedScStrCollection& rStrings, BOOL bLimit = FALSE );
BOOL GetFormulaEntries( TypedScStrCollection& rStrings );
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 1f6dc13d04ce..04a9b9d73d3c 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -799,6 +799,7 @@ struct ScQueryEntry
{
BOOL bDoQuery;
BOOL bQueryByString;
+ bool bQueryByDate;
SCCOLROW nField;
ScQueryOp eOp;
ScQueryConnect eConnect;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 9fda5d522fdc..eca658b05709 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -639,8 +639,8 @@ public:
SCSIZE Query(ScQueryParam& rQueryParam, BOOL bKeepSub);
BOOL CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
- void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings);
- void GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings );
+ void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
+ void GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
BOOL GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, BOOL bLimit);
BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index e94cfca12ab7..6574d52fb111 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1429,8 +1429,9 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
}
-void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings)
+void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates)
{
+ bool bHasDates = false;
SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
String aString;
SCROW nRow = 0;
@@ -1466,6 +1467,18 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollec
nValue = 0.0;
}
+ if (pFormatter)
+ {
+ short nType = pFormatter->GetType(nFormat);
+ if ((nType & NUMBERFORMAT_DATE) && !(nType & NUMBERFORMAT_TIME))
+ {
+ // special case for date values. Disregard the time
+ // element if the number format is of date type.
+ nValue = ::rtl::math::approxFloor(nValue);
+ bHasDates = true;
+ }
+ }
+
pData = new TypedStrData( aString, nValue, SC_STRTYPE_VALUE );
}
#if 0 // DR
@@ -1484,6 +1497,8 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollec
++nIndex;
}
+
+ rHasDates = bHasDates;
}
//
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 2529d0ad7f1d..eeb8cc5052f9 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1260,7 +1260,8 @@ BOOL ScDocument::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol,
// GetFilterEntries - Eintraege fuer AutoFilter-Listbox
//
-BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScStrCollection& rStrings, bool bFilter )
+BOOL ScDocument::GetFilterEntries(
+ SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates)
{
if ( ValidTab(nTab) && pTab[nTab] && pDBCollection )
{
@@ -1297,11 +1298,11 @@ BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScSt
if ( bFilter )
{
- pTab[nTab]->GetFilteredFilterEntries( nCol, nStartRow, nEndRow, aParam, rStrings );
+ pTab[nTab]->GetFilteredFilterEntries( nCol, nStartRow, nEndRow, aParam, rStrings, rHasDates );
}
else
{
- pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings );
+ pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings, rHasDates );
}
return TRUE;
@@ -1316,11 +1317,11 @@ BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScSt
//
BOOL ScDocument::GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
- SCTAB nTab, TypedScStrCollection& rStrings )
+ SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates )
{
if ( ValidTab(nTab) && pTab[nTab] )
{
- pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings );
+ pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings, rHasDates );
return TRUE;
}
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index e6f8523a3c42..fe7152af9d43 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -144,30 +144,32 @@ BOOL ScImportParam::operator==( const ScImportParam& rOther ) const
//------------------------------------------------------------------------
// struct ScQueryParam:
-ScQueryEntry::ScQueryEntry()
+ScQueryEntry::ScQueryEntry() :
+ bDoQuery(FALSE),
+ bQueryByString(FALSE),
+ bQueryByDate(false),
+ nField(0),
+ eOp(SC_EQUAL),
+ eConnect(SC_AND),
+ pStr(new String),
+ nVal(0.0),
+ pSearchParam(NULL),
+ pSearchText(NULL)
+{
+}
+
+ScQueryEntry::ScQueryEntry(const ScQueryEntry& r) :
+ bDoQuery(r.bDoQuery),
+ bQueryByString(r.bQueryByString),
+ bQueryByDate(r.bQueryByDate),
+ nField(r.nField),
+ eOp(r.eOp),
+ eConnect(r.eConnect),
+ pStr(new String(*r.pStr)),
+ nVal(r.nVal),
+ pSearchParam(NULL),
+ pSearchText(NULL)
{
- bDoQuery = FALSE;
- bQueryByString = FALSE;
- eOp = SC_EQUAL;
- eConnect = SC_AND;
- nField = 0;
- nVal = 0.0;
- pStr = new String;
- pSearchParam = NULL;
- pSearchText = NULL;
-}
-
-ScQueryEntry::ScQueryEntry(const ScQueryEntry& r)
-{
- bDoQuery = r.bDoQuery;
- bQueryByString = r.bQueryByString;
- eOp = r.eOp;
- eConnect = r.eConnect;
- nField = r.nField;
- nVal = r.nVal;
- pStr = new String(*r.pStr);
- pSearchParam = NULL;
- pSearchText = NULL;
}
ScQueryEntry::~ScQueryEntry()
@@ -184,6 +186,7 @@ ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r )
{
bDoQuery = r.bDoQuery;
bQueryByString = r.bQueryByString;
+ bQueryByDate = r.bQueryByDate;
eOp = r.eOp;
eConnect = r.eConnect;
nField = r.nField;
@@ -204,6 +207,7 @@ void ScQueryEntry::Clear()
{
bDoQuery = FALSE;
bQueryByString = FALSE;
+ bQueryByDate = false;
eOp = SC_EQUAL;
eConnect = SC_AND;
nField = 0;
@@ -222,6 +226,7 @@ BOOL ScQueryEntry::operator==( const ScQueryEntry& r ) const
{
return bDoQuery == r.bDoQuery
&& bQueryByString == r.bQueryByString
+ && bQueryByDate == r.bQueryByDate
&& eOp == r.eOp
&& eConnect == r.eConnect
&& nField == r.nField
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b85b910795a5..8fa48f332f7b 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -34,6 +34,7 @@
#include <rtl/math.hxx>
#include <unotools/textsearch.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include <unotools/charclass.hxx>
#include <unotools/collatorwrapper.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp>
@@ -991,6 +992,35 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
}
else
nCellVal = GetValue( static_cast<SCCOL>(rEntry.nField), nRow );
+
+ /* NOTE: lcl_PrepareQuery() prepares a filter query such that if a
+ * date+time format was queried rEntry.bQueryByDate is not set. In
+ * case other queries wanted to use this mechanism they should do
+ * the same, in other words only if rEntry.nVal is an integer value
+ * rEntry.bQueryByDate should be true and the time fraction be
+ * stripped here. */
+ if (rEntry.bQueryByDate)
+ {
+ sal_uInt32 nNumFmt = GetNumberFormat(static_cast<SCCOL>(rEntry.nField), nRow);
+ const SvNumberformat* pEntry = pDocument->GetFormatTable()->GetEntry(nNumFmt);
+ if (pEntry)
+ {
+ short nNumFmtType = pEntry->GetType();
+ /* NOTE: Omitting the check for absence of
+ * NUMBERFORMAT_TIME would include also date+time formatted
+ * values of the same day. That may be desired in some
+ * cases, querying all time values of a day, but confusing
+ * in other cases. A user can always setup a standard
+ * filter query for x >= date AND x < date+1 */
+ if ((nNumFmtType & NUMBERFORMAT_DATE) && !(nNumFmtType & NUMBERFORMAT_TIME))
+ {
+ // The format is of date type. Strip off the time
+ // element.
+ nCellVal = ::rtl::math::approxFloor(nCellVal);
+ }
+ }
+ }
+
switch (rEntry.eOp)
{
case SC_EQUAL :
@@ -1395,6 +1425,23 @@ static void lcl_PrepareQuery( ScDocument* pDoc, ScTable* pTab, ScQueryParam& rPa
sal_uInt32 nIndex = 0;
rEntry.bQueryByString = !( pDoc->GetFormatTable()->
IsNumberFormat( *rEntry.pStr, nIndex, rEntry.nVal ) );
+ if (rEntry.bQueryByDate)
+ {
+ if (!rEntry.bQueryByString && ((nIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0))
+ {
+ const SvNumberformat* pEntry = pDoc->GetFormatTable()->GetEntry(nIndex);
+ if (pEntry)
+ {
+ short nNumFmtType = pEntry->GetType();
+ if (!((nNumFmtType & NUMBERFORMAT_DATE) && !(nNumFmtType & NUMBERFORMAT_TIME)))
+ rEntry.bQueryByDate = false; // not a date only
+ }
+ else
+ rEntry.bQueryByDate = false; // what the ... not a date
+ }
+ else
+ rEntry.bQueryByDate = false; // not a date
+ }
}
else
{
@@ -1778,12 +1825,13 @@ BOOL ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL /* nEndCol *
return TRUE;
}
-void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings)
+void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates)
{
- aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings );
+ aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings, rHasDates );
}
-void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings )
+void ScTable::GetFilteredFilterEntries(
+ SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates )
{
// remove the entry for this column from the query parameter
ScQueryParam aParam( rParam );
@@ -1801,15 +1849,18 @@ void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, co
BOOL* pSpecial = new BOOL[nEntryCount];
lcl_PrepareQuery( pDocument, this, aParam, pSpecial );
-
+ bool bHasDates = false;
for ( SCROW j = nRow1; j <= nRow2; ++j )
{
if ( ValidQuery( j, aParam, pSpecial ) )
{
- aCol[nCol].GetFilterEntries( j, j, rStrings );
+ bool bThisHasDates = false;
+ aCol[nCol].GetFilterEntries( j, j, rStrings, bThisHasDates );
+ bHasDates |= bThisHasDates;
}
}
+ rHasDates = bHasDates;
delete[] pSpecial;
}
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index 61ca8ee00195..7247a6bca82d 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -157,6 +157,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
nQueryField[i] = rData.nQueryField[i];
eQueryOp[i] = rData.eQueryOp[i];
bQueryByString[i] = rData.bQueryByString[i];
+ bQueryByDate[i] = rData.bQueryByDate[i];
pQueryStr[i] = new String( *(rData.pQueryStr[i]) );
nQueryVal[i] = rData.nQueryVal[i];
eQueryConnect[i] = rData.eQueryConnect[i];
@@ -246,6 +247,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
nQueryField[i] = rData.nQueryField[i];
eQueryOp[i] = rData.eQueryOp[i];
bQueryByString[i] = rData.bQueryByString[i];
+ bQueryByDate[i] = rData.bQueryByDate[i];
*pQueryStr[i] = *rData.pQueryStr[i];
nQueryVal[i] = rData.nQueryVal[i];
eQueryConnect[i] = rData.eQueryConnect[i];
@@ -514,6 +516,7 @@ void ScDBData::GetQueryParam( ScQueryParam& rQueryParam ) const
rEntry.nField = nQueryField[i];
rEntry.eOp = eQueryOp[i];
rEntry.bQueryByString = bQueryByString[i];
+ rEntry.bQueryByDate = bQueryByDate[i];
*rEntry.pStr = *pQueryStr[i];
rEntry.nVal = nQueryVal[i];
rEntry.eConnect = eQueryConnect[i];
@@ -545,6 +548,7 @@ void ScDBData::SetQueryParam(const ScQueryParam& rQueryParam)
nQueryField[i] = rEntry.nField;
eQueryOp[i] = rEntry.eOp;
bQueryByString[i] = rEntry.bQueryByString;
+ bQueryByDate[i] = rEntry.bQueryByDate;
*pQueryStr[i] = *rEntry.pStr;
nQueryVal[i] = rEntry.nVal;
eQueryConnect[i] = rEntry.eConnect;
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index a7a80165566f..38cb14459abd 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -451,24 +451,27 @@ void ScFilterDlg::UpdateValueList( USHORT nList )
SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
if (!pEntryLists[nColumn])
{
+ USHORT nOffset = GetSliderPos();
SCTAB nTab = nSrcTab;
SCROW nFirstRow = theQueryData.nRow1;
SCROW nLastRow = theQueryData.nRow2;
+ mbHasDates[nOffset+nList-1] = false;
// erstmal ohne die erste Zeile
pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
pDoc->GetFilterEntriesArea( nColumn, nFirstRow+1, nLastRow,
- nTab, *pEntryLists[nColumn] );
+ nTab, *pEntryLists[nColumn], mbHasDates[nOffset+nList-1] );
// Eintrag fuer die erste Zeile
//! Eintrag (pHdrEntry) ohne Collection erzeugen?
nHeaderPos[nColumn] = USHRT_MAX;
TypedScStrCollection aHdrColl( 1, 1 );
+ bool bDummy = false;
pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nFirstRow,
- nTab, aHdrColl );
+ nTab, aHdrColl, bDummy );
TypedStrData* pHdrEntry = aHdrColl[0];
if ( pHdrEntry )
{
@@ -1064,7 +1067,8 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos();
- rEntry.eOp = eOp;
+ rEntry.eOp = eOp;
+ rEntry.bQueryByDate = mbHasDates[nQE];
}
}
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index 8a44d512cbe6..79a58080cd4d 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -352,11 +352,12 @@ void ScPivotFilterDlg::UpdateValueList( USHORT nList )
SCROW nFirstRow = theQueryData.nRow1;
SCROW nLastRow = theQueryData.nRow2;
nFirstRow++;
+ bool bHasDates = false;
pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nLastRow,
- nTab, *pEntryLists[nColumn] );
+ nTab, *pEntryLists[nColumn], bHasDates );
}
TypedScStrCollection* pColl = pEntryLists[nColumn];
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 7e9ed68706ef..f6a0c1a6a763 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -167,6 +167,7 @@ private:
ListBox* aFieldLbArr[4];
ListBox* aCondLbArr[4];
ListBox* aConnLbArr[4];
+ bool mbHasDates[MAXQUERY];
BOOL bRefreshExceptQuery[MAXQUERY];
USHORT nFieldCount;
BOOL bRefInputMode;
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 8b680daad6cb..9f2e0afce737 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -201,7 +201,7 @@ private:
BOOL IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab );
void ExecFilter( ULONG nSel, SCCOL nCol, SCROW nRow,
- const String& aValue );
+ const String& aValue, bool bCheckForDates );
void FilterSelect( ULONG nSel );
void ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index aca88c554317..f692dcae7c43 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -167,6 +167,7 @@ private:
BOOL bInit;
BOOL bCancelled;
BOOL bInSelect;
+ bool mbListHasDates;
ULONG nSel;
ScFilterBoxMode eMode;
@@ -190,6 +191,8 @@ public:
BOOL IsInInit() const { return bInit; }
void SetCancelled() { bCancelled = TRUE; }
BOOL IsInSelect() const { return bInSelect; }
+ void SetListHasDates(bool b) { mbListHasDates = b; }
+ bool HasDates() const { return mbListHasDates; }
};
//-------------------------------------------------------------------
@@ -205,6 +208,7 @@ ScFilterListBox::ScFilterListBox( Window* pParent, ScGridWindow* pGrid,
bInit( TRUE ),
bCancelled( FALSE ),
bInSelect( FALSE ),
+ mbListHasDates(false),
nSel( 0 ),
eMode( eNewMode )
{
@@ -879,7 +883,9 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
pFilterBox->SetSeparatorPos( nDefCount - 1 );
// get list entries
- pDoc->GetFilterEntries( nCol, nRow, nTab, aStrings, true );
+ bool bHasDates = false;
+ pDoc->GetFilterEntries( nCol, nRow, nTab, true, aStrings, bHasDates);
+ pFilterBox->SetListHasDates(bHasDates);
// check widths of numerical entries (string entries are not included)
// so all numbers are completely visible
@@ -1089,7 +1095,7 @@ void ScGridWindow::FilterSelect( ULONG nSel )
ExecDataSelect( nCol, nRow, aString );
break;
case SC_FILTERBOX_FILTER:
- ExecFilter( nSel, nCol, nRow, aString );
+ ExecFilter( nSel, nCol, nRow, aString, pFilterBox->HasDates() );
break;
case SC_FILTERBOX_SCENARIO:
pViewData->GetView()->UseScenario( aString );
@@ -1122,7 +1128,7 @@ void ScGridWindow::ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr )
void ScGridWindow::ExecFilter( ULONG nSel,
SCCOL nCol, SCROW nRow,
- const String& aValue )
+ const String& aValue, bool bCheckForDates )
{
SCTAB nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument();
@@ -1194,6 +1200,7 @@ void ScGridWindow::ExecFilter( ULONG nSel,
rNewEntry.bDoQuery = TRUE;
rNewEntry.bQueryByString = TRUE;
rNewEntry.nField = nCol;
+ rNewEntry.bQueryByDate = bCheckForDates;
if ( nSel == SC_AUTOFILTER_TOP10 )
{
rNewEntry.eOp = SC_TOPVAL;