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