Commit 664d77ee authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander.Trofimov

переделка под новые константы в формулах

переделано чтение и совместное редактирование для изменения текстовых настроек

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57313 954022d7-b5bf-4e40-9824-e11837661b57
parent 7dec934e
...@@ -894,6 +894,7 @@ var historyitem_ParaRun_TextPr = 29; // �������� �� ...@@ -894,6 +894,7 @@ var historyitem_ParaRun_TextPr = 29; // �������� ��
var historyitem_ParaRun_Unifill = 30; // �������� ��� ��������� ������� var historyitem_ParaRun_Unifill = 30; // �������� ��� ��������� �������
var historyitem_ParaRun_Shd = 31; var historyitem_ParaRun_Shd = 31;
var historyitem_ParaRun_MathStyle = 32; // Меняем стиль MathPr var historyitem_ParaRun_MathStyle = 32; // Меняем стиль MathPr
var historyitem_ParaRun_MathPrp = 33;
// Типы изменений в классе ParaTextPr // Типы изменений в классе ParaTextPr
var historyitem_TextPr_Change = 1; // Изменяем настройку var historyitem_TextPr_Change = 1; // Изменяем настройку
......
...@@ -168,7 +168,7 @@ ParaMath.prototype = ...@@ -168,7 +168,7 @@ ParaMath.prototype =
} }
else if ( para_Math === Type ) else if ( para_Math === Type )
{ {
if (oStartContent.typeObj == MATH_PLACEHOLDER) if (oStartContent.Type == para_Math_Run && oStartContent.IsPlaceholder())
{ {
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -227,16 +227,16 @@ ParaMath.prototype = ...@@ -227,16 +227,16 @@ ParaMath.prototype =
{ {
var oElem = oContent.Content.getElem(oContent.Start); var oElem = oContent.Content.getElem(oContent.Start);
if (oElem.typeObj == MATH_COMP) if (oElem.Type == para_Math_Composition)
this.RemoveElem(oContent, Direction, bOnAddText); this.RemoveElem(oContent, Direction, bOnAddText);
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == false) else if (oElem.Type == para_Math_Run && oElem.IsPlaceholder() && bOnAddText == false)
{ {
var Comp = oContent.Content.GetParent(); var Comp = oContent.Content.GetParent();
Comp.SetSelectAll(); Comp.SetSelectAll();
Comp.SelectToParent(); Comp.SelectToParent();
this.bSelectionUse = true; this.bSelectionUse = true;
} }
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == true) else if (oElem.Type == para_Math_Run && oElem.IsPlaceholder() && bOnAddText == true)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -261,7 +261,7 @@ ParaMath.prototype = ...@@ -261,7 +261,7 @@ ParaMath.prototype =
if (oContent.Content.CurPos - 1 >= 0)//слева есть элементы if (oContent.Content.CurPos - 1 >= 0)//слева есть элементы
{ {
var prevElem = oContent.Content.getElem(oContent.Start - 1); var prevElem = oContent.Content.getElem(oContent.Start - 1);
if (prevElem.typeObj == MATH_COMP) //слева композиция if (prevElem.Type == para_Math_Composition) //слева композиция
{ {
this.Set_Select_ToMComp(Direction); this.Set_Select_ToMComp(Direction);
return; return;
...@@ -302,7 +302,7 @@ ParaMath.prototype = ...@@ -302,7 +302,7 @@ ParaMath.prototype =
else //справа есть элемент else //справа есть элемент
{ {
var nextElem = oContent.Content.getElem(oContent.Start + 1); var nextElem = oContent.Content.getElem(oContent.Start + 1);
if (nextElem.typeObj == MATH_COMP) //справа композиция if (nextElem.typeObj == para_Math_Composition) //справа композиция
{ {
this.Set_Select_ToMComp(Direction); this.Set_Select_ToMComp(Direction);
return; return;
......
...@@ -6421,7 +6421,60 @@ ParaRun.prototype = ...@@ -6421,7 +6421,60 @@ ParaRun.prototype =
break; break;
} }
case historyitem_ParaRun_MathStyle:
{
// Bool : undefined ?
// false -> Long
if ( undefined != Data.New )
{
Writer.WriteBool( false );
Writer.WriteLong( Data.New );
}
else
Writer.WriteBool( true );
break;
}
case historyitem_ParaRun_MathPrp:
{
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.MathPrp.aln )
{
Writer.WriteBool( this.MathPrp.aln );
Flags |= 1;
}
if ( undefined != this.MathPrp.brk )
{
Writer.WriteBool( this.MathPrp.brk );
Flags |= 2;
}
if ( undefined != this.MathPrp.lit )
{
Writer.WriteBool( this.MathPrp.lit );
Flags |= 4;
}
if ( undefined != this.MathPrp.nor )
{
Writer.WriteBool( this.MathPrp.nor );
Flags |= 8;
}
if ( undefined != this.MathPrp.scr )
{
Writer.WriteLong( this.MathPrp.scr );
Flags |= 16;
}
if ( undefined != this.MathPrp.sty )
{
Writer.WriteLong( this.MathPrp.sty );
Flags |= 32;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
break;
}
} }
return Writer; return Writer;
...@@ -6967,8 +7020,37 @@ ParaRun.prototype = ...@@ -6967,8 +7020,37 @@ ParaRun.prototype =
break; break;
} }
case historyitem_ParaRun_MathStyle:
{
// Bool : undefined ?
// false -> Long
if ( false === Reader.GetBool() )
this.MathPrp.sty = Reader.GetLong();
else
this.MathPrp.sty = undefined;
this.Recalc_CompiledPr(true);
break;
}
case historyitem_ParaRun_MathPrp:
{
var Flags = Reader.GetLong();
if ( Flags & 1 )
this.MathPrp.aln = Reader.GetBool();
if ( Flags & 2 )
this.MathPrp.brk = Reader.GetBool();
if ( Flags & 4 )
this.MathPrp.lit = Reader.GetBool();
if ( Flags & 8 )
this.MathPrp.nor = Reader.GetBool();
if ( Flags & 16 )
this.MathPrp.scr = Reader.GetLong();
if ( Flags & 32 )
this.MathPrp.sty = Reader.GetLong();
this.Recalc_CompiledPr(true);
break;
}
} }
}, },
......
...@@ -1827,9 +1827,9 @@ function Binary_oMathWriter(memory, oMathPara) ...@@ -1827,9 +1827,9 @@ function Binary_oMathWriter(memory, oMathPara)
{ {
var oThis = this; var oThis = this;
var item = mathElem; var item = mathElem;
switch ( item.typeObj) switch ( item.Type)
{ {
case MATH_COMP: case para_Math_Composition:
{ {
switch (item.kind) switch (item.kind)
{ {
...@@ -1872,15 +1872,13 @@ function Binary_oMathWriter(memory, oMathPara) ...@@ -1872,15 +1872,13 @@ function Binary_oMathWriter(memory, oMathPara)
} }
break; break;
} }
case MATH_TEXT: case para_Math_Text:
this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(String.fromCharCode(item.value));}); //m:t this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(String.fromCharCode(item.value));}); //m:t
break; break;
case MATH_PARA_RUN: case para_Math_Run:
this.bs.WriteItem(c_oSer_OMathContentType.MRun, function(){oThis.WriteMRun(item);}); this.bs.WriteItem(c_oSer_OMathContentType.MRun, function(){oThis.WriteMRun(item);});
break; break;
case MATH_RUN_PRP: default:
case MATH_PLACEHOLDER:
case MATH_EMPTY:
break; break;
} }
}, },
...@@ -8449,7 +8447,11 @@ function Binary_oMathReader(stream) ...@@ -8449,7 +8447,11 @@ function Binary_oMathReader(stream)
var oThis = this; var oThis = this;
if (c_oSer_OMathBottomNodesValType.Val === type) if (c_oSer_OMathBottomNodesValType.Val === type)
{ {
props.begChr = this.stream.GetString2LE(length).charCodeAt(0); var text = this.stream.GetString2LE(length);
if (text == "")
props.begChr = OPERATOR_EMPTY;
else
props.begChr = text.charCodeAt(0);
} }
else else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
...@@ -9582,23 +9584,24 @@ function Binary_oMathReader(stream) ...@@ -9582,23 +9584,24 @@ function Binary_oMathReader(stream)
*/ */
} }
oMRun.Set_MathPrp(props);
if (oParent) if (oParent)
oParent.addElementToContent(oMRun); oParent.addElementToContent(oMRun);
} }
else if (c_oSer_OMathContentType.MRPr === type) else if (c_oSer_OMathContentType.MRPr === type)
{ {
//<m:rPr> //<m:rPr>
var mrPr = new CMPrp();
res = this.bcr.Read1(length, function(t, l){ res = this.bcr.Read1(length, function(t, l){
return oThis.ReadMathMRPr(t,l,props); return oThis.ReadMathMRPr(t,l,mrPr);
}); });
oMRun.Set_MathPr(mrPr);
} }
else if (c_oSer_OMathContentType.RPr === type) else if (c_oSer_OMathContentType.RPr === type)
{ {
//<w:rPr> //<w:rPr>
var rPr = new CTextPr(); var rPr = new CTextPr();
res = this.brPrr.Read(length, rPr); res = this.brPrr.Read(length, rPr);
oMRun.Pr = rPr; oMRun.Set_Pr(rPr);
} }
else else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
......
...@@ -5268,17 +5268,6 @@ CMathContent.prototype = ...@@ -5268,17 +5268,6 @@ CMathContent.prototype =
Writer.WriteLong( Data.Pos + Index ); Writer.WriteLong( Data.Pos + Index );
Writer.WriteString2( oElem.Id ); Writer.WriteString2( oElem.Id );
Writer.WriteLong( typeObj );
if (typeObj == MATH_PARA_RUN)
{
Writer.WriteBool(oElem.MathPrp.aln);
Writer.WriteBool(oElem.MathPrp.bold);
Writer.WriteBool(oElem.MathPrp.brk);
Writer.WriteBool(oElem.MathPrp.italic);
Writer.WriteBool(oElem.MathPrp.lit);
Writer.WriteLong(oElem.MathPrp.typeText);
}
} }
break; break;
} }
...@@ -5319,20 +5308,6 @@ CMathContent.prototype = ...@@ -5319,20 +5308,6 @@ CMathContent.prototype =
{ {
var Pos = Reader.GetLong(); var Pos = Reader.GetLong();
var Element = g_oTableId.Get_ById( Reader.GetString2() ); var Element = g_oTableId.Get_ById( Reader.GetString2() );
var typeObj = Reader.GetLong();
if (typeObj == MATH_PARA_RUN)
{
var MathPrp = new CMPrp();
MathPrp.aln = Reader.GetBool();
MathPrp.bold = Reader.GetBool();
MathPrp.brk = Reader.GetBool();
MathPrp.italic = Reader.GetBool();
MathPrp.lit = Reader.GetBool();
Element.MathPrp = MathPrp;
Element.typeObj = typeObj;
}
this.DeleteEmptyRuns();
this.content.splice( Pos, 0, Element ); this.content.splice( Pos, 0, Element );
this.SetRunEmptyToContent(true); this.SetRunEmptyToContent(true);
} }
...@@ -7089,7 +7064,7 @@ CMathContent.prototype = ...@@ -7089,7 +7064,7 @@ CMathContent.prototype =
{ {
oElem.Parent = this; oElem.Parent = this;
if(oElem.typeObj === MATH_COMP) if(oElem.Type === para_Math_Composition)
{ {
oElem.setArgSize(this.argSize); oElem.setArgSize(this.argSize);
this.content.splice(Pos,0,oElem); this.content.splice(Pos,0,oElem);
......
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