Commit 9a8b9905 authored by konovalovsergey's avatar konovalovsergey

for Bug 32442 - Не работает опция Constant Proportions при изменении Ширины...

for Bug 32442 - Не работает опция Constant Proportions при изменении Ширины или Высоты для изображения
parent 5e321a1a
...@@ -2916,19 +2916,11 @@ ...@@ -2916,19 +2916,11 @@
break; break;
} }
} }
if (oDrawing.isChart()) if(curDrawing)
{
this.bs.WriteItem(c_oSer_DrawingType.GraphicFrame, function () { oThis.WriteGraphicFrame(oDrawing); });
}
else if(curDrawing)
this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){pptx_content_writer.WriteDrawing(oThis.memory, curDrawing, null, null, null);}); this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){pptx_content_writer.WriteDrawing(oThis.memory, curDrawing, null, null, null);});
else else
this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){pptx_content_writer.WriteDrawing(oThis.memory, oDrawing.graphicObject, null, null, null);}); this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){pptx_content_writer.WriteDrawing(oThis.memory, oDrawing.graphicObject, null, null, null);});
}; };
this.WriteGraphicFrame = function (oDrawing) {
var oBinaryChartWriter = new AscCommon.BinaryChartWriter(this.memory);
this.bs.WriteItem(c_oSer_DrawingType.Chart2, function () { oBinaryChartWriter.WriteCT_ChartSpace(oDrawing.graphicObject); });
};
this.WriteFromTo = function(oFromTo) this.WriteFromTo = function(oFromTo)
{ {
if(null != oFromTo.col) if(null != oFromTo.col)
...@@ -6082,6 +6074,7 @@ ...@@ -6082,6 +6074,7 @@
/** proprietary begin **/ /** proprietary begin **/
else if ( c_oSer_DrawingType.GraphicFrame == type ) else if ( c_oSer_DrawingType.GraphicFrame == type )
{ {
//todo удалить
res = this.bcr.Read1(length, function (t, l) { res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadGraphicFrame(t, l, oDrawing); return oThis.ReadGraphicFrame(t, l, oDrawing);
}); });
......
...@@ -4475,6 +4475,11 @@ function CBinaryFileWriter() ...@@ -4475,6 +4475,11 @@ function CBinaryFileWriter()
this.WriteGroup(grObject, Document, oMapCommentId, oNumIdMap, copyParams, saveParams); this.WriteGroup(grObject, Document, oMapCommentId, oNumIdMap, copyParams, saveParams);
break; break;
} }
case AscDFH.historyitem_type_ChartSpace:
{
this.BinaryFileWriter.WriteChart(grObject);
break;
}
} }
this.BinaryFileWriter.EndRecord(); this.BinaryFileWriter.EndRecord();
this.BinaryFileWriter.EndRecord(); this.BinaryFileWriter.EndRecord();
......
...@@ -393,7 +393,8 @@ var c_oSerImageType2 = { ...@@ -393,7 +393,8 @@ var c_oSerImageType2 = {
Chart2: 25, Chart2: 25,
CachedImage: 26, CachedImage: 26,
SizeRelH: 27, SizeRelH: 27,
SizeRelV: 28 SizeRelV: 28,
GraphicFramePr: 30
}; };
var c_oSerEffectExtent = { var c_oSerEffectExtent = {
Left: 0, Left: 0,
...@@ -724,6 +725,14 @@ var c_oSerPageBorders = { ...@@ -724,6 +725,14 @@ var c_oSerPageBorders = {
ColorTheme: 13, ColorTheme: 13,
Val: 16 Val: 16
}; };
var c_oSerGraphicFramePr = {
NoChangeAspect: 0,
NoDrilldown: 1,
NoGrp: 2,
NoMove: 3,
NoResize: 4,
NoSelect: 5
};
var ETblStyleOverrideType = { var ETblStyleOverrideType = {
tblstyleoverridetypeBand1Horz: 0, tblstyleoverridetypeBand1Horz: 0,
tblstyleoverridetypeBand1Vert: 1, tblstyleoverridetypeBand1Vert: 1,
...@@ -4337,6 +4346,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4337,6 +4346,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.WriteEffectExtent(img.EffectExtent);}); this.bs.WriteItemWithLength(function(){oThis.WriteEffectExtent(img.EffectExtent);});
} }
if (null != img.GraphicObj.locks) {
this.memory.WriteByte(c_oSerImageType2.GraphicFramePr);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);});
}
if(null != img.GraphicObj.chart) if(null != img.GraphicObj.chart)
{ {
this.memory.WriteByte(c_oSerImageType2.Chart2); this.memory.WriteByte(c_oSerImageType2.Chart2);
...@@ -4473,7 +4487,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4473,7 +4487,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Null); this.memory.WriteByte(c_oSerPropLenType.Null);
break; break;
} }
if (null != img.GraphicObj.locks) {
this.memory.WriteByte(c_oSerImageType2.GraphicFramePr);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteGraphicFramePr(img.GraphicObj.locks);});
}
if(null != img.GraphicObj.chart) if(null != img.GraphicObj.chart)
{ {
this.memory.WriteByte(c_oSerImageType2.Chart2); this.memory.WriteByte(c_oSerImageType2.Chart2);
...@@ -4495,6 +4513,39 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4495,6 +4513,39 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteString2(img.getBase64Img()); this.memory.WriteString2(img.getBase64Img());
} }
}; };
this.WriteGraphicFramePr = function(locks)
{
if (locks & AscFormat.LOCKS_MASKS.noChangeAspect) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoChangeAspect);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noChangeAspect << 1));
}
if (locks & AscFormat.LOCKS_MASKS.noDrilldown) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoDrilldown);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noDrilldown << 1));
}
if (locks & AscFormat.LOCKS_MASKS.noGrp) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoGrp);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noGrp << 1));
}
if (locks & AscFormat.LOCKS_MASKS.noMove) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoMove);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noMove << 1));
}
if (locks & AscFormat.LOCKS_MASKS.noResize) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoResize);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noResize << 1));
}
if (locks & AscFormat.LOCKS_MASKS.noSelect) {
this.memory.WriteByte(c_oSerGraphicFramePr.NoSelect);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(!!(locks & AscFormat.LOCKS_MASKS.noSelect << 1));
}
}
this.WriteEffectExtent = function(EffectExtent) this.WriteEffectExtent = function(EffectExtent)
{ {
if(null != EffectExtent.L) if(null != EffectExtent.L)
...@@ -8664,9 +8715,10 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8664,9 +8715,10 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
{ {
var oThis = this; var oThis = this;
var doc = this.Document; var doc = this.Document;
var graphicFramePr = {locks: 0};
var oParaDrawing = new ParaDrawing(null, null, null, doc.DrawingDocument, doc, oParStruct.paragraph); var oParaDrawing = new ParaDrawing(null, null, null, doc.DrawingDocument, doc, oParStruct.paragraph);
res = this.bcr.Read2(length, function(t, l){ res = this.bcr.Read2(length, function(t, l){
return oThis.ReadPptxDrawing(t, l, oParaDrawing); return oThis.ReadPptxDrawing(t, l, oParaDrawing, graphicFramePr);
}); });
if(null != oParaDrawing.SimplePos) if(null != oParaDrawing.SimplePos)
oParaDrawing.setSimplePos(oParaDrawing.SimplePos.Use, oParaDrawing.SimplePos.X, oParaDrawing.SimplePos.Y); oParaDrawing.setSimplePos(oParaDrawing.SimplePos.Use, oParaDrawing.SimplePos.X, oParaDrawing.SimplePos.Y);
...@@ -8679,6 +8731,9 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8679,6 +8731,9 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
if(oParaDrawing.GraphicObj) if(oParaDrawing.GraphicObj)
{ {
if (oParaDrawing.GraphicObj.setLocks && graphicFramePr.locks > 0) {
oParaDrawing.GraphicObj.setLocks(graphicFramePr.locks);
}
if(oParaDrawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ChartSpace)//диаграммы могут быть без spPr if(oParaDrawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ChartSpace)//диаграммы могут быть без spPr
{ {
if(!oParaDrawing.GraphicObj.spPr) if(!oParaDrawing.GraphicObj.spPr)
...@@ -8855,7 +8910,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8855,7 +8910,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
return res; return res;
}; };
this.ReadPptxDrawing = function(type, length, oParaDrawing) this.ReadPptxDrawing = function(type, length, oParaDrawing, graphicFramePr)
{ {
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
var oThis = this; var oThis = this;
...@@ -9018,6 +9073,12 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -9018,6 +9073,12 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
return oThis.ReadWrapThroughTight(t, l, oParaDrawing.wrappingPolygon); return oThis.ReadWrapThroughTight(t, l, oParaDrawing.wrappingPolygon);
}); });
} }
else if( c_oSerImageType2.GraphicFramePr === type )
{
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadNvGraphicFramePr(t, l, graphicFramePr);
});
}
else if( c_oSerImageType2.CachedImage === type ) else if( c_oSerImageType2.CachedImage === type )
{ {
if(null != oParaDrawing.GraphicObj) if(null != oParaDrawing.GraphicObj)
...@@ -9029,6 +9090,33 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -9029,6 +9090,33 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
return res; return res;
} }
this.ReadNvGraphicFramePr = function(type, length, graphicFramePr) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
var value;
if (c_oSerGraphicFramePr.NoChangeAspect === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noChangeAspect | (value ? AscFormat.LOCKS_MASKS.noChangeAspect << 1 : 0));
} else if (c_oSerGraphicFramePr.NoDrilldown === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noDrilldown | (value ? AscFormat.LOCKS_MASKS.noDrilldown << 1 : 0));
} else if (c_oSerGraphicFramePr.NoGrp === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noGrp | (value ? AscFormat.LOCKS_MASKS.noGrp << 1 : 0));
} else if (c_oSerGraphicFramePr.NoMove === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noMove | (value ? AscFormat.LOCKS_MASKS.noMove << 1 : 0));
} else if (c_oSerGraphicFramePr.NoResize === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noResize | (value ? AscFormat.LOCKS_MASKS.noResize << 1 : 0));
} else if (c_oSerGraphicFramePr.NoSelect === type) {
value = this.stream.GetBool();
graphicFramePr.locks |= (AscFormat.LOCKS_MASKS.noSelect | (value ? AscFormat.LOCKS_MASKS.noSelect << 1 : 0));
} 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;
......
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