merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0180-calc-general-type-auto-decimal-svtools.diff
bloba0c01111c122536926c829d14156308274af4a8d
1 diff --git svtools/inc/svtools/zforlist.hxx svtools/inc/svtools/zforlist.hxx
2 index bb4a589..069930e 100644
3 --- svtools/inc/svtools/zforlist.hxx
4 +++ svtools/inc/svtools/zforlist.hxx
5 @@ -492,11 +492,16 @@ public:
6 void GetOutputString( String& sString, sal_uInt32 nFIndex,
7 String& sOutString, Color** ppColor );
9 + void GetStringColor( sal_uInt32 nFIndex, Color** ppColor );
11 /** Format a number according to the standard default format matching
12 the given format index */
13 void GetInputLineString( const double& fOutNumber,
14 sal_uInt32 nFIndex, String& sOutString );
16 + void GetInputLineString( const double& fOutNumber,
17 + sal_uInt32 nFIndex, String& sOutString, Color** ppColor );
19 /** Format a number according to a format code string to be scanned.
20 @return
21 <FALSE/> if format code contains an error
22 diff --git svtools/inc/svtools/zformat.hxx svtools/inc/svtools/zformat.hxx
23 index 4c52b10..d502bb6 100644
24 --- svtools/inc/svtools/zformat.hxx
25 +++ svtools/inc/svtools/zformat.hxx
26 @@ -241,6 +241,7 @@ public:
28 BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor );
29 BOOL GetOutputString( String& sString, String& OutString, Color** ppColor );
30 + void GetStringColor( Color** ppColor );
32 // True if type text
33 BOOL IsTextFormat() const { return (eType & NUMBERFORMAT_TEXT) != 0; }
34 diff --git svtools/source/numbers/zforlist.cxx svtools/source/numbers/zforlist.cxx
35 index 4b13774..ceedb05 100644
36 --- svtools/source/numbers/zforlist.cxx
37 +++ svtools/source/numbers/zforlist.cxx
38 @@ -1488,9 +1488,16 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
39 sal_uInt32 nFIndex,
40 String& sOutString)
42 + Color* pColor;
43 + GetInputLineString(fOutNumber, nFIndex, sOutString, &pColor);
46 +void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
47 + sal_uInt32 nFIndex,
48 + String& sOutString, Color** ppColor)
50 SvNumberformat* pFormat;
51 short nOldPrec;
52 - Color* pColor;
53 pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
54 if (!pFormat)
55 pFormat = aFTable.Get(ZF_STANDARD);
56 @@ -1531,7 +1538,13 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
57 nOldPrec = pFormatScanner->GetStandardPrec();
58 ChangeStandardPrec(300); // Merkwert
60 - pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
61 + if (ppColor)
62 + pFormat->GetOutputString(fOutNumber, sOutString, ppColor);
63 + else
64 + {
65 + Color* pColor; // throw away the color info.
66 + pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
67 + }
69 if (nOldPrec != -1)
70 ChangeStandardPrec(nOldPrec);
71 @@ -1574,6 +1587,21 @@ void SvNumberFormatter::GetOutputString(String& sString,
75 +void SvNumberFormatter::GetStringColor( sal_uInt32 nFIndex, Color** ppColor)
77 + if (!ppColor)
78 + return;
80 + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
81 + if (!pFormat)
82 + pFormat = aFTable.Get(ZF_STANDARD_TEXT);
84 + if (pFormat->IsTextFormat() || pFormat->HasTextFormat())
85 + pFormat->GetStringColor(ppColor);
86 + else
87 + *ppColor = NULL;
90 BOOL SvNumberFormatter::GetPreviewString(const String& sFormatString,
91 double fPreviewNumber,
92 String& sOutString,
93 diff --git svtools/source/numbers/zformat.cxx svtools/source/numbers/zformat.cxx
94 index 368fb16..65c0592 100644
95 --- svtools/source/numbers/zformat.cxx
96 +++ svtools/source/numbers/zformat.cxx
97 @@ -1915,6 +1915,25 @@ BOOL SvNumberformat::GetOutputString(String& sString,
99 return FALSE;
102 +void SvNumberformat::GetStringColor( Color** ppColor )
104 + if (!ppColor)
105 + return;
107 + USHORT nIx;
108 + if (eType & NUMBERFORMAT_TEXT)
109 + nIx = 0;
110 + else if (NumFor[3].GetnAnz() > 0)
111 + nIx = 3;
112 + else
114 + *ppColor = NULL; // no change of color
115 + return;
117 + *ppColor = NumFor[nIx].GetColor();
121 void SvNumberformat::GetNextFareyNumber(ULONG nPrec, ULONG x0, ULONG x1,
122 ULONG y0, ULONG y1,