Commit 0d88f4a2 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47199 954022d7-b5bf-4e40-9824-e11837661b57
parent ebaafa57
...@@ -67,6 +67,7 @@ function CBinaryFileWriter() ...@@ -67,6 +67,7 @@ function CBinaryFileWriter()
delete _canvas; delete _canvas;
}; };
this.IsWordWriter = false;
this.ImData = null; this.ImData = null;
this.data = null; this.data = null;
this.len = 0; this.len = 0;
...@@ -2404,6 +2405,9 @@ function CBinaryFileWriter() ...@@ -2404,6 +2405,9 @@ function CBinaryFileWriter()
this.WriteXfrm = function(xfrm) this.WriteXfrm = function(xfrm)
{ {
if (oThis.IsWordWriter === true)
return oThis.WriteXfrmRot(xfrm);
oThis.WriteUChar(g_nodeAttributeStart); oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteInt4(0, xfrm.offX, c_dScalePPTXSizes); oThis._WriteInt4(0, xfrm.offX, c_dScalePPTXSizes);
oThis._WriteInt4(1, xfrm.offY, c_dScalePPTXSizes); oThis._WriteInt4(1, xfrm.offY, c_dScalePPTXSizes);
...@@ -2419,6 +2423,53 @@ function CBinaryFileWriter() ...@@ -2419,6 +2423,53 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeEnd); oThis.WriteUChar(g_nodeAttributeEnd);
} }
this.WriteXfrmRot = function(xfrm)
{
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteInt4(0, xfrm.offX, c_dScalePPTXSizes);
oThis._WriteInt4(1, xfrm.offY, c_dScalePPTXSizes);
oThis._WriteInt4(2, xfrm.extX, c_dScalePPTXSizes);
oThis._WriteInt4(3, xfrm.extY, c_dScalePPTXSizes);
oThis._WriteInt4(4, xfrm.chOffX, c_dScalePPTXSizes);
oThis._WriteInt4(5, xfrm.chOffY, c_dScalePPTXSizes);
oThis._WriteInt4(6, xfrm.chExtX, c_dScalePPTXSizes);
oThis._WriteInt4(7, xfrm.chExtY, c_dScalePPTXSizes);
oThis._WriteBool2(8, xfrm.flipH);
oThis._WriteBool2(9, xfrm.flipV);
if (xfrm.rot != null)
{
var nCheckInvert = 0;
if (true == xfrm.flipH)
nCheckInvert += 1;
if (true == xfrm.flipV)
nCheckInvert += 1;
var _rot = (xfrm.rot * 180 * 60000 / Math.PI) >> 0;
var _n360 = 360 * 60000;
if (_rot > _n360)
{
var _nDel = (_rot / _n360) >> 0;
_rot = _rot - _nDel * _n360;
}
else
{
var _nDel = (-_rot / _n360) >> 0;
_nDel += 1;
_rot = _rot + _nDel * _n360;
}
if (nCheckInvert == 1)
{
_rot = _n360 - _rot;
}
oThis._WriteInt1(10, _rot);
}
oThis.WriteUChar(g_nodeAttributeEnd);
}
this.WriteUniNvPr = function(nv) this.WriteUniNvPr = function(nv)
{ {
oThis.WriteRecord1(0, nv.cNvPr, oThis.Write_cNvPr); oThis.WriteRecord1(0, nv.cNvPr, oThis.Write_cNvPr);
......
...@@ -410,6 +410,7 @@ function CPPTXContentLoader() ...@@ -410,6 +410,7 @@ function CPPTXContentLoader()
case 0: case 0:
{ {
spPr.xfrm = this.Reader.ReadXfrm(); spPr.xfrm = this.Reader.ReadXfrm();
this.CorrectXfrm(spPr.xfrm);
break; break;
} }
case 1: case 1:
...@@ -453,6 +454,41 @@ function CPPTXContentLoader() ...@@ -453,6 +454,41 @@ function CPPTXContentLoader()
s.Seek2(_end_rec); s.Seek2(_end_rec);
} }
this.CorrectXfrm = function(_xfrm)
{
if (!_xfrm)
return;
if (null == _xfrm.rot)
return;
var nInvertRotate = 0;
if (true === _xfrm.flipH)
nInvertRotate += 1;
if (true === _xfrm.flipV)
nInvertRotate += 1;
var _rot = _xfrm.rot;
var _del = 2 * Math.PI;
if (nInvertRotate)
_rot = -_rot;
if (_rot >= _del)
{
var _intD = (_rot / _del) >> 0;
_rot = _rot - _intD * _del;
}
else if (_rot < 0)
{
var _intD = (-_rot / _del) >> 0;
_intD = 1 + _intD;
_rot = _rot + _intD * _del;
}
_xfrm.rot = _rot;
}
this.ReadTheme = function(reader, stream) this.ReadTheme = function(reader, stream)
{ {
this.BaseReader = reader; this.BaseReader = reader;
...@@ -489,6 +525,7 @@ function CPPTXContentWriter() ...@@ -489,6 +525,7 @@ function CPPTXContentWriter()
{ {
this.BinaryFileWriter = new CBinaryFileWriter(); this.BinaryFileWriter = new CBinaryFileWriter();
this.BinaryFileWriter.Init(); this.BinaryFileWriter.Init();
this.BinaryFileWriter.IsWordWriter = true;
this.TreeDrawingIndex = 0; this.TreeDrawingIndex = 0;
......
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