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

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

parent 6cc49fd9
...@@ -2566,6 +2566,7 @@ CShape.prototype = ...@@ -2566,6 +2566,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)
{ {
...@@ -2573,23 +2574,23 @@ CShape.prototype = ...@@ -2573,23 +2574,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;
...@@ -2604,25 +2605,24 @@ CShape.prototype = ...@@ -2604,25 +2605,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;
......
...@@ -2372,8 +2372,8 @@ function CBinaryFileWriter() ...@@ -2372,8 +2372,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();
} }
......
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2016
* *
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* *
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* *
* You can contact Ascensio System SIA by email at sales@onlyoffice.com * You can contact Ascensio System SIA by email at sales@onlyoffice.com
* *
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
* *
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains * Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic * relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute. * in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks. * Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* *
*/ */
"use strict"; "use strict";
var g_bDate1904 = false; var g_bDate1904 = false;
...@@ -435,6 +435,26 @@ var c_oAscRelativeFromH = { ...@@ -435,6 +435,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,
......
...@@ -4294,18 +4294,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4294,18 +4294,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:
...@@ -4427,10 +4427,10 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa ...@@ -4427,10 +4427,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)
...@@ -8744,19 +8744,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8744,19 +8744,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 )
{ {
...@@ -8857,7 +8857,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow ...@@ -8857,7 +8857,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