Commit 1eb76055 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил undo/redo для sheetViewSettings

Добавил пересылку между пользователями для sheetViewSettings
Если даже нет sheetView, то все равно создаем

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47749 954022d7-b5bf-4e40-9824-e11837661b57
parent dc3b454f
...@@ -28,6 +28,7 @@ var historyitem_Worksheet_Hide = 19; ...@@ -28,6 +28,7 @@ var historyitem_Worksheet_Hide = 19;
var historyitem_Worksheet_CreateRow = 20; var historyitem_Worksheet_CreateRow = 20;
var historyitem_Worksheet_CreateCol = 21; var historyitem_Worksheet_CreateCol = 21;
var historyitem_Worksheet_CreateCell = 22; var historyitem_Worksheet_CreateCell = 22;
var historyitem_Worksheet_SetViewSettings = 23;
var historyitem_RowCol_Fontname = 1; var historyitem_RowCol_Fontname = 1;
var historyitem_RowCol_Fontsize = 2; var historyitem_RowCol_Fontsize = 2;
......
...@@ -2146,8 +2146,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf ...@@ -2146,8 +2146,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
if(ws.aCols.length > 0 || null != ws.oAllCol) if(ws.aCols.length > 0 || null != ws.oAllCol)
this.bs.WriteItem(c_oSerWorksheetsTypes.Cols, function(){oThis.WriteWorksheetCols(ws);}); this.bs.WriteItem(c_oSerWorksheetsTypes.Cols, function(){oThis.WriteWorksheetCols(ws);});
if (null !== ws.sheetViews) this.bs.WriteItem(c_oSerWorksheetsTypes.SheetViews, function(){oThis.WriteSheetViews(ws);});
this.bs.WriteItem(c_oSerWorksheetsTypes.SheetViews, function(){oThis.WriteSheetViews(ws);});
this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws);}); this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws);});
...@@ -4902,7 +4901,6 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -4902,7 +4901,6 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
}); });
oWorksheet.aConditionalFormatting.push(oConditionalFormatting); oWorksheet.aConditionalFormatting.push(oConditionalFormatting);
} else if (c_oSerWorksheetsTypes.SheetViews === type) { } else if (c_oSerWorksheetsTypes.SheetViews === type) {
oWorksheet.sheetViews = [];
res = this.bcr.Read1(length, function (t, l) { res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSheetViews(t, l, oWorksheet.sheetViews); return oThis.ReadSheetViews(t, l, oWorksheet.sheetViews);
}); });
......
...@@ -331,6 +331,7 @@ var UndoRedoDataTypes = new function() { ...@@ -331,6 +331,7 @@ var UndoRedoDataTypes = new function() {
this.ChartAxisY = 40; this.ChartAxisY = 40;
this.ChartLegend = 41; this.ChartLegend = 41;
this.ChartFont = 42; this.ChartFont = 42;
this.SheetViewSettings = 43;
this.Create = function(nType) this.Create = function(nType)
{ {
...@@ -379,6 +380,7 @@ var UndoRedoDataTypes = new function() { ...@@ -379,6 +380,7 @@ var UndoRedoDataTypes = new function() {
case this.ChartAxisY: return new asc_CChartAxisY(); break; case this.ChartAxisY: return new asc_CChartAxisY(); break;
case this.ChartLegend: return new asc_CChartLegend(); break; case this.ChartLegend: return new asc_CChartLegend(); break;
case this.ChartFont: return new asc_CChartFont(); break; case this.ChartFont: return new asc_CChartFont(); break;
case this.SheetViewSettings: return new Asc.asc_CSheetViewSettings(); break;
} }
return null; return null;
}; };
...@@ -1840,6 +1842,8 @@ UndoRedoWoorksheet.prototype = { ...@@ -1840,6 +1842,8 @@ UndoRedoWoorksheet.prototype = {
ws._removeCell(Data.nRow, Data.nCol); ws._removeCell(Data.nRow, Data.nCol);
else else
ws._getCell(Data.nRow, Data.nCol); ws._getCell(Data.nRow, Data.nCol);
} else if (historyitem_Worksheet_SetViewSettings === Type) {
ws.setSheetViewSettings(bUndo ? Data.from : Data.to);
} }
} }
}; };
......
...@@ -2102,7 +2102,7 @@ function Woorksheet(wb, _index, bAddUserId, sId){ ...@@ -2102,7 +2102,7 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.aComments = new Array(); this.aComments = new Array();
this.aCommentsCoords = new Array(); this.aCommentsCoords = new Array();
this.sheetViews = null; this.sheetViews = [];
this.aConditionalFormatting = []; this.aConditionalFormatting = [];
this.nActionNested = 0; this.nActionNested = 0;
...@@ -2398,6 +2398,12 @@ Woorksheet.prototype.initPostOpen = function(){ ...@@ -2398,6 +2398,12 @@ Woorksheet.prototype.initPostOpen = function(){
if(null == this.PagePrintOptions.asc_getHeadings()) if(null == this.PagePrintOptions.asc_getHeadings())
this.PagePrintOptions.asc_setHeadings(c_oAscPrintDefaultSettings.PageHeadings); this.PagePrintOptions.asc_setHeadings(c_oAscPrintDefaultSettings.PageHeadings);
} }
// Sheet Views
if (0 === this.sheetViews.length) {
// Даже если не было, создадим
this.sheetViews[0] = new asc.asc_CSheetViewSettings();
}
}; };
Woorksheet.prototype.onStartTriggerAction=function(){ Woorksheet.prototype.onStartTriggerAction=function(){
//начало действия, в конце которого могуть быть вызваны trigger(пока только hyperlink) //начало действия, в конце которого могуть быть вызваны trigger(пока только hyperlink)
...@@ -2561,6 +2567,19 @@ Woorksheet.prototype.setHidden=function(hidden){ ...@@ -2561,6 +2567,19 @@ Woorksheet.prototype.setHidden=function(hidden){
} }
} }
}; };
Woorksheet.prototype.getSheetViewSettings = function () {
return this.sheetViews[0].clone();
};
Woorksheet.prototype.setSheetViewSettings = function (options) {
var current = this.getSheetViewSettings();
if (current.isEqual(options))
return;
History.Create_NewPoint();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_SetViewSettings, this.getId(), null, new UndoRedoData_FromTo(current, options.clone()));
this.sheetViews[0].set(options);
};
Woorksheet.prototype.getRowsCount=function(){ Woorksheet.prototype.getRowsCount=function(){
return this.nRowsCount; return this.nRowsCount;
}; };
......
...@@ -633,6 +633,11 @@ ...@@ -633,6 +633,11 @@
return new asc_CSheetViewSettings(); return new asc_CSheetViewSettings();
} }
this.Properties = {
showGridLines : 0,
showRowColHeaders : 1
};
// Показывать ли сетку // Показывать ли сетку
this.showGridLines = null; this.showGridLines = null;
// Показывать обозначения строк и столбцов // Показывать обозначения строк и столбцов
...@@ -643,11 +648,43 @@ ...@@ -643,11 +648,43 @@
asc_CSheetViewSettings.prototype = { asc_CSheetViewSettings.prototype = {
constructor: asc_CSheetViewSettings, constructor: asc_CSheetViewSettings,
clone: function () {
var result = new asc_CSheetViewSettings();
result.showGridLines = this.showGridLines;
result.showRowColHeaders = this.showRowColHeaders;
return result;
},
isEqual: function (settings) {
return this.asc_getShowGridLines() === settings.asc_getShowGridLines() &&
this.asc_getShowRowColHeaders() === settings.asc_getShowRowColHeaders();
},
set: function (settings) {
this.showGridLines = settings.showGridLines;
this.showRowColHeaders = settings.showRowColHeaders;
},
asc_getShowGridLines: function () { return false !== this.showGridLines; }, asc_getShowGridLines: function () { return false !== this.showGridLines; },
asc_getShowRowColHeaders: function () { return false !== this.showRowColHeaders; }, asc_getShowRowColHeaders: function () { return false !== this.showRowColHeaders; },
asc_setShowGridLines: function (val) { this.showGridLines = val; }, asc_setShowGridLines: function (val) { this.showGridLines = val; },
asc_setShowRowColHeaders: function (val) { this.showRowColHeaders = val; } asc_setShowRowColHeaders: function (val) { this.showRowColHeaders = val; },
} getType : function () {
return UndoRedoDataTypes.SheetViewSettings;
},
getProperties : function () {
return this.Properties;
},
getProperty : function (nType) {
switch (nType) {
case this.Properties.showGridLines: return this.showGridLines;break;
case this.Properties.showRowColHeaders: return this.showRowColHeaders;break;
}
},
setProperty : function (nType, value) {
switch (nType) {
case this.Properties.showGridLines: this.showGridLines = value;break;
case this.Properties.showRowColHeaders: this.sheet = showRowColHeaders;break;
}
}
};
/* /*
......
...@@ -645,10 +645,7 @@ ...@@ -645,10 +645,7 @@
}, },
getSheetViewSettings: function () { getSheetViewSettings: function () {
if (null === this.model.sheetViews || 0 === this.model.sheetViews.length) return this.model.getSheetViewSettings();
return new asc.asc_CSheetViewSettings();
return this.model.sheetViews[0];
}, },
...@@ -2184,8 +2181,7 @@ ...@@ -2184,8 +2181,7 @@
/** Рисует сетку таблицы */ /** Рисует сетку таблицы */
_drawGrid: function (drawingCtx, range, leftFieldInPt, topFieldInPt, width, height) { _drawGrid: function (drawingCtx, range, leftFieldInPt, topFieldInPt, width, height) {
// Возможно сетку не нужно рисовать (при печати свои проверки) // Возможно сетку не нужно рисовать (при печати свои проверки)
if (undefined === drawingCtx && null !== this.model.sheetViews && if (undefined === drawingCtx && false === this.model.sheetViews[0].asc_getShowGridLines())
0 < this.model.sheetViews.length && false === this.model.sheetViews[0].asc_getShowGridLines())
return; return;
if (range === undefined) { if (range === undefined) {
...@@ -8288,9 +8284,7 @@ ...@@ -8288,9 +8284,7 @@
case "sheetViewSettings": case "sheetViewSettings":
functionModelAction = function () { functionModelAction = function () {
if (null === t.model.sheetViews) t.model.setSheetViewSettings(val);
t.model.sheetViews = [];
t.model.sheetViews[0] = val;
isUpdateCols = true; isUpdateCols = true;
isUpdateRows = true; isUpdateRows = true;
......
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