ooo-build r13476 - in trunk: . patches/dev300



Author: kyoshida
Date: Mon Aug  4 19:10:49 2008
New Revision: 13476
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13476&view=rev

Log:
2008-08-04  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/calc-filter-by-date-strip-time.diff: when filtering
	rows by date, strip off the time element from each value when the cell
	is formatted purely in date (n#414303).

	* patches/dev300/apply: apply the new patch.


Added:
   trunk/patches/dev300/calc-filter-by-date-strip-time.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Mon Aug  4 19:10:49 2008
@@ -722,6 +722,9 @@
 # Fix a regression on filtering by page field.
 calc-fix-datapilot-date-filter.diff, i#90022, kohei
 
+# When filtering by date, strip off the time element from each value.
+calc-filter-by-date-strip-time.diff, n#414303, kohei
+
 [ LinuxOnly ]
 # accelerate linking, by extreme cunning i#63927
 speed-local-link-except.diff, i#63927, michael

Added: trunk/patches/dev300/calc-filter-by-date-strip-time.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-filter-by-date-strip-time.diff	Mon Aug  4 19:10:49 2008
@@ -0,0 +1,50 @@
+diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
+index e2f3d57..1f5f531 100644
+--- sc/source/core/data/column3.cxx
++++ sc/source/core/data/column3.cxx
+@@ -1474,6 +1474,15 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedStrCollecti
+ 					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);
++            }
++
+ 			pData = new TypedStrData( aString, nValue, SC_STRTYPE_VALUE );
+ 		}
+ 		ScPostIt aCellNote(pDocument);
+diff --git sc/source/core/data/table3.cxx sc/source/core/data/table3.cxx
+index 6e4857b..179a54e 100644
+--- sc/source/core/data/table3.cxx
++++ sc/source/core/data/table3.cxx
+@@ -64,6 +64,7 @@
+ #include "userlist.hxx"
+ #include "progress.hxx"
+ #include "cellform.hxx"
++#include "svtools/zformat.hxx"
+ 
+ #include <vector>
+ 
+@@ -1156,6 +1157,17 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
+             }
+             else
+                 nCellVal = GetValue( static_cast<SCCOL>(rEntry.nField), nRow );
++
++            sal_uInt32 nNumFmt = GetNumberFormat(static_cast<SCCOL>(rEntry.nField), nRow);
++            const SvNumberformat* pEntry = pDocument->GetFormatTable()->GetEntry(nNumFmt);
++            if (pEntry)
++            {
++                short nNumFmtType = pEntry->GetType();
++                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 :



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]