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

Исправлены баги в совместном редактировании классов CAccent, CBox, CBorderBox,...

Исправлены баги в совместном редактировании классов CAccent, CBox, CBorderBox, CBar, CDegree. Исправлен баг с необновлением после добавления текста в совместном редактировании.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58685 954022d7-b5bf-4e40-9824-e11837661b57
parent da0d5d88
......@@ -2772,7 +2772,7 @@ Paragraph.prototype =
var Elem = new ParaMath();
//Elem.Set_Paragraph(this);
Elem.Root.Load_FromMenu(Item.Menu, this);
Elem.Root.SetRunEmptyToContent(true);
Elem.Root.Correct_Content(true);
// Добавляем гиперссылку в содержимое параграфа
this.Internal_Content_Add( CurPos + 1, Elem );
......
......@@ -6751,6 +6751,9 @@ ParaRun.prototype.Load_Changes = function(Reader, Reader2, Color)
if ( undefined !== this.Paragraph && null !== this.Paragraph )
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
if (para_Math_Run === this.Type && undefined !== this.Parent && null !== this.Parent && null !== this.Parent.ParaMath)
this.Parent.ParaMath.SetNeedResize();
break;
}
......@@ -6775,9 +6778,12 @@ ParaRun.prototype.Load_Changes = function(Reader, Reader2, Color)
this.RecalcInfo.Measure = true;
if ( undefined !== this.Paragraph && null !== this.Paragraph )
if (undefined !== this.Paragraph && null !== this.Paragraph)
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
if (para_Math_Run === this.Type && undefined !== this.Parent && null !== this.Parent && null !== this.Parent.ParaMath)
this.Parent.ParaMath.SetNeedResize();
break;
}
......
......@@ -461,6 +461,7 @@ function CAccent(props)
/////////////////
this.baseContent = new CMathContent();
this.operator = new COperator(OPER_ACCENT);
CAccent.superclass.constructor.call(this);
......@@ -477,8 +478,7 @@ CAccent.prototype.init = function(props)
this.setProperties(props);
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = this.baseContent;
this.elements[0][0].SetDot(true);
}
CAccent.prototype.setChr = function(chr)
......@@ -660,36 +660,35 @@ CAccent.prototype.Refresh_RecalcData = function(Data)
}
CAccent.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_acc );
Writer.WriteString2( this.getBase().Id );
Writer.WriteLong(historyitem_type_acc);
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.chr )
if (undefined !== this.Pr.chr)
{
Writer.WriteLong(this.Pr.chr);
Flags |= 1;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
Writer.WriteBool(true);
Writer.WriteLong(this.Pr.chr);
}
else
Writer.WriteBool(false);
}
CAccent.prototype.Read_FromBinary2 = function( Reader )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
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.chr = Reader.GetLong();
this.fillMathComposition (props, arrElems);
}
\ No newline at end of file
if (true === Reader.GetBool())
props.chr = Reader.GetLong();
this.init(props);
}
CAccent.prototype.Get_Id = function()
{
return this.Id;
};
\ No newline at end of file
......@@ -781,6 +781,13 @@ CMathBase.prototype =
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].SetRunEmptyToContent(bAll);
},
Correct_Content: function(bInnerCorrection)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].Correct_Content(bInnerCorrection);
},
Selection_Remove: function()
{
var start_X = this.SelectStart.X,
......
......@@ -2,6 +2,8 @@
function CBorderBox(props)
{
CBorderBox.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BORDER_BOX;
......@@ -19,7 +21,7 @@ function CBorderBox(props)
strikeV: false
};
CMathBase.call(this);
this.baseContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -35,7 +37,7 @@ CBorderBox.prototype.init = function(props)
CBorderBox.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = this.baseContent;
}
CBorderBox.prototype.setProperties = function(props)
{
......@@ -302,14 +304,6 @@ CBorderBox.prototype.getBase = function()
{
return this.elements[0][0];
}
CBorderBox.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CBorderBox.prototype.getPropsForWrite = function()
{
/*var props = {};
......@@ -340,8 +334,9 @@ CBorderBox.prototype.Refresh_RecalcData = function(Data)
}
CBorderBox.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_borderBox );
Writer.WriteString2( this.getBase().Id );
Writer.WriteLong(historyitem_type_borderBox);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
......@@ -395,12 +390,11 @@ CBorderBox.prototype.Write_ToBinary2 = function( Writer )
}
CBorderBox.prototype.Read_FromBinary2 = function( Reader )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
props.ctrPrp.Read_FromBinary(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 )
......@@ -419,8 +413,8 @@ CBorderBox.prototype.Read_FromBinary2 = function( Reader )
props.strikeTLBR = Reader.GetBool();
if ( Flags & 128 )
props.strikeV = Reader.GetBool();
this.fillMathComposition (props, arrElems);
this.init(props);
}
CBorderBox.prototype.Get_Id = function()
{
......@@ -428,9 +422,10 @@ CBorderBox.prototype.Get_Id = function()
}
function CBox(props)
{
CBox.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BOX;
......@@ -443,7 +438,7 @@ function CBox(props)
brk: false
};
CMathBase.call(this);
this.baseContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -459,7 +454,7 @@ CBox.prototype.init = function(props)
CBox.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = this.baseContent;
}
CBox.prototype.setProperties = function(props)
{
......@@ -482,14 +477,6 @@ CBox.prototype.setProperties = function(props)
this.RecalcInfo.bProps = true;
}
CBox.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CBox.prototype.getBase = function()
{
return this.elements[0][0];
......@@ -510,8 +497,9 @@ CBox.prototype.Refresh_RecalcData = function(Data)
}
CBox.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_box );
Writer.WriteString2( this.getBase().Id );
Writer.WriteLong(historyitem_type_box);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
......@@ -550,11 +538,10 @@ CBox.prototype.Write_ToBinary2 = function( Writer )
}
CBox.prototype.Read_FromBinary2 = function( Reader )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
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();
......@@ -568,8 +555,8 @@ CBox.prototype.Read_FromBinary2 = function( Reader )
props.noBreak = Reader.GetBool();
if ( Flags & 16 )
props.opEmu = Reader.GetBool();
this.fillMathComposition (props, arrElems);
this.init(props);
}
CBox.prototype.Get_Id = function()
{
......@@ -578,6 +565,8 @@ CBox.prototype.Get_Id = function()
function CBar(props)
{
CBar.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BAR;
......@@ -586,11 +575,11 @@ function CBar(props)
pos: LOCATION_BOT
};
this.baseContent = new CMathContent();
//this.loc = LOCATION_BOT;
this.operator = new COperator(OPER_BAR);
CCharacter.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -605,7 +594,7 @@ CBar.prototype.init = function(props)
CBar.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = this.baseContent;
}
CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
......@@ -650,14 +639,6 @@ CBar.prototype.setProperties = function(props)
this.RecalcInfo.bProps = true;
}
CBar.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CBar.prototype.getPropsForWrite = function()
{
return this.Pr;
......@@ -674,8 +655,9 @@ CBar.prototype.Refresh_RecalcData = function(Data)
}
CBar.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_bar );
Writer.WriteString2( this.getBase().Id );
Writer.WriteLong(historyitem_type_bar);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
......@@ -695,18 +677,17 @@ CBar.prototype.Write_ToBinary2 = function( Writer )
}
CBar.prototype.Read_FromBinary2 = function( Reader )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
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.fillMathComposition (props, arrElems);
this.init(props);
}
CBar.prototype.Get_Id = function()
{
......@@ -715,8 +696,9 @@ CBar.prototype.Get_Id = function()
function CPhantom(props)
{
CPhantom.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
CMathBase.call(this);
this.Pr =
{
......@@ -727,6 +709,8 @@ function CPhantom(props)
zeroWid: false
};
this.baseContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -741,7 +725,7 @@ CPhantom.prototype.init = function(props)
CPhantom.prototype.fillContent = function()
{
this.setDimension(1, 1);
this.setContent();
this.elements[0][0] = this.baseContent;
}
CPhantom.prototype.getBase = function()
{
......@@ -769,14 +753,6 @@ CPhantom.prototype.setProperties = function(props)
this.RecalcInfo.bProps = true;
}
CPhantom.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
}
CPhantom.prototype.getPropsForWrite = function()
{
return this.Pr;
......@@ -793,8 +769,9 @@ CPhantom.prototype.Refresh_RecalcData = function(Data)
}
CPhantom.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_phant );
Writer.WriteString2( this.getBase().Id );
Writer.WriteLong(historyitem_type_phant);
Writer.WriteString2(this.Id);
Writer.WriteString2(this.baseContent.Id);
this.CtrPrp.Write_ToBinary(Writer);
......@@ -833,11 +810,10 @@ CPhantom.prototype.Write_ToBinary2 = function( Writer )
}
CPhantom.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
props.ctrPrp.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
......@@ -851,8 +827,8 @@ CPhantom.prototype.Read_FromBinary2 = function( Reader )
props.zeroDesc = Reader.GetBool();
if ( Flags & 16 )
props.zeroWid = Reader.GetBool();
this.fillMathComposition (props, arrElems);
this.init(props);
}
CPhantom.prototype.Get_Id = function()
{
......
......@@ -2,6 +2,8 @@
function CDegree(props, bInside)
{
CDegree.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREE;
......@@ -13,7 +15,8 @@ function CDegree(props, bInside)
type: DEGREE_SUPERSCRIPT
};
CMathBase.call(this, bInside);
this.baseContent = new CMathContent();
this.iterContent = new CMathContent();
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -29,7 +32,8 @@ CDegree.prototype.init = function(props)
CDegree.prototype.fillContent = function()
{
this.setDimension(1, 2);
this.setContent();
this.elements[0][0] = this.baseContent;
this.elements[0][1] = this.iterContent;
};
CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
......@@ -277,17 +281,6 @@ CDegree.prototype.setProperties = function(props)
this.RecalcInfo.bProps = true;
};
CDegree.prototype.fillMathComposition = function(props, contents /*array*/)
{
this.setProperties(props);
this.fillContent();
// Base
this.elements[0][0] = contents[0];
// Iterator
this.elements[0][1] = contents[1];
};
CDegree.prototype.setBase = function(base)
{
this.elements[0][0] = base;
......@@ -312,26 +305,25 @@ CDegree.prototype.Refresh_RecalcData = function(Data)
};
CDegree.prototype.Write_ToBinary2 = function( Writer )
{
Writer.WriteLong( historyitem_type_deg );
Writer.WriteString2( this.getBase().Id );
Writer.WriteString2( this.getLowerIterator().Id );
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 )
{
var props = {ctrPrp: new CTextPr()};
var arrElems = [];
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
arrElems.push(g_oTableId.Get_ById( Reader.GetString2()));
this.Id = Reader.GetLong();
this.baseContent = g_oTableId.Get_ById(Reader.GetLong());
this.iterContent = g_oTableId.Get_ById(Reader.GetLong());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
props.type = Reader.GetLong();
this.fillMathComposition (props, arrElems);
this.init(props);
};
CDegree.prototype.Get_Id = function()
{
......
......@@ -1793,8 +1793,17 @@ CMathContent.prototype =
}
},
Correct_Content : function()
Correct_Content : function(bInnerCorrection)
{
if (true === bInnerCorrection)
{
for (var nPos = 0, nCount = this.content.length; nPos < nCount; nPos++)
{
if (para_Math_Composition === this.content[nPos].Type)
this.content[nPos].Correct_Content(true);
}
}
this.SetRunEmptyToContent(false);
// Удаляем лишние пустые раны
......@@ -1820,7 +1829,12 @@ CMathContent.prototype =
if(para_Math_Run === oCurrElement.Type)
oCurrElement.Math_Correct_Content();
}
// Если в контенте ничего нет, тогда добавляем пустой ран
if (this.content.length < 1)
{
this.Add_ToContent(0, new ParaRun(null, true));
}
if (this.content.length == 1)
......
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