Commit 2b033af5 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Переделаны функции копирования для классов CAccent, CBox, CBorderBox, CBar....

Переделаны функции копирования для классов CAccent, CBox, CBorderBox, CBar. Также для этих классов их свойства обернуты в специальные классы.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58764 954022d7-b5bf-4e40-9824-e11837661b57
parent 986c626a
...@@ -445,17 +445,65 @@ CAccentBreve.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -445,17 +445,65 @@ CAccentBreve.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[22], YY[22]); pGraphics._l(XX[22], YY[22]);
} }
function CMathAccentPr()
{
this.chr = null;
this.chrType = null;
}
CMathAccentPr.prototype.Set_FromObject = function(Obj)
{
if (undefined !== Obj.chr && null !== Obj.chr)
this.chr = Obj.chr;
else
this.chr = null;
if (undefined !== Obj.chrType && null !== Obj.chrType)
this.chrType = Obj.chrType;
else
this.chrType = null;
};
CMathAccentPr.prototype.Copy = function()
{
var NewPr = new CMathAccentPr();
NewPr.chr = this.chr;
NewPr.chrType = this.chrType;
return NewPr;
};
CMathAccentPr.prototype.Write_ToBinary = function(Writer)
{
// Long : chr (-1 : null)
// Long : chrType (-1 : null)
Writer.WriteLong(null === this.chr ? -1 : this.chr);
Writer.WriteLong(null === this.chrType ? -1 : this.chrType);
};
CMathAccentPr.prototype.Read_FromBinary = function(Reader)
{
// Long : chr (-1 : null)
// Long : chrType (-1 : null)
var chr = Reader.GetLong();
var chrType = Reader.GetLong();
this.chr = -1 === chr ? null : chr;
this.chrType = -1 === chrType ? null : chrType;
};
function CAccent(props) function CAccent(props)
{ {
CAccent.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_ACCENT; this.kind = MATH_ACCENT;
//// Properties //// Properties
this.Pr = this.Pr = new CMathAccentPr();
{
chr: null,
chrType: null
};
this.gap = 0; this.gap = 0;
...@@ -464,9 +512,6 @@ function CAccent(props) ...@@ -464,9 +512,6 @@ function CAccent(props)
this.baseContent = new CMathContent(); this.baseContent = new CMathContent();
this.operator = new COperator(OPER_ACCENT); this.operator = new COperator(OPER_ACCENT);
CAccent.superclass.constructor.call(this);
//CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
...@@ -476,7 +521,10 @@ Asc.extendClass(CAccent, CMathBase); ...@@ -476,7 +521,10 @@ Asc.extendClass(CAccent, CMathBase);
CAccent.prototype.init = function(props) CAccent.prototype.init = function(props)
{ {
this.setProperties(props); this.setProperties(props);
this.fillContent();
}
CAccent.prototype.fillContent = function()
{
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.baseContent;
this.elements[0][0].SetDot(true); this.elements[0][0].SetDot(true);
...@@ -634,13 +682,22 @@ CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, ...@@ -634,13 +682,22 @@ CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
} }
CAccent.prototype.setProperties = function(props) CAccent.prototype.setProperties = function(props)
{ {
this.Pr.chr = props.chr; this.Pr.Set_FromObject(props);
this.Pr.chrType = props.chrType;
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
} }
CAccent.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewAccent = new CAccent(oProps);
this.baseContent.CopyTo(NewAccent.baseContent, false);
return NewAccent;
};
CAccent.prototype.Refresh_RecalcData = function(Data) CAccent.prototype.Refresh_RecalcData = function(Data)
{ {
} }
...@@ -652,27 +709,17 @@ CAccent.prototype.Write_ToBinary2 = function( Writer ) ...@@ -652,27 +709,17 @@ CAccent.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.baseContent.Id); Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
if (undefined !== this.Pr.chr) };
{
Writer.WriteBool(true);
Writer.WriteLong(this.Pr.chr);
}
else
Writer.WriteBool(false);
}
CAccent.prototype.Read_FromBinary2 = function( Reader ) CAccent.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2()); this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()}; this.CtrPrp.Read_FromBinary(Reader);
props.ctrPrp.Read_FromBinary(Reader); this.Pr.Read_FromBinary(Reader);
if (true === Reader.GetBool()) this.fillContent();
props.chr = Reader.GetLong();
this.init(props);
} }
CAccent.prototype.Get_Id = function() CAccent.prototype.Get_Id = function()
{ {
......
"use strict"; "use strict";
function CMathBorderBoxPr()
{
strikeVthis.hideBot = false;
this.hideLeft = false;
this.hideRight = false;
this.hideTop = false;
this.strikeBLTR = false;
this.strikeH = false;
this.strikeTLBR = false;
this.strikeV = false;
}
CMathBorderBoxPr.prototype.Set_FromObject = function(Obj)
{
if (undefined !== Obj.hideBot && null !== Obj.hideBot)
this.hideBot = Obj.hideBot;
if (undefined !== Obj.hideLeft && null !== Obj.hideLeft)
this.hideLeft = Obj.hideLeft;
if (undefined !== Obj.hideRight && null !== Obj.hideRight)
this.hideRight = Obj.hideRight;
if (undefined !== Obj.hideTop && null !== Obj.hideTop)
this.hideTop = Obj.hideTop;
if (undefined !== Obj.strikeBLTR && null !== Obj.strikeBLTR)
this.strikeBLTR = Obj.strikeBLTR;
if (undefined !== Obj.strikeH && null !== Obj.strikeH)
this.strikeH = Obj.strikeH;
if (undefined !== Obj.strikeTLBR && null !== Obj.strikeTLBR)
this.strikeTLBR = Obj.strikeTLBR;
if (undefined !== Obj.strikeV && null !== Obj.strikeV)
this.strikeV = Obj.strikeV;
};
CMathBorderBoxPr.prototype.Copy = function()
{
var NewPr = new CMathBorderBoxPr();
NewPr.hideLeft = this.hideLeft;
NewPr.hideRight = this.hideRight;
NewPr.hideTop = this.hideTop;
NewPr.strikeBLTR = this.strikeBLTR;
NewPr.strikeH = this.strikeH;
NewPr.strikeTLBR = this.strikeTLBR;
NewPr.strikeV = this.strikeV;
return NewPr;
};
CMathBorderBoxPr.prototype.Write_ToBinary = function(Writer)
{
// Bool : hideBot
// Bool : hideLeft
// Bool : hideRight
// Bool : hideTop
// Bool : strikeBLTR
// Bool : strikeH
// Bool : strikeTLBR
// Bool : strikeV
Writer.WriteBool(this.hideBot);
Writer.WriteBool(this.hideLeft);
Writer.WriteBool(this.hideRight);
Writer.WriteBool(this.hideTop);
Writer.WriteBool(this.strikeBLTR);
Writer.WriteBool(this.strikeH);
Writer.WriteBool(this.strikeTLBR);
Writer.WriteBool(this.strikeV);
};
CMathBorderBoxPr.prototype.Read_FromBinary = function(Reader)
{
// Bool : hideBot
// Bool : hideLeft
// Bool : hideRight
// Bool : hideTop
// Bool : strikeBLTR
// Bool : strikeH
// Bool : strikeTLBR
// Bool : strikeV
this.hideLeft = Reader.GetBool();
this.hideRight = Reader.GetBool();
this.hideTop = Reader.GetBool();
this.strikeBLTR = Reader.GetBool();
this.strikeH = Reader.GetBool();
this.strikeTLBR = Reader.GetBool();
this.strikeV = Reader.GetBool();
};
function CBorderBox(props) function CBorderBox(props)
{ {
CBorderBox.superclass.constructor.call(this); CBorderBox.superclass.constructor.call(this);
...@@ -9,17 +104,7 @@ function CBorderBox(props) ...@@ -9,17 +104,7 @@ function CBorderBox(props)
this.gapBrd = 0; this.gapBrd = 0;
this.Pr = this.Pr = new CMathBorderBoxPr();
{
hideLeft: false,
hideRight: false,
hideTop: false,
hideBot: false,
strikeBLTR: false,
strikeTLBR: false,
strikeH: false,
strikeV: false
};
this.baseContent = new CMathContent(); this.baseContent = new CMathContent();
...@@ -41,33 +126,9 @@ CBorderBox.prototype.fillContent = function() ...@@ -41,33 +126,9 @@ CBorderBox.prototype.fillContent = function()
} }
CBorderBox.prototype.setProperties = function(props) CBorderBox.prototype.setProperties = function(props)
{ {
if(typeof(props.hideLeft) !== "undefined" && props.hideLeft !== null) this.Pr.Set_FromObject(props);
this.Pr.hideLeft = props.hideLeft;
if(typeof(props.hideRight) !== "undefined" && props.hideRight !== null)
this.Pr.hideRight = props.hideRight;
if(typeof(props.hideTop) !== "undefined" && props.hideTop !== null)
this.Pr.hideTop = props.hideTop;
if(typeof(props.hideBot) !== "undefined" && props.hideBot !== null)
this.Pr.hideBot = props.hideBot;
if(typeof(props.strikeBLTR) !== "undefined" && props.strikeBLTR !== null) // right diagonal
this.Pr.strikeBLTR = props.strikeBLTR;
if(typeof(props.strikeTLBR) !== "undefined" && props.strikeTLBR !== null) // left diagonal
this.Pr.strikeTLBR = props.strikeTLBR;
if(typeof(props.strikeH) !== "undefined" && props.strikeH !== null)
this.Pr.strikeH = props.strikeH;
if(typeof(props.strikeV) !== "undefined" && props.strikeV !== null)
this.Pr.strikeV = props.strikeV;
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
} }
CBorderBox.prototype.recalculateSize = function() CBorderBox.prototype.recalculateSize = function()
...@@ -306,22 +367,17 @@ CBorderBox.prototype.getBase = function() ...@@ -306,22 +367,17 @@ CBorderBox.prototype.getBase = function()
} }
CBorderBox.prototype.getPropsForWrite = function() CBorderBox.prototype.getPropsForWrite = function()
{ {
/*var props = {};
props.hideLeft = !this.bLeft;
props.hideRight = !this.bRight;
props.hideTop = !this.bTop;
props.hideBot = !this.bBot;
props.strikeBLTR = this.bRDiag;
props.strikeTLBR = this.bLDiag;
props.strikeH = this.bHor;
props.strikeV = this.bVert;
return props;*/
return this.Pr; return this.Pr;
} }
CBorderBox.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewBorderBox = new CBorderBox(oProps);
this.baseContent.CopyTo(NewBorderBox.baseContent, false);
return NewBorderBox;
};
CBorderBox.prototype.Refresh_RecalcData = function(Data) CBorderBox.prototype.Refresh_RecalcData = function(Data)
{ {
} }
...@@ -332,88 +388,103 @@ CBorderBox.prototype.Write_ToBinary2 = function( Writer ) ...@@ -332,88 +388,103 @@ CBorderBox.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.baseContent.Id); Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition(); };
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.hideBot )
{
Writer.WriteBool( this.Pr.hideBot );
Flags |= 1;
}
if ( undefined != this.Pr.hideLeft )
{
Writer.WriteBool( this.Pr.hideLeft );
Flags |= 2;
}
if ( undefined != this.Pr.hideRight )
{
Writer.WriteBool( this.Pr.hideRight );
Flags |= 4;
}
if ( undefined != this.Pr.hideTop )
{
Writer.WriteBool( this.Pr.hideTop );
Flags |= 8;
}
if ( undefined != this.Pr.strikeBLTR )
{
Writer.WriteBool( this.Pr.strikeBLTR );
Flags |= 16;
}
if ( undefined != this.Pr.strikeH )
{
Writer.WriteBool( this.Pr.strikeH );
Flags |= 32;
}
if ( undefined != this.Pr.strikeTLBR )
{
Writer.WriteBool( this.Pr.strikeTLBR );
Flags |= 64;
}
if ( undefined != this.Pr.strikeV )
{
Writer.WriteBool( this.Pr.strikeV );
Flags |= 128;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
}
CBorderBox.prototype.Read_FromBinary2 = function( Reader ) CBorderBox.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2()); this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()}; this.CtrlPr.Read_FromBinary(Reader);
props.ctrPrp.Read_FromBinary(Reader); this.Pr.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.hideBot = Reader.GetBool();
if ( Flags & 2 )
props.hideLeft = Reader.GetBool();
if ( Flags & 4 )
props.hideRight = Reader.GetBool();
if ( Flags & 8 )
props.hideTop = Reader.GetBool();
if ( Flags & 16 )
props.strikeBLTR = Reader.GetBool();
if ( Flags & 32 )
props.strikeH = Reader.GetBool();
if ( Flags & 64 )
props.strikeTLBR = Reader.GetBool();
if ( Flags & 128 )
props.strikeV = Reader.GetBool();
this.init(props); this.fillContent();
} }
CBorderBox.prototype.Get_Id = function() CBorderBox.prototype.Get_Id = function()
{ {
return this.Id; return this.Id;
} }
function CMathBoxPr()
{
this.aln = false;
this.brk = false;
this.diff = false;
this.noBreak = false;
this.opEmu = false;
};
CMathBoxPr.prototype.Set_FromObject = function(Obj)
{
if(true === Obj.aln || 1 === Obj.aln)
this.Pr.aln = true;
else
this.Pr.aln = false;
if(true === Obj.brk || 1 === Obj.brk)
this.Pr.brk = true;
else
this.Pr.brk = false;
if(true === Obj.diff || 1 === Obj.diff)
this.Pr.diff = true;
else
this.Pr.diff = false;
if(true === Obj.noBreak || 1 === Obj.noBreak)
this.Pr.noBreak = true;
else
this.Pr.noBreak = false;
if(true === Obj.opEmu || 1 === Obj.opEmu)
this.Pr.opEmu = true;
else
this.Pr.opEmu = false;
};
CMathBoxPr.prototype.Copy = function()
{
var NewPr = new CMathBoxPr();
NewPr.aln = this.aln ;
NewPr.brk = this.brk ;
NewPr.diff = this.diff ;
NewPr.noBreak = this.noBreak;
NewPr.opEmu = this.opEmu ;
return NewPr;
};
CMathBoxPr.prototype.Write_ToBinary = function(Wrtier)
{
// Bool : aln
// Bool : brk
// Bool : diff
// Bool : noBreak
// Bool : opEmu
Writer.WriteBool(aln);
Writer.WriteBool(brk);
Writer.WriteBool(diff);
Writer.WriteBool(noBreak);
Writer.WriteBool(opEmu);
};
CMathBoxPr.prototype.Read_FromBinary = function(Reader)
{
// Bool : aln
// Bool : brk
// Bool : diff
// Bool : noBreak
// Bool : opEmu
this.aln = Reader.GetBool();
this.brk = Reader.GetBool();
this.diff = Reader.GetBool();
this.noBreak = Reader.GetBool();
this.opEmu = Reader.GetBool();
};
function CBox(props) function CBox(props)
{ {
CBox.superclass.constructor.call(this); CBox.superclass.constructor.call(this);
...@@ -421,14 +492,7 @@ function CBox(props) ...@@ -421,14 +492,7 @@ function CBox(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BOX; this.kind = MATH_BOX;
this.Pr = this.Pr = new CMathBoxPr();
{
aln: false,
opEmu: false,
diff: false,
noBreak: false,
brk: false
};
this.baseContent = new CMathContent(); this.baseContent = new CMathContent();
...@@ -450,21 +514,7 @@ CBox.prototype.fillContent = function() ...@@ -450,21 +514,7 @@ CBox.prototype.fillContent = function()
} }
CBox.prototype.setProperties = function(props) CBox.prototype.setProperties = function(props)
{ {
if(props.opEmu === true || props.opEmu === false) this.Pr.Set_FromObject(Obj);
this.Pr.opEmu = props.opEmu;
if(props.diff === true || props.diff === false)
this.Pr.diff = props.diff;
if(props.noBreak === true || props.noBreak === false)
this.Pr.noBreak = props.noBreak;
if(props.brk === true || props.brk === false)
this.Pr.brk = props.brk;
if(props.aln === true || props.aln === false)
this.Pr.aln = props.aln;
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
...@@ -477,13 +527,14 @@ CBox.prototype.getPropsForWrite = function() ...@@ -477,13 +527,14 @@ CBox.prototype.getPropsForWrite = function()
{ {
return this.Pr; return this.Pr;
} }
CBox.prototype.Save_Changes = function(Data, Writer) CBox.prototype.Copy = function()
{
Writer.WriteLong( historyitem_type_box );
}
CBox.prototype.Load_Changes = function(Reader)
{ {
} var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewBox = new CBox(oProps);
this.baseContent.CopyTo(NewBox.baseContent, false);
return NewBox;
};
CBox.prototype.Refresh_RecalcData = function(Data) CBox.prototype.Refresh_RecalcData = function(Data)
{ {
} }
...@@ -494,67 +545,53 @@ CBox.prototype.Write_ToBinary2 = function( Writer ) ...@@ -494,67 +545,53 @@ CBox.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.baseContent.Id); Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition(); };
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.aln )
{
Writer.WriteBool(this.aln);
Flags |= 1;
}
if ( undefined != this.brk )
{
Writer.WriteLong(this.brk);
Flags |= 2;
}
if ( undefined != this.diff )
{
Writer.WriteBool(this.diff);
Flags |= 4;
}
if ( undefined != this.noBreak )
{
Writer.WriteBool(this.noBreak);
Flags |= 8;
}
if ( undefined != this.opEmu )
{
Writer.WriteBool(this.opEmu);
Flags |= 16;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
}
CBox.prototype.Read_FromBinary2 = function( Reader ) CBox.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2()); this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()}; this.CtrPrp.Read_FromBinary(Reader);
props.ctrPrp.Read_FromBinary(Reader); this.Pr.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.aln = Reader.GetBool();
if ( Flags & 2 )
props.brk = Reader.GetLong();
if ( Flags & 4 )
props.diff = Reader.GetBool();
if ( Flags & 8 )
props.noBreak = Reader.GetBool();
if ( Flags & 16 )
props.opEmu = Reader.GetBool();
this.init(props); this.fillContent();
} }
CBox.prototype.Get_Id = function() CBox.prototype.Get_Id = function()
{ {
return this.Id; return this.Id;
} }
function CMathBarPr()
{
this.pos = LOCATION_BOT;
}
CMathBarPr.prototype.Set_FromObject = function(Obj)
{
if(LOCATION_TOP === Obj.pos || LOCATION_BOT === Obj.pos)
this.pos = Obj.pos;
};
CMathBarPr.prototype.Copy = function()
{
var NewPr = new CMathBarPr();
NewPr.pos = this.pos;
return NewPr;
};
CMathBarPr.prototype.Write_ToBinary = function(Writer)
{
// Long : pos
Writer.WriteLong(this.pos);
};
CMathBarPr.prototype.Read_FromBinary = function(Reader)
{
// Long : pos
this.pos = Reader.GetLong();
};
function CBar(props) function CBar(props)
{ {
CBar.superclass.constructor.call(this); CBar.superclass.constructor.call(this);
...@@ -562,14 +599,10 @@ function CBar(props) ...@@ -562,14 +599,10 @@ function CBar(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BAR; this.kind = MATH_BAR;
this.Pr = this.Pr = new CMathBarPr();
{
pos: LOCATION_BOT
};
this.baseContent = new CMathContent(); this.baseContent = new CMathContent();
//this.loc = LOCATION_BOT;
this.operator = new COperator(OPER_BAR); this.operator = new COperator(OPER_BAR);
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
...@@ -624,9 +657,7 @@ CBar.prototype.getAscent = function() ...@@ -624,9 +657,7 @@ CBar.prototype.getAscent = function()
} }
CBar.prototype.setProperties = function(props) CBar.prototype.setProperties = function(props)
{ {
if(props.pos === LOCATION_TOP || props.pos === LOCATION_BOT) this.Pr.Set_FromObject(props);
this.Pr.pos = LOCATION_TOP;
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
...@@ -635,6 +666,14 @@ CBar.prototype.getPropsForWrite = function() ...@@ -635,6 +666,14 @@ CBar.prototype.getPropsForWrite = function()
{ {
return this.Pr; return this.Pr;
} }
CBar.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewBar = new CBar(oProps);
this.baseContent.CopyTo(NewBar.baseContent, false);
return NewBar;
};
CBar.prototype.Save_Changes = function(Data, Writer) CBar.prototype.Save_Changes = function(Data, Writer)
{ {
Writer.WriteLong( historyitem_type_bar ); Writer.WriteLong( historyitem_type_bar );
...@@ -686,20 +725,93 @@ CBar.prototype.Get_Id = function() ...@@ -686,20 +725,93 @@ CBar.prototype.Get_Id = function()
return this.Id; return this.Id;
} }
function CMathPhantomPr()
{
this.show = true;
this.transp = false;
this.zeroAsc = false;
this.zeroDesc = false;
this.zeroWid = false;
}
CMathPhantomPr.prototype.Set_FromObject = function(Obj)
{
if (true === Obj.show || 1 === Obj.show)
this.show = true;
else
this.show = false;
if (true === Obj.transp || 1 === Obj.transp)
this.transp = true;
else
this.transp = false;
if (true === Obj.zeroAsc || 1 === Obj.zeroAsc)
this.zeroAsc = true;
else
this.zeroAsc = false;
if (true === Obj.zeroDesc || 1 === Obj.zeroDesc)
this.zeroDesc = true;
else
this.zeroDesc = false;
if (true === Obj.zeroWid || 1 === Obj.zeroWid)
this.zeroWid = true;
else
this.zeroWid = false;
};
CMathPhantomPr.prototype.Copy = function()
{
var NewPr = new CMathPhantomPr();
NewPr.show = this.show ;
NewPr.transp = this.transp ;
NewPr.zeroAsc = this.zeroAsc ;
NewPr.zeroDesc = this.zeroDesc;
NewPr.zeroWid = this.zeroWid ;
return NewPr;
};
CMathPhantomPr.prototype.Write_ToBinary = function(Writer)
{
// Bool : show
// Bool : transp
// Bool : zeroAsc
// Bool : zeroDesc
// Bool : zeroWid
Writer.WriteBool(show);
Writer.WriteBool(transp);
Writer.WriteBool(zeroAsc);
Writer.WriteBool(zeroDesc);
Writer.WriteBool(zeroWid);
};
CMathPhantomPr.prototype.Read_FromBinary = function(Reader)
{
// Bool : show
// Bool : transp
// Bool : zeroAsc
// Bool : zeroDesc
// Bool : zeroWid
this.show = Reader.GetBool();
this.transp = Reader.GetBool();
this.zeroAsc = Reader.GetBool();
this.zeroDesc = Reader.GetBool();
this.zeroWid = Reader.GetBool();
};
function CPhantom(props) function CPhantom(props)
{ {
CPhantom.superclass.constructor.call(this); CPhantom.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.Pr = this.Pr = new CMathPhantomPr();
{
show: true,
transp: false,
zeroAsc: false,
zeroDesc: false,
zeroWid: false
};
this.baseContent = new CMathContent(); this.baseContent = new CMathContent();
...@@ -725,22 +837,7 @@ CPhantom.prototype.getBase = function() ...@@ -725,22 +837,7 @@ CPhantom.prototype.getBase = function()
} }
CPhantom.prototype.setProperties = function(props) CPhantom.prototype.setProperties = function(props)
{ {
if(props.show == true || props.show == false) this.Pr.Set_FromObject(props);
this.Pr.show = props.show;
if(props.transp == false || props.transp == true)
this.Pr.transp = props.transp;
if(props.zeroAsc == false || props.zeroAsc == true)
this.Pr.zeroAsc = props.zeroAsc;
if(props.zeroDesc == false || props.zeroDesc == true)
this.Pr.zeroDesc = props.zeroDesc;
if(props.zeroWid == false || props.zeroWid == true)
this.Pr.zeroWid = props.zeroWid;
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
...@@ -749,13 +846,15 @@ CPhantom.prototype.getPropsForWrite = function() ...@@ -749,13 +846,15 @@ CPhantom.prototype.getPropsForWrite = function()
{ {
return this.Pr; return this.Pr;
} }
CPhantom.prototype.Save_Changes = function(Data, Writer) CPhantom.prototype.Copy = function()
{
Writer.WriteLong( historyitem_type_phant );
}
CPhantom.prototype.Load_Changes = function(Reader)
{ {
} var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewPhant = new CPhantom(oProps);
this.baseContent.CopyTo(NewPhant.baseContent, false);
return NewPhant;
};
CPhantom.prototype.Refresh_RecalcData = function(Data) CPhantom.prototype.Refresh_RecalcData = function(Data)
{ {
} }
...@@ -766,61 +865,17 @@ CPhantom.prototype.Write_ToBinary2 = function( Writer ) ...@@ -766,61 +865,17 @@ CPhantom.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.baseContent.Id); Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.show )
{
Writer.WriteBool( this.Pr.show );
Flags |= 1;
}
if ( undefined != this.Pr.transp )
{
Writer.WriteBool( this.Pr.transp );
Flags |= 2;
}
if ( undefined != this.Pr.zeroAsc )
{
Writer.WriteBool( this.Pr.zeroAsc );
Flags |= 4;
}
if ( undefined != this.Pr.zeroDesc )
{
Writer.WriteBool( this.Pr.zeroDesc );
Flags |= 8;
}
if ( undefined != this.Pr.zeroWid )
{
Writer.WriteBool( this.Pr.zeroWid );
Flags |= 16;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
} }
CPhantom.prototype.Read_FromBinary2 = function( Reader ) CPhantom.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2()); this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()}; this.CtrPrp.Read_FromBinary(Reader);
props.ctrPrp.Read_FromBinary(Reader); this.Pr.Read_FromBinary(Reader);
var Flags = Reader.GetLong(); this.fillContent();
if ( Flags & 1 )
props.show = Reader.GetBool();
if ( Flags & 2 )
props.transp = Reader.GetBool();
if ( Flags & 4 )
props.zeroAsc = Reader.GetBool();
if ( Flags & 8 )
props.zeroDesc = Reader.GetBool();
if ( Flags & 16 )
props.zeroWid = Reader.GetBool();
this.init(props);
} }
CPhantom.prototype.Get_Id = function() CPhantom.prototype.Get_Id = function()
{ {
......
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