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;
var historyitem_AutoFilter_CleanAutoFilter = 7;
var historyitem_AutoFilter_Delete = 8;
var historyitem_AutoFilter_ChangeTableStyle = 9;
var historyitem_AutoFilter_Change = 10;
function CHistory(workbook)
......
......@@ -4368,6 +4368,9 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
ref.setOffsetLast({offsetCol: col ? col : 0, offsetRow: row ? row : 0});
this.Ref = ref;
//event
this.handlers.trigger("changeRefTablePart", this.DisplayName, this.Ref);
if(this.AutoFilter)
this.AutoFilter.changeRef(col, row, bIsFirst);
};
......
......@@ -1001,11 +1001,37 @@ var maxIndividualValues = 10000;
}
//TODO переделать undo, по типам
if(type === historyitem_AutoFilter_Move)
if(type === historyitem_AutoFilter_Move)//перемещение
{
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)
{
......@@ -1056,60 +1082,10 @@ var maxIndividualValues = 10000;
}
}
}
else if(cloneData.oldFilter && cloneData.newFilterRef)//при наличии newFilterRef
{
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))
{
aWs.AutoFilter = cloneData.oldFilter.clone(null);
}
else if(aWs.TableParts)
{
for(var l = 0; l < aWs.TableParts.length; l++)
{
if(cloneData.oldFilter.Ref.isIntersect(aWs.TableParts[l].Ref))
{
aWs.TableParts[l] = cloneData.oldFilter.clone(null);
this._setColorStyleTable(cloneData.oldFilter.Ref, cloneData.oldFilter, null, true);
break;
}
}
}
}
else
{
if(cloneData.Ref)
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++)
......@@ -1122,7 +1098,6 @@ var maxIndividualValues = 10000;
}
}
}
}
},
reDrawFilter: function(range, row)
......@@ -1409,7 +1384,7 @@ var maxIndividualValues = 10000;
oldFilter: oldFilter,
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
......@@ -1483,7 +1458,7 @@ var maxIndividualValues = 10000;
oldFilter: oldFilter,
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)
......@@ -2113,6 +2088,7 @@ var maxIndividualValues = 10000;
else
{
oHistoryObject.activeCells = ws.activeRange.clone();
if(type !== historyitem_AutoFilter_Change)
type = null;
}
......
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