Commit f9560223 authored by konovalovsergey's avatar konovalovsergey

open/save drawing docPr

parent 7b6797ff
...@@ -5840,12 +5840,12 @@ function BinaryPPTYLoader() ...@@ -5840,12 +5840,12 @@ function BinaryPPTYLoader()
} }
case 3: case 3:
{ {
s.GetString2(); cNvPr.title = s.GetString2();
break; break;
} }
case 4: case 4:
{ {
s.GetString2(); cNvPr.descr = s.GetString2();
break; break;
} }
default: default:
......
...@@ -3710,6 +3710,9 @@ function CBinaryFileWriter() ...@@ -3710,6 +3710,9 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeStart); oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteInt1(0, cNvPr.id); oThis._WriteInt1(0, cNvPr.id);
oThis._WriteString1(1, cNvPr.name); oThis._WriteString1(1, cNvPr.name);
oThis._WriteBool1(2, cNvPr.isHidden);
oThis._WriteString1(3, cNvPr.title);
oThis._WriteString1(4, cNvPr.descr);
oThis.WriteUChar(g_nodeAttributeEnd); oThis.WriteUChar(g_nodeAttributeEnd);
} }
......
...@@ -444,7 +444,8 @@ var c_oSerImageType2 = { ...@@ -444,7 +444,8 @@ var c_oSerImageType2 = {
CachedImage: 26, CachedImage: 26,
SizeRelH: 27, SizeRelH: 27,
SizeRelV: 28, SizeRelV: 28,
GraphicFramePr: 30 GraphicFramePr: 30,
DocPr: 31
}; };
var c_oSerEffectExtent = { var c_oSerEffectExtent = {
Left: 0, Left: 0,
...@@ -801,6 +802,13 @@ var c_oSerNotes = { ...@@ -801,6 +802,13 @@ var c_oSerNotes = {
PrEndPos: 10, PrEndPos: 10,
PrRef: 11 PrRef: 11
}; };
var c_oSerDocPr = {
Id: 0,
Name: 1,
Hidden: 2,
Title: 3,
Descr: 4
};
var c_oSerBackgroundType = { var c_oSerBackgroundType = {
Color: 0, Color: 0,
ColorTheme: 1, ColorTheme: 1,
...@@ -4563,6 +4571,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4563,6 +4571,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);}); this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);});
} }
if (null != img.docPr) {
this.memory.WriteByte(c_oSerImageType2.DocPr);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteDocPr(img.docPr);});
}
if(null != img.GraphicObj.chart) if(null != img.GraphicObj.chart)
{ {
this.memory.WriteByte(c_oSerImageType2.Chart2); this.memory.WriteByte(c_oSerImageType2.Chart2);
...@@ -4700,6 +4713,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4700,6 +4713,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);}); this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);});
} }
if (null != img.docPr) {
this.memory.WriteByte(c_oSerImageType2.DocPr);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteDocPr(img.docPr);});
}
if(null != img.GraphicObj.chart) if(null != img.GraphicObj.chart)
{ {
this.memory.WriteByte(c_oSerImageType2.Chart2); this.memory.WriteByte(c_oSerImageType2.Chart2);
...@@ -4750,6 +4768,26 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4750,6 +4768,26 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noSelect << 1)); this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noSelect << 1));
} }
} }
this.WriteDocPr = function(docPr)
{
var oThis = this;
this.bs.WriteItem(c_oSerDocPr.Id, function(){oThis.memory.WriteLong(oThis.saveParams.docPrId++);});
if (null != docPr.name) {
this.memory.WriteByte(c_oSerDocPr.Name);
this.memory.WriteString2(docPr.name);
}
if (null != docPr.isHidden) {
this.bs.WriteItem(c_oSerDocPr.Hidden, function(){oThis.memory.WriteBool(docPr.isHidden);});
}
if (null != docPr.title) {
this.memory.WriteByte(c_oSerDocPr.Title);
this.memory.WriteString2(docPr.title);
}
if (null != docPr.descr) {
this.memory.WriteByte(c_oSerDocPr.Descr);
this.memory.WriteString2(docPr.descr);
}
}
this.WriteEffectExtent = function(EffectExtent) this.WriteEffectExtent = function(EffectExtent)
{ {
if(null != EffectExtent.L) if(null != EffectExtent.L)
...@@ -9498,6 +9536,10 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo ...@@ -9498,6 +9536,10 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
res = this.bcr.Read2(length, function(t, l){ res = this.bcr.Read2(length, function(t, l){
return oThis.ReadNvGraphicFramePr(t, l, graphicFramePr); return oThis.ReadNvGraphicFramePr(t, l, graphicFramePr);
}); });
} else if( c_oSerImageType2.DocPr === type ) {
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadDocPr(t, l, oParaDrawing.docPr);
});
} }
else if( c_oSerImageType2.CachedImage === type ) else if( c_oSerImageType2.CachedImage === type )
{ {
...@@ -9537,6 +9579,24 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo ...@@ -9537,6 +9579,24 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
} }
return res; return res;
} }
this.ReadDocPr = function(type, length, docPr) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
if (c_oSerDocPr.Id === type) {
docPr.id = this.stream.GetLongLE();
} else if (c_oSerDocPr.Name === type) {
docPr.name = this.stream.GetString2LE(length);
} else if (c_oSerDocPr.Hidden === type) {
docPr.isHidden = this.stream.GetBool();
} else if (c_oSerDocPr.Title === type) {
docPr.title = this.stream.GetString2LE(length);
} else if (c_oSerDocPr.Descr === type) {
docPr.descr = this.stream.GetString2LE(length);
} else {
res = c_oSerConstants.ReadUnknown;
}
return res;
}
this.ReadEffectExtent = function(type, length, oEffectExtent) this.ReadEffectExtent = function(type, length, oEffectExtent)
{ {
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
...@@ -13416,6 +13476,7 @@ function DocSaveParams(bMailMergeDocx, bMailMergeHtml) { ...@@ -13416,6 +13476,7 @@ function DocSaveParams(bMailMergeDocx, bMailMergeHtml) {
this.trackRevisionId = 0; this.trackRevisionId = 0;
this.footnotes = {}; this.footnotes = {};
this.footnotesIndex = 0; this.footnotesIndex = 0;
this.docPrId = 0;
}; };
function DocReadResult(doc) { function DocReadResult(doc) {
this.logicDocument = doc; this.logicDocument = doc;
......
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