Commit efac5340 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add in cell_info information(disable insert/delete cols/rows)

parent 4be60482
......@@ -180,6 +180,14 @@
this.isShowHeaderRow = null;
this.tableRange = null;
this.isInsertRowAbove = null;
this.isInsertRowBelow = null;
this.isInsertColumnLeft = null;
this.isInsertColumnRight = null;
this.isDeleteRow = null;
this.isDeleteColumn = null;
this.isDeleteTable = null;
}
asc_CFormatTableInfo.prototype = {
......@@ -193,7 +201,15 @@
asc_getLastCol: function () { return this.lastCol; },
asc_getBandVer: function () { return this.bandVer; },
asc_getFilterButton: function () { return this.filterButton; },
asc_getTableRange: function () { return this.tableRange; }
asc_getTableRange: function () { return this.tableRange; },
asc_getIsInsertRowAbove: function () { return this.isInsertRowAbove; },
asc_getIsInsertRowBelow: function () { return this.isInsertRowBelow; },
asc_getIsInsertColumnLeft: function () { return this.isInsertRowLeft; },
asc_getIsInsertColumnRight: function () { return this.isInsertColumnRight; },
asc_getIsDeleteRow: function () { return this.isDeleteRow; },
asc_getIsDeleteColumn: function () { return this.isDeleteColumn; },
asc_getIsDeleteTable: function () { return this.isDeleteTable; }
};
window["Asc"].asc_CFormatTableInfo = window["Asc"]["asc_CFormatTableInfo"] = asc_CFormatTableInfo;
......@@ -211,6 +227,14 @@
prot["asc_getFilterButton"] = prot.asc_getFilterButton;
prot["asc_getTableRange"] = prot.asc_getTableRange;
prot["asc_getIsInsertRowAbove"] = prot.asc_getIsInsertRowAbove;
prot["asc_getIsInsertRowBelow"] = prot.asc_getIsInsertRowBelow;
prot["asc_getIsInsertColumnLeft"] = prot.asc_getIsInsertColumnLeft;
prot["asc_getIsInsertColumnRight"] = prot.asc_getIsInsertColumnRight;
prot["asc_getIsDeleteRow"] = prot.asc_getIsDeleteRow;
prot["asc_getIsDeleteColumn"] = prot.asc_getIsDeleteColumn;
prot["asc_getIsDeleteTable"] = prot.asc_getIsDeleteTable;
/** @constructor */
......
......@@ -7313,8 +7313,17 @@
cell_info.formatTableInfo.lastRow = curTablePart.TotalsRowCount !== null ? true : false;
cell_info.formatTableInfo.firstRow = curTablePart.HeaderRowCount === null ? true : false;
cell_info.formatTableInfo.tableRange = curTablePart.Ref.getAbsName();
//cell_info.formatTableInfo.filterButton = curTablePart.HeaderRowCount !== null ? true : false;
var checkDisableProps = this.af_checkDisableProps(curTablePart)
cell_info.formatTableInfo.isInsertRowAbove = checkDisableProps.insertRowAbove;
cell_info.formatTableInfo.isInsertRowBelow = checkDisableProps.insertRowBelow;
cell_info.formatTableInfo.isInsertColumnLeft = checkDisableProps.insertColumnLeft;
cell_info.formatTableInfo.isInsertColumnRight = checkDisableProps.insertColumnRight;
cell_info.formatTableInfo.isDeleteRow = checkDisableProps.deleteRow;
cell_info.formatTableInfo.isDeleteColumn = checkDisableProps.deleteColumn;
cell_info.formatTableInfo.isDeleteTable = checkDisableProps.deleteTable;
}
......@@ -13067,6 +13076,39 @@
return res;
};
WorksheetView.prototype.af_checkDisableProps = function(tablePart)
{
var t = this;
var ws = this.model;
var acitveRange = this.activeRange;
if(!tablePart)
{
return false;
}
var refTable = tablePart.Ref;
var refTableContainsActiveRange = refTable.containsRange(acitveRange);
var insertRowAbove, insertRowBelow, insertColumnLeft, insertColumnRight, deleteRow = true, deleteColumn = true, deleteTable = true;
//если курсор стоит в нижней строке, то разрешаем добавление нижней строки
insertRowBelow = !!(((tablePart.TotalsRowCount === null && acitveRange.startRow === refTable.r2) || (tablePart.TotalsRowCount !== null && acitveRange.startRow === refTable.r2 - 1)) && refTableContainsActiveRange);
//если курсор стоит в правом столбце, то разрешаем добавление одного столбца правее
insertColumnRight = !!(acitveRange.startCol === refTable.c2 && refTableContainsActiveRange);
//если внутри находится вся активная область или если выходит активная область за границу справа
insertColumnLeft = !!(refTableContainsActiveRange || (acitveRange.c2 > refTable.c2 && acitveRange.r1 >= refTable.r1 && acitveRange.r2 <= refTable.r2 && acitveRange.c1 >= refTable.c1));
//если внутри находится вся активная область(кроме строки заголовков) или если выходит активная область за границу снизу
insertRowAbove = !!(((acitveRange.r1 > refTable.c1 && tablePart.HeaderRowCount === null) || (acitveRange.r1 >= refTable.c1 && tablePart.HeaderRowCount !== null)) && (refTableContainsActiveRange || (acitveRange.r2 > refTable.r2 && acitveRange.c1 >= refTable.c1 && acitveRange.c2 <= refTable.c2 && acitveRange.r1 >= refTable.r1)));
return {insertRowAbove: insertRowAbove, insertRowBelow: insertRowBelow, insertColumnLeft: insertColumnLeft, insertColumnRight: insertColumnRight, deleteRow: deleteRow, deleteColumn: deleteColumn, deleteTable: deleteTable};
};
/*
* Export
* -----------------------------------------------------------------------------
......
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