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

Исправлены множественные баги в совместном редактировании в формулах....

Исправлены множественные баги в совместном редактировании в формулах. Исправлены баги в копировании в формулах.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58678 954022d7-b5bf-4e40-9824-e11837661b57
parent 878ab098
...@@ -88,20 +88,17 @@ ParaMath.prototype.Get_Id = function() ...@@ -88,20 +88,17 @@ ParaMath.prototype.Get_Id = function()
ParaMath.prototype.Copy = function(Selected) ParaMath.prototype.Copy = function(Selected)
{ {
// TODO: ParaMath.Copy
var NewMath = new ParaMath(); var NewMath = new ParaMath();
NewMath.Root.bRoot = true;
if(Selected) if(Selected)
{ {
var result = this.GetSelectContent(); var result = this.GetSelectContent();
NewMath.Root = result.Content.Copy(Selected); result.Content.CopyTo(NewMath.Root, Selected);
NewMath.Root.bRoot = true;
} }
else else
{ {
NewMath.Root = this.Root.Copy(Selected); this.Root.CopyTo(NewMath.Root, Selected);
NewMath.Root.bRoot = true;
} }
/// argSize, bDot и bRoot выставить на объединении контентов /// argSize, bDot и bRoot выставить на объединении контентов
...@@ -1596,26 +1593,29 @@ ParaMath.prototype.Load_Changes = function(Reader) ...@@ -1596,26 +1593,29 @@ ParaMath.prototype.Load_Changes = function(Reader)
}; };
ParaMath.prototype.Write_ToBinary = function(Writer)
{
// Long : Type
// String : Id
Writer.WriteLong( this.Type );
Writer.WriteString2( this.Id );
};
ParaMath.prototype.Write_ToBinary2 = function(Writer) ParaMath.prototype.Write_ToBinary2 = function(Writer)
{ {
Writer.WriteLong( historyitem_type_Math ); Writer.WriteLong( historyitem_type_Math );
Writer.WriteString2( this.Root.Id );
// String : this.Id
// Long : this.Type
// String : Root.Id
Writer.WriteString2(this.Id);
Writer.WriteLong(this.Type);
Writer.WriteString2(this.Root.Id);
}; };
ParaMath.prototype.Read_FromBinary2 = function(Reader) ParaMath.prototype.Read_FromBinary2 = function(Reader)
{ {
var Element = g_oTableId.Get_ById( Reader.GetString2() ); // String : this.Id
Element.bRoot = true; // Long : this.Type
this.Root = Element; // String : Root.Id
this.Id = Reader.GetString2();
this.Type = Reader.GetLong();
this.Root = g_oTableId.Get_ById(Reader.GetString2());
this.Root.bRoot = true;
}; };
ParaMath.prototype.Get_ContentSelection = function() ParaMath.prototype.Get_ContentSelection = function()
......
...@@ -9748,7 +9748,7 @@ function Binary_oMathReader(stream) ...@@ -9748,7 +9748,7 @@ function Binary_oMathReader(stream)
oText = new ParaSpace(1) oText = new ParaSpace(1)
*/ */
if (oText) if (oText)
oMRun.Content.splice( i, 0, oText ); oMRun.Add_ToContent(i, oText, false, true);
} }
if (oParent) if (oParent)
......
...@@ -2,9 +2,14 @@ ...@@ -2,9 +2,14 @@
function CFraction(props) function CFraction(props)
{ {
CFraction.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_FRACTION; this.kind = MATH_FRACTION;
this.Numerator = new CNumerator();
this.Denominator = new CDenominator();
this.Pr = this.Pr =
{ {
type: BAR_FRACTION type: BAR_FRACTION
...@@ -12,8 +17,6 @@ function CFraction(props) ...@@ -12,8 +17,6 @@ function CFraction(props)
this.bHideBar = false; this.bHideBar = false;
CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined") if(props !== null && typeof(props) !== "undefined")
this.init(props); this.init(props);
...@@ -367,50 +370,26 @@ CFraction.prototype.fillContent = function() ...@@ -367,50 +370,26 @@ CFraction.prototype.fillContent = function()
{ {
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION) if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{ {
var num = new CNumerator();
var den = new CDenominator();
this.setDimension(2, 1); this.setDimension(2, 1);
if(this.Pr.type == NO_BAR_FRACTION) if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true; this.bHideBar = true;
this.addMCToContent([num, den]); this.elements[0][0] = this.Numerator;
this.elements[1][0] = this.Denominator;
} }
else if(this.Pr.type == SKEWED_FRACTION) else if(this.Pr.type == SKEWED_FRACTION)
{ {
this.setDimension(1, 2); this.setDimension(1, 2);
this.setContent(); this.elements[0][0] = this.Numerator.getElement();
this.elements[0][1] = this.Denominator.getElement();
} }
else if(this.Pr.type == LINEAR_FRACTION) else if(this.Pr.type == LINEAR_FRACTION)
{ {
this.setDimension(1, 2); this.setDimension(1, 2);
this.setContent(); this.elements[0][0] = this.Numerator.getElement();
} this.elements[0][1] = this.Denominator.getElement();
}
CFraction.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
{
// Numerator
this.elements[0][0].fillMathComposition(contents[0]);
// Denominator
this.elements[1][0].fillMathComposition(contents[1]);
}
else
{
// Numerator
this.elements[0][0] = contents[0];
// Denominator
this.elements[0][1] = contents[1];
} }
} }
CFraction.prototype.getPropsForWrite = function() CFraction.prototype.getPropsForWrite = function()
{ {
...@@ -426,65 +405,61 @@ CFraction.prototype.Load_Changes = function(Reader) ...@@ -426,65 +405,61 @@ CFraction.prototype.Load_Changes = function(Reader)
CFraction.prototype.Refresh_RecalcData = function(Data) 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.getNumerator().Id ); Writer.WriteString2(this.Numerator.Get_Id());
Writer.WriteString2( this.getDenominator().Id ); Writer.WriteString2(this.Denominator.Get_Id());
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition(); if (undefined !== this.Pr.type)
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.type )
{ {
Writer.WriteLong( this.Pr.type ); Writer.WriteBool(true);
Flags |= 1; Writer.WriteLong(this.Pr.type);
} }
var EndPos = Writer.GetCurPosition(); else
Writer.Seek( StartPos ); Writer.WriteBool(false);
Writer.WriteLong( Flags ); }
Writer.Seek( EndPos ); CFraction.prototype.Read_FromBinary2 = function(Reader)
} {
CFraction.prototype.Read_FromBinary2 = function( Reader ) this.Numerator.setElement(g_oTableId.Get_ById(Reader.GetString2()));
{ this.Denominator.setElement(g_oTableId.Get_ById(Reader.GetString2()));
var props = {ctrPrp: new CTextPr()};
var arrElems = []; var props = {ctrPrp: new CTextPr()};
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
props.ctrPrp.Read_FromBinary(Reader); props.ctrPrp.Read_FromBinary(Reader);
var Flags = Reader.GetLong(); if (true === Reader.GetBool())
if ( Flags & 1 ) props.type = Reader.GetLong();
props.type = Reader.GetLong();
this.setProperties(props);
this.fillMathComposition (props, arrElems); this.fillContent();
} }
CFraction.prototype.Get_Id = function() CFraction.prototype.Get_Id = function()
{ {
return this.Id; return this.Id;
} }
function CFractionBase()
function CNumerator()
{ {
CFractionBase.superclass.constructor.call(this);
this.gap = 0; this.gap = 0;
CMathBase.call(this, true);
this.init(); this.init();
} }
Asc.extendClass(CNumerator, CMathBase); Asc.extendClass(CFractionBase, CMathBase);
CNumerator.prototype.init = function() CFractionBase.prototype.init = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
} }
CNumerator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
...@@ -495,6 +470,34 @@ CNumerator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -495,6 +470,34 @@ CNumerator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.recalculateSize(); this.recalculateSize();
} }
CFractionBase.prototype.getElement = function()
{
return this.elements[0][0];
}
CFractionBase.prototype.setElement = function(Element)
{
this.elements[0][0] = Element;
};
CFractionBase.prototype.getPropsForWrite = function()
{
var props = {};
return props;
}
CFractionBase.prototype.Get_Id = function()
{
return this.elements[0][0].Get_Id();
};
CFractionBase.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
function CNumerator()
{
CNumerator.superclass.constructor.call(this);
}
Asc.extendClass(CNumerator, CFractionBase);
CNumerator.prototype.recalculateSize = function() CNumerator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
...@@ -541,46 +544,12 @@ CNumerator.prototype.setPosition = function(pos, PosInfo) ...@@ -541,46 +544,12 @@ CNumerator.prototype.setPosition = function(pos, PosInfo)
{ {
this.elements[0][0].setPosition(pos, PosInfo); this.elements[0][0].setPosition(pos, PosInfo);
} }
CNumerator.prototype.getElement = function()
{
return this.elements[0][0];
}
CNumerator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CNumerator.prototype.getPropsForWrite = function()
{
var props = {};
return props;
}
function CDenominator() function CDenominator()
{ {
this.gap = 0; CDenominator.superclass.constructor.call(this);
CMathBase.call(this, true);
this.init();
}
Asc.extendClass(CDenominator, CMathBase);
CDenominator.prototype.init = function()
{
this.setDimension(1, 1);
this.setContent();
}
CDenominator.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.ArgSize = ArgSize.Copy();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize();
} }
Asc.extendClass(CDenominator, CFractionBase);
CDenominator.prototype.recalculateSize = function() CDenominator.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
...@@ -624,18 +593,4 @@ CDenominator.prototype.setPosition = function(pos, PosInfo) ...@@ -624,18 +593,4 @@ CDenominator.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(NewPos, PosInfo); this.elements[0][0].setPosition(NewPos, PosInfo);
} }
CDenominator.prototype.getElement = function(txt)
{
return this.elements[0][0];
}
CDenominator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CDenominator.prototype.getPropsForWrite = function()
{
var props = {};
return props;
}
////////// //////////
This source diff could not be displayed because it is too large. You can view the blob instead.
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