[ooo-build-commit] .: patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Feb 4 09:13:04 PST 2010
patches/dev300/apply | 5
patches/dev300/calc-general-type-auto-decimal-svtools.diff | 287 ++++++++++---
2 files changed, 232 insertions(+), 60 deletions(-)
New commits:
commit a393a1efc007cd5f5d01b4538dcc0daecf3cb0e0
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Feb 4 12:05:35 2010 -0500
Some updates.
* patches/dev300/apply: vcl-drawtransparent-fix.diff already in m12.
* patches/dev300/calc-general-type-auto-decimal-svtools.diff: backported fix for
i#26826.
diff --git a/patches/dev300/apply b/patches/dev300/apply
index dc47012..87406c6 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -838,9 +838,6 @@ calc-general-type-auto-decimal-sc.diff, n#541973, i#46511, kohei
calc-general-type-auto-decimal-svtools.diff, n#541973, i#46511, kohei
calc-general-type-auto-decimal-officecfg.diff, n#541973, i#46511, kohei
-# Fixed percent format incorrectly getting unlimited precision.
-calc-general-type-auto-decimal-svtools-fix.diff, n#555889, i#46511, kohei
-
[ CalcFixes >= dev300-m61 >= ooo320-m1 ]
# FIXME. hack. readd XclExpInterfaceEnd::WriteBody as in m60 as
# calc-xls-export-encryption-condfmt-fix.diff patches it. Kohei, please check
@@ -3543,6 +3540,8 @@ valgrind-fixes.diff, thorsten
framework-menubar-fix.diff, thorsten
# backport from 3.3 - prevent crash in headless svp mode
cws-sb118-headless-fix.diff, i#108681, thorsten
+
+[ Fixes < ooo320-m12 ]
vcl-drawtransparent-fix.diff, i#107763, thorsten
[ BuildBits == ooo320-m11 ]
diff --git a/patches/dev300/calc-general-type-auto-decimal-svtools.diff b/patches/dev300/calc-general-type-auto-decimal-svtools.diff
index d97dd27..fc45c26 100644
--- a/patches/dev300/calc-general-type-auto-decimal-svtools.diff
+++ b/patches/dev300/calc-general-type-auto-decimal-svtools.diff
@@ -1,8 +1,8 @@
diff --git svtools/inc/svtools/zforlist.hxx svtools/inc/svtools/zforlist.hxx
-index bb4a589..2ae53fc 100644
+index bb4a589..148bba9 100644
--- svtools/inc/svtools/zforlist.hxx
+++ svtools/inc/svtools/zforlist.hxx
-@@ -336,6 +336,11 @@ class SvNumberFormatterRegistry_Impl;
+@@ -336,9 +336,20 @@ class SvNumberFormatterRegistry_Impl;
class SVT_DLLPUBLIC SvNumberFormatter
{
public:
@@ -11,18 +11,42 @@ index bb4a589..2ae53fc 100644
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
++
++ /**
++ * Precision suitable for numbers displayed in input bar, for instance
++ * Calc's formula input bar.
++ */
++ static const sal_uInt16 INPUTSTRING_PRECISION;
+
+- /// Preferred ctor with service manager and language/country enum
+- SvNumberFormatter(
++ /// Preferred ctor with service manager and language/country enum
++ SvNumberFormatter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr,
+ LanguageType eLang
+ );
+@@ -582,14 +593,13 @@ public:
- /// Preferred ctor with service manager and language/country enum
- SvNumberFormatter(
-@@ -586,7 +591,7 @@ public:
- /// Return the reference date
- Date* GetNullDate();
- /// Return the standard decimal precision
+ /// Whether nFIndex is a special builtin format
+ BOOL IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge );
+-
+- /// Return the reference date
+- Date* GetNullDate();
+- /// Return the standard decimal precision
- short GetStandardPrec();
+- /// Return whether zero suppression is switched on
+- BOOL GetNoZero() { return bNoZero; }
+- /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
++ /// Return the reference date
++ Date* GetNullDate();
++ /// Return the standard decimal precision
+ sal_uInt16 GetStandardPrec();
- /// Return whether zero suppression is switched on
- BOOL GetNoZero() { return bNoZero; }
- /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
++ /// Return whether zero suppression is switched on
++ BOOL GetNoZero() { return bNoZero; }
++ /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
+ but with NUMBERFORMAT_DEFINED masked out */
+ short GetType(sal_uInt32 nFIndex);
+
diff --git svtools/inc/svtools/zformat.hxx svtools/inc/svtools/zformat.hxx
index 4c52b10..8158524 100644
--- svtools/inc/svtools/zformat.hxx
@@ -49,7 +73,7 @@ index 4c52b10..8158524 100644
SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString );
diff --git svtools/source/numbers/zforlist.cxx svtools/source/numbers/zforlist.cxx
-index 4b13774..85807ce 100644
+index 4b13774..703a8d1 100644
--- svtools/source/numbers/zforlist.cxx
+++ svtools/source/numbers/zforlist.cxx
@@ -70,6 +70,7 @@
@@ -60,44 +84,114 @@ index 4b13774..85807ce 100644
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-@@ -192,6 +193,8 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* );
+@@ -190,11 +191,15 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* );
+ #define NF_BANKSYMBOL_FIX_POSITION 1
+
++
/***********************Funktionen SvNumberFormatter**************************/
-+const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
++const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
++const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits<sal_uInt16>::max()-1;
+
SvNumberFormatter::SvNumberFormatter(
- const Reference< XMultiServiceFactory >& xSMgr,
- LanguageType eLang )
-@@ -352,7 +355,7 @@ void SvNumberFormatter::ChangeStandardPrec(short nPrec)
- pFormatScanner->ChangeStandardPrec(nPrec);
+- const Reference< XMultiServiceFactory >& xSMgr,
+- LanguageType eLang )
++ const Reference< XMultiServiceFactory >& xSMgr,
++ LanguageType eLang )
+ :
+ xServiceManager( xSMgr )
+ {
+@@ -349,14 +354,13 @@ Date* SvNumberFormatter::GetNullDate()
+
+ void SvNumberFormatter::ChangeStandardPrec(short nPrec)
+ {
+- pFormatScanner->ChangeStandardPrec(nPrec);
++ pFormatScanner->ChangeStandardPrec(nPrec);
}
-short SvNumberFormatter::GetStandardPrec()
+sal_uInt16 SvNumberFormatter::GetStandardPrec()
{
- return pFormatScanner->GetStandardPrec();
+- return pFormatScanner->GetStandardPrec();
++ return pFormatScanner->GetStandardPrec();
}
-@@ -1508,7 +1511,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
- eType = NUMBERFORMAT_NUMBER;
- nOldPrec = pFormatScanner->GetStandardPrec();
+-
+ void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 )
+ {
+ if (eLnge == LANGUAGE_DONTKNOW)
+@@ -1486,32 +1490,32 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIn
+
+ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
+ sal_uInt32 nFIndex,
+- String& sOutString)
++ String& sOutString)
+ {
+- SvNumberformat* pFormat;
+- short nOldPrec;
+- Color* pColor;
+- pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+- if (!pFormat)
++ SvNumberformat* pFormat;
++ Color* pColor;
++ pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
++ if (!pFormat)
+ pFormat = aFTable.Get(ZF_STANDARD);
+ LanguageType eLang = pFormat->GetLanguage();
+ ChangeIntl( eLang );
+- short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
+- if (eType == 0)
+- eType = NUMBERFORMAT_DEFINED;
+- nOldPrec = -1;
+- if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
+- || eType == NUMBERFORMAT_CURRENCY
+- || eType == NUMBERFORMAT_SCIENTIFIC
++ short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
++ if (eType == 0)
++ eType = NUMBERFORMAT_DEFINED;
++ sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
++ bool bPrecChanged = false;
++ if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
++ || eType == NUMBERFORMAT_CURRENCY
++ || eType == NUMBERFORMAT_SCIENTIFIC
+ || eType == NUMBERFORMAT_FRACTION)
+- {
+- if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
+- eType = NUMBERFORMAT_NUMBER;
+- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
-+ ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert
- }
- sal_uInt32 nKey = nFIndex;
- switch ( eType )
-@@ -1529,7 +1532,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
+- }
+- sal_uInt32 nKey = nFIndex;
+- switch ( eType )
++ {
++ if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
++ eType = NUMBERFORMAT_NUMBER;
++ ChangeStandardPrec(INPUTSTRING_PRECISION);
++ bPrecChanged = true;
++ }
++ sal_uInt32 nKey = nFIndex;
++ switch ( eType )
+ { // #61619# immer vierstelliges Jahr editieren
+ case NUMBERFORMAT_DATE :
+ nKey = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang );
+@@ -1528,12 +1532,12 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
+ {
if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
{
- nOldPrec = pFormatScanner->GetStandardPrec();
+- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
-+ ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert
++ ChangeStandardPrec(INPUTSTRING_PRECISION);
++ bPrecChanged = true;
}
pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
}
+- if (nOldPrec != -1)
++ if (bPrecChanged)
+ ChangeStandardPrec(nOldPrec);
+ }
+
diff --git svtools/source/numbers/zformat.cxx svtools/source/numbers/zformat.cxx
-index 368fb16..2be8168 100644
+index 368fb16..37233de 100644
--- svtools/source/numbers/zformat.cxx
+++ svtools/source/numbers/zformat.cxx
@@ -57,6 +57,9 @@
@@ -110,17 +204,18 @@ index 368fb16..2be8168 100644
using namespace svt;
namespace {
-@@ -66,6 +69,9 @@ struct Gregorian
+@@ -66,6 +69,10 @@ struct Gregorian
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian"));
}
};
+
+const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary...
++const double EXP_LOWER_BOUND = 1.0E-4; // prefer scientific notation below this value.
+
}
const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0
-@@ -1777,47 +1783,62 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const
+@@ -1777,47 +1784,62 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const
void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
{
@@ -214,7 +309,7 @@ index 368fb16..2be8168 100644
}
void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString)
-@@ -1958,6 +1979,65 @@ ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y)
+@@ -1958,6 +1980,71 @@ ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y)
}
}
@@ -251,6 +346,12 @@ index 368fb16..2be8168 100644
+ if (bSign)
+ fTestNum = -fTestNum;
+
++ if (fTestNum < EXP_LOWER_BOUND)
++ {
++ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
++ return true;
++ }
++
+ double fExp = log10(fTestNum);
+ // Values < 1.0 always have one digit before the decimal point.
+ sal_uInt16 nDigitPre = fExp >= 0.0 ? static_cast<sal_uInt16>(ceil(fExp)) : 1;
@@ -280,56 +381,128 @@ index 368fb16..2be8168 100644
BOOL SvNumberformat::GetOutputString(double fNumber,
String& OutString,
Color** ppColor)
-@@ -1981,7 +2058,7 @@ BOOL SvNumberformat::GetOutputString(double fNumber,
+@@ -1981,16 +2068,43 @@ BOOL SvNumberformat::GetOutputString(double fNumber,
BOOL bHadStandard = FALSE;
if (bStandard) // einzelne Standardformate
{
- if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine
-+ if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) // alle Zahlformate InputLine
++ if (rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION) // alle Zahlformate InputLine
{
ImpGetOutputInputLine(fNumber, OutString);
- return FALSE;
+- return FALSE;
++ return false;
+ }
+ switch (eType)
+ {
+ case NUMBERFORMAT_NUMBER: // Standardzahlformat
++ {
++ if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION)
++ {
++ bool bSign = ::rtl::math::isSignBitSet(fNumber);
++ if (bSign)
++ fNumber = -fNumber;
++ ImpGetOutputInputLine(fNumber, OutString);
++ if (fNumber < EXP_LOWER_BOUND)
++ {
++ xub_StrLen nLen = OutString.Len();
++ if (!nLen)
++ return false;
++
++ if (nLen > 11)
++ {
++ sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
++ nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals
++ OutString = ::rtl::math::doubleToUString( fNumber,
++ rtl_math_StringFormat_E, nStandardPrec /*2*/,
++ GetFormatter().GetNumDecimalSep().GetChar(0), true);
++ }
++ }
++ if (bSign)
++ OutString.Insert('-', 0);
++ return false;
++ }
+ ImpGetOutputStandard(fNumber, OutString);
+ bHadStandard = TRUE;
++ }
+ break;
+ case NUMBERFORMAT_DATE:
+ bRes |= ImpGetDateOutput(fNumber, 0, OutString);
diff --git svtools/source/numbers/zforscan.cxx svtools/source/numbers/zforscan.cxx
-index ab780cd..7bd764e 100644
+index ab780cd..119d292 100644
--- svtools/source/numbers/zforscan.cxx
+++ svtools/source/numbers/zforscan.cxx
-@@ -468,7 +468,7 @@ void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nY
- pNullDate = new Date(nDay, nMonth, nYear);
+@@ -465,14 +465,13 @@ void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nY
+ if ( pNullDate )
+ *pNullDate = Date(nDay, nMonth, nYear);
+ else
+- pNullDate = new Date(nDay, nMonth, nYear);
++ pNullDate = new Date(nDay, nMonth, nYear);
}
-void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec)
+void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)
{
- nStandardPrec = nPrec;
+- nStandardPrec = nPrec;
++ nStandardPrec = nPrec;
}
+-
+ Color* ImpSvNumberformatScan::GetColor(String& sStr)
+ {
+ String sString = pFormatter->GetCharClass()->upper(sStr);
diff --git svtools/source/numbers/zforscan.hxx svtools/source/numbers/zforscan.hxx
-index df243f1..6a69675 100644
+index df243f1..cd3f13e 100644
--- svtools/source/numbers/zforscan.hxx
+++ svtools/source/numbers/zforscan.hxx
-@@ -57,7 +57,7 @@ public:
+@@ -55,11 +55,12 @@ public:
+ ~ImpSvNumberformatScan();
+ void ChangeIntl(); // tauscht Keywords aus
- void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
- // tauscht Referenzdatum aus
+- void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
+- // tauscht Referenzdatum aus
- void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus
-+ void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus
- xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
+- xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
++ void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
++ // tauscht Referenzdatum aus
++ void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus
++
++ xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
-@@ -96,7 +96,7 @@ public:
+ void CopyInfo(ImpSvNumberformatInfo* pInfo,
+ USHORT nAnz); // Kopiert die FormatInfo
+@@ -96,11 +97,10 @@ public:
InitKeywords();
return sNameStandardFormat;
}
- short GetStandardPrec() const { return nStandardPrec; }
+- const Color& GetRedColor() const { return StandardColor[4]; }
+- Color* GetColor(String& sStr); // Setzt Hauptfarben oder
+- // definierte Farben
+-
+ sal_uInt16 GetStandardPrec() const { return nStandardPrec; }
- const Color& GetRedColor() const { return StandardColor[4]; }
- Color* GetColor(String& sStr); // Setzt Hauptfarben oder
- // definierte Farben
-@@ -161,7 +161,7 @@ private: // ---- privater Teil
- // Array der Standardfarben
- Date* pNullDate; // 30Dec1899
- String sNameStandardFormat; // "Standard"
++ const Color& GetRedColor() const { return StandardColor[4]; }
++ Color* GetColor(String& sStr); // Setzt Hauptfarben oder
++ // definierte Farben
+ // the compatibility currency symbol for old automatic currency formats
+ const String& GetCurSymbol() const
+ {
+@@ -158,13 +158,13 @@ public:
+ private: // ---- privater Teil
+ NfKeywordTable sKeyword; // Schluesselworte der Syntax
+ Color StandardColor[NF_MAX_DEFAULT_COLORS];
+- // Array der Standardfarben
+- Date* pNullDate; // 30Dec1899
+- String sNameStandardFormat; // "Standard"
- short nStandardPrec; // default Precision fuer Standardformat (2)
+- SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
++ // Array der Standardfarben
++ Date* pNullDate; // 30Dec1899
++ String sNameStandardFormat; // "Standard"
+ sal_uInt16 nStandardPrec; // default Precision for Standardformat
- SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
++ SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
- String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
+- String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
++ String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
+ short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Infos
+ // externe Infos:
+ USHORT nAnzResStrings; // Anzahl der Ergebnissymbole
More information about the ooo-build-commit
mailing list