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

Исправлены баги в совместном редактировании и Undo/Redo после добавления новой...

Исправлены баги в совместном редактировании и Undo/Redo после добавления новой формулы. Исправлены баги в копировании и совместном редкатировании с placeholder.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58770 954022d7-b5bf-4e40-9824-e11837661b57
parent fd285713
...@@ -6830,9 +6830,10 @@ function ParagraphContent_Read_FromBinary(Reader) ...@@ -6830,9 +6830,10 @@ function ParagraphContent_Read_FromBinary(Reader)
case para_Numbering : Element = new ParaNumbering(); break; case para_Numbering : Element = new ParaNumbering(); break;
case para_Tab : Element = new ParaTab(); break; case para_Tab : Element = new ParaTab(); break;
case para_PageNum : Element = new ParaPageNum(); break; case para_PageNum : Element = new ParaPageNum(); break;
case para_Math_Placeholder : Element = new CMathText(); break;
case para_Math_Text : Element = new CMathText(); break;
case para_Math_Ampersand : Element = new CMathAmp(); break;
case para_PresentationNumbering : Element = new ParaPresentationNumbering(); break; case para_PresentationNumbering : Element = new ParaPresentationNumbering(); break;
case para_Math_Text : Element = new CMathText(false); break;
case para_Math_Ampersand : Element = new CMathAmp(); break;
} }
if ( null != Element ) if ( null != Element )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
function CMathBorderBoxPr() function CMathBorderBoxPr()
{ {
strikeVthis.hideBot = false; this.hideBot = false;
this.hideLeft = false; this.hideLeft = false;
this.hideRight = false; this.hideRight = false;
this.hideTop = false; this.hideTop = false;
...@@ -417,29 +417,29 @@ function CMathBoxPr() ...@@ -417,29 +417,29 @@ function CMathBoxPr()
CMathBoxPr.prototype.Set_FromObject = function(Obj) CMathBoxPr.prototype.Set_FromObject = function(Obj)
{ {
if(true === Obj.aln || 1 === Obj.aln) if(true === Obj.aln || 1 === Obj.aln)
this.Pr.aln = true; this.aln = true;
else else
this.Pr.aln = false; this.aln = false;
if(true === Obj.brk || 1 === Obj.brk) if(true === Obj.brk || 1 === Obj.brk)
this.Pr.brk = true; this.brk = true;
else else
this.Pr.brk = false; this.brk = false;
if(true === Obj.diff || 1 === Obj.diff) if(true === Obj.diff || 1 === Obj.diff)
this.Pr.diff = true; this.diff = true;
else else
this.Pr.diff = false; this.diff = false;
if(true === Obj.noBreak || 1 === Obj.noBreak) if(true === Obj.noBreak || 1 === Obj.noBreak)
this.Pr.noBreak = true; this.noBreak = true;
else else
this.Pr.noBreak = false; this.noBreak = false;
if(true === Obj.opEmu || 1 === Obj.opEmu) if(true === Obj.opEmu || 1 === Obj.opEmu)
this.Pr.opEmu = true; this.opEmu = true;
else else
this.Pr.opEmu = false; this.opEmu = false;
}; };
CMathBoxPr.prototype.Copy = function() CMathBoxPr.prototype.Copy = function()
...@@ -514,7 +514,7 @@ CBox.prototype.fillContent = function() ...@@ -514,7 +514,7 @@ CBox.prototype.fillContent = function()
} }
CBox.prototype.setProperties = function(props) CBox.prototype.setProperties = function(props)
{ {
this.Pr.Set_FromObject(Obj); this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
......
...@@ -2807,22 +2807,6 @@ CMathContent.prototype = ...@@ -2807,22 +2807,6 @@ CMathContent.prototype =
{ {
if(this.ParaMath !== null) if(this.ParaMath !== null)
this.ParaMath.Refresh_RecalcData(); // Refresh_RecalcData сообщает родительскому классу, что у него произошли изменения, нужно пересчитать this.ParaMath.Refresh_RecalcData(); // Refresh_RecalcData сообщает родительскому классу, что у него произошли изменения, нужно пересчитать
},
_Check_HistoryUninon: function(Data1, Data2)
{
var Type1 = Data1.Type;
var Type2 = Data2.Type;
if ( historyitem_Paragraph_AddItem === Type1 && historyitem_Paragraph_AddItem === Type2 )
{
if ( 1 === Data1.Items.length && 1 === Data2.Items.length && Data1.Pos === Data2.Pos - 1 && !this.content[Data1.Pos].typeObj === MATH_COMP && !this.content[Data2.Pos].typeObj === MATH_COMP )
return true;
}
return false
},
Check_HistoryUninon: function(Data1, Data2)
{
return false;
}, },
Load_FromMenu: function(Type, Paragraph) Load_FromMenu: function(Type, Paragraph)
{ {
...@@ -4547,80 +4531,38 @@ CMathContent.prototype = ...@@ -4547,80 +4531,38 @@ CMathContent.prototype =
break; break;
} }
}, },
Add: function (oElem, Pos)
{
oElem.Parent = this;
if(oElem.Type === para_Math_Composition) AddText : function(oElem, sText)
{
//oElem.setArgSize(this.argSize);
this.content.splice(Pos,0,oElem);
}
else
{
this.content.splice(Pos,0,oElem);
}
if (this.content.length != 1)
this.CurPos++;
},
AddText : function(oElem, sText)
{ {
if(sText) if(sText)
{ {
var MathRun = new ParaRun(this.Paragraph, true); var MathRun = new ParaRun(this.Paragraph, true);
var Pos = oElem.CurPos + 1, for (var nCharPos = 0, nTextLen = sText.length; nCharPos < nTextLen; nCharPos++)
PosEnd = Pos + 1;
var items = [];
for (var i=0; i < sText.length; i++)
{ {
var oText = null; var oText = null;
if ( 0x0026 == sText[i].charCodeAt(0)) if ( 0x0026 == sText.charCodeAt(nCharPos))
oText = new CMathAmp(); oText = new CMathAmp();
else else
{ {
oText = new CMathText(false); oText = new CMathText(false);
oText.addTxt(sText[i]); oText.addTxt(sText[nCharPos]);
} }
MathRun.Add(oText, true); MathRun.Add(oText, true);
} }
oElem.DeleteEmptyRuns();
oElem.Add(MathRun,Pos); oElem.Internal_Content_Add(oElem.CurPos + 1, MathRun, true);
items.push(MathRun); }
History.Add(oElem, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd});
oElem.SetRunEmptyToContent(true);
}
}, },
DeleteEmptyRuns : function ()
{
var nLen = this.content.length;
while(nLen >= 0 )
{
var oElem = this.content[nLen];
if (oElem && oElem.typeObj == MATH_PARA_RUN && oElem.Content.length == 0)
this.content.splice(nLen, 1);
nLen--;
}
},
CreateElem : function (oElem, oParent) CreateElem : function (oElem, oParent)
{ {
oElem.Parent = oParent; oElem.Parent = oParent;
var Pos = oParent.CurPos + 1,
PosEnd = Pos + 1;
var items = [];
if (oParent)
{
oParent.DeleteEmptyRuns();
oParent.Add(oElem,Pos);
items.push(oElem);
History.Add(oParent, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd});
oParent.SetRunEmptyToContent(true); var Pos = oParent.CurPos + 1;
} oParent.Internal_Content_Add(Pos, oElem, true);
}, },
CreateFraction : function (oFraction,oParentElem,sNumText,sDenText) CreateFraction : function (oFraction,oParentElem,sNumText,sDenText)
{ {
this.CreateElem(oFraction, oParentElem); this.CreateElem(oFraction, oParentElem);
......
...@@ -41,7 +41,7 @@ function CMathText(bJDraw) ...@@ -41,7 +41,7 @@ function CMathText(bJDraw)
// для Para_Run // для Para_Run
this.Type = para_Math_Text; this.Type = para_Math_Text;
this.bJDraw = bJDraw; this.bJDraw = (undefined === bJDraw ? false : bJDraw);
this.value = null; this.value = null;
...@@ -785,22 +785,26 @@ CMathText.prototype = ...@@ -785,22 +785,26 @@ CMathText.prototype =
Copy: function() Copy: function()
{ {
var NewLetter = new CMathText(this.bJDraw); var NewLetter = new CMathText(this.bJDraw);
NewLetter.add(this.value); NewLetter.Type = this.Type;
NewLetter.value = this.value;
return NewLetter; return NewLetter;
}, },
Write_ToBinary : function(Writer) Write_ToBinary : function(Writer)
{ {
// Пишем тип дла раза, 1 раз для общей функции чтения, второй раз
// для разделения обычного MathText от PlaceHolder
Writer.WriteLong(this.Type);
// Long : Type // Long : Type
// Long : value // Long : value
Writer.WriteLong(this.Type);
Writer.WriteLong( this.Type ); Writer.WriteLong(this.value) ;
Writer.WriteLong( this.value );
}, },
Read_FromBinary : function(Reader) Read_FromBinary : function(Reader)
{ {
this.value = Reader.GetLong(); this.Type = Reader.GetLong();
this.value = Reader.GetLong();
} }
} }
......
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