Commit 68dd2bf2 authored by Sergey Luzyanin's avatar Sergey Luzyanin

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

parent 6cc49fd9
......@@ -2566,6 +2566,7 @@ CShape.prototype =
var oParentParagraph = oParaDrawing.Get_ParentParagraph();
if(oParentParagraph)
{
var oSectPr = oParentParagraph.Get_SectPr();
if(oSectPr)
{
......@@ -2573,23 +2574,23 @@ CShape.prototype =
{
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();
break;
}
case c_oAscRelativeFromH.Page:
case c_oAscSizeRelFromH.sizerelfromhPage:
{
this.extX = oSectPr.Get_PageWidth();
break;
}
case c_oAscRelativeFromH.LeftMargin:
case c_oAscSizeRelFromH.sizerelfromhLeftMargin:
{
this.extX = oSectPr.Get_PageMargin_Left();
break;
}
case c_oAscRelativeFromH.RightMargin:
case c_oAscSizeRelFromH.sizerelfromhRightMargin:
{
this.extX = oSectPr.Get_PageMargin_Right();
break;
......@@ -2604,25 +2605,24 @@ CShape.prototype =
}
if(oParaDrawing.SizeRelV)
{
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();
break;
}
case c_oAscRelativeFromV.Page:
case c_oAscSizeRelFromV.sizerelfromvPage:
{
this.extY = oSectPr.Get_PageHeight();
break;
}
case c_oAscRelativeFromV.TopMargin:
case c_oAscSizeRelFromV.sizerelfromvTopMargin:
{
this.extY = oSectPr.Get_PageMargin_Top();
break;
}
case c_oAscRelativeFromV.BottomMargin:
case c_oAscSizeRelFromV.sizerelfromvBottomMargin:
{
this.extY = oSectPr.Get_PageMargin_Bottom();
break;
......
......@@ -2372,8 +2372,8 @@ function CBinaryFileWriter()
oThis._WriteInt2(1, fill.tile.sy);
oThis._WriteInt2(2, fill.tile.tx);
oThis._WriteInt2(3, fill.tile.ty);
oThis._WriteInt2(4, fill.tile.algn);
oThis._WriteInt2(5, fill.tile.flip);
oThis._WriteLimit2(4, fill.tile.algn);
oThis._WriteLimit2(5, fill.tile.flip);
oThis.WriteUChar(g_nodeAttributeEnd);
oThis.EndRecord();
}
......
......@@ -435,6 +435,26 @@ var c_oAscRelativeFromH = {
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 = {
BottomMargin: 0x00,
InsideMargin: 0x01,
......
......@@ -4294,18 +4294,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteSimplePos(img.SimplePos);});
}
// if(null != img.SizeRelH)
// {
// this.memory.WriteByte(c_oSerImageType2.SizeRelH);
// this.memory.WriteByte(c_oSerPropLenType.Variable);
// this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelH);});
// }
// if(null != img.SizeRelV)
// {
// this.memory.WriteByte(c_oSerImageType2.SizeRelV);
// this.memory.WriteByte(c_oSerPropLenType.Variable);
// this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelV);});
// }
if(null != img.SizeRelH)
{
this.memory.WriteByte(c_oSerImageType2.SizeRelH);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelH);});
}
if(null != img.SizeRelV)
{
this.memory.WriteByte(c_oSerImageType2.SizeRelV);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteSizeRelHV(img.SizeRelV);});
}
switch(img.wrappingType)
{
case WRAPPING_TYPE_NONE:
......@@ -4427,10 +4427,10 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(SizeRelHV.RelativeFrom);
}
if (null != SizeRelHV.Pct) {
if (null != SizeRelHV.Percent) {
this.memory.WriteByte(c_oSerSizeRelHV.Pct);
this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(SizeRelHV.Pct);
this.memory.WriteDouble((SizeRelHV.Percent*100) >> 0);
}
}
this.WriteSimplePos = function(oSimplePos)
......@@ -8744,19 +8744,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
}
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){
return oThis.ReadSizeRelHV(t, l, oNewSizeRel);
});
//oParaDrawing.SizeRelH = oNewSizeRel;
oParaDrawing.SetSizeRelH(oNewSizeRel);
}
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){
return oThis.ReadSizeRelHV(t, l, oNewSizeRel);
});
//oParaDrawing.SizeRelV = oNewSizeRel;
oParaDrawing.SetSizeRelV(oNewSizeRel);
}
else if( c_oSerImageType2.WrapSquare === type )
{
......@@ -8857,7 +8857,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
if (c_oSerSizeRelHV.RelativeFrom === type) {
SizeRel.RelativeFrom = this.stream.GetUChar();
} else if (c_oSerSizeRelHV.Pct === type) {
SizeRel.Pct = this.bcr.ReadDouble();
SizeRel.Percent = this.bcr.ReadDouble()/100.0;
}
else
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