Commit 01351811 authored by Sergey Luzyanin's avatar Sergey Luzyanin Committed by Alexander.Trofimov

Относительные размеры шейпов

parent ea96cf4a
...@@ -2542,6 +2542,7 @@ CShape.prototype = ...@@ -2542,6 +2542,7 @@ CShape.prototype =
var oParentParagraph = oParaDrawing.Get_ParentParagraph(); var oParentParagraph = oParaDrawing.Get_ParentParagraph();
if(oParentParagraph) if(oParentParagraph)
{ {
var oSectPr = oParentParagraph.Get_SectPr(); var oSectPr = oParentParagraph.Get_SectPr();
if(oSectPr) if(oSectPr)
{ {
...@@ -2549,23 +2550,23 @@ CShape.prototype = ...@@ -2549,23 +2550,23 @@ CShape.prototype =
{ {
switch(oParaDrawing.SizeRelH.RelativeFrom) switch(oParaDrawing.SizeRelH.RelativeFrom)
{ {
case c_oAscRelativeFromH.Margin: case c_oAscSizeRelFromH.sizerelfromhMargin:
{ {
this.extX = oSectPr.Get_PageWidth() - oSectPr.Get_PageMargin_Left() - oSectPr.Get_PageMargin_Right(); this.extX = oSectPr.Get_PageWidth() - oSectPr.Get_PageMargin_Left() - oSectPr.Get_PageMargin_Right();
break; break;
} }
case c_oAscRelativeFromH.Page: case c_oAscSizeRelFromH.sizerelfromhPage:
{ {
this.extX = oSectPr.Get_PageWidth(); this.extX = oSectPr.Get_PageWidth();
break; break;
} }
case c_oAscRelativeFromH.LeftMargin: case c_oAscSizeRelFromH.sizerelfromhLeftMargin:
{ {
this.extX = oSectPr.Get_PageMargin_Left(); this.extX = oSectPr.Get_PageMargin_Left();
break; break;
} }
case c_oAscRelativeFromH.RightMargin: case c_oAscSizeRelFromH.sizerelfromhRightMargin:
{ {
this.extX = oSectPr.Get_PageMargin_Right(); this.extX = oSectPr.Get_PageMargin_Right();
break; break;
...@@ -2580,25 +2581,24 @@ CShape.prototype = ...@@ -2580,25 +2581,24 @@ CShape.prototype =
} }
if(oParaDrawing.SizeRelV) if(oParaDrawing.SizeRelV)
{ {
switch(oParaDrawing.SizeRelV.RelativeFrom) switch(oParaDrawing.SizeRelV.RelativeFrom)
{ {
case c_oAscRelativeFromV.Margin: case c_oAscSizeRelFromV.sizerelfromvMargin:
{ {
this.extY = oSectPr.Get_PageHeight() - oSectPr.Get_PageMargin_Top() - oSectPr.Get_PageMargin_Bottom(); this.extY = oSectPr.Get_PageHeight() - oSectPr.Get_PageMargin_Top() - oSectPr.Get_PageMargin_Bottom();
break; break;
} }
case c_oAscRelativeFromV.Page: case c_oAscSizeRelFromV.sizerelfromvPage:
{ {
this.extY = oSectPr.Get_PageHeight(); this.extY = oSectPr.Get_PageHeight();
break; break;
} }
case c_oAscRelativeFromV.TopMargin: case c_oAscSizeRelFromV.sizerelfromvTopMargin:
{ {
this.extY = oSectPr.Get_PageMargin_Top(); this.extY = oSectPr.Get_PageMargin_Top();
break; break;
} }
case c_oAscRelativeFromV.BottomMargin: case c_oAscSizeRelFromV.sizerelfromvBottomMargin:
{ {
this.extY = oSectPr.Get_PageMargin_Bottom(); this.extY = oSectPr.Get_PageMargin_Bottom();
break; break;
......
...@@ -2348,8 +2348,8 @@ function CBinaryFileWriter() ...@@ -2348,8 +2348,8 @@ function CBinaryFileWriter()
oThis._WriteInt2(1, fill.tile.sy); oThis._WriteInt2(1, fill.tile.sy);
oThis._WriteInt2(2, fill.tile.tx); oThis._WriteInt2(2, fill.tile.tx);
oThis._WriteInt2(3, fill.tile.ty); oThis._WriteInt2(3, fill.tile.ty);
oThis._WriteInt2(4, fill.tile.algn); oThis._WriteLimit2(4, fill.tile.algn);
oThis._WriteInt2(5, fill.tile.flip); oThis._WriteLimit2(5, fill.tile.flip);
oThis.WriteUChar(g_nodeAttributeEnd); oThis.WriteUChar(g_nodeAttributeEnd);
oThis.EndRecord(); oThis.EndRecord();
} }
......
...@@ -411,6 +411,26 @@ var c_oAscRelativeFromH = { ...@@ -411,6 +411,26 @@ var c_oAscRelativeFromH = {
RightMargin: 0x07 RightMargin: 0x07
}; };
var c_oAscSizeRelFromH =
{
sizerelfromhMargin: 0,
sizerelfromhPage: 1,
sizerelfromhLeftMargin: 2,
sizerelfromhRightMargin: 3,
sizerelfromhInsideMargin: 4,
sizerelfromhOutsideMargin: 5
};
var c_oAscSizeRelFromV =
{
sizerelfromvMargin: 0,
sizerelfromvPage: 1,
sizerelfromvTopMargin: 2,
sizerelfromvBottomMargin: 3,
sizerelfromvInsideMargin: 4,
sizerelfromvOutsideMargin: 5
};
var c_oAscRelativeFromV = { var c_oAscRelativeFromV = {
BottomMargin: 0x00, BottomMargin: 0x00,
InsideMargin: 0x01, InsideMargin: 0x01,
......
...@@ -4270,18 +4270,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4270,18 +4270,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteSimplePos(img.SimplePos);}); this.bs.WriteItemWithLength(function(){oThis.WriteSimplePos(img.SimplePos);});
} }
// if(null != img.SizeRelH) if(null != img.SizeRelH)
// { {
// this.memory.WriteByte(c_oSerImageType2.SizeRelH); this.memory.WriteByte(c_oSerImageType2.SizeRelH);
// this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
// this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelH);}); this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelH);});
// } }
// if(null != img.SizeRelV) if(null != img.SizeRelV)
// { {
// this.memory.WriteByte(c_oSerImageType2.SizeRelV); this.memory.WriteByte(c_oSerImageType2.SizeRelV);
// this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
// this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelV);}); this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelV);});
// } }
switch(img.wrappingType) switch(img.wrappingType)
{ {
case WRAPPING_TYPE_NONE: case WRAPPING_TYPE_NONE:
...@@ -4403,10 +4403,10 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4403,10 +4403,10 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(SizeRelHV.RelativeFrom); this.memory.WriteByte(SizeRelHV.RelativeFrom);
} }
if (null != SizeRelHV.Pct) { if (null != SizeRelHV.Percent) {
this.memory.WriteByte(c_oSerSizeRelHV.Pct); this.memory.WriteByte(c_oSerSizeRelHV.Pct);
this.memory.WriteByte(c_oSerPropLenType.Double); this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(SizeRelHV.Pct); this.memory.WriteDouble((SizeRelHV.Percent*100) >> 0);
} }
} }
this.WriteSimplePos = function(oSimplePos) this.WriteSimplePos = function(oSimplePos)
...@@ -8720,19 +8720,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8720,19 +8720,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
} }
else if( c_oSerImageType2.SizeRelH === type ) else if( c_oSerImageType2.SizeRelH === type )
{ {
var oNewSizeRel = {RelativeFrom: null, Pct: null}; var oNewSizeRel = {RelativeFrom: null, Percent: null};
res = this.bcr.Read2(length, function(t, l){ res = this.bcr.Read2(length, function(t, l){
return oThis.ReadSizeRelHV(t, l, oNewSizeRel); return oThis.ReadSizeRelHV(t, l, oNewSizeRel);
}); });
//oParaDrawing.SizeRelH = oNewSizeRel; oParaDrawing.SetSizeRelH(oNewSizeRel);
} }
else if( c_oSerImageType2.SizeRelV === type ) else if( c_oSerImageType2.SizeRelV === type )
{ {
var oNewSizeRel = {RelativeFrom: null, Pct: null}; var oNewSizeRel = {RelativeFrom: null, Percent: null};
res = this.bcr.Read2(length, function(t, l){ res = this.bcr.Read2(length, function(t, l){
return oThis.ReadSizeRelHV(t, l, oNewSizeRel); return oThis.ReadSizeRelHV(t, l, oNewSizeRel);
}); });
//oParaDrawing.SizeRelV = oNewSizeRel; oParaDrawing.SetSizeRelV(oNewSizeRel);
} }
else if( c_oSerImageType2.WrapSquare === type ) else if( c_oSerImageType2.WrapSquare === type )
{ {
...@@ -8833,7 +8833,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8833,7 +8833,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
if (c_oSerSizeRelHV.RelativeFrom === type) { if (c_oSerSizeRelHV.RelativeFrom === type) {
SizeRel.RelativeFrom = this.stream.GetUChar(); SizeRel.RelativeFrom = this.stream.GetUChar();
} else if (c_oSerSizeRelHV.Pct === type) { } else if (c_oSerSizeRelHV.Pct === type) {
SizeRel.Pct = this.bcr.ReadDouble(); SizeRel.Percent = this.bcr.ReadDouble()/100.0;
} }
else else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
......
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