Commit 3a7f999a authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add changes from SVN branch(FormatAsTable Branch)

parent b72006da
......@@ -1439,7 +1439,7 @@ parserHelper.prototype.checkDataRange = function (model, wb, dialogType, dataRan
return c_oAscError.ID.MaxDataSeriesError;
} else if (c_oAscSelectionDialogType.FormatTable === dialogType) {
// ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters
if (true === wb.getWorksheet().autoFilters.isRangeIntersectionTableOrFilter(dataRange))
if (true === wb.getWorksheet().model.autoFilters.isRangeIntersectionTableOrFilter(dataRange))
return c_oAscError.ID.AutoFilterDataRangeError;
}
}
......
......@@ -2960,7 +2960,7 @@
var api = window["Asc"]["editor"];
var ws = api.wb.getWorksheet();
bIsTablePartContainActiveRange = ws.autoFilters.isTablePartContainActiveRange();
bIsTablePartContainActiveRange = ws.model.autoFilters.isTablePartContainActiveRange(ws.activeRange);
}
else
{
......
......@@ -3034,7 +3034,7 @@ UndoRedoCell.prototype = {
cell.setValueData(Val);
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
var worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.autoFilters.renameTableColumn(new Asc.Range(nCol, nRow, nCol, nRow), bUndo);
worksheetView.model.autoFilters.renameTableColumn(new Asc.Range(nCol, nRow, nCol, nRow), bUndo);
}
else if(historyitem_Cell_SetStyle == Type)
{
......@@ -3195,7 +3195,7 @@ UndoRedoWoorksheet.prototype = {
if(bUndo)
{
var workSheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
workSheetView.autoFilters.reDrawFilter(new Asc.Range(0, from, ws.nColsCount - 1, to));
workSheetView.model.autoFilters.reDrawFilter(new Asc.Range(0, from, ws.nColsCount - 1, to));
}
}
else if(historyitem_Worksheet_AddRows == Type || historyitem_Worksheet_RemoveRows == Type)
......@@ -3232,8 +3232,6 @@ UndoRedoWoorksheet.prototype = {
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
if(!bUndo)
worksheetView.autoFilters.insertRows(bInsert ? "insCell" : "delCell", range, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range);
}
else if(historyitem_Worksheet_AddCols == Type || historyitem_Worksheet_RemoveCols == Type)
......@@ -3271,8 +3269,6 @@ UndoRedoWoorksheet.prototype = {
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
if(!bUndo)
worksheetView.autoFilters.insertColumn(bInsert ? "insCell" : "delCell", range, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range);
}
else if(historyitem_Worksheet_ShiftCellsLeft == Type || historyitem_Worksheet_ShiftCellsRight == Type)
......@@ -3310,10 +3306,6 @@ UndoRedoWoorksheet.prototype = {
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
var isCheckChangeAutoFilter = worksheetView.autoFilters.isActiveCellsCrossHalfFTable(range.bbox, operType, bInsert ? "insCell" : "delCell");
if(!bUndo && isCheckChangeAutoFilter === true)
worksheetView.autoFilters.insertColumn(bInsert ? "insCell" : "delCell", range.bbox, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range.bbox);
}
else if(historyitem_Worksheet_ShiftCellsTop == Type || historyitem_Worksheet_ShiftCellsBottom == Type)
......@@ -3351,8 +3343,6 @@ UndoRedoWoorksheet.prototype = {
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
if(!bUndo)
worksheetView.autoFilters.insertRows(bInsert ? "insCell" : "delCell",range.bbox, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range.bbox);
}
else if(historyitem_Worksheet_Sort == Type)
......@@ -3416,11 +3406,11 @@ UndoRedoWoorksheet.prototype = {
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
if(bUndo)//если на Undo перемещается диапазон из форматированной таблицы - стиль форматированной таблицы не должен цепляться
{
worksheetView.autoFilters._cleanStyleTable(to);
worksheetView.model.autoFilters._cleanStyleTable(to);
}
worksheetView.autoFilters.reDrawFilter(to);
worksheetView.autoFilters.reDrawFilter(from);
worksheetView.model.autoFilters.reDrawFilter(to);
worksheetView.model.autoFilters.reDrawFilter(from);
}
else if(historyitem_Worksheet_Merge == Type || historyitem_Worksheet_Unmerge == Type)
{
......@@ -3791,7 +3781,7 @@ UndoRedoAutoFilters.prototype = {
var ws = api.wb.getWorksheetById(nSheetId);
Data.worksheet = ws;
var autoFilters = ws.autoFilters;
var autoFilters = ws.model.autoFilters;
if (bUndo == true)
{
autoFilters.Undo(Type, Data);
......
......@@ -3128,6 +3128,8 @@ function Woorksheet(wb, _index, sId){
this.aConditionalFormatting = [];
this.sheetPr = null;
this.aFormulaExt = null;
this.autoFilters = new asc.AutoFilters(this);
this.oDrawingOjectsManager = new DrawingObjectsManager(this);
this.contentChanges = new CContentChanges();
......@@ -3657,6 +3659,8 @@ Woorksheet.prototype._removeRows=function(start, stop){
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveRows, this.getId(), new Asc.Range(0, start, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, start, stop));
this.autoFilters.insertRows( "delCell", new Asc.Range(0, start, gc_nMaxCol0, stop), c_oAscDeleteOptions.DeleteRows );
buildRecalc(this.workbook);
unLockDraw(this.workbook);
......@@ -3714,6 +3718,8 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){
History.LocalChange = false;
}
this.autoFilters.insertRows( "insCell", new Asc.Range(0, index, gc_nMaxCol0, index + count - 1), c_oAscInsertOptions.InsertColumns );
buildRecalc(this.workbook);
unLockDraw(this.workbook);
......@@ -3797,6 +3803,8 @@ Woorksheet.prototype._removeCols=function(start, stop){
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCols, this.getId(), new Asc.Range(start, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, start, stop));
this.autoFilters.insertColumn( "delCell", new Asc.Range(start, 0, stop, gc_nMaxRow0), c_oAscInsertOptions.InsertColumns );
buildRecalc(this.workbook);
unLockDraw(this.workbook);
......@@ -3837,7 +3845,8 @@ Woorksheet.prototype._insertColsBefore=function(index, count){
}
}
this.autoFilters.insertColumn( "insCells", new Asc.Range(index, 0, index + count - 1, gc_nMaxRow0), c_oAscInsertOptions.InsertColumns );
buildRecalc(this.workbook);
unLockDraw(this.workbook);
......@@ -4626,6 +4635,9 @@ Woorksheet.prototype._moveRange=function(oBBoxFrom, oBBoxTo, copyRange){
}
}
if(false == this.workbook.bUndoChanges && false == this.workbook.bRedoChanges)
this.autoFilters._moveAutoFilters( oBBoxTo, oBBoxFrom, null, copyRange, true, oBBoxFrom );
if(false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || true == this.workbook.bCollaborativeChanges))
{
History.LocalChange = true;
......@@ -4734,6 +4746,7 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
}
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsLeft, this.getId(), new Asc.Range(nLeft, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertColumn( "delCell", oBBox, c_oAscDeleteOptions.DeleteCellsAndShiftLeft );
//todo проверить не уменьшились ли границы таблицы
};
Woorksheet.prototype._shiftCellsUp=function(oBBox){
......@@ -4776,6 +4789,7 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
}
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsTop, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertRows( "delCell", oBBox, c_oAscDeleteOptions.DeleteCellsAndShiftTop );
//todo проверить не уменьшились ли границы таблицы
};
Woorksheet.prototype._shiftCellsRight=function(oBBox){
......@@ -4813,6 +4827,7 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){
}
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsRight, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertColumn( "insCells", oBBox, c_oAscInsertOptions.InsertCellsAndShiftRight );
};
Woorksheet.prototype._shiftCellsBottom=function(oBBox){
//до перемещения ячеек, перед функцией, в которой используются nodesSheetArea/nodesSheetCell move/shift нужно обязательно вызвать force buildRecalc
......@@ -4847,6 +4862,7 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
}
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsBottom, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertRows( "insCell", oBBox, c_oAscInsertOptions.InsertCellsAndShiftDown );
};
Woorksheet.prototype._setIndex=function(ind){
this.index = ind;
......
......@@ -4793,6 +4793,9 @@ FilterColumn.prototype.isHideValue = function(val, isDateTimeFormat, top10Length
res = this.CustomFiltersObj.isHideValue(val);
else if(this.Top10)
res = this.Top10.isHideValue(val, top10Length);
else if(this.ColorFilter)
res = this.ColorFilter.isHideValue(val);
return res;
};
FilterColumn.prototype.clean = function() {
......@@ -5310,6 +5313,9 @@ ColorFilter.prototype.clone = function() {
}
return res;
};
ColorFilter.prototype.isHideValue = function() {
return false;
};
ColorFilter.prototype.asc_getCellColor = function () { return this.CellColor; };
ColorFilter.prototype.asc_getDxf = function () { return this.dxf; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
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