Commit 864b8cf9 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Баги в WordArt'ах

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62622 954022d7-b5bf-4e40-9824-e11837661b57
parent 716cb63e
......@@ -3386,7 +3386,14 @@ CGs.prototype =
IsIdentical : function(fill)
{
return false;
if(!fill)
return false;
if(this.pos !== fill.pos)
return false;
if(!this.color && fill.color || this.color && !fill.color || (this.color && fill.color && !this.color.IsIdentical(fill.color)))
return false;
return true;
},
createDuplicate : function()
......@@ -4032,6 +4039,13 @@ CGradFill.prototype =
return false;
}
}
if(!this.path && fill.path || this.path && !fill.path || (this.path && fill.path && !this.path.IsIdentical(fill.path)))
return false;
if(!this.lin && fill.lin || !fill.lin && this.lin || (this.lin && fill.lin && !this.lin.IsIdentical(fill.lin)))
return false;
return true;
},
......@@ -5488,6 +5502,20 @@ LineJoin.prototype =
Refresh_RecalcData: function()
{},
IsIdentical : function(oJoin)
{
if(!oJoin)
return false;
if(this.type !== oJoin.type)
{
return false;
}
if(this.limit !== oJoin.limit)
return false;
return true;
},
getObjectType: function()
{
return historyitem_type_LineJoin;
......@@ -5778,7 +5806,7 @@ CLn.prototype =
IsIdentical: function(ln)
{
return ln && (this.Fill == null ? ln.Fill == null : this.Fill.IsIdentical(ln.Fill) )&& this.Join == ln.Join
return ln && (this.Fill == null ? ln.Fill == null : this.Fill.IsIdentical(ln.Fill) )&& (this.Join == null ? ln.Join == null : this.Join.IsIdentical(ln.Join) )
&& (this.headEnd == null ? ln.headEnd == null : this.headEnd.IsIdentical(ln.headEnd) )
&& (this.tailEnd == null ? ln.tailEnd == null : this.tailEnd.IsIdentical(ln.headEnd)) &&
this.algn == ln.algn && this.cap == ln.cap && this.cmpd == ln.cmpd && this.w== ln.w;
......
......@@ -6,6 +6,14 @@ function CheckObjectLine(obj)
return (obj instanceof CShape && obj.spPr && obj.spPr.geometry && obj.spPr.geometry.preset === "line");
}
function CheckWordArtTextPr(oTextPr)
{
if(oTextPr.TextFill || oTextPr.TextOutline || (oTextPr.Unifill && oTextPr.Unifill.fill.type !== FILL_TYPE_SOLID))
return true;
return false;
}
function hitToHandles(x, y, object)
{
var invert_transform = object.getInvertTransform();
......@@ -691,7 +699,7 @@ CShape.prototype =
//dd.EndSearchTransform();
}
},
Search_GetId : function(bNext, bCurrent)
{
if(this.textBoxContent)
......@@ -701,7 +709,7 @@ CShape.prototype =
{
return this.txBody.content.Search_GetId(bNext, bCurrent);
}
return null;
},
......@@ -4173,15 +4181,69 @@ CShape.prototype =
this.bounds.h = this.bounds.b - this.bounds.t;
},
checkRunWordArtContent: function(aContent)
{
for(var j = 0; j < aContent.length; ++j)
{
if(aContent[j].Type === para_Run)
{
if( CheckWordArtTextPr(aContent[j].Get_CompiledPr()))
{
return true;
}
}
else if(aContent[j].Type === para_Hyperlink)
{
if(this.checkRunWordArtContent(aContent[j].Content))
{
return true;
}
}
}
return false;
},
checkContentWordArt: function(oContent)
{
var i, j, k, oElement, aRows, oRow;
for(i = 0; i < oContent.Content.length; ++i)
{
oElement = oContent.Content[i];
if(oElement.Get_Type() === type_Paragraph)
{
if(this.checkRunWordArtContent(oElement.Content))
{
return true;
}
}
else if(oElement.Get_Type() === type_Table)
{
aRows = oElement.Content;
for(j = 0; j < aRows.length; ++j)
{
oRow = aRows[j];
for(k = 0; k < oRow.Content.length; ++k)
{
if(this.checkContentWordArt(oRow.Content[k].Content))
{
return true;
}
}
}
}
}
return false;
},
checkTextWarp: function(oContent, oBodyPr, dWidth, dHeight)
{
var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null};
if(oBodyPr.prstTxWarp)
if((oBodyPr.prstTxWarp && oBodyPr.prstTxWarp.preset !== "textNoShape") || this.checkContentWordArt(oContent))
{
var bNeedRecalcContent = (oBodyPr.prstTxWarp.pathLst.length % 2) === 1;
var oTextDrawer = new CTextDrawer(dWidth, dHeight, true);
var warpGeometry = oBodyPr.prstTxWarp;
warpGeometry.Recalculate(dWidth, dHeight);
warpGeometry && warpGeometry.Recalculate(dWidth, dHeight);
var OldShowParaMarks;
if(isRealObject(editor))
{
......@@ -4195,7 +4257,7 @@ CShape.prototype =
}
oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarks.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this);
oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry);
warpGeometry && oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry);
if(isRealObject(editor))
{
......@@ -4209,7 +4271,7 @@ CShape.prototype =
}
oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStruct.Recalculate(this.Get_Theme(), this.Get_ColorMap(), dWidth, dHeight, this);
oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry);
warpGeometry && oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry);
}
return oRet;
}
......
......@@ -36,11 +36,11 @@ CDocContentStructure.prototype.checkByWarpStruct = function(oWarpStruct)
{
var nDivCount = oWarpStruct.pathLst.length >> 1;
var aByPaths = oWarpStruct.getArrayPolygonsByPaths(PATH_DIV_EPSILON);
var nLastIndex = 0, aIndex = [], aWarpedObjects = [], dTmp, oBoundsChecker, oTemp, nIndex;
var nLastIndex = 0, aIndex = [], aWarpedObjects = [], dTmp, oBoundsChecker, oTemp, nIndex, aWarpedObjects2 = [];
oBoundsChecker = new CSlideBoundsChecker();
oBoundsChecker.init(100, 100, 100, 100);
var bCheckBounds = false, dMinX, dMaxX;
if(oWarpStruct.pathLst.length > 2)
//if(oWarpStruct.pathLst.length > 2)
{
bCheckBounds = true;
for(j = 0; j < this.m_aByLines.length; ++j)
......@@ -48,7 +48,7 @@ CDocContentStructure.prototype.checkByWarpStruct = function(oWarpStruct)
oTemp = this.m_aByLines[j];
for(t = 0; t < oTemp.length; ++t)
{
oTemp[t].GetAllWarped(aWarpedObjects);
oTemp[t].GetAllWarped(aWarpedObjects2);
oTemp[t].CheckBoundsWarped(oBoundsChecker);
}
}
......@@ -56,6 +56,8 @@ CDocContentStructure.prototype.checkByWarpStruct = function(oWarpStruct)
dMaxX = oBoundsChecker.Bounds.max_x;
}
for( i = 0; i < nDivCount; ++i)
{
dTmp = (this.m_aByLines.length - nLastIndex)/(nDivCount - i);
......@@ -85,6 +87,26 @@ CDocContentStructure.prototype.checkByWarpStruct = function(oWarpStruct)
ObjectsToDrawBetweenTwoPolygons(aWarpedObjects, oBoundsChecker.Bounds, new PolygonWrapper(aByPaths[i << 1]), new PolygonWrapper(aByPaths[(i << 1) + 1]));
nLastIndex = nIndex;
}
var oLastObjectToDraw = null, oCurObjectToDraw;
for(i = 0; i < aWarpedObjects2.length; ++i)
{
if(oLastObjectToDraw === null)
{
oLastObjectToDraw = aWarpedObjects2[i];
continue;
}
oCurObjectToDraw = aWarpedObjects2[i];
if(oLastObjectToDraw && CompareBrushes(oLastObjectToDraw.brush, oCurObjectToDraw.brush) && ComparePens(oLastObjectToDraw.pen, oCurObjectToDraw.pen))
{
oLastObjectToDraw.geometry.pathLst = oLastObjectToDraw.geometry.pathLst.concat(oCurObjectToDraw.geometry.pathLst);
oCurObjectToDraw.geometry.pathLst.length = 0;
}
else
{
oLastObjectToDraw = oCurObjectToDraw;
}
}
break;
}
case 3:
......@@ -97,6 +119,7 @@ CDocContentStructure.prototype.checkByWarpStruct = function(oWarpStruct)
break;
}
}
};
function CParagraphStructure()
......@@ -1339,14 +1362,46 @@ CTextDrawer.prototype =
SetTextPr : function(textPr, theme)
{
if(!this.CheckCompareFillBrush(textPr, this.m_oTextPr))
{
this.Get_PathToDraw(false, true);
}
this.m_oTextPr = textPr;
if (theme)
this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme, this.m_oTextPr.RFonts);
else
this.m_oGrFonts = this.m_oTextPr.RFonts;
this.Get_PathToDraw(false, true);
},
CheckCompareFillBrush: function(oTextPr1, oTextPr2)
{
if(oTextPr1 && oTextPr2)
{
var oFill1 = this.GetFillFromTextPr(oTextPr1);
var oFill2 = this.GetFillFromTextPr(oTextPr2);
if(!CompareBrushes(oFill1, oFill2))
return false;
var oPen1 = this.GetPenFromTextPr(oTextPr1);
var oPen2 = this.GetPenFromTextPr(oTextPr2);
if(!CompareBrushes(oPen1, oPen2))
return false;
}
return true;
},
GetFillFromTextPr: function(oTextPr)
{
return oTextPr.Unifill;
},
GetPenFromTextPr: function(oTextPr)
{
return oTextPr.TextOutline;
},
GetTextPr : function()
{
return this.m_oTextPr;
......@@ -1505,4 +1560,17 @@ function ObjectsToDrawBetweenTwoPolygons(aObjectsToDraw, oBoundsController, oPol
}
}
}
function CompareBrushes(oFill1, oFill2)
{
if(oFill1 && !oFill2 || !oFill1 && oFill2 || (oFill1 && oFill2 && !oFill1.IsIdentical(oFill2)))
return false;
return true;
}
function ComparePens(oPen1, oPen2)
{
if(oPen1 && !oPen2 || !oPen1 && oPen2 || (oPen1 && oPen2 && !oPen1.IsIdentical(oPen2)))
return false;
return true;
}
\ No newline at end of file
......@@ -1829,6 +1829,9 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeEnd);
if(rPr.TextOutline)
oThis.WriteRecord1(0, rPr.TextOutline, oThis.WriteLn);
if(rPr.Unifill)
oThis.WriteRecord1(1, rPr.Unifill, oThis.WriteUniFill);
......
......@@ -6957,18 +6957,10 @@ CTextPr.prototype =
{
this.TextOutline = TextPr.TextOutline.createDuplicate();
}
else
{
this.TextOutline = undefined;
}
if(undefined != TextPr.TextFill)
{
this.TextFill = TextPr.TextFill.createDuplicate();
}
else
{
this.TextFill = undefined;
}
},
Init_Default : function()
......
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