ooo-build r13655 - in trunk: . patches/dev300
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13655 - in trunk: . patches/dev300
- Date: Fri, 22 Aug 2008 04:19:40 +0000 (UTC)
Author: kyoshida
Date: Fri Aug 22 04:19:40 2008
New Revision: 13655
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13655&view=rev
Log:
2008-08-22 Kohei Yoshida <kyoshida novell com>
* patches/dev300/calc-autofill-increment-fix.diff: modify Calc's
autofill behavior to make its behavior a little closer to Excel's
(i#5550).
* patches/dev300/apply: apply the new patch.
Added:
trunk/patches/dev300/calc-autofill-increment-fix.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Fri Aug 22 04:19:40 2008
@@ -748,6 +748,9 @@
# When filtering by date, strip off the time element from each value.
calc-filter-by-date-strip-time.diff, n#414303, kohei
+# modify the autofill behavior to bring it a little closer to Excel's.
+calc-autofill-increment-fix.diff, i#5550, kohei
+
[ CalcFixes < ooo300-m3 ]
# Fix a regression on filtering by page field.
calc-fix-datapilot-date-filter.diff, i#90022, kohei
Added: trunk/patches/dev300/calc-autofill-increment-fix.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-autofill-increment-fix.diff Fri Aug 22 04:19:40 2008
@@ -0,0 +1,110 @@
+diff --git sc/source/core/data/table4.cxx sc/source/core/data/table4.cxx
+index 5dabb8e..e36b4f8 100644
+--- sc/source/core/data/table4.cxx
++++ sc/source/core/data/table4.cxx
+@@ -93,48 +93,68 @@ extern USHORT nScFillModeMouseModifier; // global.cxx
+
+ short lcl_DecompValueString( String& aValue, sal_Int32& nVal, USHORT* pMinDigits = NULL )
+ {
+- if ( !aValue.Len() )
++ xub_StrLen nLen = aValue.Len();
++ if (!nLen)
+ {
+ nVal = 0;
+ return 0;
+ }
+ const sal_Unicode* p = aValue.GetBuffer();
+- xub_StrLen nNeg = 0;
+- xub_StrLen nNum = 0;
+- if ( p[nNum] == '-' )
+- nNum = nNeg = 1;
+- while ( p[nNum] && CharClass::isAsciiNumeric( p[nNum] ) )
+- nNum++;
+- if ( nNum > nNeg )
+- { // number at the beginning
+- nVal = aValue.Copy( 0, nNum ).ToInt32();
+- // #60893# any number with a leading zero sets the minimum number of digits
+- if ( p[nNeg] == '0' && pMinDigits && ( nNum - nNeg > *pMinDigits ) )
+- *pMinDigits = nNum - nNeg;
+- aValue.Erase( 0, nNum );
+- return -1;
+- }
+- else
+- {
+- nNeg = 0;
+- xub_StrLen nEnd = nNum = aValue.Len() - 1;
+- while ( nNum && CharClass::isAsciiNumeric( p[nNum] ) )
+- nNum--;
+- if ( p[nNum] == '-' )
+- {
+- nNum--;
+- nNeg = 1;
+- }
+- if ( nNum < nEnd - nNeg )
+- { // number at the end
+- nVal = aValue.Copy( nNum + 1 ).ToInt32();
+- // #60893# any number with a leading zero sets the minimum number of digits
+- if ( p[nNum+1+nNeg] == '0' && pMinDigits && ( nEnd - nNum - nNeg > *pMinDigits ) )
+- *pMinDigits = nEnd - nNum - nNeg;
+- aValue.Erase( nNum + 1 );
+- return 1;
+- }
+- }
++ xub_StrLen nSign = (p[0] == '+' || p[0] == '-') ? 1 : 0;
++ xub_StrLen nDot = nLen, nFirst = nLen;
++ String aBuf;
++ for (xub_StrLen i = nSign; i < nLen; ++i)
++ {
++ sal_Unicode c = p[i];
++ if (CharClass::isAsciiNumeric(c) && c != '+' && c != '-')
++ {
++ aBuf.Append(c);
++ continue;
++ }
++
++ // numerical sequence ended.
++
++ if (nFirst == nLen)
++ nFirst = i;
++
++ if (c == '.')
++ {
++ // if it's a dot, erase the buffer and keep going.
++ aBuf.Erase();
++ nDot = i;
++ continue;
++ }
++ else if (aBuf.Len())
++ {
++ // leading number
++ if (nDot < nLen)
++ {
++ // If a dot has been previously encounted, then use the first
++ // numerical segment.
++ i = nFirst;
++ aBuf = aValue.Copy(0, nFirst);
++ }
++
++ nVal = aBuf.ToInt32();
++ if (nSign && p[0] == '-')
++ nVal *= -1;
++ aValue.Erase(0, i);
++ if (pMinDigits)
++ *pMinDigits = i - nSign;
++ return -1;
++ }
++ }
++ if (aBuf.Len())
++ {
++ // trailing number.
++ xub_StrLen nBufLen = aBuf.Len();
++ nVal = aBuf.ToInt32();
++ aValue.Erase(nLen - nBufLen);
++ if (pMinDigits)
++ *pMinDigits = nBufLen;
++ return 1;
++ }
++
+ nVal = 0;
+ return 0;
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]