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,21 +2438,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2438,21 +2438,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
}); });
} }
}; };
this.WriteMathArgNodes = function(oOMath) this.WriteMathArgNodes = function(oElem)
{
if (oElem)
{ {
var oThis = this; var oThis = this;
var nStart = 0; var nStart = 0;
var nEnd = oOMath.content.length - 1; var nEnd = oElem.content.length - 1;
var nCurPos = 0; var nCurPos = 0;
var oText = "";
for(var i = nStart; i <= nEnd; i++) for(var i = nStart; i <= nEnd; i++)
{ {
var item = oOMath.content[i].value; var item = oElem.content[i].value;
var nextItem = null;
if ( oOMath.content[i+1] != null)
nextItem = oOMath.content[i+1].value;
switch ( item.typeObj) switch ( item.typeObj)
{ {
...@@ -2501,35 +2498,34 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2501,35 +2498,34 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
} }
case MATH_RUN_PRP: case MATH_RUN_PRP:
{ {
nCurPos = this.bs.WriteItemWithLengthStart();
this.memory.WriteByte(c_oSer_OMathContentType.MRun); this.memory.WriteByte(c_oSer_OMathContentType.MRun);
nCurPos = this.bs.WriteItemWithLengthStart();
var props = item.getPropsForWrite(); var props = item.getPropsForWrite();
oThis.bs.WriteItem(c_oSerRunType.rPr, function(){oThis.brPrs.Write_rPr(props.textPrp);}); // w:rPr oThis.bs.WriteItem(c_oSerRunType.rPr, function(){oThis.brPrs.Write_rPr(props.textPrp);}); // w:rPr
if ( props.mathRunPrp != null) if ( props.mathRunPrp != null)
this.bs.WriteItem(c_oSer_OMathContentType.MRPr, function(){oThis.WriteMathMRPr(props.mathRunPrp);}); // m:rPr this.bs.WriteItem(c_oSer_OMathContentType.MRPr, function(){oThis.WriteMathMRPr(props.mathRunPrp);}); // m:rPr
oText = ""; var oText = "";
} while (oElem.content[i+1] != null && oElem.content[i+1].value.typeObj == MATH_TEXT)
break;
case MATH_TEXT:
{
oText += String.fromCharCode(item.value);
if (nextItem == null || nextItem.typeObj == MATH_RUN_PRP)
{ {
oText += String.fromCharCode(oElem.content[i+1].value.value);
i++
}
if (null != oText) if (null != oText)
this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(oText.toString());}); //m:t this.bs.WriteItem(c_oSer_OMathContentType.MText, function(){ oThis.memory.WriteString2(oText);}); //m:t
this.bs.WriteItemEnd(nCurPos); this.bs.WriteItemEnd(nCurPos);
nCurPos = 0;
}
} }
break; break;
case MATH_TEXT:
case MATH_PLACEHOLDER: case MATH_PLACEHOLDER:
case MATH_EMPTY: case MATH_EMPTY:
break; break;
} }
} }
}
}; };
this.WriteMathAcc = function(oAcc) this.WriteMathAcc = function(oAcc)
...@@ -2714,7 +2710,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2714,7 +2710,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
{ {
var oThis = this; var oThis = this;
var nStart = 0; var nStart = 0;
var nEnd = oDelimiter.elements.length; var nEnd = oDelimiter.nCol;
var props = oDelimiter.getPropsForWrite(); var props = oDelimiter.getPropsForWrite();
this.bs.WriteItem(c_oSer_OMathContentType.DelimiterPr, function(){oThis.WriteMathDelimiterPr(props, oDelimiter);}); this.bs.WriteItem(c_oSer_OMathContentType.DelimiterPr, function(){oThis.WriteMathDelimiterPr(props, oDelimiter);});
...@@ -2837,35 +2833,50 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2837,35 +2833,50 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.bs.WriteItem(c_oSer_OMathBottomNodesType.CtrlPr, function(){oThis.WriteMathCtrlPr(oGroupChr);}); this.bs.WriteItem(c_oSer_OMathBottomNodesType.CtrlPr, function(){oThis.WriteMathCtrlPr(oGroupChr);});
} }
this.WriteMathGrow = function(Grow) this.WriteMathGrow = function(Grow)
{
if (!Grow)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(Grow); this.memory.WriteBool(Grow);
} }
}
this.WriteMathHideBot = function(HideBot) this.WriteMathHideBot = function(HideBot)
{
if (HideBot)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideBot); this.memory.WriteBool(HideBot);
} }
}
this.WriteMathHideLeft = function(HideLeft) this.WriteMathHideLeft = function(HideLeft)
{
if (HideLeft)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideLeft); this.memory.WriteBool(HideLeft);
} }
}
this.WriteMathHideRight = function(HideRight) this.WriteMathHideRight = function(HideRight)
{
if (HideRight)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideRight); this.memory.WriteBool(HideRight);
} }
}
this.WriteMathHideTop = function(HideTop) this.WriteMathHideTop = function(HideTop)
{
if (HideTop)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(HideTop); this.memory.WriteBool(HideTop);
} }
}
this.WriteMathMJc = function(MJc) this.WriteMathMJc = function(MJc)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
...@@ -2873,11 +2884,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2873,11 +2884,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(MJc); this.memory.WriteByte(MJc);
} }
this.WriteMathLimLoc = function(LimLoc) this.WriteMathLimLoc = function(LimLoc)
{
if (LimLoc != 1)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(LimLoc); this.memory.WriteByte(LimLoc);
} }
}
this.WriteMathLimLow = function(oLimLow) this.WriteMathLimLow = function(oLimLow)
{ {
var oThis = this; var oThis = this;
...@@ -2929,7 +2943,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -2929,7 +2943,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
var nEnd = oMatrix.nRow; var nEnd = oMatrix.nRow;
var props = oMatrix.getPropsForWrite(); 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++) for(var i = nStart; i < nEnd; i++)
{ {
...@@ -3157,11 +3171,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -3157,11 +3171,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(Show); this.memory.WriteBool(Show);
} }
this.WriteMathShp = function(Show) this.WriteMathShp = function(Shp)
{
if (Shp != 1)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Show); this.memory.WriteByte(Shp);
}
} }
this.WriteMathSPre = function(oSPre) this.WriteMathSPre = function(oSPre)
{ {
...@@ -3235,29 +3252,41 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -3235,29 +3252,41 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.bs.WriteItem(c_oSer_OMathBottomNodesType.CtrlPr, function(){oThis.WriteMathCtrlPr(oSSup);}); this.bs.WriteItem(c_oSer_OMathBottomNodesType.CtrlPr, function(){oThis.WriteMathCtrlPr(oSSup);});
} }
this.WriteMathStrikeBLTR = function(StrikeBLTR) this.WriteMathStrikeBLTR = function(StrikeBLTR)
{
if (StrikeBLTR)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeBLTR); this.memory.WriteBool(StrikeBLTR);
} }
}
this.WriteMathStrikeH = function(StrikeH) this.WriteMathStrikeH = function(StrikeH)
{
if (StrikeH)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeH); this.memory.WriteBool(StrikeH);
} }
}
this.WriteMathStrikeTLBR = function(StrikeTLBR) this.WriteMathStrikeTLBR = function(StrikeTLBR)
{
if (StrikeTLBR)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeTLBR); this.memory.WriteBool(StrikeTLBR);
} }
}
this.WriteMathStrikeV = function(StrikeV) this.WriteMathStrikeV = function(StrikeV)
{
if (StrikeV)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(StrikeV); this.memory.WriteBool(StrikeV);
} }
}
this.WriteMathSty = function(Sty) this.WriteMathSty = function(Sty)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
...@@ -3265,17 +3294,23 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -3265,17 +3294,23 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(Sty); this.memory.WriteByte(Sty);
} }
this.WriteMathSubHide = function(SubHide) this.WriteMathSubHide = function(SubHide)
{
if (SubHide)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SubHide); this.memory.WriteBool(SubHide);
} }
}
this.WriteMathSupHide = function(SupHide) this.WriteMathSupHide = function(SupHide)
{
if (SupHide)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(SupHide); this.memory.WriteBool(SupHide);
} }
}
this.WriteMathTransp = function(Transp) this.WriteMathTransp = function(Transp)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
...@@ -3283,11 +3318,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -3283,11 +3318,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteBool(Transp); this.memory.WriteBool(Transp);
} }
this.WriteMathType = function(Type) this.WriteMathType = function(Type)
{
if ( Type != 0)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Type); this.memory.WriteByte(Type);
} }
}
this.WriteMathVertJc = function(VertJc) this.WriteMathVertJc = function(VertJc)
{ {
this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);
......
...@@ -72,7 +72,7 @@ CMathMatrix.prototype.init = function(props) ...@@ -72,7 +72,7 @@ CMathMatrix.prototype.init = function(props)
this.setRuleGap(this.spaceColumn, props.cGpRule, props.cGp, props.cSp); this.setRuleGap(this.spaceColumn, props.cGpRule, props.cGp, props.cSp);
this.setRuleGap(this.spaceRow, props.rSpRule, props.rSp); this.setRuleGap(this.spaceRow, props.rSpRule, props.rSp);
if(props.plcHide === true) if(props.plcHide === true || props.plcHide === 1)
{ {
this.plcHide = true; this.plcHide = true;
this.hidePlaceholder(true); this.hidePlaceholder(true);
......
...@@ -20,7 +20,7 @@ function CNary() ...@@ -20,7 +20,7 @@ function CNary()
this.grow = false; this.grow = false;
this.supHide = false; this.supHide = false;
this.subHide = false; this.subHide = false;
this.limLoc = NARY_SubSup; this.limLoc = NARY_UndOvr;
CSubMathBase.call(this); CSubMathBase.call(this);
} }
extend(CNary, CSubMathBase); extend(CNary, CSubMathBase);
......
...@@ -2966,7 +2966,9 @@ COperator.prototype.getChr = function() ...@@ -2966,7 +2966,9 @@ COperator.prototype.getChr = function()
var chr = null; //если operator не определен, то this.code = null var chr = null; //если operator не определен, то this.code = null
if(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; return chr;
} }
...@@ -3527,7 +3529,13 @@ CDelimiter.prototype.getPropsForWrite = function() ...@@ -3527,7 +3529,13 @@ CDelimiter.prototype.getPropsForWrite = function()
props.grow = this.grow == true ? 1 : 0; props.grow = this.grow == true ? 1 : 0;
props.column = this.nCol; 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.begChr = this.begOper.getChr(); // default: PARENTHESIS_LEFT
props.endChr = this.endOper.getChr(); // default: PARENTHESIS_RIGHT props.endChr = this.endOper.getChr(); // default: PARENTHESIS_RIGHT
...@@ -3886,10 +3894,10 @@ CGroupCharacter.prototype.old_getGlyph = function(code, type) ...@@ -3886,10 +3894,10 @@ CGroupCharacter.prototype.old_getGlyph = function(code, type)
CGroupCharacter.prototype.getPropsForWrite = function() CGroupCharacter.prototype.getPropsForWrite = function()
{ {
var vertJc = null; var vertJc = null;
if (this.vertJc == VJUST_BOT) if (this.vertJc == VJUST_TOP)
vertJc = 0;
else if ( this.vertJc == VJUST_TOP)
vertJc = 1; vertJc = 1;
else
vertJc = 0;
var pos = null; var pos = null;
if (this.loc == LOCATION_BOT) if (this.loc == LOCATION_BOT)
......
...@@ -8838,7 +8838,7 @@ asc_docs_api.prototype.asc_AddMath = function(Type) ...@@ -8838,7 +8838,7 @@ asc_docs_api.prototype.asc_AddMath = function(Type)
var oDegree2 = new CDegree(); var oDegree2 = new CDegree();
MathElement.CreateDegree(oDegree2, oElem, props, "c", "2", null); MathElement.CreateDegree(oDegree2, oElem, props, "c", "2", null);
break; break;
case 175: props = {pos:"top"}; case 175: props = {pos:LOCATION_TOP};
var oBar = new CBar(); var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props); MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oBar.fillPlaceholders(); oBar.fillPlaceholders();
...@@ -8847,19 +8847,19 @@ asc_docs_api.prototype.asc_AddMath = function(Type) ...@@ -8847,19 +8847,19 @@ asc_docs_api.prototype.asc_AddMath = function(Type)
MathElement.CreateElem(oBar,MathElement.Math.Root,props); MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oBar.fillPlaceholders(); oBar.fillPlaceholders();
break; break;
case 177: props = {pos:"top"}; case 177: props = {pos:LOCATION_TOP};
var oBar = new CBar(); var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props); MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase(); oElem = oBar.getBase();
MathElement.AddText(oElem, "A"); MathElement.AddText(oElem, "A");
break; break;
case 178: props = {pos:"top"}; case 178: props = {pos:LOCATION_TOP};
var oBar = new CBar(); var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props); MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase(); oElem = oBar.getBase();
MathElement.AddText(oElem, "ABC"); MathElement.AddText(oElem, "ABC");
break; break;
case 179: props = {pos:"top"}; case 179: props = {pos:LOCATION_TOP};
var oBar = new CBar(); var oBar = new CBar();
MathElement.CreateElem(oBar,MathElement.Math.Root,props); MathElement.CreateElem(oBar,MathElement.Math.Root,props);
oElem = oBar.getBase(); 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