Commit 07b95c65 authored by Ilya.Kirillov's avatar Ilya.Kirillov

В базовый класс CMathBase добавлено поле Content, которое будет хранить все...

В базовый класс CMathBase добавлено поле Content, которое будет хранить все MathContent, которые идет в элементе в их логическом порядке. Функции копирования и совместного редактирования также добавлены в базовый класс, классы, в которых будет правильно запоняться Content, смогут работать с этими функциями через базовый класс. Заполнение Content реализовано в классах CAccent, CBox, CBorderBox, CBar, CDelimiter, CPhantom, CEqArray. 

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58833 954022d7-b5bf-4e40-9824-e11837661b57
parent ec5c0681
...@@ -500,7 +500,6 @@ function CAccent(props) ...@@ -500,7 +500,6 @@ function CAccent(props)
CAccent.superclass.constructor.call(this); CAccent.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_ACCENT;
//// Properties //// Properties
this.Pr = new CMathAccentPr(); this.Pr = new CMathAccentPr();
...@@ -509,7 +508,6 @@ function CAccent(props) ...@@ -509,7 +508,6 @@ function CAccent(props)
///////////////// /////////////////
this.baseContent = new CMathContent();
this.operator = new COperator(OPER_ACCENT); this.operator = new COperator(OPER_ACCENT);
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
...@@ -518,29 +516,27 @@ function CAccent(props) ...@@ -518,29 +516,27 @@ function CAccent(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CAccent, CMathBase); Asc.extendClass(CAccent, CMathBase);
CAccent.prototype.ClassType = historyitem_type_acc;
CAccent.prototype.kind = MATH_ACCENT;
CAccent.prototype.init = function(props) CAccent.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
CAccent.prototype.getBase = function()
{
return this.Content[0];
};
CAccent.prototype.fillContent = function() CAccent.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
this.elements[0][0].SetDot(true); this.elements[0][0].SetDot(true);
} }
CAccent.prototype.setChr = function(chr)
{
this.Pr.chr = chr;
this.Pr.chrType = null;
this.RecalcInfo.bProps = true;
}
CAccent.prototype.setChrType = function(chrType)
{
this.Pr.chr = null;
this.Pr.chrType = chrType;
this.RecalcInfo.bProps = true;
}
CAccent.prototype.IsAccent = function() CAccent.prototype.IsAccent = function()
{ {
return true; return true;
...@@ -571,10 +567,6 @@ CAccent.prototype.setPosition = function(pos, PosInfo) ...@@ -571,10 +567,6 @@ CAccent.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(PosBase, PosInfo); this.elements[0][0].setPosition(PosBase, PosInfo);
} }
CAccent.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
this.Parent = Parent; this.Parent = Parent;
...@@ -619,10 +611,6 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -619,10 +611,6 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.size = {height: height, width: width, ascent: ascent}; this.size = {height: height, width: width, ascent: ascent};
} }
CAccent.prototype.getBase = function()
{
return this.elements[0][0];
}
CAccent.prototype.draw = function(x, y, pGraphics) CAccent.prototype.draw = function(x, y, pGraphics)
{ {
var base = this.elements[0][0]; var base = this.elements[0][0];
...@@ -680,48 +668,3 @@ CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, ...@@ -680,48 +668,3 @@ CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
return result; return result;
} }
\ No newline at end of file
CAccent.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
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.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_acc);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
};
CAccent.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.fillContent();
}
CAccent.prototype.Get_Id = function()
{
return this.Id;
};
\ No newline at end of file
...@@ -18,6 +18,7 @@ function CMathBase(bInside) ...@@ -18,6 +18,7 @@ function CMathBase(bInside)
///////////////// /////////////////
this.CurPos_X = 0; this.CurPos_X = 0;
this.CurPos_Y = 0; this.CurPos_Y = 0;
...@@ -63,11 +64,15 @@ function CMathBase(bInside) ...@@ -63,11 +64,15 @@ function CMathBase(bInside)
bProps: true bProps: true
}; };
this.Content = [];
return this; return this;
} }
CMathBase.prototype = CMathBase.prototype =
{ {
constructor: CMathBase, constructor: CMathBase,
setContent: function() setContent: function()
{ {
for(var i=0; i < this.nRow; i++) for(var i=0; i < this.nRow; i++)
...@@ -1236,4 +1241,86 @@ CMathBase.prototype = ...@@ -1236,4 +1241,86 @@ CMathBase.prototype =
} }
////////////////////////// //////////////////////////
};
CMathBase.prototype.Fill_LogicalContent = function(nCount)
{
for (var nIndex = 0; nIndex < nCount; nIndex++)
this.Content[nIndex] = new CMathContent();
};
CMathBase.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewElement = new this.constructor(oProps);
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; nIndex++)
{
this.Content[nIndex].CopyTo(NewElement.Content[nIndex], false);
}
return NewElement;
};
CMathBase.prototype.Refresh_RecalcData = function(Data)
{
};
CMathBase.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(this.ClassType);
// String : Id
// Long : Content.length
// Array of Strings : Content[Index].Id
// Variable : Pr
// Variable(CTextPr): CtrPrp
Writer.WriteString2(this.Id);
var nCount = this.Content.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; nIndex++)
{
Writer.WriteString2(this.Content[nIndex].Id);
}
this.Pr.Write_ToBinary(Writer);
this.CtrPrp.Write_ToBinary(Writer);
};
CMathBase.prototype.Read_FromBinary2 = function( Reader )
{
// String : Id
// Long : Content.length
// Array of Strings : Content[Index].Id
// Variable : Pr
// Variable(CTextPr): CtrPrp
this.Id = Reader.GetString2();
var nCount = Reader.GetLong();
this.Content = [];
for (var nIndex = 0; nIndex < nCount; nIndex++)
{
this.Content[nIndex] = g_oTableId.Get_ById(Reader.GetString2());
}
this.Pr.Read_FromBinary(Reader);
this.CtrPrp.Read_FromBinary(Reader);
this.fillContent();
}
CMathBase.prototype.Get_Id = function()
{
return this.Id;
};
CMathBase.prototype.getPropsForWrite = function()
{
return this.Pr;
};
CMathBase.prototype.setProperties = function(oProps)
{
this.Pr.Set_FromObject(oProps);
this.setCtrPrp(oProps.ctrPrp);
this.RecalcInfo.bProps = true;
} }
...@@ -100,36 +100,36 @@ function CBorderBox(props) ...@@ -100,36 +100,36 @@ function CBorderBox(props)
CBorderBox.superclass.constructor.call(this); CBorderBox.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BORDER_BOX;
this.gapBrd = 0; this.gapBrd = 0;
this.Pr = new CMathBorderBoxPr(); this.Pr = new CMathBorderBoxPr();
this.baseContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
g_oTableId.Add(this, this.Id); g_oTableId.Add(this, this.Id);
} }
Asc.extendClass(CBorderBox, CMathBase); Asc.extendClass(CBorderBox, CMathBase);
CBorderBox.prototype.ClassType = historyitem_type_borderBox;
CBorderBox.prototype.kind = MATH_BORDER_BOX;
CBorderBox.prototype.init = function(props) CBorderBox.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
CBorderBox.prototype.getBase = function()
{
return this.Content[0];
};
CBorderBox.prototype.fillContent = function() CBorderBox.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
}
CBorderBox.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
} }
CBorderBox.prototype.recalculateSize = function() CBorderBox.prototype.recalculateSize = function()
{ {
...@@ -361,49 +361,6 @@ CBorderBox.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin ...@@ -361,49 +361,6 @@ CBorderBox.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
return result; return result;
} }
CBorderBox.prototype.getBase = function()
{
return this.elements[0][0];
}
CBorderBox.prototype.getPropsForWrite = function()
{
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.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_borderBox);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
};
CBorderBox.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.fillContent();
}
CBorderBox.prototype.Get_Id = function()
{
return this.Id;
}
function CMathBoxPr() function CMathBoxPr()
{ {
...@@ -490,7 +447,6 @@ function CBox(props) ...@@ -490,7 +447,6 @@ function CBox(props)
CBox.superclass.constructor.call(this); CBox.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BOX;
this.Pr = new CMathBoxPr(); this.Pr = new CMathBoxPr();
...@@ -502,65 +458,27 @@ function CBox(props) ...@@ -502,65 +458,27 @@ function CBox(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CBox, CMathBase); Asc.extendClass(CBox, CMathBase);
CBox.prototype.ClassType = historyitem_type_box;
CBox.prototype.kind = MATH_BOX;
CBox.prototype.init = function(props) CBox.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
CBox.prototype.fillContent = function() CBox.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
}
CBox.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
} }
CBox.prototype.getBase = function() CBox.prototype.getBase = function()
{ {
return this.elements[0][0]; return this.Content[0];
} }
CBox.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CBox.prototype.Copy = function()
{
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.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_box);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
};
CBox.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.fillContent();
}
CBox.prototype.Get_Id = function()
{
return this.Id;
}
function CMathBarPr() function CMathBarPr()
{ {
...@@ -597,12 +515,9 @@ function CBar(props) ...@@ -597,12 +515,9 @@ function CBar(props)
CBar.superclass.constructor.call(this); CBar.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BAR;
this.Pr = new CMathBarPr(); this.Pr = new CMathBarPr();
this.baseContent = new CMathContent();
this.operator = new COperator(OPER_BAR); this.operator = new COperator(OPER_BAR);
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
...@@ -611,15 +526,25 @@ function CBar(props) ...@@ -611,15 +526,25 @@ function CBar(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CBar, CCharacter); Asc.extendClass(CBar, CCharacter);
CBar.prototype.ClassType = historyitem_type_bar;
CBar.prototype.kind = MATH_BAR;
CBar.prototype.init = function(props) CBar.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
CBar.prototype.getBase = function()
{
return this.Content[0];
};
CBar.prototype.fillContent = function() CBar.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
} }
CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
...@@ -655,75 +580,6 @@ CBar.prototype.getAscent = function() ...@@ -655,75 +580,6 @@ CBar.prototype.getAscent = function()
return ascent; return ascent;
} }
CBar.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
}
CBar.prototype.getPropsForWrite = function()
{
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)
{
Writer.WriteLong( historyitem_type_bar );
}
CBar.prototype.Load_Changes = function(Reader)
{
}
CBar.prototype.Refresh_RecalcData = function(Data)
{
}
CBar.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_bar);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.pos )
{
Writer.WriteLong( this.Pr.pos );
Flags |= 1;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
}
CBar.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.pos = Reader.GetLong();
this.init(props);
}
CBar.prototype.Get_Id = function()
{
return this.Id;
}
function CMathPhantomPr() function CMathPhantomPr()
{ {
...@@ -813,71 +669,29 @@ function CPhantom(props) ...@@ -813,71 +669,29 @@ function CPhantom(props)
this.Pr = new CMathPhantomPr(); this.Pr = new CMathPhantomPr();
this.baseContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CPhantom, CMathBase); Asc.extendClass(CPhantom, CMathBase);
CPhantom.prototype.ClassType = historyitem_type_phant;
CPhantom.prototype.kind = MATH_PHANTOM;
CPhantom.prototype.init = function(props) CPhantom.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
CPhantom.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.elements[0][0] = this.baseContent;
}
CPhantom.prototype.getBase = function() CPhantom.prototype.getBase = function()
{ {
return this.elements[0][0]; return this.Content[0];
}
CPhantom.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true;
} }
CPhantom.prototype.getPropsForWrite = function() CPhantom.prototype.fillContent = function()
{
return this.Pr;
}
CPhantom.prototype.Copy = function()
{
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.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong(historyitem_type_phant);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
}
CPhantom.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.fillContent();
}
CPhantom.prototype.Get_Id = function()
{ {
return this.Id; this.setDimension(1, 1);
this.elements[0][0] = this.getBase();
} }
\ No newline at end of file
...@@ -35,7 +35,6 @@ function CFraction(props) ...@@ -35,7 +35,6 @@ function CFraction(props)
CFraction.superclass.constructor.call(this); CFraction.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_FRACTION;
this.Numerator = new CNumerator(); this.Numerator = new CNumerator();
this.Denominator = new CDenominator(); this.Denominator = new CDenominator();
...@@ -50,6 +49,10 @@ function CFraction(props) ...@@ -50,6 +49,10 @@ function CFraction(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CFraction, CMathBase); Asc.extendClass(CFraction, CMathBase);
CFraction.prototype.ClassType = historyitem_type_frac;
CFraction.prototype.kind = MATH_FRACTION;
CFraction.prototype.init = function(props) CFraction.prototype.init = function(props)
{ {
this.setProperties(props); this.setProperties(props);
......
...@@ -757,6 +757,8 @@ function CMathEqArrPr() ...@@ -757,6 +757,8 @@ function CMathEqArrPr()
this.rSp = 0; this.rSp = 0;
this.rSpRule = 0; this.rSpRule = 0;
this.baseJc = BASEJC_CENTER; this.baseJc = BASEJC_CENTER;
this.row = 1;
} }
CMathEqArrPr.prototype.Set_FromObject = function(Obj) CMathEqArrPr.prototype.Set_FromObject = function(Obj)
...@@ -775,6 +777,8 @@ CMathEqArrPr.prototype.Set_FromObject = function(Obj) ...@@ -775,6 +777,8 @@ CMathEqArrPr.prototype.Set_FromObject = function(Obj)
if(undefined !== Obj.baseJc && null !== Obj.baseJc) if(undefined !== Obj.baseJc && null !== Obj.baseJc)
this.baseJc = Obj.baseJc; this.baseJc = Obj.baseJc;
this.row = Obj.row;
}; };
CMathEqArrPr.prototype.Copy = function() CMathEqArrPr.prototype.Copy = function()
...@@ -786,6 +790,7 @@ CMathEqArrPr.prototype.Copy = function() ...@@ -786,6 +790,7 @@ CMathEqArrPr.prototype.Copy = function()
NewPr.rSp = this.rSp ; NewPr.rSp = this.rSp ;
NewPr.rSpRule = this.rSpRule; NewPr.rSpRule = this.rSpRule;
NewPr.baseJc = this.baseJc ; NewPr.baseJc = this.baseJc ;
NewPr.row = this.row;
return NewPr; return NewPr;
}; };
...@@ -797,12 +802,14 @@ CMathEqArrPr.prototype.Write_ToBinary = function(Writer) ...@@ -797,12 +802,14 @@ CMathEqArrPr.prototype.Write_ToBinary = function(Writer)
// Long : rSp // Long : rSp
// Long : rSpRule // Long : rSpRule
// Long : baseJc // Long : baseJc
// Long : row
Writer.WriteLong(this.maxDist); Writer.WriteLong(this.maxDist);
Writer.WriteLong(this.objDist); Writer.WriteLong(this.objDist);
Writer.WriteLong(this.rSp); Writer.WriteLong(this.rSp);
Writer.WriteLong(this.rSpRule); Writer.WriteLong(this.rSpRule);
Writer.WriteLong(this.baseJc); Writer.WriteLong(this.baseJc);
Writer.WriteLong(this.row);
}; };
CMathEqArrPr.prototype.Read_FromBinary = function(Reader) CMathEqArrPr.prototype.Read_FromBinary = function(Reader)
...@@ -812,12 +819,14 @@ CMathEqArrPr.prototype.Read_FromBinary = function(Reader) ...@@ -812,12 +819,14 @@ CMathEqArrPr.prototype.Read_FromBinary = function(Reader)
// Long : rSp // Long : rSp
// Long : rSpRule // Long : rSpRule
// Long : baseJc // Long : baseJc
// Long : row
this.maxDist = Reader.GetLong(); this.maxDist = Reader.GetLong();
this.objDist = Reader.GetLong(); this.objDist = Reader.GetLong();
this.rSp = Reader.GetLong(); this.rSp = Reader.GetLong();
this.rSpRule = Reader.GetLong(); this.rSpRule = Reader.GetLong();
this.baseJc = Reader.GetLong(); this.baseJc = Reader.GetLong();
this.row = Reader.GetLong();
}; };
//// ////
...@@ -826,7 +835,6 @@ function CEqArray(props) ...@@ -826,7 +835,6 @@ function CEqArray(props)
CEqArray.superclass.constructor.call(this); CEqArray.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_EQ_ARRAY;
this.Pr = new CMathEqArrPr(); this.Pr = new CMathEqArrPr();
...@@ -848,12 +856,27 @@ function CEqArray(props) ...@@ -848,12 +856,27 @@ function CEqArray(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CEqArray, CMatrixBase); Asc.extendClass(CEqArray, CMatrixBase);
CEqArray.prototype.ClassType = historyitem_type_eqArr;
CEqArray.prototype.kind = MATH_EQ_ARRAY;
CEqArray.prototype.init = function(props) CEqArray.prototype.init = function(props)
{ {
var nRowsCount = props.row;
this.Fill_LogicalContent(nRowsCount);
this.setProperties(props); this.setProperties(props);
this.setDimension(props.row, 1); this.fillContent();
this.setContent();
} }
CEqArray.prototype.fillContent = function()
{
var nRowsCount = this.Content.length;
this.setDimension(nRowsCount, 1);
for (var nIndex = 0; nIndex < nRowsCount; nIndex++)
this.elements[nIndex][0] = this.Content[nIndex];
};
CEqArray.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CEqArray.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
// на случай, чтобы не затереть массив // на случай, чтобы не затереть массив
...@@ -1023,68 +1046,7 @@ CEqArray.prototype.setPosition = function(pos) ...@@ -1023,68 +1046,7 @@ CEqArray.prototype.setPosition = function(pos)
//PosInfo.Points.length = 0; //PosInfo.Points.length = 0;
} }
CEqArray.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
}
CEqArray.prototype.getElement = function(num) CEqArray.prototype.getElement = function(num)
{ {
return this.elements[num][0]; return this.elements[num][0];
} }
CEqArray.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CEqArray.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
var NewEqArray = new CEqArray(oProps);
var nRowsCount = this.elements.length;
NewEqArray.setDimension(nRowsCount, 1);
NewEqArray.setContent();
for (var nRowIndex = 0; nRowIndex < nRowsCount; nRowIndex++)
{
this.elements[nRowIndex][0].CopyTo(NewEqArray.elements[nRowIndex][0], false);
}
return NewEqArray;
};
CEqArray.prototype.Refresh_RecalcData = function(Data)
{
}
CEqArray.prototype.Write_ToBinary2 = function( Writer )
{
var nRowsCount = this.elements.length;
Writer.WriteLong( historyitem_type_eqArr );
Writer.WriteString2(this.Id);
Writer.WriteLong(nRowsCount);
for (var nRowIndex = 0; nRowIndex < nRowsCount; nRowIndex++)
{
Writer.WriteString2(this.getElement(nRowIndex).Id);
}
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
}
CEqArray.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
var nRowsCount = Reader.GetLong();
this.setDimension(nRowsCount, 1);
for (var nRowIndex = 0; nRowIndex < nRowsCount; nRowIndex++)
{
this.elements[nRowIndex][0] = g_oTableId.Get_ById(Reader.GetString2());
}
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
}
CEqArray.prototype.Get_Id = function()
{
return this.Id;
}
...@@ -3383,7 +3383,6 @@ function CDelimiter(props) ...@@ -3383,7 +3383,6 @@ function CDelimiter(props)
CDelimiter.superclass.constructor.call(this); CDelimiter.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DELIMITER;
this.begOper = new COperator (OPER_DELIMITER); this.begOper = new COperator (OPER_DELIMITER);
this.endOper = new COperator (OPER_DELIMITER); this.endOper = new COperator (OPER_DELIMITER);
...@@ -3397,24 +3396,30 @@ function CDelimiter(props) ...@@ -3397,24 +3396,30 @@ function CDelimiter(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CDelimiter, CMathBase); Asc.extendClass(CDelimiter, CMathBase);
CDelimiter.prototype.ClassType = historyitem_type_delimiter;
CDelimiter.prototype.kind = MATH_DELIMITER;
CDelimiter.prototype.init = function(props) CDelimiter.prototype.init = function(props)
{ {
this.setProperties(props); this.setProperties(props);
this.Fill_LogicalContent(this.getColumnsCount());
this.fillContent(); this.fillContent();
} }
CDelimiter.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CDelimiter.prototype.getColumnsCount = function() CDelimiter.prototype.getColumnsCount = function()
{ {
return this.Pr.column; return this.Pr.column;
}; };
CDelimiter.prototype.fillContent = function() CDelimiter.prototype.fillContent = function()
{ {
this.setDimension(1, this.Pr.column); var nColumnsCount = this.getColumnsCount();
this.setContent();
this.setDimension(1, nColumnsCount);
for (var nIndex = 0; nIndex < nColumnsCount; nIndex++)
this.elements[0][nIndex] = this.Content[nIndex];
} }
CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
...@@ -3755,62 +3760,6 @@ CDelimiter.prototype.getBase = function(numb) ...@@ -3755,62 +3760,6 @@ CDelimiter.prototype.getBase = function(numb)
return this.elements[0][numb]; return this.elements[0][numb];
} }
CDelimiter.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CDelimiter.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewDelimiter = new CDelimiter(oProps);
var nColsCount = this.getColumnsCount();
NewDelimiter.setDimension(1, nColsCount);
NewDelimiter.setContent();
for (var nColIndex = 0; nColIndex < nColsCount; nColIndex++)
this.elements[0][nColIndex].CopyTo(NewDelimiter.elements[0][nColIndex], false);
return NewDelimiter;
};
CDelimiter.prototype.Refresh_RecalcData = function(Data)
{
}
CDelimiter.prototype.Write_ToBinary2 = function( Writer )
{
var nColsCount = this.getColumnsCount();
Writer.WriteLong( historyitem_type_delimiter );
Writer.WriteString2(this.Id);
Writer.WriteLong(nColsCount);
for (var nColIndex = 0; nColIndex < nColsCount; nColIndex++)
Writer.WriteString2(this.getBase(nColIndex).Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
}
CDelimiter.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
var nColsCount = Reader.GetLong();
this.setDimension(1, nColsCount);
for (var nColIndex = 0; nColIndex < nColsCount; nColIndex++)
this.elements[0][nColIndex] = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
}
CDelimiter.prototype.Get_Id = function()
{
return this.Id;
}
function CCharacter() function CCharacter()
{ {
...@@ -4005,7 +3954,7 @@ function CGroupCharacter(props) ...@@ -4005,7 +3954,7 @@ function CGroupCharacter(props)
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.baseContent = new CMathContent();
this.Pr = new CMathGroupChrPr(); this.Pr = new CMathGroupChrPr();
...@@ -4056,17 +4005,17 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg ...@@ -4056,17 +4005,17 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg
else else
Iterator = new CNumerator(); Iterator = new CNumerator();
Iterator.setElement(this.Content); Iterator.setElement(this.baseContent);
this.elements[0][0] = Iterator; this.elements[0][0] = Iterator;
} }
else else
this.elements[0][0] = this.Content; this.elements[0][0] = this.baseContent;
CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSz); CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSz);
} }
CGroupCharacter.prototype.getBase = function() CGroupCharacter.prototype.getBase = function()
{ {
return this.Content; return this.baseContent;
} }
CGroupCharacter.prototype.setProperties = function(props) CGroupCharacter.prototype.setProperties = function(props)
{ {
...@@ -4076,7 +4025,7 @@ CGroupCharacter.prototype.setProperties = function(props) ...@@ -4076,7 +4025,7 @@ CGroupCharacter.prototype.setProperties = function(props)
CGroupCharacter.prototype.fillContent = function() CGroupCharacter.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.Content; this.elements[0][0] = this.baseContent;
} }
CGroupCharacter.prototype.getAscent = function(oMeasure) CGroupCharacter.prototype.getAscent = function(oMeasure)
{ {
...@@ -4111,7 +4060,7 @@ CGroupCharacter.prototype.Copy = function() ...@@ -4111,7 +4060,7 @@ CGroupCharacter.prototype.Copy = function()
oProps.ctrPrp = this.CtrPrp.Copy(); oProps.ctrPrp = this.CtrPrp.Copy();
var NewGroupChar = new CGroupCharacter(oProps); var NewGroupChar = new CGroupCharacter(oProps);
this.Content.CopyTo(NewGroupChar.Content, false); this.baseContent.CopyTo(NewGroupChar.baseContent, false);
return NewGroupChar; return NewGroupChar;
}; };
CGroupCharacter.prototype.Refresh_RecalcData = function(Data) CGroupCharacter.prototype.Refresh_RecalcData = function(Data)
...@@ -4122,7 +4071,7 @@ CGroupCharacter.prototype.Write_ToBinary2 = function( Writer ) ...@@ -4122,7 +4071,7 @@ CGroupCharacter.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteLong( historyitem_type_groupChr ); Writer.WriteLong( historyitem_type_groupChr );
Writer.WriteString2(this.Id); Writer.WriteString2(this.Id);
Writer.WriteString2(this.Content.Id); Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer); this.Pr.Write_ToBinary(Writer);
...@@ -4131,7 +4080,7 @@ CGroupCharacter.prototype.Read_FromBinary2 = function( Reader ) ...@@ -4131,7 +4080,7 @@ CGroupCharacter.prototype.Read_FromBinary2 = function( Reader )
{ {
this.Id = Reader.GetString2(); this.Id = Reader.GetString2();
this.Content = g_oTableId.Get_ById(Reader.GetString2()); this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.CtrPrp.Read_FromBinary(Reader); this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader); this.Pr.Read_FromBinary(Reader);
......
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