Commit fec324f6 authored by Ilya.Kirillov's avatar Ilya.Kirillov

Исправлен баг при рассчете класса CGroupCharacter, из-за которого создавались...

Исправлен баг при рассчете класса CGroupCharacter, из-за которого создавались классы CMathContent. В классах CFraction и CGroupCharacter реализовано заполнение Content.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58838 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f37df58
...@@ -412,7 +412,7 @@ CMathBoxPr.prototype.Copy = function() ...@@ -412,7 +412,7 @@ CMathBoxPr.prototype.Copy = function()
return NewPr; return NewPr;
}; };
CMathBoxPr.prototype.Write_ToBinary = function(Wrtier) CMathBoxPr.prototype.Write_ToBinary = function(Writer)
{ {
// Bool : aln // Bool : aln
// Bool : brk // Bool : brk
...@@ -420,11 +420,11 @@ CMathBoxPr.prototype.Write_ToBinary = function(Wrtier) ...@@ -420,11 +420,11 @@ CMathBoxPr.prototype.Write_ToBinary = function(Wrtier)
// Bool : noBreak // Bool : noBreak
// Bool : opEmu // Bool : opEmu
Writer.WriteBool(aln); Writer.WriteBool(this.aln);
Writer.WriteBool(brk); Writer.WriteBool(this.brk);
Writer.WriteBool(diff); Writer.WriteBool(this.diff);
Writer.WriteBool(noBreak); Writer.WriteBool(this.noBreak);
Writer.WriteBool(opEmu); Writer.WriteBool(this.opEmu);
}; };
CMathBoxPr.prototype.Read_FromBinary = function(Reader) CMathBoxPr.prototype.Read_FromBinary = function(Reader)
...@@ -639,11 +639,11 @@ CMathPhantomPr.prototype.Write_ToBinary = function(Writer) ...@@ -639,11 +639,11 @@ CMathPhantomPr.prototype.Write_ToBinary = function(Writer)
// Bool : zeroDesc // Bool : zeroDesc
// Bool : zeroWid // Bool : zeroWid
Writer.WriteBool(show); Writer.WriteBool(this.show);
Writer.WriteBool(transp); Writer.WriteBool(this.transp);
Writer.WriteBool(zeroAsc); Writer.WriteBool(this.zeroAsc);
Writer.WriteBool(zeroDesc); Writer.WriteBool(this.zeroDesc);
Writer.WriteBool(zeroWid); Writer.WriteBool(this.zeroWid);
}; };
CMathPhantomPr.prototype.Read_FromBinary = function(Reader) CMathPhantomPr.prototype.Read_FromBinary = function(Reader)
......
...@@ -36,8 +36,8 @@ function CFraction(props) ...@@ -36,8 +36,8 @@ function CFraction(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.Numerator = new CNumerator(); this.Numerator = null;
this.Denominator = new CDenominator(); this.Denominator = null;
this.Pr = new CMathFractionPr(); this.Pr = new CMathFractionPr();
...@@ -55,6 +55,8 @@ CFraction.prototype.kind = MATH_FRACTION; ...@@ -55,6 +55,8 @@ CFraction.prototype.kind = MATH_FRACTION;
CFraction.prototype.init = function(props) CFraction.prototype.init = function(props)
{ {
this.Fill_LogicalContent(2);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
...@@ -385,13 +387,11 @@ CFraction.prototype.setPosition = function(pos, PosInfo) ...@@ -385,13 +387,11 @@ CFraction.prototype.setPosition = function(pos, PosInfo)
else else
CFraction.superclass.setPosition.call(this, pos, PosInfo); CFraction.superclass.setPosition.call(this, pos, PosInfo);
} }
CFraction.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CFraction.prototype.fillContent = function() CFraction.prototype.fillContent = function()
{ {
this.Numerator = new CNumerator(this.Content[0]);
this.Denominator = new CDenominator(this.Content[1]);
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION) if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{ {
this.setDimension(2, 1); this.setDimension(2, 1);
...@@ -415,63 +415,18 @@ CFraction.prototype.fillContent = function() ...@@ -415,63 +415,18 @@ CFraction.prototype.fillContent = function()
this.elements[0][1] = this.Denominator.getElement(); this.elements[0][1] = this.Denominator.getElement();
} }
} }
CFraction.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CFraction.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewFraction = new CFraction(oProps); function CFractionBase(bInside, MathContent)
this.Denominator.getElement().CopyTo(NewFraction.Denominator.getElement(), false);
this.Numerator.getElement().CopyTo(NewFraction.Numerator.getElement(), false);
return NewFraction;
};
CFraction.prototype.Refresh_RecalcData = function(Data)
{
}
CFraction.prototype.Write_ToBinary2 = function(Writer)
{
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);
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()));
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
this.fillContent();
}
CFraction.prototype.Get_Id = function()
{
return this.Id;
}
function CFractionBase(bInside)
{ {
CFractionBase.superclass.constructor.call(this, bInside); CFractionBase.superclass.constructor.call(this, bInside);
this.gap = 0; this.gap = 0;
this.init(); this.init(MathContent);
} }
Asc.extendClass(CFractionBase, CMathBase); Asc.extendClass(CFractionBase, CMathBase);
CFractionBase.prototype.init = function() CFractionBase.prototype.init = function(MathContent)
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.elements[0][0] = MathContent;
} }
CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
...@@ -494,18 +449,16 @@ CFractionBase.prototype.setElement = function(Element) ...@@ -494,18 +449,16 @@ CFractionBase.prototype.setElement = function(Element)
}; };
CFractionBase.prototype.getPropsForWrite = function() CFractionBase.prototype.getPropsForWrite = function()
{ {
var props = {}; return {};
return props;
} }
CFractionBase.prototype.Get_Id = function() CFractionBase.prototype.Get_Id = function()
{ {
return this.elements[0][0].Get_Id(); return this.elements[0][0].Get_Id();
}; };
function CNumerator() function CNumerator(MathContent)
{ {
CNumerator.superclass.constructor.call(this, true); CNumerator.superclass.constructor.call(this, true, MathContent);
} }
Asc.extendClass(CNumerator, CFractionBase); Asc.extendClass(CNumerator, CFractionBase);
CNumerator.prototype.recalculateSize = function() CNumerator.prototype.recalculateSize = function()
...@@ -555,9 +508,9 @@ CNumerator.prototype.setPosition = function(pos, PosInfo) ...@@ -555,9 +508,9 @@ CNumerator.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(pos, PosInfo); this.elements[0][0].setPosition(pos, PosInfo);
} }
function CDenominator() function CDenominator(MathContent)
{ {
CDenominator.superclass.constructor.call(this, true); CDenominator.superclass.constructor.call(this, true, MathContent);
} }
Asc.extendClass(CDenominator, CFractionBase); Asc.extendClass(CDenominator, CFractionBase);
CDenominator.prototype.recalculateSize = function() CDenominator.prototype.recalculateSize = function()
......
...@@ -3886,8 +3886,8 @@ CCharacter.prototype.getBase = function() ...@@ -3886,8 +3886,8 @@ CCharacter.prototype.getBase = function()
function CMathGroupChrPr() function CMathGroupChrPr()
{ {
this.chr = null; this.chr = undefined;
this.chrType = null; this.chrType = undefined;
this.vertJc = VJUST_TOP; this.vertJc = VJUST_TOP;
this.pos = LOCATION_BOT; this.pos = LOCATION_BOT;
} }
...@@ -3917,33 +3917,62 @@ CMathGroupChrPr.prototype.Copy = function() ...@@ -3917,33 +3917,62 @@ CMathGroupChrPr.prototype.Copy = function()
}; };
CMathGroupChrPr.prototype.Write_ToBinary = function(Writer) CMathGroupChrPr.prototype.Write_ToBinary = function(Writer)
{ {
// Long : Flag
// Long : chr // Long : chr
// Long : chrType // Long : chrType
// Long : vertJc // Long : vertJc
// Long : pos // Long : pos
Writer.WriteLong(null === this.chr ? -1 : this.chr); var StartPos = Writer.GetCurPosition();
Writer.WriteLong(null === this.chrType ? -1 : this.chrType); Writer.Skip(4);
var Flags = 0;
if (undefined !== this.chr)
{
Writer.WriteLong(this.chr);
Flags |= 1;
}
if (undefined !== this.chrType)
{
Writer.WriteLong(this.chrType);
Flags |= 2;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek(StartPos);
Writer.WriteLong(Flags);
Writer.Seek(EndPos);
Writer.WriteLong(this.vertJc); Writer.WriteLong(this.vertJc);
Writer.WriteLong(this.pos); Writer.WriteLong(this.pos);
}; };
CMathGroupChrPr.prototype.Read_FromBinary = function(Reader) CMathGroupChrPr.prototype.Read_FromBinary = function(Reader)
{ {
// Long : Flag
// Long : chr // Long : chr
// Long : chrType // Long : chrType
// Long : vertJc // Long : vertJc
// Long : pos // Long : pos
var Flags = Reader.GetLong();
if (Flags & 1)
this.chr = Reader.GetLong(); this.chr = Reader.GetLong();
else
this.chr = undefined;
if (Flags & 2)
this.chrType = Reader.GetLong(); this.chrType = Reader.GetLong();
else
this.chrType = undefined;
this.vertJc = Reader.GetLong(); this.vertJc = Reader.GetLong();
this.pos = Reader.GetLong(); this.pos = Reader.GetLong();
if (-1 === this.chr)
this.chr = null;
if (-1 === this.chrType)
this.chrType = null;
}; };
...@@ -3952,9 +3981,6 @@ function CGroupCharacter(props) ...@@ -3952,9 +3981,6 @@ function CGroupCharacter(props)
CGroupCharacter.superclass.constructor.call(this); CGroupCharacter.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_GROUP_CHARACTER;
this.baseContent = new CMathContent();
this.Pr = new CMathGroupChrPr(); this.Pr = new CMathGroupChrPr();
...@@ -3965,8 +3991,14 @@ function CGroupCharacter(props) ...@@ -3965,8 +3991,14 @@ function CGroupCharacter(props)
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(CGroupCharacter, CCharacter); Asc.extendClass(CGroupCharacter, CCharacter);
CGroupCharacter.prototype.ClassType = historyitem_type_groupChr;
CGroupCharacter.prototype.kind = MATH_GROUP_CHARACTER;
CGroupCharacter.prototype.init = function(props) CGroupCharacter.prototype.init = function(props)
{ {
this.Fill_LogicalContent(1);
this.setProperties(props); this.setProperties(props);
this.fillContent(); this.fillContent();
} }
...@@ -4001,31 +4033,25 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg ...@@ -4001,31 +4033,25 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg
var Iterator; var Iterator;
if(this.Pr.pos == LOCATION_TOP) if(this.Pr.pos == LOCATION_TOP)
Iterator = new CDenominator(); Iterator = new CDenominator(this.getBase());
else else
Iterator = new CNumerator(); Iterator = new CNumerator(this.getBase());
Iterator.setElement(this.baseContent);
this.elements[0][0] = Iterator; this.elements[0][0] = Iterator;
} }
else else
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
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.baseContent; return this.Content[0];
}
CGroupCharacter.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
} }
CGroupCharacter.prototype.fillContent = function() CGroupCharacter.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.baseContent; this.elements[0][0] = this.getBase();
} }
CGroupCharacter.prototype.getAscent = function(oMeasure) CGroupCharacter.prototype.getAscent = function(oMeasure)
{ {
...@@ -4050,44 +4076,3 @@ CGroupCharacter.prototype.getAscent = function(oMeasure) ...@@ -4050,44 +4076,3 @@ CGroupCharacter.prototype.getAscent = function(oMeasure)
return ascent; return ascent;
} }
\ No newline at end of file
CGroupCharacter.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CGroupCharacter.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewGroupChar = new CGroupCharacter(oProps);
this.baseContent.CopyTo(NewGroupChar.baseContent, false);
return NewGroupChar;
};
CGroupCharacter.prototype.Refresh_RecalcData = function(Data)
{
}
CGroupCharacter.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_groupChr );
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
this.Pr.Write_ToBinary(Writer);
}
CGroupCharacter.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();
}
CGroupCharacter.prototype.Get_Id = function()
{
return this.Id;
}
\ No newline at end of file
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