Commit 9c46692e authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

добавлены функции для возможности передачи CustomFilter при совместном редактировании

+ различные правки

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62626 954022d7-b5bf-4e40-9824-e11837661b57
parent debc0e96
...@@ -364,7 +364,9 @@ var UndoRedoDataTypes = new function() { ...@@ -364,7 +364,9 @@ var UndoRedoDataTypes = new function() {
this.SingleProperty = 33; this.SingleProperty = 33;
this.RgbColor = 34; this.RgbColor = 34;
this.ThemeColor = 35; this.ThemeColor = 35;
this.CustomFilters = 36;
this.CustomFilter = 37;
this.DefinedName = 39; this.DefinedName = 39;
this.DefinedNamesChange = 40; this.DefinedNamesChange = 40;
...@@ -433,6 +435,8 @@ var UndoRedoDataTypes = new function() { ...@@ -433,6 +435,8 @@ var UndoRedoDataTypes = new function() {
case this.AutoFilter: return new UndoRedoData_AutoFilter(); break; case this.AutoFilter: return new UndoRedoData_AutoFilter(); break;
case this.AutoFiltersOptions: return new Asc.AutoFiltersOptions(); break; case this.AutoFiltersOptions: return new Asc.AutoFiltersOptions(); break;
case this.AutoFilterObj: return new Asc.AutoFilterObj(); break; case this.AutoFilterObj: return new Asc.AutoFilterObj(); break;
case this.CustomFilters: return new Asc.CustomFilters(); break;
case this.CustomFilter: return new Asc.CustomFilter(); break;
case this.AutoFiltersOptionsElements: return new Asc.AutoFiltersOptionsElements(); break; case this.AutoFiltersOptionsElements: return new Asc.AutoFiltersOptionsElements(); break;
case this.AddFormatTableOptions: return new Asc.AddFormatTableOptions(); break; case this.AddFormatTableOptions: return new Asc.AddFormatTableOptions(); break;
case this.SingleProperty: return new UndoRedoData_SingleProperty(); break; case this.SingleProperty: return new UndoRedoData_SingleProperty(); break;
...@@ -1677,7 +1681,7 @@ UndoRedoData_ClrScheme.prototype = { ...@@ -1677,7 +1681,7 @@ UndoRedoData_ClrScheme.prototype = {
}; };
var g_oUndoRedoData_AutoFilterProperties = { var g_oUndoRedoData_AutoFilterProperties = {
activeCells : 0, activeCells : 0,
lTable : 1, styleName : 1,
type : 2, type : 2,
cellId : 3, cellId : 3,
autoFiltersObject : 4, autoFiltersObject : 4,
...@@ -1692,7 +1696,7 @@ function UndoRedoData_AutoFilter() { ...@@ -1692,7 +1696,7 @@ function UndoRedoData_AutoFilter() {
this.undo = null; this.undo = null;
this.activeCells = null; this.activeCells = null;
this.lTable = null; this.styleName = null;
this.type = null; this.type = null;
this.cellId = null; this.cellId = null;
this.autoFiltersObject = null; this.autoFiltersObject = null;
...@@ -1715,7 +1719,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1715,7 +1719,7 @@ UndoRedoData_AutoFilter.prototype = {
switch (nType) switch (nType)
{ {
case this.Properties.activeCells: return new UndoRedoData_BBox(this.activeCells); break; case this.Properties.activeCells: return new UndoRedoData_BBox(this.activeCells); break;
case this.Properties.lTable: return this.lTable; break; case this.Properties.styleName: return this.styleName; break;
case this.Properties.type: return this.type; break; case this.Properties.type: return this.type; break;
case this.Properties.cellId: return this.cellId; break; case this.Properties.cellId: return this.cellId; break;
case this.Properties.autoFiltersObject: return this.autoFiltersObject; break; case this.Properties.autoFiltersObject: return this.autoFiltersObject; break;
...@@ -1732,7 +1736,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1732,7 +1736,7 @@ UndoRedoData_AutoFilter.prototype = {
switch (nType) switch (nType)
{ {
case this.Properties.activeCells: this.activeCells = new Asc.Range(value.c1, value.r1, value.c2, value.r2);break; case this.Properties.activeCells: this.activeCells = new Asc.Range(value.c1, value.r1, value.c2, value.r2);break;
case this.Properties.lTable: this.lTable = value;break; case this.Properties.styleName: this.styleName = value;break;
case this.Properties.type: this.type = value;break; case this.Properties.type: this.type = value;break;
case this.Properties.cellId: this.cellId = value;break; case this.Properties.cellId: this.cellId = value;break;
case this.Properties.autoFiltersObject: this.autoFiltersObject = value;break; case this.Properties.autoFiltersObject: this.autoFiltersObject = value;break;
......
...@@ -4717,11 +4717,38 @@ DateGroupItem.prototype.convertRangeToDateGroupItem = function(range) { ...@@ -4717,11 +4717,38 @@ DateGroupItem.prototype.convertRangeToDateGroupItem = function(range) {
} }
}; };
var g_oCustomFilters = {
And : 0,
CustomFilters : 1
};
/** @constructor */ /** @constructor */
function CustomFilters() { function CustomFilters() {
this.Properties = g_oCustomFilters;
this.And = null; this.And = null;
this.CustomFilters = null; this.CustomFilters = null;
} }
CustomFilters.prototype.getType = function() {
return UndoRedoDataTypes.CustomFilters;
};
CustomFilters.prototype.getProperties = function() {
return this.Properties;
};
CustomFilters.prototype.getProperty = function(nType) {
switch (nType) {
case this.Properties.And: return this.And; break;
case this.Properties.CustomFilters: return this.CustomFilters; break;
}
return null;
};
CustomFilters.prototype.setProperty = function(nType, value) {
switch (nType) {
case this.Properties.And: this.And = value;break;
case this.Properties.CustomFilters: this.CustomFilters = value;break;
}
};
CustomFilters.prototype.clone = function() { CustomFilters.prototype.clone = function() {
var i, res = new CustomFilters(); var i, res = new CustomFilters();
res.And = this.And; res.And = this.And;
...@@ -4760,12 +4787,38 @@ CustomFilters.prototype.asc_getCustomFilters = function () { return this.CustomF ...@@ -4760,12 +4787,38 @@ CustomFilters.prototype.asc_getCustomFilters = function () { return this.CustomF
CustomFilters.prototype.asc_setAnd = function (val) { this.And = val; }; CustomFilters.prototype.asc_setAnd = function (val) { this.And = val; };
CustomFilters.prototype.asc_setCustomFilters = function (val) { this.CustomFilters = val; }; CustomFilters.prototype.asc_setCustomFilters = function (val) { this.CustomFilters = val; };
var g_oCustomFilter = {
Operator : 0,
Val : 1
};
/** @constructor */ /** @constructor */
function CustomFilter(operator, val) { function CustomFilter(operator, val) {
this.Properties = g_oCustomFilter;
this.Operator = operator != undefined ? operator : null; this.Operator = operator != undefined ? operator : null;
this.Val = val != undefined ? val : null; this.Val = val != undefined ? val : null;
} }
CustomFilter.prototype.getType = function() {
return UndoRedoDataTypes.CustomFilter;
};
CustomFilter.prototype.getProperties = function() {
return this.Properties;
};
CustomFilter.prototype.getProperty = function(nType) {
switch (nType) {
case this.Properties.Operator: return this.Operator; break;
case this.Properties.Val: return this.Val; break;
}
return null;
};
CustomFilter.prototype.setProperty = function(nType, value) {
switch (nType) {
case this.Properties.Operator: this.Operator = value;break;
case this.Properties.Val: this.Val = value;break;
}
};
CustomFilter.prototype.clone = function() { CustomFilter.prototype.clone = function() {
var res = new CustomFilter(); var res = new CustomFilter();
res.Operator = this.Operator; res.Operator = this.Operator;
......
...@@ -342,7 +342,7 @@ var maxIndividualValues = 10000; ...@@ -342,7 +342,7 @@ var maxIndividualValues = 10000;
} }
//updates //updates
ws._onUpdateFormatTable(filterRange, true, true); ws._onUpdateFormatTable(filterRange, !!(styleName), true);
History.EndTransaction(); History.EndTransaction();
}; };
...@@ -431,7 +431,7 @@ var maxIndividualValues = 10000; ...@@ -431,7 +431,7 @@ var maxIndividualValues = 10000;
isTablePartsContainsRange.TableStyleInfo.Name = styleName; isTablePartsContainsRange.TableStyleInfo.Name = styleName;
t._setColorStyleTable(isTablePartsContainsRange.Ref, isTablePartsContainsRange); t._setColorStyleTable(isTablePartsContainsRange.Ref, isTablePartsContainsRange);
ws._onUpdateFormatTable(isTablePartsContainsRange.Ref, true, true); ws._onUpdateFormatTable(isTablePartsContainsRange.Ref, false, true);
//history //history
t._addHistoryObj(cloneFilter, historyitem_AutoFilter_ChangeTableStyle, t._addHistoryObj(cloneFilter, historyitem_AutoFilter_ChangeTableStyle,
...@@ -1296,6 +1296,7 @@ var maxIndividualValues = 10000; ...@@ -1296,6 +1296,7 @@ var maxIndividualValues = 10000;
{ {
var ws = this.worksheet; var ws = this.worksheet;
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
activeRange = activeRange.clone();
var diff = activeRange.c2 - activeRange.c1 + 1; var diff = activeRange.c2 - activeRange.c1 + 1;
var oldFilter; var oldFilter;
...@@ -1305,6 +1306,13 @@ var maxIndividualValues = 10000; ...@@ -1305,6 +1306,13 @@ var maxIndividualValues = 10000;
var bUndoChanges = aWs.workbook.bUndoChanges; var bUndoChanges = aWs.workbook.bUndoChanges;
var bRedoChanges = aWs.workbook.bRedoChanges; var bRedoChanges = aWs.workbook.bRedoChanges;
var DeleteColumns = ((insertType == c_oAscDeleteOptions.DeleteColumns && type == 'delCell') || insertType == c_oAscInsertOptions.InsertColumns) ? true : false;
if(DeleteColumns)//в случае, если удаляем столбцы, тогда расширяем активную область область по всем строкам
{
activeRange.r1 = 0;
activeRange.r2 = gc_nMaxRow - 1;
}
History.StartTransaction(); History.StartTransaction();
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -1322,7 +1330,10 @@ var maxIndividualValues = 10000; ...@@ -1322,7 +1330,10 @@ var maxIndividualValues = 10000;
{ {
oldFilter = aWs.AutoFilter.clone(null); oldFilter = aWs.AutoFilter.clone(null);
aWs.AutoFilter.Ref = new Asc.Range(ref.c1 + diff, ref.r1, ref.c2 + diff, ref.r2); var start = (ref.c1 + diff) >= 0 ? ref.c1 + diff : 0;
var end = ref.c2 + diff;
aWs.AutoFilter.Ref = new Asc.Range(start, ref.r1, end, ref.r2);
} }
else if(activeRange.c1 > ref.c1 && activeRange.c1 <= ref.c2)//inside else if(activeRange.c1 > ref.c1 && activeRange.c1 <= ref.c2)//inside
{ {
...@@ -1364,9 +1375,11 @@ var maxIndividualValues = 10000; ...@@ -1364,9 +1375,11 @@ var maxIndividualValues = 10000;
{ {
oldFilter = tableParts[i].clone(null); oldFilter = tableParts[i].clone(null);
tableParts[i].Ref = new Asc.Range(ref.c1 + diff, ref.r1, ref.c2 + diff, ref.r2); var start = (ref.c1 + diff) >= 0 ? ref.c1 + diff : 0;
var end = ref.c2 + diff;
tableParts[i].Ref = new Asc.Range(start, ref.r1, end, ref.r2);
if(tableParts[i].AutoFilter) if(tableParts[i].AutoFilter)
tableParts[i].AutoFilter.Ref = new Asc.Range(ref.c1 + diff, ref.r1, ref.c2 + diff, ref.r2); tableParts[i].AutoFilter.Ref = new Asc.Range(start, ref.r1, end, ref.r2);
} }
else if(activeRange.c1 > ref.c1 && activeRange.c1 <= ref.c2)//inside else if(activeRange.c1 > ref.c1 && activeRange.c1 <= ref.c2)//inside
{ {
...@@ -1440,6 +1453,7 @@ var maxIndividualValues = 10000; ...@@ -1440,6 +1453,7 @@ var maxIndividualValues = 10000;
{ {
var ws = this.worksheet; var ws = this.worksheet;
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
activeRange = activeRange.clone();
var diff = activeRange.r2 - activeRange.r1 + 1; var diff = activeRange.r2 - activeRange.r1 + 1;
var oldFilter; var oldFilter;
...@@ -1449,6 +1463,14 @@ var maxIndividualValues = 10000; ...@@ -1449,6 +1463,14 @@ var maxIndividualValues = 10000;
var bUndoChanges = aWs.workbook.bUndoChanges; var bUndoChanges = aWs.workbook.bUndoChanges;
var bRedoChanges = aWs.workbook.bRedoChanges; var bRedoChanges = aWs.workbook.bRedoChanges;
var DeleteRows = ((insertType == c_oAscDeleteOptions.DeleteRows && type == 'delCell') || insertType == c_oAscInsertOptions.InsertRows) ? true : false;
if(DeleteRows)//в случае, если удаляем строки, тогда расширяем активную область область по всем столбцам
{
activeRange.c1 = 0;
activeRange.c2 = gc_nMaxCol - 1;
}
History.StartTransaction(); History.StartTransaction();
History.Create_NewPoint(); History.Create_NewPoint();
......
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