Commit 1d9782b1 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug #31035

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66582 954022d7-b5bf-4e40-9824-e11837661b57
parent 312f21ef
......@@ -4226,17 +4226,19 @@
}
};
WorksheetView.prototype._addCellTextToCache = function (col, row, canChangeColWidth) {
WorksheetView.prototype._addCellTextToCache = function(col, row, canChangeColWidth) {
var self = this;
function makeFnIsGoodNumFormat(flags, width) {
return function (str) {
return function(str) {
return self.stringRender.measureString(str, flags, width).width <= width;
};
}
var c = this._getCell(col, row);
if (null === c) {return col;}
if (null === c) {
return col;
}
var bUpdateScrollX = false;
var bUpdateScrollY = false;
......@@ -4264,11 +4266,15 @@
var fMergedColumns = false; // Замержены ли колонки (если да, то автоподбор ширины не должен работать)
var fMergedRows = false; // Замержены ли строки (если да, то автоподбор высоты не должен работать)
if (null !== mc) {
if (col !== mc.c1 || row !== mc.r1) {return mc.c2;} // skip other merged cell from range
if (mc.c1 !== mc.c2)
if (col !== mc.c1 || row !== mc.r1) {
return mc.c2;
} // skip other merged cell from range
if (mc.c1 !== mc.c2) {
fMergedColumns = true;
if (mc.r1 !== mc.r2)
}
if (mc.r1 !== mc.r2) {
fMergedRows = true;
}
isMerged = true;
}
......@@ -4297,12 +4303,12 @@
var pad = this.width_padding * 2 + this.width_1px;
var sstr, sfl, stm;
if (!this.cols[col].isCustomWidth && fl.isNumberFormat && !fMergedColumns &&
(c_oAscCanChangeColWidth.numbers === canChangeColWidth ||
c_oAscCanChangeColWidth.all === canChangeColWidth)) {
if (!this.cols[col].isCustomWidth && fl.isNumberFormat && !fMergedColumns && (c_oAscCanChangeColWidth.numbers === canChangeColWidth || c_oAscCanChangeColWidth.all === canChangeColWidth)) {
colWidth = this.cols[col].innerWidth;
// Измеряем целую часть числа
sstr = c.getValue2(gc_nMaxDigCountView, function(){return true;});
sstr = c.getValue2(gc_nMaxDigCountView, function() {
return true;
});
if ("General" === numFormatStr && c_oAscCanChangeColWidth.all !== canChangeColWidth) {
// asc.truncFracPart изменяет исходный массив, поэтому клонируем
var fragmentsTmp = [];
......@@ -4312,9 +4318,11 @@
}
sfl = fl.clone();
sfl.wrapText = false;
stm = this._roundTextMetrics( this.stringRender.measureString(sstr, sfl, colWidth) );
stm = this._roundTextMetrics(this.stringRender.measureString(sstr, sfl, colWidth));
// Если целая часть числа не убирается в ячейку, то расширяем столбец
if (stm.width > colWidth) {this._changeColWidth(col, stm.width, pad);}
if (stm.width > colWidth) {
this._changeColWidth(col, stm.width, pad);
}
// Обновленная ячейка
dDigitsCount = this.cols[col].charCount;
colWidth = this.cols[col].innerWidth;
......@@ -4323,10 +4331,11 @@
dDigitsCount = this.cols[col].charCount;
colWidth = this.cols[col].innerWidth;
// подбираем ширину
if (!this.cols[col].isCustomWidth && !fMergedColumns && !fl.wrapText &&
c_oAscCanChangeColWidth.all === canChangeColWidth) {
sstr = c.getValue2(gc_nMaxDigCountView, function(){return true;});
stm = this._roundTextMetrics( this.stringRender.measureString(sstr, fl, colWidth) );
if (!this.cols[col].isCustomWidth && !fMergedColumns && !fl.wrapText && c_oAscCanChangeColWidth.all === canChangeColWidth) {
sstr = c.getValue2(gc_nMaxDigCountView, function() {
return true;
});
stm = this._roundTextMetrics(this.stringRender.measureString(sstr, fl, colWidth));
if (stm.width > colWidth) {
this._changeColWidth(col, stm.width, pad);
// Обновленная ячейка
......@@ -4348,9 +4357,8 @@
var ha = c.getAlignHorizontalByValue().toLowerCase();
var va = c.getAlignVertical().toLowerCase();
var maxW = fl.wrapText || fl.shrinkToFit || isMerged || asc.isFixedWidthCell(str) ? this._calcMaxWidth(col, row, mc) : undefined;
tm = this._roundTextMetrics( this.stringRender.measureString(str, fl, maxW) );
var cto = (isMerged || fl.wrapText) ?
{
tm = this._roundTextMetrics(this.stringRender.measureString(str, fl, maxW));
var cto = (isMerged || fl.wrapText) ? {
maxWidth: maxW - this.cols[col].innerWidth + this.cols[col].width,
leftSide: 0,
rightSide: 0
......@@ -4401,24 +4409,24 @@
}
this._fetchCellCache(col, row).text = {
state : this.stringRender.getInternalState(),
flags : fl,
color : (oFontColor || this.settings.cells.defaultState.color),
metrics : tm,
cellW : cto.maxWidth,
cellHA : ha,
cellVA : va,
sideL : cto.leftSide,
sideR : cto.rightSide,
cellType : cellType,
isFormula : c.isFormula(),
angle : angle,
textBound : textBound
state: this.stringRender.getInternalState(),
flags: fl,
color: (oFontColor || this.settings.cells.defaultState.color),
metrics: tm,
cellW: cto.maxWidth,
cellHA: ha,
cellVA: va,
sideL: cto.leftSide,
sideR: cto.rightSide,
cellType: cellType,
isFormula: c.isFormula(),
angle: angle,
textBound: textBound
};
this._fetchCellCacheText(col, row).hasText = true;
if (cto.leftSide !== 0 || cto.rightSide !== 0) {
if (!angle && (cto.leftSide !== 0 || cto.rightSide !== 0)) {
this._addErasedBordersToCache(col - cto.leftSide, col + cto.rightSide, row);
}
......
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