Commit db72934e authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

BinaryCommonWriter и Binary_CommonReader перевел на prototype

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53667 954022d7-b5bf-4e40-9824-e11837661b57
parent 6db470fe
......@@ -37,44 +37,45 @@ function OpenColor() {
function BinaryCommonWriter(memory)
{
this.memory = memory;
this.WriteItem = function(type, fWrite)
{
}
BinaryCommonWriter.prototype.WriteItem = function(type, fWrite)
{
//type
this.memory.WriteByte(type);
this.WriteItemWithLength(fWrite);
};
this.WriteItemStart = function(type)
{
};
BinaryCommonWriter.prototype.WriteItemStart = function(type)
{
this.memory.WriteByte(type);
return this.WriteItemWithLengthStart(fWrite);
};
this.WriteItemEnd = function(nStart)
{
};
BinaryCommonWriter.prototype.WriteItemEnd = function(nStart)
{
this.WriteItemWithLengthEnd(nStart);
};
this.WriteItemWithLength = function(fWrite)
{
};
BinaryCommonWriter.prototype.WriteItemWithLength = function(fWrite)
{
var nStart = this.WriteItemWithLengthStart();
fWrite();
this.WriteItemWithLengthEnd(nStart);
};
this.WriteItemWithLengthStart = function()
{
};
BinaryCommonWriter.prototype.WriteItemWithLengthStart = function()
{
//Запоминаем позицию чтобы в конце записать туда длину
var nStart = this.memory.GetCurPosition();
this.memory.Skip(4);
return nStart;
};
this.WriteItemWithLengthEnd = function(nStart)
{
};
BinaryCommonWriter.prototype.WriteItemWithLengthEnd = function(nStart)
{
//Length
var nEnd = this.memory.GetCurPosition();
this.memory.Seek(nStart);
this.memory.WriteLong(nEnd - nStart - 4);
this.memory.Seek(nEnd);
};
this.WriteBorder = function(border)
{
};
BinaryCommonWriter.prototype.WriteBorder = function(border)
{
if(border_None != border.Value)
{
if(null != border.Color)
......@@ -98,9 +99,9 @@ function BinaryCommonWriter(memory)
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(border.Value);
}
};
this.WriteBorders = function(Borders)
{
};
BinaryCommonWriter.prototype.WriteBorders = function(Borders)
{
var oThis = this;
//Left
if(null != Borders.Left)
......@@ -123,17 +124,17 @@ function BinaryCommonWriter(memory)
//Between
if(null != Borders.Between)
this.WriteItem(c_oSerBordersType.between, function(){oThis.WriteBorder(Borders.Between);});
};
this.WriteColor = function(type, color)
{
};
BinaryCommonWriter.prototype.WriteColor = function(type, color)
{
this.memory.WriteByte(type);
this.memory.WriteByte(c_oSerPropLenType.Three);
this.memory.WriteByte(color.r);
this.memory.WriteByte(color.g);
this.memory.WriteByte(color.b);
};
this.WriteShd = function(Shd)
{
};
BinaryCommonWriter.prototype.WriteShd = function(Shd)
{
//Value
if(null != Shd.Value)
{
......@@ -146,9 +147,9 @@ function BinaryCommonWriter(memory)
{
this.WriteColor(c_oSerShdType.Color, Shd.Color);
}
};
this.WritePaddings = function(Paddings)
{
};
BinaryCommonWriter.prototype.WritePaddings = function(Paddings)
{
//left
if(null != Paddings.L)
{
......@@ -177,9 +178,9 @@ function BinaryCommonWriter(memory)
this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(Paddings.B);
}
};
this.WriteColorSpreadsheet = function(color)
{
};
BinaryCommonWriter.prototype.WriteColorSpreadsheet = function(color)
{
if(color instanceof ThemeColor)
{
if(null != color.theme)
......@@ -201,14 +202,14 @@ function BinaryCommonWriter(memory)
this.memory.WriteByte(c_oSerPropLenType.Long);
this.memory.WriteLong(color.getRgb());
}
};
}
};
function Binary_CommonReader(stream)
{
this.stream = stream;
}
this.ReadTable = function(fReadContent)
{
Binary_CommonReader.prototype.ReadTable = function(fReadContent)
{
var res = c_oSerConstants.ReadOk;
//stLen
res = this.stream.EnterFrame(4);
......@@ -220,9 +221,9 @@ function Binary_CommonReader(stream)
if(c_oSerConstants.ReadOk != res)
return res;
return this.Read1(stLen, fReadContent);
};
this.Read1 = function(stLen, fRead)
{
};
Binary_CommonReader.prototype.Read1 = function(stLen, fRead)
{
var res = c_oSerConstants.ReadOk;
var stCurPos = 0;
while(stCurPos < stLen)
......@@ -242,9 +243,9 @@ function Binary_CommonReader(stream)
stCurPos += length + 5;
}
return res;
};
this.Read2 = function(stLen, fRead)
{
};
Binary_CommonReader.prototype.Read2 = function(stLen, fRead)
{
var res = c_oSerConstants.ReadOk;
var stCurPos = 0;
while(stCurPos < stLen)
......@@ -280,9 +281,9 @@ function Binary_CommonReader(stream)
stCurPos += nRealLen + nCurPosShift;
}
return res;
};
this.Read2Spreadsheet = function(stLen, fRead)
{
};
Binary_CommonReader.prototype.Read2Spreadsheet = function(stLen, fRead)
{
var res = c_oSerConstants.ReadOk;
var stCurPos = 0;
while(stCurPos < stLen)
......@@ -318,9 +319,9 @@ function Binary_CommonReader(stream)
stCurPos += nRealLen + nCurPosShift;
}
return res;
};
this.ReadDouble = function()
{
};
Binary_CommonReader.prototype.ReadDouble = function()
{
var dRes = 0.0;
dRes |= this.stream.GetUChar();
dRes |= this.stream.GetUChar() << 8;
......@@ -328,16 +329,16 @@ function Binary_CommonReader(stream)
dRes |= this.stream.GetUChar() << 24;
dRes /= 100000;
return dRes;
}
this.ReadColor = function()
{
};
Binary_CommonReader.prototype.ReadColor = function()
{
var r = this.stream.GetUChar();
var g = this.stream.GetUChar();
var b = this.stream.GetUChar()
return new CDocumentColor(r, g, b);
}
this.ReadShd = function(type, length, Shd)
{
};
Binary_CommonReader.prototype.ReadShd = function(type, length, Shd)
{
var res = c_oSerConstants.ReadOk;
switch(type)
{
......@@ -348,9 +349,9 @@ function Binary_CommonReader(stream)
break;
}
return res;
};
this.ReadColorSpreadsheet = function(type, length, color)
{
};
Binary_CommonReader.prototype.ReadColorSpreadsheet = function(type, length, color)
{
var res = c_oSerConstants.ReadOk;
if ( c_oSer_ColorObjectType.Type == type )
color.auto = (c_oSer_ColorType.Auto == this.stream.GetUChar());
......@@ -363,8 +364,7 @@ function Binary_CommonReader(stream)
else
res = c_oSerConstants.ReadUnknown;
return res;
}
}
};
/** @constructor */
function FT_Stream2(data, size) {
this.obj = 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