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

сохранение формул в xml поправлены баги

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53270 954022d7-b5bf-4e40-9824-e11837661b57
parent d1a368bb
......@@ -2438,98 +2438,94 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
});
}
};
this.WriteMathArgNodes = function(oOMath)
this.WriteMathArgNodes = function(oElem)
{
var oThis = this;
var nStart = 0;
var nEnd = oOMath.content.length - 1;
var nCurPos = 0;
var oText = "";
for(var i = nStart; i <= nEnd; i++)
{
var item = oOMath.content[i].value;
if (oElem)
{
var oThis = this;
var nStart = 0;
var nEnd = oElem.content.length - 1;
var nCurPos = 0;
var nextItem = null;
if ( oOMath.content[i+1] != null)
nextItem = oOMath.content[i+1].value;
for(var i = nStart; i <= nEnd; i++)
{
var item = oElem.content[i].value;
switch ( item.typeObj)
{
case MATH_COMP:
{
switch (item.kind)
switch ( item.typeObj)
{
case MATH_COMP:
{
case MATH_ACCENT : this.bs.WriteItem(c_oSer_OMathContentType.Acc, function(){oThis.WriteMathAcc(item);}); break;
case "ArgPr" : this.bs.WriteItem(c_oSer_OMathContentType.ArgPr, function(){oThis.WriteMathArgPr(item);}); break;//нет обертки
case MATH_BAR : this.bs.WriteItem(c_oSer_OMathContentType.Bar, function(){oThis.WriteMathBar(item);}); break;
case MATH_BORDER_BOX : this.bs.WriteItem(c_oSer_OMathContentType.BorderBox, function(){oThis.WriteMathBorderBox(item);});break;
case MATH_BOX : this.bs.WriteItem(c_oSer_OMathContentType.Box, function(){oThis.WriteMathBox(item);}); break;
case "CCtrlPr" : this.bs.WriteItem(c_oSer_OMathContentType.CtrlPr, function(){oThis.WriteMathCtrlPr(item);}); break;
case MATH_DELIMITER : this.bs.WriteItem(c_oSer_OMathContentType.Delimiter, function(){oThis.WriteMathDelimiter(item);});break;
case MATH_EQ_ARRAY : this.bs.WriteItem(c_oSer_OMathContentType.EqArr, function(){oThis.WriteMathEqArr(item);}); break;
case MATH_FRACTION : this.bs.WriteItem(c_oSer_OMathContentType.Fraction, function(){oThis.WriteMathFraction(item);}); break;
case MATH_FUNCTION : this.bs.WriteItem(c_oSer_OMathContentType.Func, function(){oThis.WriteMathFunc(item);}); break;
case MATH_GROUP_CHARACTER : this.bs.WriteItem(c_oSer_OMathContentType.GroupChr, function(){oThis.WriteMathGroupChr(item);}); break;
case MATH_LIMIT :
if (LIMIT_LOW == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.LimLow, function(){oThis.WriteMathLimLow(item);});
else if (LIMIT_UP == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.LimUpp, function(){oThis.WriteMathLimUpp(item);});
break;
case MATH_MATRIX : this.bs.WriteItem(c_oSer_OMathContentType.Matrix, function(){oThis.WriteMathMatrix(item);}); break;
case MATH_NARY : this.bs.WriteItem(c_oSer_OMathContentType.Nary, function(){oThis.WriteMathNary(item);}); break;
case "OMath" : this.bs.WriteItem(c_oSer_OMathContentType.OMath, function(){oThis.WriteMathArgNodes(item);}); break;
case "OMathPara" : this.bs.WriteItem(c_oSer_OMathContentType.OMathPara, function(){oThis.WriteMathOMathPara(item);});break;
case MATH_PHANTOM : this.bs.WriteItem(c_oSer_OMathContentType.Phant, function(){oThis.WriteMathPhant(item);}); break;
//case "MRun" : this.bs.WriteItem(c_oSer_OMathContentType.MRun, function(){oThis.WriteMathMRun(item);}); break;
case MATH_RADICAL : this.bs.WriteItem(c_oSer_OMathContentType.Rad, function(){oThis.WriteMathRad(item);}); break;
case MATH_DEGREESubSup :
if (DEGREE_PreSubSup == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SPre, function(){oThis.WriteMathSPre(item);});
else if (DEGREE_SubSup == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSubSup, function(){oThis.WriteMathSSubSup(item);});
break;
case MATH_DEGREE :
if (DEGREE_SUBSCRIPT == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSub, function(){oThis.WriteMathSSub(item);});
else if (DEGREE_SUPERSCRIPT == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSup, function(){oThis.WriteMathSSup(item);});
break;
switch (item.kind)
{
case MATH_ACCENT : this.bs.WriteItem(c_oSer_OMathContentType.Acc, function(){oThis.WriteMathAcc(item);}); break;
case "ArgPr" : this.bs.WriteItem(c_oSer_OMathContentType.ArgPr, function(){oThis.WriteMathArgPr(item);}); break;//нет обертки
case MATH_BAR : this.bs.WriteItem(c_oSer_OMathContentType.Bar, function(){oThis.WriteMathBar(item);}); break;
case MATH_BORDER_BOX : this.bs.WriteItem(c_oSer_OMathContentType.BorderBox, function(){oThis.WriteMathBorderBox(item);});break;
case MATH_BOX : this.bs.WriteItem(c_oSer_OMathContentType.Box, function(){oThis.WriteMathBox(item);}); break;
case "CCtrlPr" : this.bs.WriteItem(c_oSer_OMathContentType.CtrlPr, function(){oThis.WriteMathCtrlPr(item);}); break;
case MATH_DELIMITER : this.bs.WriteItem(c_oSer_OMathContentType.Delimiter, function(){oThis.WriteMathDelimiter(item);});break;
case MATH_EQ_ARRAY : this.bs.WriteItem(c_oSer_OMathContentType.EqArr, function(){oThis.WriteMathEqArr(item);}); break;
case MATH_FRACTION : this.bs.WriteItem(c_oSer_OMathContentType.Fraction, function(){oThis.WriteMathFraction(item);}); break;
case MATH_FUNCTION : this.bs.WriteItem(c_oSer_OMathContentType.Func, function(){oThis.WriteMathFunc(item);}); break;
case MATH_GROUP_CHARACTER : this.bs.WriteItem(c_oSer_OMathContentType.GroupChr, function(){oThis.WriteMathGroupChr(item);}); break;
case MATH_LIMIT :
if (LIMIT_LOW == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.LimLow, function(){oThis.WriteMathLimLow(item);});
else if (LIMIT_UP == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.LimUpp, function(){oThis.WriteMathLimUpp(item);});
break;
case MATH_MATRIX : this.bs.WriteItem(c_oSer_OMathContentType.Matrix, function(){oThis.WriteMathMatrix(item);}); break;
case MATH_NARY : this.bs.WriteItem(c_oSer_OMathContentType.Nary, function(){oThis.WriteMathNary(item);}); break;
case "OMath" : this.bs.WriteItem(c_oSer_OMathContentType.OMath, function(){oThis.WriteMathArgNodes(item);}); break;
case "OMathPara" : this.bs.WriteItem(c_oSer_OMathContentType.OMathPara, function(){oThis.WriteMathOMathPara(item);});break;
case MATH_PHANTOM : this.bs.WriteItem(c_oSer_OMathContentType.Phant, function(){oThis.WriteMathPhant(item);}); break;
//case "MRun" : this.bs.WriteItem(c_oSer_OMathContentType.MRun, function(){oThis.WriteMathMRun(item);}); break;
case MATH_RADICAL : this.bs.WriteItem(c_oSer_OMathContentType.Rad, function(){oThis.WriteMathRad(item);}); break;
case MATH_DEGREESubSup :
if (DEGREE_PreSubSup == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SPre, function(){oThis.WriteMathSPre(item);});
else if (DEGREE_SubSup == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSubSup, function(){oThis.WriteMathSSubSup(item);});
break;
case MATH_DEGREE :
if (DEGREE_SUBSCRIPT == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSub, function(){oThis.WriteMathSSub(item);});
else if (DEGREE_SUPERSCRIPT == item.type)
this.bs.WriteItem(c_oSer_OMathContentType.SSup, function(){oThis.WriteMathSSup(item);});
break;
}
break;
}
break;
}
case MATH_RUN_PRP:
{
nCurPos = this.bs.WriteItemWithLengthStart();
this.memory.WriteByte(c_oSer_OMathContentType.MRun);
var props = item.getPropsForWrite();
oThis.bs.WriteItem(c_oSerRunType.rPr, function(){oThis.brPrs.Write_rPr(props.textPrp);}); // w:rPr
if ( props.mathRunPrp != null)
this.bs.WriteItem(c_oSer_OMathContentType.MRPr, function(){oThis.WriteMathMRPr(props.mathRunPrp);}); // m:rPr
oText = "";
}
break;
case MATH_TEXT:
{
oText += String.fromCharCode(item.value);
if (nextItem == null || nextItem.typeObj == MATH_RUN_PRP)
{
if (null != oText)
this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(oText.toString());}); //m:t
case MATH_RUN_PRP:
{
this.memory.WriteByte(c_oSer_OMathContentType.MRun);
nCurPos = this.bs.WriteItemWithLengthStart();
var props = item.getPropsForWrite();
oThis.bs.WriteItem(c_oSerRunType.rPr, function(){oThis.brPrs.Write_rPr(props.textPrp);}); // w:rPr
if ( props.mathRunPrp != null)
this.bs.WriteItem(c_oSer_OMathContentType.MRPr, function(){oThis.WriteMathMRPr(props.mathRunPrp);}); // m:rPr
var oText = "";
while (oElem.content[i+1] != null && oElem.content[i+1].value.typeObj == MATH_TEXT)
{
oText += String.fromCharCode(oElem.content[i+1].value.value);
i++
}
if (null != oText)
this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(oText);}); //m:t
this.bs.WriteItemEnd(nCurPos);
nCurPos = 0;
}
}
break;
case MATH_PLACEHOLDER:
case MATH_EMPTY:
break;
break;
case MATH_TEXT:
case MATH_PLACEHOLDER:
case MATH_EMPTY:
break;
}
}
}
}
};
this.WriteMathAcc = function(oAcc)
......@@ -2714,7 +2710,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
{
var oThis = this;
var nStart = 0;
var nEnd = oDelimiter.elements.length;
var nEnd = oDelimiter.nCol;
var props = oDelimiter.getPropsForWrite();
this.bs.WriteItem(c_oSer_OMathContentType.DelimiterPr, function(){oThis.WriteMathDelimiterPr(props, oDelimiter);});
......@@ -2838,33 +2834,48 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}
this.WriteMathGrow = function(Grow)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(Grow);
if (!Grow)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(Grow);
}
}
this.WriteMathHideBot = function(HideBot)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideBot);
if (HideBot)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideBot);
}
}
this.WriteMathHideLeft = function(HideLeft)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideLeft);
if (HideLeft)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideLeft);
}
}
this.WriteMathHideRight = function(HideRight)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideRight);
if (HideRight)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideRight);
}
}
this.WriteMathHideTop = function(HideTop)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideTop);
if (HideTop)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideTop);
}
}
this.WriteMathMJc = function(MJc)
{
......@@ -2874,9 +2885,12 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}
this.WriteMathLimLoc = function(LimLoc)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(LimLoc);
if (LimLoc != 1)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(LimLoc);
}
}
this.WriteMathLimLow = function(oLimLow)
{
......@@ -2929,7 +2943,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
var nEnd = oMatrix.nRow;
var props = oMatrix.getPropsForWrite();
this.bs.WriteItem(c_oSer_OMathContentType.MatrixPr, function(){oThis.WriteMathMPr(props, oMatrix);});
this.bs.WriteItem(c_oSer_OMathContentType.MPr, function(){oThis.WriteMathMPr(props, oMatrix);});
for(var i = nStart; i < nEnd; i++)
{
......@@ -3157,11 +3171,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(Show);
}
this.WriteMathShp = function(Show)
this.WriteMathShp = function(Shp)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Show);
if (Shp != 1)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Shp);
}
}
this.WriteMathSPre = function(oSPre)
{
......@@ -3236,27 +3253,39 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}
this.WriteMathStrikeBLTR = function(StrikeBLTR)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeBLTR);
if (StrikeBLTR)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeBLTR);
}
}
this.WriteMathStrikeH = function(StrikeH)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeH);
if (StrikeH)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeH);
}
}
this.WriteMathStrikeTLBR = function(StrikeTLBR)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeTLBR);
if (StrikeTLBR)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeTLBR);
}
}
this.WriteMathStrikeV = function(StrikeV)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeV);
if (StrikeV)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeV);
}
}
this.WriteMathSty = function(Sty)
{
......@@ -3266,15 +3295,21 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}
this.WriteMathSubHide = function(SubHide)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SubHide);
if (SubHide)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SubHide);
}
}
this.WriteMathSupHide = function(SupHide)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SupHide);
if (SupHide)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SupHide);
}
}
this.WriteMathTransp = function(Transp)
{
......@@ -3284,9 +3319,12 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}
this.WriteMathType = function(Type)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Type);
if ( Type != 0)
{
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Type);
}
}
this.WriteMathVertJc = function(VertJc)
{
......
......@@ -72,7 +72,7 @@ CMathMatrix.prototype.init = function(props)
this.setRuleGap(this.spaceColumn, props.cGpRule, props.cGp, props.cSp);
this.setRuleGap(this.spaceRow, props.rSpRule, props.rSp);
if(props.plcHide === true)
if(props.plcHide === true || props.plcHide === 1)
{
this.plcHide = true;
this.hidePlaceholder(true);
......
......@@ -20,7 +20,7 @@ function CNary()
this.grow = false;
this.supHide = false;
this.subHide = false;
this.limLoc = NARY_SubSup;
this.limLoc = NARY_UndOvr;
CSubMathBase.call(this);
}
extend(CNary, CSubMathBase);
......
......@@ -2966,7 +2966,9 @@ COperator.prototype.getChr = function()
var chr = null; //если operator не определен, то this.code = null
if(this.code !== null)
chr = this.typeOper == this.defaultType ? "" : String.fromCharCode(this.code);
chr = this.typeOper == this.defaultType ? null : String.fromCharCode(this.code);
if (this.operator == OPERATOR_EMPTY)
chr = "";
return chr;
}
......@@ -3527,7 +3529,13 @@ CDelimiter.prototype.getPropsForWrite = function()
props.grow = this.grow == true ? 1 : 0;
props.column = this.nCol;
props.shp = this.shape;
var shp = null
if ( this.shape == DELIMITER_SHAPE_MATH)
shp = 0;
else if ( this.shape == DELIMITER_SHAPE_CENTERED )
shp = 1;
props.shp = shp;
props.begChr = this.begOper.getChr(); // default: PARENTHESIS_LEFT
props.endChr = this.endOper.getChr(); // default: PARENTHESIS_RIGHT
......@@ -3886,10 +3894,10 @@ CGroupCharacter.prototype.old_getGlyph = function(code, type)
CGroupCharacter.prototype.getPropsForWrite = function()
{
var vertJc = null;
if (this.vertJc == VJUST_BOT)
vertJc = 0;
else if ( this.vertJc == VJUST_TOP)
if (this.vertJc == VJUST_TOP)
vertJc = 1;
else
vertJc = 0;
var pos = null;
if (this.loc == LOCATION_BOT)
......
......@@ -8838,7 +8838,7 @@ asc_docs_api.prototype.asc_AddMath = function(Type)
var oDegree2 = new CDegree();
MathElement.CreateDegree(oDegree2, oElem, props, "c", "2", null);
break;
case 175: props = {pos:"top"};
case 175: props = {pos:LOCATION_TOP};
var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oBar.fillPlaceholders();
......@@ -8847,19 +8847,19 @@ asc_docs_api.prototype.asc_AddMath = function(Type)
MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oBar.fillPlaceholders();
break;
case 177: props = {pos:"top"};
case 177: props = {pos:LOCATION_TOP};
var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase();
MathElement.AddText(oElem, "A");
break;
case 178: props = {pos:"top"};
case 178: props = {pos:LOCATION_TOP};
var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase();
MathElement.AddText(oElem, "ABC");
break;
case 179: props = {pos:"top"};
case 179: props = {pos:LOCATION_TOP};
var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase();
......
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