Commit 7b2d67b6 authored by Sergey Konovalov's avatar Sergey Konovalov

open/save CInlineLevelSdt

parent 0d8fafba
...@@ -1276,7 +1276,7 @@ function BinaryFileWriter(doc, bMailMergeDocx, bMailMergeHtml) ...@@ -1276,7 +1276,7 @@ function BinaryFileWriter(doc, bMailMergeDocx, bMailMergeHtml)
if(this.copyParams.bLockCopyElems > 0) if(this.copyParams.bLockCopyElems > 0)
return; return;
var oThis = this; var oThis = this;
this.bs.WriteItem(c_oSerParType.Sdt, function(){oThis.copyParams.bdtw.WriteSdt(Item);}); this.bs.WriteItem(c_oSerParType.Sdt, function(){oThis.copyParams.bdtw.WriteSdt(Item, 0);});
this.copyParams.itemCount++; this.copyParams.itemCount++;
} }
this.CopyEnd = function() this.CopyEnd = function()
...@@ -4167,7 +4167,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4167,7 +4167,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
else if(type_BlockLevelSdt === item.GetType()) else if(type_BlockLevelSdt === item.GetType())
{ {
this.memory.WriteByte(c_oSerParType.Sdt); this.memory.WriteByte(c_oSerParType.Sdt);
this.bs.WriteItemWithLength(function(){oThis.WriteSdt(item);}); this.bs.WriteItemWithLength(function(){oThis.WriteSdt(item, 0);});
} }
} }
if(true == bSectPr) if(true == bSectPr)
...@@ -4389,7 +4389,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4389,7 +4389,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
} }
} }
break; break;
case para_InlineLevelSdt:
this.bs.WriteItem(c_oSerParType.Sdt, function () {
oThis.WriteSdt(item, 1);
});
break;
} }
} }
if ((bLastRun && bUseSelection && !par.Selection_CheckParaEnd()) || (selectedAll != undefined && selectedAll === false) ) if ((bLastRun && bUseSelection && !par.Selection_CheckParaEnd()) || (selectedAll != undefined && selectedAll === false) )
...@@ -5316,7 +5320,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -5316,7 +5320,7 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
oThis.bs.WriteItem(c_oSerParType.OMath, function(){oThis.boMaths.WriteArgNodes(obj.ParaMath.Root);}); oThis.bs.WriteItem(c_oSerParType.OMath, function(){oThis.boMaths.WriteArgNodes(obj.ParaMath.Root);});
oThis.bs.WriteItem(c_oSerRunType.pptxDrawing, function () { oThis.WriteImage(obj); }); oThis.bs.WriteItem(c_oSerRunType.pptxDrawing, function () { oThis.WriteImage(obj); });
}; };
this.WriteSdt = function (oSdt) this.WriteSdt = function (oSdt, type)
{ {
var oThis = this; var oThis = this;
if (oSdt.Pr) { if (oSdt.Pr) {
...@@ -5325,8 +5329,12 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -5325,8 +5329,12 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
// if (oSdt.EndPr) { // if (oSdt.EndPr) {
// this.bs.WriteItem(c_oSerSdt.EndPr, function(){oThis.brPrs.Write_rPr(oSdt.EndPr, null, null);}); // this.bs.WriteItem(c_oSerSdt.EndPr, function(){oThis.brPrs.Write_rPr(oSdt.EndPr, null, null);});
// } // }
if (0 === type) {
var oInnerDocument = new BinaryDocumentTableWriter(this.memory, this.Document, this.oMapCommentId, this.oNumIdMap, this.copyParams, this.saveParams, this.oBinaryHeaderFooterTableWriter); var oInnerDocument = new BinaryDocumentTableWriter(this.memory, this.Document, this.oMapCommentId, this.oNumIdMap, this.copyParams, this.saveParams, this.oBinaryHeaderFooterTableWriter);
this.bs.WriteItem(c_oSerSdt.Content, function(){oInnerDocument.WriteDocumentContent(oSdt.Content);}); this.bs.WriteItem(c_oSerSdt.Content, function(){oInnerDocument.WriteDocumentContent(oSdt.Content);});
} else if (1 === type) {
this.bs.WriteItem(c_oSerSdt.Content, function(){oThis.WriteParagraphContent(oSdt, false, false);});
}
}; };
this.WriteSdtPr = function (val) this.WriteSdtPr = function (val)
{ {
...@@ -9305,9 +9313,14 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo ...@@ -9305,9 +9313,14 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
} }
} }
} else if ( c_oSerParType.Sdt === type) { } else if ( c_oSerParType.Sdt === type) {
res = this.bcr.Read1(length, function(t, l) { var oSdt = new AscCommonWord.CInlineLevelSdt();
return oThis.ReadSdt(t, l, null, 1, oParStruct); oSdt.Set_Paragraph(oParStruct.paragraph);
var oSdtStruct = new OpenParStruct(oSdt, oParStruct.paragraph);
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadSdt(t,l, oSdt, 1, oSdtStruct);
}); });
oSdtStruct.commitAll();
oParStruct.addToContent(oSdt);
} else } else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
return res; return res;
...@@ -10498,7 +10511,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo ...@@ -10498,7 +10511,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
var oThis = this; var oThis = this;
if (c_oSerSdt.Pr === type) { if (c_oSerSdt.Pr === type) {
if (0 === typeContainer) { if (oSdt) {
var sdtPr = new AscCommonWord.CSdtPr(); var sdtPr = new AscCommonWord.CSdtPr();
res = this.bcr.Read1(length, function(t, l) { res = this.bcr.Read1(length, function(t, l) {
return oThis.ReadSdtPr(t, l, sdtPr); return oThis.ReadSdtPr(t, l, sdtPr);
......
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