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

Исправлен баг при рассчете класса 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 96a03e90
......@@ -412,7 +412,7 @@ CMathBoxPr.prototype.Copy = function()
return NewPr;
};
CMathBoxPr.prototype.Write_ToBinary = function(Wrtier)
CMathBoxPr.prototype.Write_ToBinary = function(Writer)
{
// Bool : aln
// Bool : brk
......@@ -420,11 +420,11 @@ CMathBoxPr.prototype.Write_ToBinary = function(Wrtier)
// Bool : noBreak
// Bool : opEmu
Writer.WriteBool(aln);
Writer.WriteBool(brk);
Writer.WriteBool(diff);
Writer.WriteBool(noBreak);
Writer.WriteBool(opEmu);
Writer.WriteBool(this.aln);
Writer.WriteBool(this.brk);
Writer.WriteBool(this.diff);
Writer.WriteBool(this.noBreak);
Writer.WriteBool(this.opEmu);
};
CMathBoxPr.prototype.Read_FromBinary = function(Reader)
......@@ -639,11 +639,11 @@ CMathPhantomPr.prototype.Write_ToBinary = function(Writer)
// Bool : zeroDesc
// Bool : zeroWid
Writer.WriteBool(show);
Writer.WriteBool(transp);
Writer.WriteBool(zeroAsc);
Writer.WriteBool(zeroDesc);
Writer.WriteBool(zeroWid);
Writer.WriteBool(this.show);
Writer.WriteBool(this.transp);
Writer.WriteBool(this.zeroAsc);
Writer.WriteBool(this.zeroDesc);
Writer.WriteBool(this.zeroWid);
};
CMathPhantomPr.prototype.Read_FromBinary = function(Reader)
......
......@@ -36,8 +36,8 @@ function CFraction(props)
this.Id = g_oIdCounter.Get_NewId();
this.Numerator = new CNumerator();
this.Denominator = new CDenominator();
this.Numerator = null;
this.Denominator = null;
this.Pr = new CMathFractionPr();
......@@ -55,6 +55,8 @@ CFraction.prototype.kind = MATH_FRACTION;
CFraction.prototype.init = function(props)
{
this.Fill_LogicalContent(2);
this.setProperties(props);
this.fillContent();
}
......@@ -385,13 +387,11 @@ CFraction.prototype.setPosition = function(pos, PosInfo)
else
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()
{
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)
{
this.setDimension(2, 1);
......@@ -415,63 +415,18 @@ CFraction.prototype.fillContent = function()
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);
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)
function CFractionBase(bInside, MathContent)
{
CFractionBase.superclass.constructor.call(this, bInside);
this.gap = 0;
this.init();
this.init(MathContent);
}
Asc.extendClass(CFractionBase, CMathBase);
CFractionBase.prototype.init = function()
CFractionBase.prototype.init = function(MathContent)
{
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = MathContent;
}
CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
......@@ -494,18 +449,16 @@ CFractionBase.prototype.setElement = function(Element)
};
CFractionBase.prototype.getPropsForWrite = function()
{
var props = {};
return props;
return {};
}
CFractionBase.prototype.Get_Id = function()
{
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);
CNumerator.prototype.recalculateSize = function()
......@@ -555,9 +508,9 @@ CNumerator.prototype.setPosition = function(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);
CDenominator.prototype.recalculateSize = function()
......
......@@ -3886,8 +3886,8 @@ CCharacter.prototype.getBase = function()
function CMathGroupChrPr()
{
this.chr = null;
this.chrType = null;
this.chr = undefined;
this.chrType = undefined;
this.vertJc = VJUST_TOP;
this.pos = LOCATION_BOT;
}
......@@ -3917,33 +3917,62 @@ CMathGroupChrPr.prototype.Copy = function()
};
CMathGroupChrPr.prototype.Write_ToBinary = function(Writer)
{
// Long : Flag
// Long : chr
// Long : chrType
// Long : vertJc
// Long : pos
Writer.WriteLong(null === this.chr ? -1 : this.chr);
Writer.WriteLong(null === this.chrType ? -1 : this.chrType);
var StartPos = Writer.GetCurPosition();
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.pos);
};
CMathGroupChrPr.prototype.Read_FromBinary = function(Reader)
{
// Long : Flag
// Long : chr
// Long : chrType
// Long : vertJc
// Long : pos
this.chr = Reader.GetLong();
this.chrType = Reader.GetLong();
this.vertJc = Reader.GetLong();
this.pos = Reader.GetLong();
var Flags = Reader.GetLong();
if (-1 === this.chr)
this.chr = null;
if (Flags & 1)
this.chr = Reader.GetLong();
else
this.chr = undefined;
if (-1 === this.chrType)
this.chrType = null;
if (Flags & 2)
this.chrType = Reader.GetLong();
else
this.chrType = undefined;
this.vertJc = Reader.GetLong();
this.pos = Reader.GetLong();
};
......@@ -3952,9 +3981,6 @@ function CGroupCharacter(props)
CGroupCharacter.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_GROUP_CHARACTER;
this.baseContent = new CMathContent();
this.Pr = new CMathGroupChrPr();
......@@ -3965,8 +3991,14 @@ function CGroupCharacter(props)
g_oTableId.Add( this, this.Id );
}
Asc.extendClass(CGroupCharacter, CCharacter);
CGroupCharacter.prototype.ClassType = historyitem_type_groupChr;
CGroupCharacter.prototype.kind = MATH_GROUP_CHARACTER;
CGroupCharacter.prototype.init = function(props)
{
this.Fill_LogicalContent(1);
this.setProperties(props);
this.fillContent();
}
......@@ -4001,31 +4033,25 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg
var Iterator;
if(this.Pr.pos == LOCATION_TOP)
Iterator = new CDenominator();
Iterator = new CDenominator(this.getBase());
else
Iterator = new CNumerator();
Iterator = new CNumerator(this.getBase());
Iterator.setElement(this.baseContent);
this.elements[0][0] = Iterator;
}
else
this.elements[0][0] = this.baseContent;
this.elements[0][0] = this.getBase();
CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSz);
}
CGroupCharacter.prototype.getBase = function()
{
return this.baseContent;
}
CGroupCharacter.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
return this.Content[0];
}
CGroupCharacter.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.elements[0][0] = this.baseContent;
this.elements[0][0] = this.getBase();
}
CGroupCharacter.prototype.getAscent = function(oMeasure)
{
......@@ -4049,45 +4075,4 @@ CGroupCharacter.prototype.getAscent = function(oMeasure)
return ascent;
}
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