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,46 +7291,48 @@ Range.prototype._canPromote=function(from, to, bIsPromote, nWidth, nHeight, bVer ...@@ -7291,46 +7291,48 @@ 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 nIndex = 1;
//проверяем можно ли осуществить promote
var oCanPromote = this._canPromote(from, to, false, 1, 1, bVertical, nIndex);
if(null != oCanPromote)
{
History.Create_NewPoint();
var oSelection = History.GetSelection();
if(null != oSelection)
{ {
var bVertical = true; oSelection = oSelection.clone();
var nIndex = 1; oSelection.assign(from.c1, from.r1, from.c2, from.r2);
//проверяем можно ли осуществить promote History.SetSelection(oSelection);
var oCanPromote = this._canPromote(from, to, false, 1, 1, bVertical, nIndex); }
if(null != oCanPromote) var oSelectionRedo = History.GetSelectionRedo();
{ if(null != oSelectionRedo)
History.Create_NewPoint(); {
var oSelection = History.GetSelection(); oSelectionRedo = oSelectionRedo.clone();
if(null != oSelection) oSelectionRedo.assign(to.c1, to.r1, to.c2, to.r2);
{ History.SetSelectionRedo(oSelectionRedo);
oSelection = oSelection.clone();
oSelection.assign(from.c1, from.r1, from.c2, from.r2);
History.SetSelection(oSelection);
}
var oSelectionRedo = History.GetSelectionRedo();
if(null != oSelectionRedo)
{
oSelectionRedo = oSelectionRedo.clone();
oSelectionRedo.assign(to.c1, to.r1, to.c2, to.r2);
History.SetSelectionRedo(oSelectionRedo);
}
//удаляем merge ячейки в to(после _canPromote должны остаться только inner)
this.worksheet.mergeManager.remove(to, true);
this._promoteFromTo(from, to, false, oCanPromote, false, bVertical, nIndex);
}
} }
//удаляем merge ячейки в to(после _canPromote должны остаться только inner)
this.worksheet.mergeManager.remove(to, true);
this._promoteFromTo(from, to, false, oCanPromote, false, bVertical, nIndex);
} }
}; };
Range.prototype.promote=function(bCtrl, bVertical, nIndex){ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
......
...@@ -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