Commit 223522bc authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил баг http://bugzserver/show_bug.cgi?id=27008

Перед копированием стиля делаем подготовку (т.к. диапазон может увеличиться + обрабатываем ошибку перед lock-ом)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58821 954022d7-b5bf-4e40-9824-e11837661b57
parent ca0cbd82
...@@ -7291,20 +7291,24 @@ Range.prototype._canPromote=function(from, to, bIsPromote, nWidth, nHeight, bVer ...@@ -7291,20 +7291,24 @@ Range.prototype._canPromote=function(from, to, bIsPromote, nWidth, nHeight, bVer
} }
return oRes; return oRes;
}; };
Range.prototype.promoteFromTo=function(from, to){ // Подготовка Copy Style
if(to.isOneCell()) Range.prototype.preparePromoteFromTo = function (from, to) {
{ var bSuccess = true;
to = to.clone(); if (to.isOneCell())
to.setOffsetLast({offsetCol: (from.c2 - from.c1) - (to.c2 - to.c1), offsetRow: (from.r2 - from.r1) - (to.r2 - to.r1)}); to.setOffsetLast({offsetCol: (from.c2 - from.c1) - (to.c2 - to.c1), offsetRow: (from.r2 - from.r1) - (to.r2 - to.r1)});
}
if(!from.isIntersect(to)) if(!from.isIntersect(to)) {
{
var bFromWholeCol = (0 == from.c1 && gc_nMaxCol0 == from.c2); var bFromWholeCol = (0 == from.c1 && gc_nMaxCol0 == from.c2);
var bFromWholeRow = (0 == from.r1 && gc_nMaxRow0 == from.r2); var bFromWholeRow = (0 == from.r1 && gc_nMaxRow0 == from.r2);
var bToWholeCol = (0 == to.c1 && gc_nMaxCol0 == to.c2); var bToWholeCol = (0 == to.c1 && gc_nMaxCol0 == to.c2);
var bToWholeRow = (0 == to.r1 && gc_nMaxRow0 == to.r2); var bToWholeRow = (0 == to.r1 && gc_nMaxRow0 == to.r2);
if(((bFromWholeCol && bToWholeCol) == (bFromWholeCol || bToWholeCol)) && ((bFromWholeRow && bToWholeRow) == (bFromWholeRow || bToWholeRow))) bSuccess = (bFromWholeCol === bToWholeCol && bFromWholeRow === bToWholeRow);
{ } else
bSuccess = false;
return bSuccess;
};
// Перед promoteFromTo обязательно должна быть вызывана функция preparePromoteFromTo
Range.prototype.promoteFromTo=function(from, to){
var bVertical = true; var bVertical = true;
var nIndex = 1; var nIndex = 1;
//проверяем можно ли осуществить promote //проверяем можно ли осуществить promote
...@@ -7330,8 +7334,6 @@ Range.prototype.promoteFromTo=function(from, to){ ...@@ -7330,8 +7334,6 @@ Range.prototype.promoteFromTo=function(from, to){
this.worksheet.mergeManager.remove(to, true); this.worksheet.mergeManager.remove(to, true);
this._promoteFromTo(from, to, false, oCanPromote, false, bVertical, nIndex); this._promoteFromTo(from, to, false, oCanPromote, false, bVertical, nIndex);
} }
}
}
}; };
Range.prototype.promote=function(bCtrl, bVertical, nIndex){ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
//todo отдельный метод для promote в таблицах и merge в таблицах //todo отдельный метод для promote в таблицах и merge в таблицах
......
...@@ -4042,7 +4042,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -4042,7 +4042,7 @@ var gUndoInsDelCellsFlag = true;
_cleanStyleTable : function(aWs, sRef) _cleanStyleTable : function(aWs, sRef)
{ {
var oRange = new Range(aWs, sRef.r1, sRef.c1, sRef.r2, sRef.c2) var oRange = new Range(aWs, sRef.r1, sRef.c1, sRef.r2, sRef.c2);
oRange.setTableStyle(null); oRange.setTableStyle(null);
}, },
...@@ -6243,7 +6243,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -6243,7 +6243,7 @@ var gUndoInsDelCellsFlag = true;
if(tableParts) if(tableParts)
{ {
var ref = tableParts.Ref; var ref = tableParts.Ref;
this._setColorStyleTable(ref, tableParts) this._setColorStyleTable(ref, tableParts);
} }
}, },
......
...@@ -6952,13 +6952,13 @@ ...@@ -6952,13 +6952,13 @@
WorksheetView.prototype.applyFormatPainter = function () { WorksheetView.prototype.applyFormatPainter = function () {
var t = this; var t = this;
var from = t.copyActiveRange.getAllRange(), to = t.activeRange.getAllRange(); var from = t.copyActiveRange.getAllRange(), to = t.activeRange.getAllRange();
var oTmpRange = this._getRange(0, 0, 0, 0);
var onApplyFormatPainterCallback = function (isSuccess) { var onApplyFormatPainterCallback = function (isSuccess) {
// Очищаем выделение // Очищаем выделение
t.cleanSelection(); t.cleanSelection();
if (true === isSuccess) if (true === isSuccess)
t._getRange(0, 0, 0, 0).promoteFromTo(from, to); oTmpRange.promoteFromTo(from, to);
// Сбрасываем параметры // Сбрасываем параметры
t._updateCellsRange(t.activeRange, /*canChangeColWidth*/c_oAscCanChangeColWidth.none, /*lockDraw*/true); t._updateCellsRange(t.activeRange, /*canChangeColWidth*/c_oAscCanChangeColWidth.none, /*lockDraw*/true);
...@@ -6968,6 +6968,13 @@ ...@@ -6968,6 +6968,13 @@
t.draw(); t.draw();
}; };
var result = oTmpRange.preparePromoteFromTo(from, to);
if (!result) {
// ToDo вывести ошибку
onApplyFormatPainterCallback(false);
return;
}
this._isLockedCells (to, null, onApplyFormatPainterCallback); this._isLockedCells (to, null, onApplyFormatPainterCallback);
}; };
WorksheetView.prototype.formatPainter = function (stateFormatPainter) { WorksheetView.prototype.formatPainter = function (stateFormatPainter) {
......
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