Commit 6fd1d4a8 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

оптимизация скрытия строк

http://bugzserver/show_bug.cgi?id=30122 -  Длительный процесс сохранения и сборки

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64389 954022d7-b5bf-4e40-9824-e11837661b57
parent 5d161551
......@@ -41,6 +41,7 @@ var historyitem_Worksheet_RemoveCellFormula = 24;
var historyitem_Worksheet_ChangeMerge = 25;
var historyitem_Worksheet_ChangeHyperlink = 26;
var historyitem_Worksheet_SetTabColor = 27;
var historyitem_Worksheet_RowHide = 28;
// Frozen cell
var historyitem_Worksheet_ChangeFrozenCell = 30;
......@@ -419,7 +420,7 @@ CHistory.prototype._addRedoObjectParam = function (oRedoObjectParam, Point) {
oRedoObjectParam.bIsReInit = true;
oRedoObjectParam.oOnUpdateSheetViewSettings[Point.SheetId] = Point.SheetId;
}
else if (g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RowProp == Point.Type || historyitem_Worksheet_ColProp == Point.Type))
else if (g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RowProp == Point.Type || historyitem_Worksheet_ColProp == Point.Type || historyitem_Worksheet_RowHide == Point.Type))
oRedoObjectParam.oChangeWorksheetUpdate[Point.SheetId] = Point.SheetId;
else if (g_oUndoRedoWorkbook === Point.Class && (historyitem_Workbook_SheetAdd === Point.Type || historyitem_Workbook_SheetRemove === Point.Type || historyitem_Workbook_SheetMove === Point.Type || historyitem_Workbook_SheetPositions === Point.Type)) {
oRedoObjectParam.bUpdateWorksheetByModel = true;
......
......@@ -604,7 +604,8 @@ UndoRedoData_CellValueData.prototype = {
};
var g_oUndoRedoData_FromToRowColProperties = {
from: 0,
to: 1
to: 1,
bRow: 2
};
function UndoRedoData_FromToRowCol(bRow, from, to){
this.Properties = g_oUndoRedoData_FromToRowColProperties;
......@@ -615,7 +616,7 @@ function UndoRedoData_FromToRowCol(bRow, from, to){
UndoRedoData_FromToRowCol.prototype = {
getType : function()
{
return UndoRedoDataTypes.FromTo;
return UndoRedoDataTypes.FromToRowCol;
},
getProperties : function()
{
......@@ -627,6 +628,7 @@ UndoRedoData_FromToRowCol.prototype = {
{
case this.Properties.from: return this.from;break;
case this.Properties.to: return this.to;break;
case this.Properties.bRow: return this.bRow;break;
}
return null;
},
......@@ -636,6 +638,7 @@ UndoRedoData_FromToRowCol.prototype = {
{
case this.Properties.from: this.from = value;break;
case this.Properties.to: this.to = value;break;
case this.Properties.bRow: this.bRow = value;break;
}
},
applyCollaborative : function(nSheetId, collaborativeEditing)
......@@ -3145,6 +3148,30 @@ UndoRedoWoorksheet.prototype = {
//var workSheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
//workSheetView.autoFilters.reDrawFilter(null, index);
}
else if(historyitem_Worksheet_RowHide == Type)
{
from = Data.from;
to = Data.to;
nRow = Data.bRow;
if(false != this.wb.bCollaborativeChanges)
{
from = collaborativeEditing.getLockOtherRow2(nSheetId, from);
to = collaborativeEditing.getLockOtherRow2(nSheetId, to);
oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(0, from, gc_nMaxCol0, to);
this.wb.aCollaborativeChangeElements.push(oLockInfo);
}
if(bUndo)
nRow = !nRow;
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.model.setRowHidden(nRow, Data.from, Data.to);
}
else if(historyitem_Worksheet_AddRows == Type || historyitem_Worksheet_RemoveRows == Type)
{
from = Data.from;
......
......@@ -3848,17 +3848,41 @@ Woorksheet.prototype.setRowHidden=function(bHidden, start, stop){
stop = start;
History.Create_NewPoint();
var oThis = this, i;
var historyStart = 0, prevStatus = null;
var fProcessRow = function(row){
if(row && bHidden != (0 != (g_nRowFlag_hd & row.flags)))
{
var oOldProps = row.getHeightProp();
if(bHidden)
row.flags |= g_nRowFlag_hd;
else
row.flags &= ~g_nRowFlag_hd;
var oNewProps = row.getHeightProp();
if(false === oOldProps.isEqual(oNewProps))
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowProp, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
var isEqualProp = prevStatus !== null && prevStatus.isEqual(oNewProps) ? true : false;
if(isEqualProp)//если статус не изменяется
{
if(row.index === stop)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowHide, oThis.getId(), row._getUpdateRange(), new UndoRedoData_FromToRowCol(bHidden, historyStart, row.index));
}
else
{
if(prevStatus !== null)//заносим в историю предыдущие строки
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowHide, oThis.getId(), row._getUpdateRange(), new UndoRedoData_FromToRowCol(prevStatus.hd, historyStart, row.index - 1));
if(row.index === stop)//если строка последняя, её необходимо добавить в историю
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowHide, oThis.getId(), row._getUpdateRange(), new UndoRedoData_FromToRowCol(bHidden, row.index, row.index));
//обнуляем индексы
historyStart = row.index;
}
prevStatus = oNewProps;
}
else
{
if(prevStatus !== null)//заносим предыдущие строки
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowHide, oThis.getId(), row._getUpdateRange(), new UndoRedoData_FromToRowCol(prevStatus.hd, historyStart, row.index - 1));
prevStatus = null;
}
};
if(0 == start && gc_nMaxRow0 == stop)
......
......@@ -542,6 +542,8 @@ var maxIndividualValues = 10000;
//open/close rows
if(!bUndoChanges && !bRedoChanges)
{
var hiddenObj = {start: currentFilter.Ref.r1 + 1, h: null};
for(var i = currentFilter.Ref.r1 + 1; i <= currentFilter.Ref.r2; i++)
{
var isHidden = false;
......@@ -555,8 +557,24 @@ var maxIndividualValues = 10000;
var isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
if(isDateTimeFormat)
currentValue = cell.getValueWithoutFormat();
aWs.setRowHidden(newFilterColumn.isHideValue(currentValue, isDateTimeFormat), i, i);
var isSetHidden = newFilterColumn.isHideValue(currentValue, isDateTimeFormat);
//скрываем строки
if(hiddenObj.h === null)
hiddenObj.h = isSetHidden;
else if(hiddenObj.h !== isSetHidden)
{
aWs.setRowHidden(hiddenObj.h, hiddenObj.start, i - 1);
hiddenObj.h = isSetHidden;
hiddenObj.start = i;
}
if(i === currentFilter.Ref.r2)
{
aWs.setRowHidden(hiddenObj.h, hiddenObj.start, i);
}
}
}
}
......
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