Commit 528324dc authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

delete unused insColBefore, insColAfter, delCol, insRowBefore, insRowAfter, delRow

fix bug #29998

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64050 954022d7-b5bf-4e40-9824-e11837661b57
parent 15d01c82
......@@ -2458,18 +2458,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().changeWorksheet("colWidth", width);
};
spreadsheet_api.prototype.asc_insertColumnsBefore = function (count) {
this.wb.getWorksheet().changeWorksheet("insColBefore", count);
};
spreadsheet_api.prototype.asc_insertColumnsAfter = function (count){
this.wb.getWorksheet().changeWorksheet("insColAfter", count);
};
spreadsheet_api.prototype.asc_deleteColumns = function() {
this.wb.getWorksheet().changeWorksheet("delCol");
};
spreadsheet_api.prototype.asc_showColumns = function () {
this.wb.getWorksheet().changeWorksheet("showCols");
};
......@@ -2487,18 +2475,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().changeWorksheet("rowHeight", height);
};
spreadsheet_api.prototype.asc_insertRowsBefore = function(count) {
this.wb.getWorksheet().changeWorksheet("insRowBefore", count);
};
spreadsheet_api.prototype.asc_insertRowsAfter = function (count) {
this.wb.getWorksheet().changeWorksheet("insRowAfter", count);
};
spreadsheet_api.prototype.asc_deleteRows = function () {
this.wb.getWorksheet().changeWorksheet("delRow");
};
spreadsheet_api.prototype.asc_showRows = function () {
this.wb.getWorksheet().changeWorksheet("showRows");
};
......@@ -3813,16 +3789,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_getColumnWidth"] = prot.asc_getColumnWidth;
prot["asc_setColumnWidth"] = prot.asc_setColumnWidth;
prot["asc_insertColumnsBefore"] = prot.asc_insertColumnsBefore;
prot["asc_insertColumnsAfter"] = prot.asc_insertColumnsAfter;
prot["asc_deleteColumns"] = prot.asc_deleteColumns;
prot["asc_showColumns"] = prot.asc_showColumns;
prot["asc_hideColumns"] = prot.asc_hideColumns;
prot["asc_getRowHeight"] = prot.asc_getRowHeight;
prot["asc_setRowHeight"] = prot.asc_setRowHeight;
prot["asc_insertRowsBefore"] = prot.asc_insertRowsBefore;
prot["asc_insertRowsAfter"] = prot.asc_insertRowsAfter;
prot["asc_deleteRows"] = prot.asc_deleteRows;
prot["asc_showRows"] = prot.asc_showRows;
prot["asc_hideRows"] = prot.asc_hideRows;
prot["asc_insertCells"] = prot.asc_insertCells;
......
......@@ -611,22 +611,6 @@
case "mnuOpen":{
break;
}
case "mnuAddRowBelow":{
api.asc_insertRowsAfter(1)
break;
}
case "mnuAddRowAbove":{
api.asc_insertRowsBefore(1)
break;
}
case "mnuAddColumnLeft":{
api.asc_insertColumnsBefore(1)
break;
}
case "mnuAddColumnRight":{
api.asc_insertColumnsAfter(1)
break;
}
case "mnuSheetRename":{
$("#dialogRenameWS").dialog("open");
break;
......
......@@ -652,16 +652,16 @@ CCellCommentator.prototype.updateCommentsDependencies = function(bInsert, operTy
function updateCommentsList(aComments) {
if (aComments.length) {
t.bSaveHistory = false;
var changeArray = [];
var removeArray = [];
for (var i = 0; i < aComments.length; i++) {
if (aComments[i].bChange) {
t.bSaveHistory = false;
t.asc_changeComment(aComments[i].comment.asc_getId(), aComments[i].comment,
/*bChangeCoords*/true, /*bNoEvent*/true, /*bNoAscLock*/true, /*bNoDraw*/false);
changeArray.push({"Id": aComments[i].comment.asc_getId(), "Comment": aComments[i].comment});
t.bSaveHistory = true;
} else {
t.asc_removeComment(aComments[i].comment.asc_getId(), /*bNoEvent*/true,
/*bNoAscLock*/true, /*bNoDraw*/false);
......@@ -673,8 +673,6 @@ CCellCommentator.prototype.updateCommentsDependencies = function(bInsert, operTy
t.worksheet.model.workbook.handlers.trigger("asc_onChangeComments", changeArray);
if (removeArray.length)
t.worksheet.model.workbook.handlers.trigger("asc_onRemoveComments", removeArray);
t.bSaveHistory = true;
}
}
......
......@@ -7552,8 +7552,8 @@ Range.prototype.removeHyperlink = function (val, removeStyle) {
History.EndTransaction();
}
};
Range.prototype.deleteCellsShiftUp=function(){
return this._shiftUpDown(true);
Range.prototype.deleteCellsShiftUp=function(preDeleteAction){
return this._shiftUpDown(true, preDeleteAction);
};
Range.prototype.addCellsShiftBottom=function(){
return this._shiftUpDown(false);
......@@ -7561,19 +7561,26 @@ Range.prototype.addCellsShiftBottom=function(){
Range.prototype.addCellsShiftRight=function(){
return this._shiftLeftRight(false);
};
Range.prototype.deleteCellsShiftLeft=function(){
return this._shiftLeftRight(true);
Range.prototype.deleteCellsShiftLeft=function(preDeleteAction){
return this._shiftLeftRight(true, preDeleteAction);
};
Range.prototype._canShiftLeftRight=function(bLeft){
var aColsToDelete = [], aCellsToDelete = [];
var oBBox = this.bbox;
var nWidth = oBBox.c2 - oBBox.c1 + 1;
var nRangeType = this._getRangeType(oBBox);
if(c_oRangeType.Range != nRangeType && c_oRangeType.Col != nRangeType)
return false;
return null;
var nWidth = oBBox.c2 - oBBox.c1 + 1;
if(!bLeft && !this.worksheet.workbook.bUndoChanges && !this.worksheet.workbook.bRedoChanges){
var rangeEdge = this.worksheet.getRange3(oBBox.r1, gc_nMaxCol0 - nWidth + 1, oBBox.r2, gc_nMaxCol0);
var aColsToDelete = [];
var aCellsToDelete = [];
var aMerged = this.worksheet.mergeManager.get(rangeEdge.bbox);
if(aMerged.all.length > 0)
return null;
var aHyperlink = this.worksheet.hyperlinkManager.get(rangeEdge.bbox);
if(aHyperlink.all.length > 0)
return null;
var bError = rangeEdge._setPropertyNoEmpty(null, function(col){
if(null != col){
if(null != col && null != col.xfs && null != col.xfs.fill && null != col.xfs.fill.getRgbOrNull())
......@@ -7590,31 +7597,30 @@ Range.prototype._canShiftLeftRight=function(bLeft){
}
});
if(bError)
return null;
}
return {aColsToDelete: aColsToDelete, aCellsToDelete: aCellsToDelete};
};
Range.prototype._shiftLeftRight=function(bLeft, preDeleteAction){
var canShiftRes = this._canShiftLeftRight(bLeft);
if(null === canShiftRes)
return false;
var aMerged = this.worksheet.mergeManager.get(rangeEdge.bbox);
if(aMerged.all.length > 0)
return false;
var aHyperlink = this.worksheet.hyperlinkManager.get(rangeEdge.bbox);
if(aHyperlink.all.length > 0)
return false;
if (preDeleteAction)
preDeleteAction();
//удаляем крайние колонки и ячейки
for(var i = 0; i < aColsToDelete.length; ++i){
var col = aColsToDelete[i];
this.worksheet._removeCols(col.index, col.index);
}
for(var i = 0; i < aCellsToDelete.length; ++i){
var cell = aCellsToDelete[i];
this.worksheet._removeCell(null, null, cell);
var i, length, colIndex;
for(i = 0, length = canShiftRes.aColsToDelete.length; i < length; ++i){
colIndex = canShiftRes.aColsToDelete[i].index;
this.worksheet._removeCols(colIndex, colIndex);
}
}
return true;
};
Range.prototype._shiftLeftRight=function(bLeft){
for(i = 0, length = canShiftRes.aCellsToDelete.length; i < length; ++i)
this.worksheet._removeCell(null, null, canShiftRes.aCellsToDelete[i]);
var oBBox = this.bbox;
var nWidth = oBBox.c2 - oBBox.c1 + 1;
var nRangeType = this._getRangeType(oBBox);
if(!this._canShiftLeftRight(bLeft))
return false;
var mergeManager = this.worksheet.mergeManager;
lockDraw(this.worksheet.workbook);
//todo вставить предупреждение, что будет unmerge
......@@ -7629,7 +7635,7 @@ Range.prototype._shiftLeftRight=function(bLeft){
if(null != aMerged.outer && aMerged.outer.length > 0)
{
var bChanged = false;
for(var i = 0, length = aMerged.outer.length; i < length; i++)
for(i = 0, length = aMerged.outer.length; i < length; i++)
{
var elem = aMerged.outer[i];
if(!(elem.bbox.c1 < oShiftGet.bbox.c1 && oShiftGet.bbox.r1 <= elem.bbox.r1 && elem.bbox.r2 <= oShiftGet.bbox.r2))
......@@ -7671,18 +7677,25 @@ Range.prototype._shiftLeftRight=function(bLeft){
return true;
};
Range.prototype._canShiftUpDown=function(bUp){
var aRowsToDelete = [], aCellsToDelete = [];
var oBBox = this.bbox;
var nHeight = oBBox.r2 - oBBox.r1 + 1;
var nRangeType = this._getRangeType(oBBox);
if(c_oRangeType.Range != nRangeType && c_oRangeType.Row != nRangeType)
return false;
return null;
var nHeight = oBBox.r2 - oBBox.r1 + 1;
if(!bUp && !this.worksheet.workbook.bUndoChanges && !this.worksheet.workbook.bRedoChanges){
var rangeEdge = this.worksheet.getRange3(gc_nMaxRow0 - nHeight + 1, oBBox.c1, gc_nMaxRow0, oBBox.c2);
var aRowsToDelete = [];
var aCellsToDelete = [];
var aMerged = this.worksheet.mergeManager.get(rangeEdge.bbox);
if(aMerged.all.length > 0)
return null;
var aHyperlink = this.worksheet.hyperlinkManager.get(rangeEdge.bbox);
if(aHyperlink.all.length > 0)
return null;
var bError = rangeEdge._setPropertyNoEmpty(function(row){
if(null != row){
if(null != row && null != row.xfs && null != row.xfs.fill && null != row.xfs.fill.getRgbOrNull())
if(null != row.xfs && null != row.xfs.fill && null != row.xfs.fill.getRgbOrNull())
return true;
aRowsToDelete.push(row);
}
......@@ -7696,31 +7709,30 @@ Range.prototype._canShiftUpDown=function(bUp){
}
});
if(bError)
return null;
}
return {aRowsToDelete: aRowsToDelete, aCellsToDelete: aCellsToDelete};
};
Range.prototype._shiftUpDown = function (bUp, preDeleteAction) {
var canShiftRes = this._canShiftUpDown(bUp);
if(null === canShiftRes)
return false;
var aMerged = this.worksheet.mergeManager.get(rangeEdge.bbox);
if(aMerged.all.length > 0)
return false;
var aHyperlink = this.worksheet.hyperlinkManager.get(rangeEdge.bbox);
if(aHyperlink.all.length > 0)
return false;
if (preDeleteAction)
preDeleteAction();
//удаляем крайние колонки и ячейки
for(var i = 0; i < aRowsToDelete.length; ++i){
var row = aRowsToDelete[i];
this.worksheet._removeRows(row.index, row.index);
}
for(var i = 0; i < aCellsToDelete.length; ++i){
var cell = aCellsToDelete[i];
this.worksheet._removeCell(null, null, cell);
var i, length, rowIndex;
for(i = 0, length = canShiftRes.aRowsToDelete.length; i < length; ++i){
rowIndex = canShiftRes.aRowsToDelete[i].index;
this.worksheet._removeRows(rowIndex, rowIndex);
}
}
return true;
};
Range.prototype._shiftUpDown = function (bUp) {
for(i = 0, length = canShiftRes.aCellsToDelete.length; i < length; ++i)
this.worksheet._removeCell(null, null, canShiftRes.aCellsToDelete[i]);
var oBBox = this.bbox;
var nHeight = oBBox.r2 - oBBox.r1 + 1;
var nRangeType = this._getRangeType(oBBox);
if(!this._canShiftUpDown(bUp))
return false;
var mergeManager = this.worksheet.mergeManager;
lockDraw(this.worksheet.workbook);
//todo вставить предупреждение, что будет unmerge
......@@ -7735,7 +7747,7 @@ Range.prototype._shiftUpDown = function (bUp) {
if(null != aMerged.outer && aMerged.outer.length > 0)
{
var bChanged = false;
for(var i = 0, length = aMerged.outer.length; i < length; i++)
for(i = 0, length = aMerged.outer.length; i < length; i++)
{
var elem = aMerged.outer[i];
if(!(elem.bbox.r1 < oShiftGet.bbox.r1 && oShiftGet.bbox.c1 <= elem.bbox.c1 && elem.bbox.c2 <= oShiftGet.bbox.c2))
......
......@@ -9590,35 +9590,6 @@
};
this._isLockedAll(onChangeWorksheetCallback);
break;
case "insColBefore":
functionModelAction = function () {
fullRecalc = true;
t.autoFilters.insertColumn(prop, val);
t.model.insertColsBefore(arn.c1, val);
};
oChangeData.added = new asc_Range(arn.c1, 0, arn.c1 + val - 1, gc_nMaxRow0);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertColumns,
onChangeWorksheetCallback);
break;
case "insColAfter":
functionModelAction = function () {
fullRecalc = true;
t.autoFilters.insertColumn(prop, val);
t.model.insertColsAfter(arn.c2, val);
};
oChangeData.added = new asc_Range(arn.c2, 0, arn.c2 + val - 1, gc_nMaxRow0);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertColumns,
onChangeWorksheetCallback);
break;
case "delCol":
functionModelAction = function () {
fullRecalc = true;
t.model.removeCols(arn.c1, arn.c2);
};
oChangeData.removed = new asc_Range(arn.c1, 0, arn.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteColumns,
onChangeWorksheetCallback);
break;
case "showCols":
functionModelAction = function () {
t.model.setColHidden(/*bHidden*/false, arn.c1, arn.c2);
......@@ -9645,33 +9616,6 @@
reinitRanges = true;
};
return this._isLockedAll(onChangeWorksheetCallback);
case "insRowBefore":
functionModelAction = function () {
fullRecalc = true;
t.model.insertRowsBefore(arn.r1, val);
};
oChangeData.added = new asc_Range(0, arn.r1, gc_nMaxCol0, arn.r1 + val - 1);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertRows,
onChangeWorksheetCallback);
break;
case "insRowAfter":
functionModelAction = function () {
fullRecalc = true;
t.model.insertRowsAfter(arn.r2, val);
};
oChangeData.added = new asc_Range(0, arn.r2, gc_nMaxCol0, arn.r2 + val - 1);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertRows,
onChangeWorksheetCallback);
break;
case "delRow":
functionModelAction = function () {
fullRecalc = true;
t.model.removeRows(arn.r1, arn.r2);
};
oChangeData.removed = new asc_Range(0, arn.r1, gc_nMaxCol0, arn.r1);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteRows,
onChangeWorksheetCallback);
break;
case "showRows":
functionModelAction = function () {
t.model.setRowHidden(/*bHidden*/false, arn.r1, arn.r2);
......@@ -9779,11 +9723,13 @@
History.StartTransaction();
if(isCheckChangeAutoFilter === true)
t.autoFilters.isEmptyAutoFilters(arn, c_oAscDeleteOptions.DeleteCellsAndShiftLeft);
if (range.deleteCellsShiftLeft()) {
if (range.deleteCellsShiftLeft(function () {
t._cleanCache(oChangeData.changedRange);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
})) {
// ToDo проверить, может перенести в функцию prechange
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertColumn(prop, checkRange, c_oAscDeleteOptions.DeleteCellsAndShiftLeft);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
t.objectRender.updateDrawingObject(false, val, checkRange);
}
History.EndTransaction();
......@@ -9802,11 +9748,13 @@
History.StartTransaction();
if(isCheckChangeAutoFilter === true)
t.autoFilters.isEmptyAutoFilters(arn, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
if (range.deleteCellsShiftUp()) {
if (range.deleteCellsShiftUp(function () {
t._cleanCache(oChangeData.changedRange);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
})) {
// ToDo проверить, может перенести в функцию prechange
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertRows(prop, checkRange, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
t.objectRender.updateDrawingObject(false, val, checkRange);
}
History.EndTransaction();
......@@ -9824,11 +9772,11 @@
fullRecalc = true;
History.Create_NewPoint();
History.StartTransaction();
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
t.autoFilters.isEmptyAutoFilters(arn, c_oAscDeleteOptions.DeleteColumns);
t.model.removeCols(checkRange.c1, checkRange.c2);
t.autoFilters.insertColumn(prop, arn, c_oAscDeleteOptions.DeleteColumns);
t.objectRender.updateDrawingObject(false, val, checkRange);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
History.EndTransaction();
};
......@@ -9845,11 +9793,11 @@
fullRecalc = true;
History.Create_NewPoint();
History.StartTransaction();
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
t.autoFilters.isEmptyAutoFilters(arn, c_oAscDeleteOptions.DeleteRows);
t.model.removeRows(checkRange.r1, checkRange.r2);
t.autoFilters.insertRows(prop, checkRange, c_oAscDeleteOptions.DeleteRows);
t.objectRender.updateDrawingObject(false, val, checkRange);
t.cellCommentator.updateCommentsDependencies(false, val, checkRange);
History.EndTransaction();
};
......
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