Commit 313cbeb5 authored by konovalovsergey's avatar konovalovsergey

fix bug 34607

parent 9277fc47
...@@ -50,15 +50,16 @@ var CellAddress = AscCommon.CellAddress; ...@@ -50,15 +50,16 @@ var CellAddress = AscCommon.CellAddress;
var c_oUndoRedoSerializeType = var c_oUndoRedoSerializeType =
{ {
Null:0, Null:0,
Byte:1, Undefined:1,
Bool:2, SByte:2,
Short:3, Byte:3,
Three:4, Bool:4,
Long:5, Long:5,
Double:6, ULong:6,
String:7, Double:7,
Object:8, String:8,
Array:9 Object:9,
Array:10
}; };
function DrawingCollaborativeData() function DrawingCollaborativeData()
...@@ -184,7 +185,7 @@ UndoRedoItemSerializable.prototype = { ...@@ -184,7 +185,7 @@ UndoRedoItemSerializable.prototype = {
SerializeDataInner: function(oBinaryWriter, nItemType, oItem, nSheetId, collaborativeEditing) { SerializeDataInner: function(oBinaryWriter, nItemType, oItem, nSheetId, collaborativeEditing) {
var oThis = this; var oThis = this;
var sTypeOf; var sTypeOf;
if(null == oItem) if(null === oItem)
sTypeOf = "null"; sTypeOf = "null";
else if(oItem instanceof Array) else if(oItem instanceof Array)
sTypeOf = "array"; sTypeOf = "array";
...@@ -208,18 +209,23 @@ UndoRedoItemSerializable.prototype = { ...@@ -208,18 +209,23 @@ UndoRedoItemSerializable.prototype = {
var nFlorItem = Math.floor(oItem); var nFlorItem = Math.floor(oItem);
if(nFlorItem == oItem) if(nFlorItem == oItem)
{ {
if(oItem >= 0 && oItem <= 255) if (-128 <= oItem && oItem <= 127) {
{ oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.SByte);
oBinaryWriter.WriteSByte(oItem);
}
else if (127 < oItem && oItem <= 255) {
oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Byte); oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Byte);
oBinaryWriter.WriteByte(oItem); oBinaryWriter.WriteByte(oItem);
} }
else if(oItem <= 0xffffffff) else if (-0x80000000 <= oItem && oItem <= 0x7FFFFFFF) {
{
oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Long); oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Long);
oBinaryWriter.WriteLong(oItem); oBinaryWriter.WriteLong(oItem);
} }
else else if (0x7FFFFFFF < oItem && oItem <= 0xFFFFFFFF) {
{ oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.ULong);
oBinaryWriter.WriteLong(oItem);
}
else {
oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Double); oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Double);
oBinaryWriter.WriteDouble2(oItem); oBinaryWriter.WriteDouble2(oItem);
} }
...@@ -241,9 +247,13 @@ UndoRedoItemSerializable.prototype = { ...@@ -241,9 +247,13 @@ UndoRedoItemSerializable.prototype = {
oBinaryWriter.WriteString2(oItem); oBinaryWriter.WriteString2(oItem);
break; break;
case "null": case "null":
case "undefined":
oBinaryWriter.WriteByte(nItemType); oBinaryWriter.WriteByte(nItemType);
oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Null); oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Null);
break;
case "undefined":
oBinaryWriter.WriteByte(nItemType);
oBinaryWriter.WriteByte(c_oUndoRedoSerializeType.Undefined);
break;
default: default:
break; break;
} }
...@@ -324,14 +334,23 @@ UndoRedoItemSerializable.prototype = { ...@@ -324,14 +334,23 @@ UndoRedoItemSerializable.prototype = {
case c_oUndoRedoSerializeType.Null: case c_oUndoRedoSerializeType.Null:
oNewValue = null; oNewValue = null;
break; break;
case c_oUndoRedoSerializeType.Undefined:
oNewValue = undefined;
break;
case c_oUndoRedoSerializeType.Bool: case c_oUndoRedoSerializeType.Bool:
oNewValue = oBinaryReader.GetBool(); oNewValue = oBinaryReader.GetBool();
break; break;
case c_oUndoRedoSerializeType.SByte:
oNewValue = oBinaryReader.GetChar();
break;
case c_oUndoRedoSerializeType.Byte: case c_oUndoRedoSerializeType.Byte:
oNewValue = oBinaryReader.GetUChar(); oNewValue = oBinaryReader.GetUChar();
break; break;
case c_oUndoRedoSerializeType.Long: case c_oUndoRedoSerializeType.Long:
oNewValue = oBinaryReader.GetULongLE(); oNewValue = oBinaryReader.GetLongLE();
break;
case c_oUndoRedoSerializeType.ULong:
oNewValue = AscFonts.FT_Common.IntToUInt(oBinaryReader.GetULongLE());
break; break;
case c_oUndoRedoSerializeType.Double: case c_oUndoRedoSerializeType.Double:
oNewValue = oBinaryReader.GetDoubleLE(); oNewValue = oBinaryReader.GetDoubleLE();
......
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