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) ...@@ -9238,7 +9238,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1'); f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined); f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x2', 'y2'); f.AddPathCommand(1, 'x2', 'y2');
f.AddPathCommand(3, 'wd2', 'wd2', 'stAng', 'swAng'); f.AddPathCommand(3, 'wd2', 'hd2', 'stAng', 'swAng');
break; break;
} }
case 'textArchDownPour':{ case 'textArchDownPour':{
...@@ -9311,7 +9311,7 @@ function CreatePrstTxWarpGeometry(prst) ...@@ -9311,7 +9311,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1'); f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined); f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1'); f.AddPathCommand(1, 'x1', 'y1');
f.AddPathCommand(3, 'wd2', 'wd2', 'adval', 'swAng'); f.AddPathCommand(3, 'wd2', 'hd2', 'adval', 'swAng');
break; break;
} }
case 'textArchUpPour':{ case 'textArchUpPour':{
...@@ -9400,13 +9400,13 @@ function CreatePrstTxWarpGeometry(prst) ...@@ -9400,13 +9400,13 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x3', 'y3'); f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x3', 'y3');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined); f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1'); 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(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'l', 'vc'); f.AddPathCommand(1, 'l', 'vc');
f.AddPathCommand(2, 'r', 'vc'); f.AddPathCommand(2, 'r', 'vc');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined); f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x2', 'y2'); f.AddPathCommand(1, 'x2', 'y2');
f.AddPathCommand(3, 'wd2', 'wd2', 'stB', 'swB'); f.AddPathCommand(3, 'wd2', 'hd2', 'stB', 'swB');
break; break;
} }
case 'textButtonPour':{ case 'textButtonPour':{
...@@ -9620,7 +9620,7 @@ function CreatePrstTxWarpGeometry(prst) ...@@ -9620,7 +9620,7 @@ function CreatePrstTxWarpGeometry(prst)
f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1'); f.AddHandlePolar('adj', '0', '21599999', undefined, '0', '0', 'x1', 'y1');
f.AddPathCommand(0, false, 'none', undefined, undefined, undefined); f.AddPathCommand(0, false, 'none', undefined, undefined, undefined);
f.AddPathCommand(1, 'x1', 'y1'); f.AddPathCommand(1, 'x1', 'y1');
f.AddPathCommand(3, 'wd2', 'wd2', 'adval', 'swAng'); f.AddPathCommand(3, 'wd2', 'hd2', 'adval', 'swAng');
break; break;
} }
case 'textCirclePour':{ case 'textCirclePour':{
......
...@@ -997,7 +997,6 @@ Geometry.prototype= ...@@ -997,7 +997,6 @@ Geometry.prototype=
} }
}, },
Recalculate: function(w, h) Recalculate: function(w, h)
{ {
this.gdLst["_3cd4"]= 16200000; this.gdLst["_3cd4"]= 16200000;
...@@ -1079,6 +1078,37 @@ Geometry.prototype= ...@@ -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) draw: function(shape_drawer)
{ {
if(shape_drawer.Graphics && shape_drawer.Graphics.bDrawSmart) if(shape_drawer.Graphics && shape_drawer.Graphics.bDrawSmart)
......
...@@ -25,7 +25,6 @@ function Path() ...@@ -25,7 +25,6 @@ function Path()
this.ArrPathCommandInfo = []; this.ArrPathCommandInfo = [];
this.ArrPathCommand = []; this.ArrPathCommand = [];
this.IsHidden = false;//For WordArt
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id); g_oTableId.Add(this, this.Id);
...@@ -177,6 +176,7 @@ Path.prototype = { ...@@ -177,6 +176,7 @@ Path.prototype = {
this.addPathCommand({id:bezier4, X0:x0, Y0:y0, X1:x1, Y1:y1, X2:x2, Y2:y2}); this.addPathCommand({id:bezier4, X0:x0, Y0:y0, X1:x1, Y1:y1, X2:x2, Y2:y2});
}, },
close: function() close: function()
{ {
this.addPathCommand({id:close}); this.addPathCommand({id:close});
......
...@@ -4742,37 +4742,74 @@ CShape.prototype = ...@@ -4742,37 +4742,74 @@ CShape.prototype =
var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null}; var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null};
if((oBodyPr.prstTxWarp && oBodyPr.prstTxWarp.preset !== "textNoShape") || this.checkContentWordArt(oContent)) 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; var warpGeometry = oBodyPr.prstTxWarp;
warpGeometry && warpGeometry.Recalculate(dWidth, dHeight); 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; var OldShowParaMarks;
if(isRealObject(editor)) if(isRealObject(editor))
{ {
OldShowParaMarks = editor.ShowParaMarks; OldShowParaMarks = editor.ShowParaMarks;
editor.ShowParaMarks = true; editor.ShowParaMarks = true;
} }
oContent.Draw(oContent.StartPage, oTextDrawer); oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
if(isRealObject(editor)) if(isRealObject(editor))
{ {
editor.ShowParaMarks = OldShowParaMarks; editor.ShowParaMarks = OldShowParaMarks;
} }
oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure; oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarks.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this); oRet.oTxWarpStructParamarks.Recalculate(oTheme, oColorMap, dWidth*dKoeff, dHeight*dKoeff, this);
warpGeometry && oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry); warpGeometry && oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
if(isRealObject(editor)) if(isRealObject(editor))
{ {
OldShowParaMarks = editor.ShowParaMarks; OldShowParaMarks = editor.ShowParaMarks;
editor.ShowParaMarks = false; editor.ShowParaMarks = false;
} }
oContent.Draw(oContent.StartPage, oTextDrawer); oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
if(isRealObject(editor)) if(isRealObject(editor))
{ {
editor.ShowParaMarks = OldShowParaMarks; editor.ShowParaMarks = OldShowParaMarks;
} }
oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure; oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStruct.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this); oRet.oTxWarpStruct.Recalculate(oTheme, oColorMap, dWidth*dKoeff, dHeight*dKoeff, this);
warpGeometry && oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry);
warpGeometry && oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
this.recalcInfo.warpGeometry = warpGeometry; this.recalcInfo.warpGeometry = warpGeometry;
} }
else else
......
This diff is collapsed.
...@@ -147,7 +147,7 @@ function OverlayObject(geometry, extX, extY, brush, pen, transform ) ...@@ -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.brush = brush;
this.pen = pen; this.pen = pen;
...@@ -157,6 +157,9 @@ function ObjectToDraw(brush, pen, extX, extY, geometry, transform, oTextDrawer) ...@@ -157,6 +157,9 @@ function ObjectToDraw(brush, pen, extX, extY, geometry, transform, oTextDrawer)
this.TransformMatrix = transform; this.TransformMatrix = transform;
this.geometry = geometry; this.geometry = geometry;
this.parentShape = null; this.parentShape = null;
/* */
this.x = x;
this.y = y;
} }
ObjectToDraw.prototype = ObjectToDraw.prototype =
{ {
...@@ -178,14 +181,28 @@ ObjectToDraw.prototype = ...@@ -178,14 +181,28 @@ ObjectToDraw.prototype =
} }
}, },
resetBrushPen: function(brush, pen) resetBrushPen: function(brush, pen, x, y)
{ {
this.brush = brush; this.brush = brush;
this.pen = pen; 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) if(this.brush)
{ {
this.brush.check(oTheme, oColorMap); this.brush.check(oTheme, oColorMap);
...@@ -199,7 +216,6 @@ ObjectToDraw.prototype = ...@@ -199,7 +216,6 @@ ObjectToDraw.prototype =
this.geometry.Recalculate(dWidth, dHeight); this.geometry.Recalculate(dWidth, dHeight);
} }
this.parentShape = oShape; this.parentShape = oShape;
this.oParaLine = oParaLine;
}, },
draw: function(graphics, bNoParentShapeTransform, oTransformMatrix, oTheme, oColorMap) draw: function(graphics, bNoParentShapeTransform, oTransformMatrix, oTheme, oColorMap)
...@@ -240,9 +256,8 @@ ObjectToDraw.prototype = ...@@ -240,9 +256,8 @@ ObjectToDraw.prototype =
graphics.RestoreGrState(); graphics.RestoreGrState();
}, },
createDuplicate: function(bNoCopyHiddeen) createDuplicate: function()
{ {
var oCopy = new ObjectToDraw()
} }
}; };
function RotateTrackShapeImage(originalObject) 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