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

обработка случая с нечетным количеством путей в prstTxWarp

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63287 954022d7-b5bf-4e40-9824-e11837661b57
parent 37d30b39
......@@ -9238,7 +9238,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x2', 'y2');
f.AddPathCommand(3, 'wd2', 'wd2', 'stAng', 'swAng');
f.AddPathCommand(3, 'wd2', 'hd2', 'stAng', 'swAng');
break;
}
case 'textArchDownPour':{
......@@ -9311,7 +9311,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1');
f.AddPathCommand(3, 'wd2', 'wd2', 'adval', 'swAng');
f.AddPathCommand(3, 'wd2', 'hd2', 'adval', 'swAng');
break;
}
case 'textArchUpPour':{
......@@ -9400,13 +9400,13 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x3', 'y3');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1');
f.AddPathCommand(3, 'wd2', 'wd2', 'stT', 'swT');
f.AddPathCommand(3, 'wd2', 'hd2', 'stT', 'swT');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'l', 'vc');
f.AddPathCommand(2, 'r', 'vc');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x2', 'y2');
f.AddPathCommand(3, 'wd2', 'wd2', 'stB', 'swB');
f.AddPathCommand(3, 'wd2', 'hd2', 'stB', 'swB');
break;
}
case 'textButtonPour':{
......@@ -9620,7 +9620,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1');
f.AddPathCommand(3, 'wd2', 'wd2', 'adval', 'swAng');
f.AddPathCommand(3, 'wd2', 'hd2', 'adval', 'swAng');
break;
}
case 'textCirclePour':{
......
......@@ -997,7 +997,6 @@ Geometry.prototype=
}
},
Recalculate: function(w, h)
{
this.gdLst["_3cd4"]= 16200000;
......@@ -1079,6 +1078,37 @@ Geometry.prototype=
},
getMaxPathPolygonLength: function()
{
var aByPaths = this.getArrayPolygonsByPaths(PATH_DIV_EPSILON);
var dLength = 0;
for(var i = 0; i < aByPaths.length; ++i)
{
var oWarpPathPolygon = new PolygonWrapper(aByPaths[i]);
if(dLength < oWarpPathPolygon.dLen)
{
dLength = oWarpPathPolygon.dLen;
}
}
return dLength;
},
getMinPathPolygonLength: function()
{
var aByPaths = this.getArrayPolygonsByPaths(PATH_DIV_EPSILON);
var dLength = 10000000;
for(var i = 0; i < aByPaths.length; ++i)
{
var oWarpPathPolygon = new PolygonWrapper(aByPaths[i]);
if(dLength > oWarpPathPolygon.dLen)
{
dLength = oWarpPathPolygon.dLen;
}
}
return dLength;
},
draw: function(shape_drawer)
{
if(shape_drawer.Graphics && shape_drawer.Graphics.bDrawSmart)
......
......@@ -25,7 +25,6 @@ function Path()
this.ArrPathCommandInfo = [];
this.ArrPathCommand = [];
this.IsHidden = false;//For WordArt
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
......@@ -177,6 +176,7 @@ Path.prototype = {
this.addPathCommand({id:bezier4, X0:x0, Y0:y0, X1:x1, Y1:y1, X2:x2, Y2:y2});
},
close: function()
{
this.addPathCommand({id:close});
......
......@@ -4742,37 +4742,74 @@ CShape.prototype =
var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null};
if((oBodyPr.prstTxWarp && oBodyPr.prstTxWarp.preset !== "textNoShape") || this.checkContentWordArt(oContent))
{
var oTextDrawer = new CTextDrawer(dWidth, dHeight, true, this.Get_Theme());
var bNeedRecalc = oBodyPr.prstTxWarp.pathLst.length / 2 - ((oBodyPr.prstTxWarp.pathLst.length / 2) >> 0) > 0 , dOldXLimit = oContent.XLimit, dOldYLimit = oContent.YLimit, dOneLineWidth, dMinPolygonLength = 0, dKoeff = 1;
var oTheme = this.Get_Theme(), oColorMap = this.Get_ColorMap();
var oTextDrawer = new CTextDrawer(dWidth, dHeight, true, oTheme, bNeedRecalc);
var warpGeometry = oBodyPr.prstTxWarp;
warpGeometry && warpGeometry.Recalculate(dWidth, dHeight);
var oContentToDraw = oContent;
if(bNeedRecalc)
{
oContentToDraw = oContent.Copy(oContent.Parent, oContent.DrawingDocument);
var bNeedTurnOn = false;
if(this.bWordShape && editor && editor.WordControl.m_oLogicDocument)
{
if(!editor.WordControl.m_oLogicDocument.TurnOffRecalc)
{
bNeedTurnOn = true;
editor.WordControl.m_oLogicDocument.TurnOff_Recalculate();
}
}
oContentToDraw.Set_ApplyToAll(true);
oContentToDraw.Set_ParagraphSpacing({Before: 0, After: 0});
oContentToDraw.Set_ApplyToAll(false);
if(bNeedTurnOn)
{
editor.WordControl.m_oLogicDocument.TurnOn_Recalculate();
}
dMinPolygonLength = warpGeometry.getMinPathPolygonLength();
dOneLineWidth = GetRectContentWidth(oContentToDraw);
if(dOneLineWidth > dMinPolygonLength)
{
dKoeff = dMinPolygonLength/dOneLineWidth;
oContentToDraw.Reset(0, 0, dOneLineWidth, 20000);
}
else
{
oContentToDraw.Reset(0, 0, dMinPolygonLength, 20000);
}
oContentToDraw.Recalculate_Page(0, true);
}
var dContentHeight = oContentToDraw.Get_SummaryHeight();
var OldShowParaMarks;
if(isRealObject(editor))
{
OldShowParaMarks = editor.ShowParaMarks;
editor.ShowParaMarks = true;
}
oContent.Draw(oContent.StartPage, oTextDrawer);
oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
if(isRealObject(editor))
{
editor.ShowParaMarks = OldShowParaMarks;
}
oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarks.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this);
warpGeometry && oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry);
oRet.oTxWarpStructParamarks.Recalculate(oTheme, oColorMap, dWidth*dKoeff, dHeight*dKoeff, this);
warpGeometry && oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
if(isRealObject(editor))
{
OldShowParaMarks = editor.ShowParaMarks;
editor.ShowParaMarks = false;
}
oContent.Draw(oContent.StartPage, oTextDrawer);
oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
if(isRealObject(editor))
{
editor.ShowParaMarks = OldShowParaMarks;
}
oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStruct.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this);
warpGeometry && oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry);
oRet.oTxWarpStruct.Recalculate(oTheme, oColorMap, dWidth*dKoeff, dHeight*dKoeff, this);
warpGeometry && oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
this.recalcInfo.warpGeometry = warpGeometry;
}
else
......
This diff is collapsed.
......@@ -147,7 +147,7 @@ function OverlayObject(geometry, extX, extY, brush, pen, transform )
}
}
function ObjectToDraw(brush, pen, extX, extY, geometry, transform, oTextDrawer)
function ObjectToDraw(brush, pen, extX, extY, geometry, transform, x, y)
{
this.brush = brush;
this.pen = pen;
......@@ -157,6 +157,9 @@ function ObjectToDraw(brush, pen, extX, extY, geometry, transform, oTextDrawer)
this.TransformMatrix = transform;
this.geometry = geometry;
this.parentShape = null;
/* */
this.x = x;
this.y = y;
}
ObjectToDraw.prototype =
{
......@@ -178,14 +181,28 @@ ObjectToDraw.prototype =
}
},
resetBrushPen: function(brush, pen)
resetBrushPen: function(brush, pen, x, y)
{
this.brush = brush;
this.pen = pen;
if(isRealNumber(x) && isRealNumber(y))
{
this.x = x;
this.y = y;
}
},
Recalculate: function(oTheme, oColorMap, dWidth, dHeight, oShape, oParaLine)
Recalculate: function(oTheme, oColorMap, dWidth, dHeight, oShape)
{
// if(isRealNumber(this.x) && isRealNumber(this.y))
// {
// if(Math.abs(dWidth - this.extX) > MOVE_DELTA || Math.abs(dHeight - this.extY))
// {
// this.x*=dWidth/this.extX;
// this.y*=dHeight/this.extY;
// }
// }
if(this.brush)
{
this.brush.check(oTheme, oColorMap);
......@@ -199,7 +216,6 @@ ObjectToDraw.prototype =
this.geometry.Recalculate(dWidth, dHeight);
}
this.parentShape = oShape;
this.oParaLine = oParaLine;
},
draw: function(graphics, bNoParentShapeTransform, oTransformMatrix, oTheme, oColorMap)
......@@ -240,9 +256,8 @@ ObjectToDraw.prototype =
graphics.RestoreGrState();
},
createDuplicate: function(bNoCopyHiddeen)
createDuplicate: function()
{
var oCopy = new ObjectToDraw()
}
};
function RotateTrackShapeImage(originalObject)
......
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