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

Переделаны функции копирования в классах CDegree, CDegreeSubSup,...

Переделаны функции копирования в классах CDegree, CDegreeSubSup, CGroupCharacter. В классах CFraction, CLimit, CMathFunc настройки обернуты в специальный класс, и переработана функция копирования. Исправлена функция Correct_Content в класс CLimit.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58774 954022d7-b5bf-4e40-9824-e11837661b57
parent 8742d213
......@@ -237,6 +237,21 @@ CDegree.prototype.getPropsForWrite = function()
{
return this.Pr;
};
CDegree.prototype.Copy = function()
{
var oProps =
{
ctrPrp : this.CtrPrp.Copy(),
type : this.Pr.type
};
var NewDegree = new CDegree(oProps);
this.baseContent.CopyTo(NewDegree.baseContent, false);
this.iterContent.CopyTo(NewDegree.iterContent, false);
return NewDegree;
};
CDegree.prototype.Refresh_RecalcData = function(Data)
{
};
......@@ -536,6 +551,21 @@ CDegreeSubSup.prototype.getPropsForWrite = function()
{
return this.Pr;
};
CDegreeSubSup.prototype.Copy = function()
{
var oProps =
{
ctrPrp : this.CtrPrp.Copy()
};
var NewDegree = new CDegreeSubSup(oProps);
this.baseContent.CopyTo(NewDegree.baseContent, false);
this.iters.iterDn.CopyTo(NewDegree.iters.iterDn, false);
this.iters.iterUp.CopyTo(NewDegree.iters.iterUp, false);
return NewDegree;
};
CDegreeSubSup.prototype.Refresh_RecalcData = function(Data)
{
};
......
"use strict";
function CMathFractionPr()
{
this.type = BAR_FRACTION;
}
CMathFractionPr.prototype.Set_FromObject = function(Obj)
{
if (undefined !== Obj.type && null !== Obj.type)
this.type = Obj.type;
};
CMathFractionPr.prototype.Copy = function(Obj)
{
var NewPr = new CMathFractionPr();
NewPr.type = this.type;
return NewPr;
};
CMathFractionPr.prototype.Write_ToBinary = function(Writer)
{
// Long : type
Writer.WriteLong(this.type);
};
CMathFractionPr.prototype.Read_FromBinary = function(Reader)
{
// Long : type
this.type = Reader.GetLong();
};
function CFraction(props)
{
CFraction.superclass.constructor.call(this);
......@@ -10,10 +40,7 @@ function CFraction(props)
this.Numerator = new CNumerator();
this.Denominator = new CDenominator();
this.Pr =
{
type: BAR_FRACTION
};
this.Pr = new CMathFractionPr();
this.bHideBar = false;
......@@ -357,13 +384,7 @@ CFraction.prototype.setPosition = function(pos, PosInfo)
}
CFraction.prototype.setProperties = function(props)
{
var bBar = props.type === BAR_FRACTION || props.type === NO_BAR_FRACTION,
bSkew = props.type === SKEWED_FRACTION,
bLin = props.type === LINEAR_FRACTION;
if(bBar || bSkew || bLin)
this.Pr.type = props.type;
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CFraction.prototype.fillContent = function()
......@@ -397,19 +418,14 @@ CFraction.prototype.getPropsForWrite = function()
}
CFraction.prototype.Copy = function()
{
var oProps =
{
ctrPrp : this.CtrPrp.Copy(),
type : this.Pr.Type
};
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewFraction = new CFraction(oProps);
this.Denominator.getElement().CopyTo(NewFraction.Denominator.getElement(), false);
this.Numerator.getElement().CopyTo(NewFraction.Numerator.getElement(), false);
NewFraction.fillContent();
return NewFraction;
};
CFraction.prototype.Refresh_RecalcData = function(Data)
......@@ -417,39 +433,24 @@ CFraction.prototype.Refresh_RecalcData = function(Data)
}
CFraction.prototype.Write_ToBinary2 = function(Writer)
{
// Long : historyitem_type_frac
// String : Numerator Id
// String : Denominator Id
// Variable : CtrlPr
// Bool->Long : Type
Writer.WriteLong( historyitem_type_frac );
Writer.WriteString2(this.Id);
Writer.WriteString2(this.Numerator.Get_Id());
Writer.WriteString2(this.Denominator.Get_Id());
this.CtrPrp.Write_ToBinary(Writer);
if (undefined !== this.Pr.type)
{
Writer.WriteBool(true);
Writer.WriteLong(this.Pr.type);
}
else
Writer.WriteBool(false);
this.Pr.Write_ToBinary(Writer);
}
CFraction.prototype.Read_FromBinary2 = function(Reader)
{
this.Id = Reader.GetString2();
this.Numerator.setElement(g_oTableId.Get_ById(Reader.GetString2()));
this.Denominator.setElement(g_oTableId.Get_ById(Reader.GetString2()));
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
if (true === Reader.GetBool())
props.type = Reader.GetLong();
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.setProperties(props);
this.fillContent();
}
CFraction.prototype.Get_Id = function()
......
"use strict";
function CMathLimitPr()
{
this.type = LIMIT_LOW;
}
CMathLimitPr.prototype.Set_FromObject = function(Obj)
{
if (undefined !== Obj.type && null !== Obj.type)
this.type = Obj.type;
};
CMathLimitPr.prototype.Copy = function()
{
var NewPr = new CMathLimitPr();
NewPr.type = this.type;
return NewPr;
};
CMathLimitPr.prototype.Write_ToBinary = function(Writer)
{
// Long : type
Writer.WriteLong(this.type);
};
CMathLimitPr.prototype.Read_FromBinary = function(Reader)
{
// Long : type
this.type = Reader.GetLong();
};
function CLimit(props)
{
CLimit.superclass.constructor.call(this);
......@@ -11,10 +41,7 @@ function CLimit(props)
this.ContentFName = new CMathContent();
this.ContentIterator = new CMathContent();
this.Pr =
{
type: LIMIT_LOW
};
this.Pr = new CMathLimitPr();
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -39,9 +66,7 @@ CLimit.prototype.getIterator = function()
}
CLimit.prototype.setProperties = function(props)
{
if(props.type === LIMIT_UP || props.type === LIMIT_LOW)
this.Pr.type = props.type;
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
......@@ -163,6 +188,21 @@ CLimit.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CLimit.prototype.Correct_Content = function(bInnerCorrection)
{
this.ContentFName.Correct_Content(bInnerCorrection);
this.ContentIterator.Correct_Content(bInnerCorrection);
};
CLimit.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewLimit = new CLimit(oProps);
this.ContentFName.CopyTo(NewLimit.ContentFName, false);
this.ContentIterator.CopyTo(NewLimit.ContentIterator, false);
return NewLimit;
};
CLimit.prototype.Refresh_RecalcData = function(Data)
{
}
......@@ -174,7 +214,7 @@ CLimit.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.getIterator().Id);
this.CtrPrp.Write_ToBinary(Writer);
Writer.WriteLong(this.Pr.type);
this.Pr.Write_ToBinary(Writer);
}
CLimit.prototype.Read_FromBinary2 = function( Reader )
{
......@@ -182,11 +222,8 @@ CLimit.prototype.Read_FromBinary2 = function( Reader )
this.ContentFName = g_oTableId.Get_ById(Reader.GetString2());
this.ContentIterator = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
props.type = Reader.GetLong();
this.init(props);
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
}
CLimit.prototype.Get_Id = function()
{
......@@ -251,13 +288,18 @@ CMathFunc.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CMathFunc.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong( historyitem_type_mathFunc );
}
CMathFunc.prototype.Load_Changes = function(Reader)
CMathFunc.prototype.Copy = function()
{
}
var oProps =
{
ctrPrp : this.CtrPrp.Copy()
};
var NewMathFunc = new CMathFunc(oProps);
this.fnameContent.CopyTo(NewMathFunc.fnameContent, false);
this.argumentContent.CopyTo(NewMathFunc.argumentContent, false);
return NewMathFunc;
};
CMathFunc.prototype.Refresh_RecalcData = function(Data)
{
}
......@@ -276,10 +318,9 @@ CMathFunc.prototype.Read_FromBinary2 = function( Reader )
this.fnameContent = g_oTableId.Get_ById(Reader.GetString2());
this.argumentContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
this.CtrPrp.Read_FromBinary(Reader);
this.init(props);
this.fillContent();
}
CMathFunc.prototype.Get_Id = function()
{
......
......@@ -3869,6 +3869,18 @@ CMathGroupChrPr.prototype.Set_FromObject = function(Obj)
if(LOCATION_TOP === Obj.pos || LOCATION_BOT === Obj.pos)
this.pos = Obj.pos;
};
CMathGroupChrPr.prototype.Copy = function()
{
var NewPr = new CMathGroupChrPr();
NewPr.chr = this.chr ;
NewPr.chrType = this.chrType;
NewPr.vertJc = this.vertJc ;
NewPr.pos = this.pos ;
return NewPr;
};
CMathGroupChrPr.prototype.Write_ToBinary = function(Writer)
{
// Long : chr
......@@ -3903,20 +3915,14 @@ CMathGroupChrPr.prototype.Read_FromBinary = function(Reader)
function CGroupCharacter(props)
{
CGroupCharacter.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_GROUP_CHARACTER;
this.Content = new CMathContent();
this.Pr =
{
chr: null,
chrType: null,
vertJc: VJUST_TOP,
pos: LOCATION_BOT
};
CCharacter.call(this);
this.Pr = new CMathGroupChrPr();
if(props !== null && typeof(props)!== "undefined")
this.init(props);
......@@ -3979,15 +3985,7 @@ CGroupCharacter.prototype.getBase = function()
}
CGroupCharacter.prototype.setProperties = function(props)
{
if(props.vertJc === VJUST_TOP || props.vertJc === VJUST_BOT)
this.Pr.vertJc = props.vertJc;
if(props.pos === LOCATION_TOP || props.pos === LOCATION_BOT)
this.Pr.pos = props.pos;
this.Pr.chr = props.chr;
this.Pr.chrType = props.chrType;
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CGroupCharacter.prototype.fillContent = function()
......@@ -4022,13 +4020,15 @@ CGroupCharacter.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CGroupCharacter.prototype.Save_Changes = function(Data, Writer)
CGroupCharacter.prototype.Copy = function()
{
Writer.WriteLong( historyitem_type_groupChr );
}
CGroupCharacter.prototype.Load_Changes = function(Reader)
{
}
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewGroupChar = new CGroupCharacter(oProps);
this.Content.CopyTo(NewGroupChar.Content, false);
return NewGroupChar;
};
CGroupCharacter.prototype.Refresh_RecalcData = function(Data)
{
}
......
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