Commit 99d14626 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Изменения в Excel теперь пишутся в виде "массива", а не "массива массивов".

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62059 954022d7-b5bf-4e40-9824-e11837661b57
parent ca25beaf
...@@ -1822,7 +1822,7 @@ Workbook.prototype.SerializeHistory = function(){ ...@@ -1822,7 +1822,7 @@ Workbook.prototype.SerializeHistory = function(){
var aRes = []; var aRes = [];
//соединяем изменения, которые были до приема данных с теми, что получились после. //соединяем изменения, которые были до приема данных с теми, что получились после.
var worksheets = this.aWorksheets, t; var worksheets = this.aWorksheets, t, j, length2;
for(t = 0; t < worksheets.length; ++t) for(t = 0; t < worksheets.length; ++t)
{ {
worksheets[t] && worksheets[t].refreshContentChanges(); worksheets[t] && worksheets[t].refreshContentChanges();
...@@ -1831,15 +1831,12 @@ Workbook.prototype.SerializeHistory = function(){ ...@@ -1831,15 +1831,12 @@ Workbook.prototype.SerializeHistory = function(){
if(aActions.length > 0) if(aActions.length > 0)
{ {
var oMemory = new CMemory(); var oMemory = new CMemory();
var oThis = this;
var bChangeSheetPlace = false; var bChangeSheetPlace = false;
var aPointChangesBase64;
for(var i = 0, length = aActions.length; i < length; ++i) for(var i = 0, length = aActions.length; i < length; ++i)
{ {
var aPointChanges = aActions[i]; var aPointChanges = aActions[i];
aPointChangesBase64 = [];
bChangeSheetPlace = false; bChangeSheetPlace = false;
for (var j = 0, length2 = aPointChanges.length; j < length2; ++j) { for (j = 0, length2 = aPointChanges.length; j < length2; ++j) {
var item = aPointChanges[j]; var item = aPointChanges[j];
if (g_oUndoRedoWorkbook == item.oClass) { if (g_oUndoRedoWorkbook == item.oClass) {
if (historyitem_Workbook_SheetAdd == item.nActionType || historyitem_Workbook_SheetRemove == item.nActionType || historyitem_Workbook_SheetMove == item.nActionType) if (historyitem_Workbook_SheetAdd == item.nActionType || historyitem_Workbook_SheetRemove == item.nActionType || historyitem_Workbook_SheetMove == item.nActionType)
...@@ -1848,21 +1845,20 @@ Workbook.prototype.SerializeHistory = function(){ ...@@ -1848,21 +1845,20 @@ Workbook.prototype.SerializeHistory = function(){
else if (g_oUndoRedoWorksheet === item.oClass && historyitem_Worksheet_Hide === item.nActionType) { else if (g_oUndoRedoWorksheet === item.oClass && historyitem_Worksheet_Hide === item.nActionType) {
bChangeSheetPlace = true; bChangeSheetPlace = true;
} }
this._SerializeHistoryBase64(oMemory, item, aPointChangesBase64); this._SerializeHistoryBase64(oMemory, item, aRes);
} }
var oUndoRedoData_SheetPositions; var oUndoRedoData_SheetPositions;
if (bChangeSheetPlace) { if (bChangeSheetPlace) {
//создаем еще один элемент в undo/redo - взаимное расположение Sheet, чтобы не запутываться в add, move событиях //создаем еще один элемент в undo/redo - взаимное расположение Sheet, чтобы не запутываться в add, move событиях
//добавляем не после конца aActions, чтобы можно было делать undo/redo и просто удалять хвост изменений. //добавляем не после конца aActions, чтобы можно было делать undo/redo и просто удалять хвост изменений.
var oSheetPlaceData = []; var oSheetPlaceData = [];
for (var j = 0, length2 = this.aWorksheets.length; j < length2; ++j) for (j = 0, length2 = this.aWorksheets.length; j < length2; ++j)
oSheetPlaceData.push(this.aWorksheets[j].getId()); oSheetPlaceData.push(this.aWorksheets[j].getId());
oUndoRedoData_SheetPositions = new UndoRedoData_SheetPositions(oSheetPlaceData); oUndoRedoData_SheetPositions = new UndoRedoData_SheetPositions(oSheetPlaceData);
} }
else else
oUndoRedoData_SheetPositions = new UndoRedoData_SheetPositions(); oUndoRedoData_SheetPositions = new UndoRedoData_SheetPositions();
this._SerializeHistoryBase64(oMemory, new UndoRedoItemSerializable(g_oUndoRedoWorkbook, historyitem_Workbook_SheetPositions, null, null, oUndoRedoData_SheetPositions), aPointChangesBase64); this._SerializeHistoryBase64(oMemory, new UndoRedoItemSerializable(g_oUndoRedoWorkbook, historyitem_Workbook_SheetPositions, null, null, oUndoRedoData_SheetPositions), aRes);
aRes.push(aPointChangesBase64);
} }
this.aCollaborativeActions = []; this.aCollaborativeActions = [];
} }
...@@ -1877,21 +1873,16 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){ ...@@ -1877,21 +1873,16 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
this.bCollaborativeChanges = true; this.bCollaborativeChanges = true;
//собираем общую длину //собираем общую длину
var dstLen = 0; var dstLen = 0;
var aIndexes = []; var aIndexes = [], i, length = aChanges.length, sChange;
for(var i = 0, length = aChanges.length;i < length; ++i) for(i = 0; i < length; ++i)
{ {
var aPointChanges = aChanges[i]; sChange = aChanges[i];
var aIndexesPoint = [];
for (var j = 0, length2 = aPointChanges.length; j < length2; ++j) {
var sChange = aPointChanges[j];
var nIndex = sChange.indexOf(";"); var nIndex = sChange.indexOf(";");
if (-1 != nIndex) { if (-1 != nIndex) {
dstLen += parseInt(sChange.substring(0, nIndex)); dstLen += parseInt(sChange.substring(0, nIndex));
nIndex++; nIndex++;
} }
aIndexesPoint.push(nIndex); aIndexes.push(nIndex);
}
aIndexes.push(aIndexesPoint);
} }
var pointer = g_memory.Alloc(dstLen); var pointer = g_memory.Alloc(dstLen);
var stream = new FT_Stream2(pointer.data, dstLen); var stream = new FT_Stream2(pointer.data, dstLen);
...@@ -1900,13 +1891,10 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){ ...@@ -1900,13 +1891,10 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
//пробегаемся первый раз чтобы заполнить oFontMap //пробегаемся первый раз чтобы заполнить oFontMap
var oFontMap = {};//собираем все шрифтры со всех изменений var oFontMap = {};//собираем все шрифтры со всех изменений
var aUndoRedoElems = []; var aUndoRedoElems = [];
for (var i = 0, length = aChanges.length; i < length; ++i) { for (i = 0; i < length; ++i) {
var aPointChanges = aChanges[i]; sChange = aChanges[i];
var aIndexesPoint = aIndexes[i];
for (var j = 0, length2 = aPointChanges.length; j < length2; ++j) {
var sChange = aPointChanges[j];
var oBinaryFileReader = new Asc.BinaryFileReader(); var oBinaryFileReader = new Asc.BinaryFileReader();
nCurOffset = oBinaryFileReader.getbase64DecodedData2(sChange, aIndexesPoint[j], stream, nCurOffset); nCurOffset = oBinaryFileReader.getbase64DecodedData2(sChange, aIndexes[i], stream, nCurOffset);
var item = new UndoRedoItemSerializable(); var item = new UndoRedoItemSerializable();
item.Deserialize(stream); item.Deserialize(stream);
if (g_oUndoRedoWorkbook == item.oClass && historyitem_Workbook_AddFont == item.nActionType) { if (g_oUndoRedoWorkbook == item.oClass && historyitem_Workbook_AddFont == item.nActionType) {
...@@ -1915,9 +1903,8 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){ ...@@ -1915,9 +1903,8 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
} }
aUndoRedoElems.push(item); aUndoRedoElems.push(item);
} }
}
window["Asc"]["editor"]._loadFonts(oFontMap, function(){
window["Asc"]["editor"]._loadFonts(oFontMap, function(){
var wsViews = window["Asc"]["editor"].wb.wsViews; var wsViews = window["Asc"]["editor"].wb.wsViews;
for(var i in wsViews) for(var i in wsViews)
{ {
...@@ -2026,7 +2013,7 @@ Workbook.prototype.DeserializeHistoryNative = function(oRedoObjectParam, data, i ...@@ -2026,7 +2013,7 @@ Workbook.prototype.DeserializeHistoryNative = function(oRedoObjectParam, data, i
this.bCollaborativeChanges = false; this.bCollaborativeChanges = false;
} }
return oRedoObjectParam; return oRedoObjectParam;
} };
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
/** /**
* @constructor * @constructor
......
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