Commit 89f9b951 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Заглушка для chart и NumFormat "Основной".

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55943 954022d7-b5bf-4e40-9824-e11837661b57
parent 2fa135ae
...@@ -736,7 +736,7 @@ CDLbl.prototype = ...@@ -736,7 +736,7 @@ CDLbl.prototype =
if(compiled_string.length > 0) if(compiled_string.length > 0)
compiled_string += separator; compiled_string += separator;
var num_format = oNumFormatCache.get(this.series.getFormatCode()); var num_format = oNumFormatCache.get(this.series.getFormatCode());
compiled_string += num_format.format(this.series.getValByIndex(this.pt.idx), CellValueType.Number, 15)[0].text; compiled_string += num_format.format(this.series.getValByIndex(this.pt.idx), CellValueType.Number, gc_nMaxDigCount, null, true)[0].text;
} }
if(this.showPercent) if(this.showPercent)
{ {
......
...@@ -687,7 +687,7 @@ CChartSpace.prototype = ...@@ -687,7 +687,7 @@ CChartSpace.prototype =
for(i = 0; i < arr_val.length; ++i) for(i = 0; i < arr_val.length; ++i)
{ {
var calc_value = arr_val[i]*multiplier; var calc_value = arr_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.Number, 15); var rich_value = num_format.format(calc_value, CellValueType.Number, gc_nMaxDigCount, null, true);
arr_strings.push(rich_value[0].text); arr_strings.push(rich_value[0].text);
} }
} }
...@@ -737,7 +737,7 @@ CChartSpace.prototype = ...@@ -737,7 +737,7 @@ CChartSpace.prototype =
for(i = 0; i < arr_x_val.length; ++i) for(i = 0; i < arr_x_val.length; ++i)
{ {
var calc_value = arr_x_val[i]*multiplier; var calc_value = arr_x_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.number, 15); var rich_value = num_format.format(calc_value, CellValueType.number, gc_nMaxDigCount, null, true);
string_pts.push({val:rich_value[0].text}); string_pts.push({val:rich_value[0].text});
} }
} }
...@@ -1335,7 +1335,7 @@ CChartSpace.prototype = ...@@ -1335,7 +1335,7 @@ CChartSpace.prototype =
for(i = 0; i < arr_val.length; ++i) for(i = 0; i < arr_val.length; ++i)
{ {
var calc_value = arr_val[i]*multiplier; var calc_value = arr_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.Number, 15); var rich_value = num_format.format(calc_value, CellValueType.Number, gc_nMaxDigCount, null, true);
arr_strings.push(rich_value[0].text); arr_strings.push(rich_value[0].text);
} }
} }
...@@ -2358,7 +2358,7 @@ CChartSpace.prototype = ...@@ -2358,7 +2358,7 @@ CChartSpace.prototype =
for(i = 0; i < arr_val.length; ++i) for(i = 0; i < arr_val.length; ++i)
{ {
var calc_value = arr_val[i]*multiplier; var calc_value = arr_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.number, 15); var rich_value = num_format.format(calc_value, CellValueType.number, gc_nMaxDigCount, null, true);
arr_strings.push(rich_value[0].text); arr_strings.push(rich_value[0].text);
} }
} }
...@@ -4343,7 +4343,7 @@ CChartSpace.prototype = ...@@ -4343,7 +4343,7 @@ CChartSpace.prototype =
for(i = 0; i < arr_val.length; ++i) for(i = 0; i < arr_val.length; ++i)
{ {
var calc_value = arr_val[i]*multiplier; var calc_value = arr_val[i]*multiplier;
var rich_value = num_format.format(calc_value, CellValueType.number, 15); var rich_value = num_format.format(calc_value, CellValueType.number, gc_nMaxDigCount, null, true);
arr_strings.push(rich_value[0].text); arr_strings.push(rich_value[0].text);
} }
} }
......
...@@ -245,6 +245,7 @@ function NumFormat(bAddMinusIfNes) ...@@ -245,6 +245,7 @@ function NumFormat(bAddMinusIfNes)
this.Color = -1; this.Color = -1;
this.ComporationOperator = null; this.ComporationOperator = null;
this.bGeneralChart = false;//если в формате только один текст(например в chart "Основной")
this.bGeneral = false;//Форматирование не задано this.bGeneral = false;//Форматирование не задано
this.bAddMinusIfNes = bAddMinusIfNes;//когда не задано форматирование для отрицательных чисел иногда надо вставлять минус this.bAddMinusIfNes = bAddMinusIfNes;//когда не задано форматирование для отрицательных чисел иногда надо вставлять минус
}; };
...@@ -355,9 +356,11 @@ NumFormat.prototype = ...@@ -355,9 +356,11 @@ NumFormat.prototype =
}, },
_parseFormat : function(format) _parseFormat : function(format)
{ {
this.bGeneralChart = true;
while(true) while(true)
{ {
var next = this._readChar(); var next = this._readChar();
var bNoFormat = false;
if(this.EOF == next) if(this.EOF == next)
break; break;
else if("[" == next) else if("[" == next)
...@@ -448,12 +451,15 @@ NumFormat.prototype = ...@@ -448,12 +451,15 @@ NumFormat.prototype =
{ {
this._addToFormat2(new FormatObjDateVal(numFormat_Second, 1, false)); this._addToFormat2(new FormatObjDateVal(numFormat_Second, 1, false));
} }
else if("A" == next || "a" == next) else if ("A" == next || "a" == next) {
{
this._ReadAmPm(next); this._ReadAmPm(next);
} }
else else {
bNoFormat = true;
this._addToFormat(numFormat_Text, next); this._addToFormat(numFormat_Text, next);
}
if (!bNoFormat)
this.bGeneralChart = false;
} }
return true; return true;
}, },
...@@ -1353,7 +1359,7 @@ NumFormat.prototype = ...@@ -1353,7 +1359,7 @@ NumFormat.prototype =
{ {
return (number == number - 0) && ((number < 0 && false == g_bDate1904) || number > 2958465.9999884); return (number == number - 0) && ((number < 0 && false == g_bDate1904) || number > 2958465.9999884);
}, },
format: function (number, nValType, dDigitsCount, oAdditionalResult, cultureInfo) format: function (number, nValType, dDigitsCount, oAdditionalResult, cultureInfo, bChart)
{ {
if (null == cultureInfo) if (null == cultureInfo)
cultureInfo = g_oDefaultCultureInfo; cultureInfo = g_oDefaultCultureInfo;
...@@ -1374,7 +1380,7 @@ NumFormat.prototype = ...@@ -1374,7 +1380,7 @@ NumFormat.prototype =
} }
} }
var oParsedNumber = this._parseNumber(number, this.aDecFormat, this.aFracFormat.length, nValType, cultureInfo); var oParsedNumber = this._parseNumber(number, this.aDecFormat, this.aFracFormat.length, nValType, cultureInfo);
if(true == this.bGeneral || (true == oParsedNumber.bDigit && true == this.bTextFormat) || (false == oParsedNumber.bDigit && false == this.bTextFormat)) if (true == this.bGeneral || (true == oParsedNumber.bDigit && true == this.bTextFormat) || (false == oParsedNumber.bDigit && false == this.bTextFormat) || (bChart && this.bGeneralChart))
{ {
//Строим подходящий general format //Строим подходящий general format
if(null != oAdditionalResult) if(null != oAdditionalResult)
...@@ -2139,26 +2145,38 @@ CellFormat.prototype = ...@@ -2139,26 +2145,38 @@ CellFormat.prototype =
} }
return oRes; return oRes;
}, },
format : function(number, nValType, dDigitsCount, oAdditionalResult) format : function(number, nValType, dDigitsCount, oAdditionalResult, bChart)
{ {
var res = null;
if (null == bChart)
bChart = false;
var cacheVal = this.formatCache[number]; var cacheVal = this.formatCache[number];
var cacheType = null;
var cacheRes = null;
if(null != cacheVal) if(null != cacheVal)
{ {
cacheVal = cacheVal[nValType]; cacheType = cacheVal[nValType];
if(null != cacheVal) if (null != cacheType)
{ {
cacheVal = cacheVal[dDigitsCount]; cacheRes = cacheType[dDigitsCount];
if(null != cacheVal) if (null != cacheRes) {
return cacheVal; if (bChart)
res = cacheRes.chart;
else
res = cacheRes.nochart;
if (null != res)
return res;
}
} }
} }
var res = [{text: number}]; res = [{text: number}];
var dNumber = number - 0; var dNumber = number - 0;
var oFormat = null;
if(CellValueType.String != nValType && number == dNumber) if(CellValueType.String != nValType && number == dNumber)
{ {
var oFormat = this.getFormatByValue(dNumber); oFormat = this.getFormatByValue(dNumber);
if(null != oFormat) if(null != oFormat)
res = oFormat.format(number, nValType, dDigitsCount, oAdditionalResult); res = oFormat.format(number, nValType, dDigitsCount, oAdditionalResult, null, bChart);
else if(null != this.aComporationFormats) else if(null != this.aComporationFormats)
{ {
var oNewFont = new NumFormatFont(); var oNewFont = new NumFormatFont();
...@@ -2169,22 +2187,35 @@ CellFormat.prototype = ...@@ -2169,22 +2187,35 @@ CellFormat.prototype =
else else
{ {
//text //text
if(null != this.oTextFormat) if (null != this.oTextFormat) {
res = this.oTextFormat.format(number, nValType, dDigitsCount, oAdditionalResult); oFormat = this.oTextFormat;
res = oFormat.format(number, nValType, dDigitsCount, oAdditionalResult, null, bChart);
}
} }
var cacheVal = this.formatCache[number];
if(null == cacheVal) if(null == cacheVal)
{ {
cacheVal = {}; cacheVal = {};
this.formatCache[number] = cacheVal; this.formatCache[number] = cacheVal;
} }
var cacheType = cacheVal[nValType];
if(null == cacheType) if(null == cacheType)
{ {
cacheType = {}; cacheType = {};
cacheVal[nValType] = cacheType; cacheVal[nValType] = cacheType;
} }
cacheType[dDigitsCount] = res; if (null == cacheRes) {
cacheRes = { chart: null, nochart: null };
cacheType[dDigitsCount] = cacheRes;
}
if (null != oFormat && oFormat.bGeneralChart) {
if (bChart)
cacheRes.chart = res;
else
cacheRes.nochart = res;
}
else {
cacheRes.chart = res;
cacheRes.nochart = res;
}
return res; return res;
}, },
shiftFormat : function(output, nShift) shiftFormat : function(output, nShift)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment