Commit 73645f83 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 24745 - Изменение стиля текста в Merge ячейке с большим количеством...

Bug 24745 - Изменение стиля текста в Merge ячейке с большим количеством пробелов не осуществляется и вызывает ошибку в консоли

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56667 954022d7-b5bf-4e40-9824-e11837661b57
parent 9f7d0334
...@@ -2756,14 +2756,8 @@ CCellValue.prototype = ...@@ -2756,14 +2756,8 @@ CCellValue.prototype =
{ {
if(null != this.number || (null != this.text && "" != this.text)) if(null != this.number || (null != this.text && "" != this.text))
return false; return false;
if(null != this.multiText) if(null != this.multiText && "" != this.getStringFromMultiText())
{ return false;
var sText = "";
for(var i = 0, length = this.multiText.length; i < length; ++i)
sText += this.multiText[i].text;
if("" != sText)
return false;
}
return true; return true;
}, },
isEqual : function(val) isEqual : function(val)
...@@ -2822,16 +2816,24 @@ CCellValue.prototype = ...@@ -2822,16 +2816,24 @@ CCellValue.prototype =
this.textValueForEdit = null; this.textValueForEdit = null;
this.textValueForEdit2 = null; this.textValueForEdit2 = null;
}, },
getStringFromMultiText: function () {
var sRes = "";
if (null != this.multiText) {
for (var i = 0, length = this.multiText.length; i < length; ++i) {
var elem = this.multiText[i];
if (null != elem.text)
sRes += elem.text;
}
}
return sRes;
},
makeSimpleText : function() makeSimpleText : function()
{ {
var bRes = false; var bRes = false;
if(null != this.multiText) if(null != this.multiText)
{ {
var sRes = ""; this.text = this.getStringFromMultiText();
for(var i = 0, length = this.multiText.length; i < length; ++i) this.multiText = null;
sRes += this.multiText[i].text;
this.multiText = null;
this.text = sRes;
bRes = true; bRes = true;
} }
return bRes; return bRes;
...@@ -2850,11 +2852,7 @@ CCellValue.prototype = ...@@ -2850,11 +2852,7 @@ CCellValue.prototype =
else if(null != this.text) else if(null != this.text)
sResult = this.text; sResult = this.text;
else if(null != this.multiText) else if(null != this.multiText)
{ sResult = this.getStringFromMultiText();
for(var i = 0, length = this.multiText.length; i < length; i++){
sResult += this.multiText[i].text;
}
}
return sResult; return sResult;
}, },
getValue : function() getValue : function()
...@@ -2925,9 +2923,7 @@ CCellValue.prototype = ...@@ -2925,9 +2923,7 @@ CCellValue.prototype =
sText = null; sText = null;
} }
else if (null != this.multiText) { else if (null != this.multiText) {
var sSimpleString = ""; var sSimpleString = this.getStringFromMultiText();
for (var i = 0, length = this.multiText.length; i < length; ++i)
sSimpleString += this.multiText[i].text;
aText = oNumFormat.format(sSimpleString, this.type, dDigitsCount, oAdditionalResult); aText = oNumFormat.format(sSimpleString, this.type, dDigitsCount, oAdditionalResult);
sText = null; sText = null;
} }
...@@ -3337,22 +3333,35 @@ CCellValue.prototype = ...@@ -3337,22 +3333,35 @@ CCellValue.prototype =
bSetCellFont = true; bSetCellFont = true;
if(null != this.multiText && this.multiText.length > 0) if(null != this.multiText && this.multiText.length > 0)
{ {
var aVal = this.multiText; var range = this.cell.ws.getCell3(this.cell.oId.getRow0(), this.cell.oId.getCol0());
var oIntersectFont = aVal[0].format.clone(); var cellFont = range.getFont();
for(var i = 1, length = aVal.length; i < length; i++) var oIntersectFont;
oIntersectFont.intersect(aVal[i].format, g_oDefaultFont); for (var i = 0, length = this.multiText.length; i < length; i++) {
var elem = this.multiText[i];
if (null != elem.format) {
if (null == oIntersectFont)
oIntersectFont = elem.format.clone();
oIntersectFont.intersect(elem.format, cellFont);
}
else {
oIntersectFont = cellFont.clone();
break;
}
}
if(bSetCellFont) if(bSetCellFont)
{ {
if(oIntersectFont.isEqual(g_oDefaultFont)) if (oIntersectFont.isEqual(cellFont))
this.cell.setFont(null, false); this.cell.setFont(null, false);
else else
this.cell.setFont(oIntersectFont, false); this.cell.setFont(oIntersectFont, false);
} }
//если у всех элементов один формат, то сохраняем только текст //если у всех элементов один формат, то сохраняем только текст
var bIsEqual = true; var bIsEqual = true;
for(var i = 0, length = aVal.length; i < length; i++) for (var i = 0, length = this.multiText.length; i < length; i++)
{ {
if(false == oIntersectFont.isEqual(aVal[i].format)) var elem = this.multiText[i];
if (null != elem.format && false == oIntersectFont.isEqual(elem.format))
{ {
bIsEqual = false; bIsEqual = false;
break; break;
...@@ -3375,7 +3384,8 @@ CCellValue.prototype = ...@@ -3375,7 +3384,8 @@ CCellValue.prototype =
var bChange = false; var bChange = false;
for(var i = 0, length = this.multiText.length; i < length; ++i) for(var i = 0, length = this.multiText.length; i < length; ++i)
{ {
if(true == fCheck(this.multiText[i].format)) var elem = this.multiText[i];
if (null != elem.format && true == fCheck(elem.format))
{ {
bChange = true; bChange = true;
break; break;
...@@ -3384,8 +3394,11 @@ CCellValue.prototype = ...@@ -3384,8 +3394,11 @@ CCellValue.prototype =
if(bChange) if(bChange)
{ {
var backupObj = this.cell.getValueData(); var backupObj = this.cell.getValueData();
for(var i = 0, length = this.multiText.length; i < length; ++i) for (var i = 0, length = this.multiText.length; i < length; ++i) {
fAction(this.multiText[i].format); var elem = this.multiText[i];
if (null != elem.format)
fAction(elem.format)
}
//пробуем преобразовать в простую строку //пробуем преобразовать в простую строку
var cell = this.cell; var cell = this.cell;
if(this.miminizeMultiText(false)) if(this.miminizeMultiText(false))
......
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