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

add function af_changeSelectionFormatTable(for change selection table from menu)

parent 6ca440df
...@@ -176,6 +176,13 @@ var c_oAscChangeFilterOptions = { ...@@ -176,6 +176,13 @@ var c_oAscChangeFilterOptions = {
style: 2 style: 2
}; };
var c_oAscChangeSelectionFormatTable = {
all: 1,
data: 2,
row: 3,
column: 4
};
// Состояние редактора ячейки // Состояние редактора ячейки
var c_oAscCellEditorState = { var c_oAscCellEditorState = {
editEnd: 0, // Окончание редактирования editEnd: 0, // Окончание редактирования
......
...@@ -8294,6 +8294,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){ ...@@ -8294,6 +8294,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){
nStartCol = merged.bbox.c1; nStartCol = merged.bbox.c1;
} }
lockDraw(this.worksheet.workbook); lockDraw(this.worksheet.workbook);
var isSortColor = !!(colorText || colorFill);
var oRes = null; var oRes = null;
var oThis = this; var oThis = this;
var bAscent = false; var bAscent = false;
...@@ -8364,7 +8365,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){ ...@@ -8364,7 +8365,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){
sText = val; sText = val;
aSortElems.push({row: nRow0, num: nNumber, text: sText, colorFill: colorFillCell, colorsText: colorsTextCell}); aSortElems.push({row: nRow0, num: nNumber, text: sText, colorFill: colorFillCell, colorsText: colorsTextCell});
} }
else if(colorFill || colorText) else if(isSortColor)
{ {
aSortElems.push({row: nRow0, num: nNumber, text: sText, colorFill: colorFillCell, colorsText: colorsTextCell}); aSortElems.push({row: nRow0, num: nNumber, text: sText, colorFill: colorFillCell, colorsText: colorsTextCell});
} }
...@@ -8421,7 +8422,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){ ...@@ -8421,7 +8422,7 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){
return res; return res;
}; };
if(colorText || colorFill) if(isSortColor)
{ {
var newArrayNeedColor = []; var newArrayNeedColor = [];
var newArrayAnotherColor = []; var newArrayAnotherColor = [];
......
...@@ -12705,6 +12705,70 @@ ...@@ -12705,6 +12705,70 @@
return true; return true;
}; };
WorksheetView.prototype.af_changeSelectionFormatTable = function(optionType, tableName)
{
var t = this;
var ws = this.model;
var tablePart = ws._getFilterByDisplayName(tableName);
if(!tablePart || !(tablePart && tablePart.Ref))
{
return false;
}
var refTablePart = tablePart.Ref;
var startCol = this.activeRange.c1;
var endCol = this.activeRange.c2;
var startRow = this.activeRange.r1;
var endRow = this.activeRange.r2;
var newActiveRange;
switch(optionType)
{
case c_oAscChangeSelectionFilter.all:
{
startCol = refTablePart.c1;
endCol = refTablePart.c2;
startRow = refTablePart.r1;
endRow = refTablePart.r2;
break;
}
case c_oAscChangeSelectionFilter.data:
{
//TODO проверить есть ли строка заголовков
startCol = refTablePart.c1;
endCol = refTablePart.c2;
startRow = refTablePart.r1 + 1;
endRow = refTablePart.r2;
break;
}
case c_oAscChangeSelectionFilter.row:
{
startCol = refTablePart.c1;
endCol = refTablePart.c2;
startRow = this.activeRange.r1 < refTablePart.r1 ? refTablePart.r1 : this.activeRange.r1;
endRow = this.activeRange.r2 > refTablePart.r2 ? refTablePart.r2 : this.activeRange.r2;
break;
}
case c_oAscChangeSelectionFilter.column:
{
startCol = this.activeRange.c1 < refTablePart.c1 ? refTablePart.c1 : this.activeRange.c1;
endCol = this.activeRange.c2 > refTablePart.r2 ? refTablePart.r2 : this.activeRange.r2;
startRow = refTablePart.r1;
endRow = refTablePart.r2;
break;
}
}
t.setSelection(new Asc.Range(startCol, startRow, endCol, endRow));
};
/* /*
* Export * 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