Commit 2010f772 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

изменения для undo + вызов функции для именованных диапазонов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63871 954022d7-b5bf-4e40-9824-e11837661b57
parent a449a4b0
...@@ -100,6 +100,7 @@ var historyitem_AutoFilter_Move = 6; ...@@ -100,6 +100,7 @@ var historyitem_AutoFilter_Move = 6;
var historyitem_AutoFilter_CleanAutoFilter = 7; var historyitem_AutoFilter_CleanAutoFilter = 7;
var historyitem_AutoFilter_Delete = 8; var historyitem_AutoFilter_Delete = 8;
var historyitem_AutoFilter_ChangeTableStyle = 9; var historyitem_AutoFilter_ChangeTableStyle = 9;
var historyitem_AutoFilter_Change = 10;
function CHistory(workbook) function CHistory(workbook)
......
...@@ -4368,6 +4368,9 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) { ...@@ -4368,6 +4368,9 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
ref.setOffsetLast({offsetCol: col ? col : 0, offsetRow: row ? row : 0}); ref.setOffsetLast({offsetCol: col ? col : 0, offsetRow: row ? row : 0});
this.Ref = ref; this.Ref = ref;
//event
this.handlers.trigger("changeRefTablePart", this.DisplayName, this.Ref);
if(this.AutoFilter) if(this.AutoFilter)
this.AutoFilter.changeRef(col, row, bIsFirst); this.AutoFilter.changeRef(col, row, bIsFirst);
}; };
......
...@@ -1001,11 +1001,37 @@ var maxIndividualValues = 10000; ...@@ -1001,11 +1001,37 @@ var maxIndividualValues = 10000;
} }
//TODO переделать undo, по типам //TODO переделать undo, по типам
if(type === historyitem_AutoFilter_Move) if(type === historyitem_AutoFilter_Move)//перемещение
{ {
this._moveAutoFilters(null, null, data); this._moveAutoFilters(null, null, data);
} }
else if(cloneData.FilterColumns || cloneData.AutoFilter || cloneData.TableColumns || (cloneData.Ref && (cloneData instanceof AutoFilter || cloneData instanceof TablePart))) else if(type === historyitem_AutoFilter_Change/* && cloneData.oldFilter && cloneData.newFilterRef*/)//добавление/удаление строк/столбцов
{
if(aWs.AutoFilter && cloneData.newFilterRef.isEqual(aWs.AutoFilter.Ref))
aWs.AutoFilter = cloneData.oldFilter.clone(null);
else if(aWs.TableParts)
{
for(var l = 0; l < aWs.TableParts.length; l++)
{
if(cloneData.newFilterRef && cloneData.newFilterRef.isEqual(aWs.TableParts[l].Ref))
{
aWs.TableParts[l] = cloneData.oldFilter.clone(null);
//чистим стиль от старой таблицы
var clearRange = new Range(aWs, cloneData.newFilterRef.r1, cloneData.newFilterRef.c1, cloneData.newFilterRef.r2, cloneData.newFilterRef.c2);
clearRange.setTableStyle(null);
this._setColorStyleTable(cloneData.oldFilter.Ref, cloneData.oldFilter, null, true);
//event
aWs.handlers.trigger("changeRefTablePart", cloneData.oldFilter.DisplayName, cloneData.oldFilter.Ref);
break;
}
}
}
}
else if(cloneData.FilterColumns || cloneData.AutoFilter || cloneData.TableColumns || (cloneData.Ref && (cloneData instanceof AutoFilter || cloneData instanceof TablePart)))//add
{ {
if(cloneData.Ref) if(cloneData.Ref)
{ {
...@@ -1056,73 +1082,22 @@ var maxIndividualValues = 10000; ...@@ -1056,73 +1082,22 @@ var maxIndividualValues = 10000;
} }
} }
} }
else if(cloneData.oldFilter && cloneData.newFilterRef)//при наличии newFilterRef else if(cloneData.Ref) //удаление таблиц / автофильтров
{
if(aWs.AutoFilter && cloneData.newFilterRef && cloneData.newFilterRef.isEqual(aWs.AutoFilter.Ref))
{
aWs.AutoFilter = cloneData.oldFilter.clone(null);
}
else if(aWs.TableParts)
{
for(var l = 0; l < aWs.TableParts.length; l++)
{
if(cloneData.newFilterRef && cloneData.newFilterRef.isEqual(aWs.TableParts[l].Ref))
{
aWs.TableParts[l] = cloneData.oldFilter.clone(null);
//чистим стиль от старой таблицы
var clearRange = new Range(aWs, cloneData.newFilterRef.r1, cloneData.newFilterRef.c1, cloneData.newFilterRef.r2, cloneData.newFilterRef.c2);
clearRange.setTableStyle(null);
this._setColorStyleTable(cloneData.oldFilter.Ref, cloneData.oldFilter, null, true);
break;
}
}
}
}
else if(cloneData.oldFilter)//в случае удаления/добавления строк
{ {
if(aWs.AutoFilter && cloneData.oldFilter.Ref.isIntersect(aWs.AutoFilter.Ref)) if(aWs.AutoFilter && aWs.AutoFilter.Ref.isEqual(cloneData.Ref))
{ aWs.AutoFilter = null;
aWs.AutoFilter = cloneData.oldFilter.clone(null);
}
else if(aWs.TableParts) else if(aWs.TableParts)
{ {
for(var l = 0; l < aWs.TableParts.length; l++) for(var l = 0; l < aWs.TableParts.length; l++)
{ {
if(cloneData.oldFilter.Ref.isIntersect(aWs.TableParts[l].Ref)) if(cloneData.Ref.isEqual(aWs.TableParts[l].Ref))
{ {
aWs.TableParts[l] = cloneData.oldFilter.clone(null); this._cleanStyleTable(cloneData.Ref);
aWs.TableParts.splice(l,1);
this._setColorStyleTable(cloneData.oldFilter.Ref, cloneData.oldFilter, null, true);
break;
} }
} }
} }
} }
else
{
if(cloneData.Ref)
{
if(aWs.AutoFilter && aWs.AutoFilter.Ref.isEqual(cloneData.Ref))
{
aWs.AutoFilter = null;
}
else if(aWs.TableParts)
{
for(var l = 0; l < aWs.TableParts.length; l++)
{
if(cloneData.Ref.isEqual(aWs.TableParts[l].Ref))
{
this._cleanStyleTable(cloneData.Ref);
aWs.TableParts.splice(l,1);
}
}
}
}
}
}, },
reDrawFilter: function(range, row) reDrawFilter: function(range, row)
...@@ -1409,7 +1384,7 @@ var maxIndividualValues = 10000; ...@@ -1409,7 +1384,7 @@ var maxIndividualValues = 10000;
oldFilter: oldFilter, oldFilter: oldFilter,
newFilterRef: filter.Ref.clone() newFilterRef: filter.Ref.clone()
}; };
t._addHistoryObj(changeElement, null, null, true, oldFilter.Ref, null, true); t._addHistoryObj(changeElement, historyitem_AutoFilter_Change, null, true, oldFilter.Ref, null, true);
} }
//set style //set style
...@@ -1483,7 +1458,7 @@ var maxIndividualValues = 10000; ...@@ -1483,7 +1458,7 @@ var maxIndividualValues = 10000;
oldFilter: oldFilter, oldFilter: oldFilter,
newFilterRef: filter.Ref.clone() newFilterRef: filter.Ref.clone()
}; };
t._addHistoryObj(changeElement, null, null, true, oldFilter.Ref, null, true); t._addHistoryObj(changeElement, historyitem_AutoFilter_Change, null, true, oldFilter.Ref, null, true);
} }
if(oldFilter && bTablePart) if(oldFilter && bTablePart)
...@@ -2113,7 +2088,8 @@ var maxIndividualValues = 10000; ...@@ -2113,7 +2088,8 @@ var maxIndividualValues = 10000;
else else
{ {
oHistoryObject.activeCells = ws.activeRange.clone(); oHistoryObject.activeCells = ws.activeRange.clone();
type = null; if(type !== historyitem_AutoFilter_Change)
type = null;
} }
if(!activeHistoryRange) if(!activeHistoryRange)
......
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