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

В классах CDegree, CDegreeSubSup, CNary реализовано заполнение Content.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58847 954022d7-b5bf-4e40-9824-e11837661b57
parent 8d2c8969
"use strict"; "use strict";
function CMathDegreePr()
{
this.type = DEGREE_SUPERSCRIPT;
}
CMathDegreePr.prototype.Set_FromObject = function(Obj)
{
if (DEGREE_SUPERSCRIPT === Obj.type || DEGREE_SUBSCRIPT === Obj.type)
this.type = Obj.type;
else
this.type = DEGREE_SUPERSCRIPT;
};
CMathDegreePr.prototype.Copy = function()
{
var NewPr = new CMathDegreePr();
NewPr.type = this.type;
return NewPr;
};
CMathDegreePr.prototype.Write_ToBinary = function(Writer)
{
// Long : type
Writer.WriteLong(this.type);
};
CMathDegreePr.prototype.Read_FromBinary = function(Reader)
{
// Long : type
this.type = Reader.GetLong(Reader);
};
function CDegreeBase(props, bInside) function CDegreeBase(props, bInside)
{ {
CDegreeBase.superclass.constructor.call(this, bInside); CDegreeBase.superclass.constructor.call(this, bInside);
...@@ -7,15 +39,11 @@ function CDegreeBase(props, bInside) ...@@ -7,15 +39,11 @@ function CDegreeBase(props, bInside)
this.upBase = 0; // отступ сверху для основания this.upBase = 0; // отступ сверху для основания
this.upIter = 0; // отступ сверху для итератора this.upIter = 0; // отступ сверху для итератора
this.Pr = this.Pr = new CMathDegreePr();
{
type: DEGREE_SUPERSCRIPT
};
this.baseContent = null; this.baseContent = null;
this.iterContent = null; this.iterContent = null;
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
} }
...@@ -192,17 +220,6 @@ CDegreeBase.prototype.IsPlhIterator = function() ...@@ -192,17 +220,6 @@ CDegreeBase.prototype.IsPlhIterator = function()
{ {
return this.iterContent.IsPlaceholder(); return this.iterContent.IsPlaceholder();
}; };
CDegreeBase.prototype.setProperties = function(props)
{
if(props.type === DEGREE_SUPERSCRIPT || props.type === DEGREE_SUBSCRIPT)
this.Pr.type = props.type;
else
this.Pr.type = DEGREE_SUPERSCRIPT;
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
};
CDegreeBase.prototype.setBase = function(base) CDegreeBase.prototype.setBase = function(base)
{ {
this.baseContent = base; this.baseContent = base;
...@@ -214,13 +231,9 @@ CDegreeBase.prototype.setIterator = function(iterator) ...@@ -214,13 +231,9 @@ CDegreeBase.prototype.setIterator = function(iterator)
function CDegree(props, bInside) function CDegree(props, bInside)
{ {
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREE;
CDegree.superclass.constructor.call(this, props, bInside); CDegree.superclass.constructor.call(this, props, bInside);
this.baseContent = new CMathContent(); this.Id = g_oIdCounter.Get_NewId();
this.iterContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
...@@ -228,57 +241,23 @@ function CDegree(props, bInside) ...@@ -228,57 +241,23 @@ function CDegree(props, bInside)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CDegree, CDegreeBase); Asc.extendClass(CDegree, CDegreeBase);
CDegree.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
};
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); CDegree.prototype.ClassType = historyitem_type_deg;
this.iterContent.CopyTo(NewDegree.iterContent, false); CDegree.prototype.kind = MATH_DEGREE;
return NewDegree; CDegree.prototype.init = function(props)
};
CDegree.prototype.Refresh_RecalcData = function(Data)
{
};
CDegree.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_deg);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
Writer.WriteString2(this.iterContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
Writer.WriteLong( this.Pr.type );
};
CDegree.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Fill_LogicalContent(2);
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.iterContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.type = Reader.GetLong();
this.setProperties(props);
this.fillContent(); this.fillContent();
}; };
CDegree.prototype.Get_Id = function() CDegree.prototype.fillContent = function()
{ {
return this.Id; this.iterContent = this.Content[0];
this.baseContent = this.Content[1];
CDegree.superclass.fillContent.apply(this, arguments);
}; };
function CIterators(iterUp, iterDn) function CIterators(iterUp, iterDn)
...@@ -324,17 +303,59 @@ CIterators.prototype.alignIterators = function(mcJc) ...@@ -324,17 +303,59 @@ CIterators.prototype.alignIterators = function(mcJc)
this.alignment.wdt[0] = mcJc; this.alignment.wdt[0] = mcJc;
}; };
function CMathDegreeSubSupPr()
{
this.type = DEGREE_SubSup;
this.alnScr = false;// не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
}
CMathDegreeSubSupPr.prototype.Set_FromObject = function(Obj)
{
if (true === Obj.alnScr || 1 === Obj.alnScr)
this.alnScr = true;
else
this.alnScr = false;
if (DEGREE_SubSup === Obj.type || DEGREE_PreSubSup === Obj.type)
this.type = Obj.type;
};
CMathDegreeSubSupPr.prototype.Copy = function()
{
var NewPr = new CMathDegreeSubSupPr();
NewPr.type = this.type;
NewPr.alnScr = this.alnScr;
return NewPr;
};
CMathDegreeSubSupPr.prototype.Write_ToBinary = function(Writer)
{
// Long : type
// Bool : alnScr
Writer.WriteLong(this.type);
Writer.WriteBool(this.alnScr);
};
CMathDegreeSubSupPr.prototype.Read_FromBinary = function(Reader)
{
// Long : type
// Bool : alnScr
this.type = Reader.GetLong();
this.alnScr = Reader.GetBool();
};
function CDegreeSubSupBase(props, bInside) function CDegreeSubSupBase(props, bInside)
{ {
CDegreeSubSupBase.superclass.constructor.call(this, bInside); CDegreeSubSupBase.superclass.constructor.call(this, bInside);
this.gapBase = 0; this.gapBase = 0;
this.Pr = this.Pr = new CMathDegreeSubSupPr();
{
type: DEGREE_SubSup,
alnScr: false // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
};
this.baseContent = null; this.baseContent = null;
this.iters = new CIterators(null, null); this.iters = new CIterators(null, null);
...@@ -510,30 +531,12 @@ CDegreeSubSupBase.prototype.setLowerIterator = function(iterator) ...@@ -510,30 +531,12 @@ CDegreeSubSupBase.prototype.setLowerIterator = function(iterator)
{ {
this.iters.iterDn = iterator; this.iters.iterDn = iterator;
}; };
CDegreeSubSupBase.prototype.setProperties = function(props)
{
if(props.alnScr === true || props.alnScr === 1)
this.Pr.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0)
this.Pr.alnScr = false;
if(props.type === DEGREE_SubSup || props.type === DEGREE_PreSubSup)
this.Pr.type = props.type;
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
};
function CDegreeSubSup(props, bInside) function CDegreeSubSup(props, bInside)
{ {
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREESubSup;
CDegreeSubSup.superclass.constructor.call(this, props, bInside); CDegreeSubSup.superclass.constructor.call(this, props, bInside);
this.baseContent = new CMathContent(); this.Id = g_oIdCounter.Get_NewId();
this.iters = new CIterators(new CMathContent(), new CMathContent());
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
...@@ -541,81 +544,22 @@ function CDegreeSubSup(props, bInside) ...@@ -541,81 +544,22 @@ function CDegreeSubSup(props, bInside)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CDegreeSubSup, CDegreeSubSupBase); Asc.extendClass(CDegreeSubSup, CDegreeSubSupBase);
CDegreeSubSup.prototype.ClassType = historyitem_type_deg_subsup;
CDegreeSubSup.prototype.kind = MATH_DEGREESubSup;
CDegreeSubSup.prototype.init = function(props) CDegreeSubSup.prototype.init = function(props)
{ {
this.Fill_LogicalContent(3);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
}; };
CDegreeSubSup.prototype.getPropsForWrite = function()
{
return this.Pr;
};
CDegreeSubSup.prototype.Copy = function()
{
var oProps =
{
ctrPrp : this.CtrPrp.Copy()
};
var NewDegree = new CDegreeSubSup(oProps); CDegreeSubSup.prototype.fillContent = function()
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)
{ {
}; this.baseContent = this.Content[2];
CDegreeSubSup.prototype.Write_ToBinary2 = function( Writer ) this.iters = new CIterators(this.Content[1], this.Content[0]);
{
Writer.WriteLong( historyitem_type_deg_subsup );
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
Writer.WriteString2(this.iters.iterDn.Id);
Writer.WriteString2(this.iters.iterUp.Id);
this.CtrPrp.Write_ToBinary(Writer); CDegreeSubSup.superclass.fillContent.apply(this, arguments);
Writer.WriteLong( this.Pr.type );
if ( this.Pr.type == DEGREE_SubSup )
{
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.alnScr )
{
Writer.WriteBool( this.Pr.alnScr );
Flags |= 1;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
}
};
CDegreeSubSup.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.iters.iterDn = g_oTableId.Get_ById(Reader.GetString2());
this.iters.iterUp = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
props.type = Reader.GetLong();
if ( props.type == DEGREE_SubSup )
{
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.alnScr = Reader.GetBool();
}
this.init(props);
this.iters.init();
};
CDegreeSubSup.prototype.Get_Id = function()
{
return this.Id;
}; };
...@@ -129,15 +129,14 @@ function CNary(props) ...@@ -129,15 +129,14 @@ function CNary(props)
CNary.superclass.constructor.call(this); CNary.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_NARY;
this.Pr = new CMathNaryPr(); this.Pr = new CMathNaryPr();
this.Base = null; this.Base = null;
this.Sign = null; this.Sign = null;
this.LowerIterator = new CMathContent(); this.LowerIterator = null;
this.UpperIterator = new CMathContent(); this.UpperIterator = null;
this.Arg = new CMathContent(); this.Arg = null;
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
...@@ -145,16 +144,24 @@ function CNary(props) ...@@ -145,16 +144,24 @@ function CNary(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CNary, CMathBase); Asc.extendClass(CNary, CMathBase);
CNary.prototype.ClassType = historyitem_type_nary;
CNary.prototype.kind = MATH_NARY;
CNary.prototype.init = function(props) CNary.prototype.init = function(props)
{ {
this.Fill_LogicalContent(3);
this.setProperties(props); this.setProperties(props);
this.fillContent();
} }
CNary.prototype.setProperties = function(props) CNary.prototype.fillContent = function()
{ {
this.setCtrPrp(props.ctrPrp); this.LowerIterator = this.Content[0];
this.Pr.Set_FromObject(props); this.UpperIterator = this.Content[1];
} this.Arg = this.Content[2];
CNary.prototype.fillContent = function(PropsInfo) };
CNary.prototype.fillBase = function(PropsInfo)
{ {
this.setDimension(1, 2); this.setDimension(1, 2);
...@@ -233,7 +240,6 @@ CNary.prototype.fillContent = function(PropsInfo) ...@@ -233,7 +240,6 @@ CNary.prototype.fillContent = function(PropsInfo)
this.Base = base; this.Base = base;
this.addMCToContent( [base, this.Arg] ); this.addMCToContent( [base, this.Arg] );
} }
CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
...@@ -277,7 +283,7 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -277,7 +283,7 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
// пока оставим так, chrType сейчас нигде не используется // пока оставим так, chrType сейчас нигде не используется
this.Pr.chrType = oSign.chrType; this.Pr.chrType = oSign.chrType;
this.fillContent(PropsInfo); this.fillBase(PropsInfo);
this.RecalcInfo.bProps = false; this.RecalcInfo.bProps = false;
} }
...@@ -427,62 +433,12 @@ CNary.prototype.getLowerIterator = function() ...@@ -427,62 +433,12 @@ CNary.prototype.getLowerIterator = function()
if (!this.Pr.subHide) if (!this.Pr.subHide)
return this.LowerIterator; return this.LowerIterator;
} }
CNary.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CNary.prototype.Correct_Content = function(bInnerCorrection) CNary.prototype.Correct_Content = function(bInnerCorrection)
{ {
this.LowerIterator.Correct_Content(bInnerCorrection); this.Content[0].Correct_Content(bInnerCorrection);
this.UpperIterator.Correct_Content(bInnerCorrection); this.Content[1].Correct_Content(bInnerCorrection);
this.Arg.Correct_Content(bInnerCorrection); this.Content[2].Correct_Content(bInnerCorrection);
}; };
CNary.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewNAry = new CNary(oProps);
this.LowerIterator.CopyTo(NewNAry.LowerIterator, false);
this.UpperIterator.CopyTo(NewNAry.UpperIterator, false);
this.Arg.CopyTo(NewNAry.Arg, false);
return NewNAry;
};
CNary.prototype.Refresh_RecalcData = function(Data)
{
}
CNary.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_nary );
Writer.WriteString2(this.Id);
Writer.WriteString2(this.Arg.Id);
Writer.WriteString2(this.LowerIterator.Id);
Writer.WriteString2(this.UpperIterator.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
}
CNary.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.Arg = g_oTableId.Get_ById(Reader.GetString2());
this.LowerIterator = g_oTableId.Get_ById(Reader.GetString2());
this.UpperIterator = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.RecalcInfo.bProps = true;
}
CNary.prototype.Get_Id = function()
{
return this.Id;
}
function CNaryUnd(bInside) function CNaryUnd(bInside)
{ {
......
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