Commit 05571723 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Сделано объединение рамок для рецензирования.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66201 954022d7-b5bf-4e40-9824-e11837661b57
parent 407de4dc
......@@ -3034,5 +3034,63 @@ CGraphics.prototype =
this.DrawPresentationComment(type, x, y, w, h);
this.SetIntegerGrid(false);
}
},
DrawPolygon : function(oPath, lineWidth, shift)
{
this.m_oContext.lineWidth = lineWidth;
this.m_oContext.beginPath();
var Points = oPath.Points;
var nCount = Points.length;
// берем предпоследнюю точку, т.к. последняя совпадает с первой
var PrevX = Points[nCount - 2].X, PrevY = Points[nCount - 2].Y;
var _x = Points[nCount - 2].X,
_y = Points[nCount - 2].Y;
var StartX, StartY ;
for (var nIndex = 0; nIndex < nCount; nIndex++)
{
if(PrevX > Points[nIndex].X)
{
_y = Points[nIndex].Y - shift;
}
else if(PrevX < Points[nIndex].X)
{
_y = Points[nIndex].Y + shift;
}
if(PrevY < Points[nIndex].Y)
{
_x = Points[nIndex].X - shift;
}
else if(PrevY > Points[nIndex].Y)
{
_x = Points[nIndex].X + shift;
}
PrevX = Points[nIndex].X;
PrevY = Points[nIndex].Y;
if(nIndex > 0)
{
if (1 == nIndex)
{
StartX = _x;
StartY = _y;
this._m(_x, _y);
}
else
{
this._l(_x, _y);
}
}
}
this._l(StartX, StartY);
this.m_oContext.closePath();
this.m_oContext.stroke();
this.m_oContext.beginPath();
}
};
......@@ -15,7 +15,9 @@ var type_Paragraph = 0x0001;
var UnknownValue = null;
//var REVIEW_COLOR = {r : 255, g : 0, b : 58};
//var REVIEW_COLOR = {r : 204, g : 51, b : 0};
var REVIEW_COLOR = {r : 255, g : 0, b : 0};
// Класс Paragraph
function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit, bFromPresentation)
......@@ -1497,7 +1499,7 @@ Paragraph.prototype =
var Y_top = this.Pages[CurPage].Bounds.Top;
var Y_bottom = this.Pages[CurPage].Bounds.Bottom;
pGraphics.p_color(255, 0, 0, 255);
pGraphics.p_color(REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b, 255);
pGraphics.drawVerLine(0, X_min, Y_top, Y_bottom, 0);
}
}
......@@ -2117,6 +2119,10 @@ Paragraph.prototype =
PDSL.SpellingCounter = this.SpellChecker.Get_DrawingInfo( this.Get_PageStartPos(CurPage) );
var RunPrReview = null;
var arrRunReviewAreas = [];
var arrRunReviewRects = [];
for ( var CurLine = StartLine; CurLine <= EndLine; CurLine++ )
{
var Line = this.Lines[CurLine];
......@@ -2209,14 +2215,30 @@ Paragraph.prototype =
}
// Рисуем красный рект вокруг измененных ранов
Element = aRunReview.Get_Next();
var arrRunReviewRectsLine = [];
Element = aRunReview.Get_NextForward();
while (null !== Element)
{
pGraphics.p_color(Element.r, Element.g, Element.b, 255);
pGraphics.AddSmartRect(Element.x0, Page.Y + Line.Top, Element.x1 - Element.x0, Line.Bottom - Line.Top, 0);
Element = aRunReview.Get_Next();
if (null === RunPrReview || true !== RunPrReview.Is_Equal(Element.Additional.RunPr))
{
if (arrRunReviewRectsLine.length > 0 && arrRunReviewRects)
{
arrRunReviewRects.push(arrRunReviewRectsLine);
arrRunReviewRectsLine = [];
}
RunPrReview = Element.Additional.RunPr;
arrRunReviewRects = [];
arrRunReviewAreas.push(arrRunReviewRects);
}
arrRunReviewRectsLine.push({X : Element.x0, Y : Page.Y + Line.Y - Line.Metrics.TextAscent, W : Element.x1 - Element.x0, H : Line.Metrics.TextDescent + Line.Metrics.TextAscent + Line.Metrics.LineGap, Page : 0});
Element = aRunReview.Get_NextForward();
}
if (arrRunReviewRectsLine.length > 0)
arrRunReviewRects.push(arrRunReviewRectsLine);
if(this.bFromDocument)
{
// Рисуем рект вокруг измененных ранов (измененных другим пользователем)
......@@ -2245,6 +2267,23 @@ Paragraph.prototype =
pGraphics.End_Command()
}
}
if (pGraphics.DrawPolygon)
{
for (var ReviewAreaIndex = 0, ReviewAreasCount = arrRunReviewAreas.length; ReviewAreaIndex < ReviewAreasCount; ++ReviewAreaIndex)
{
var arrRunReviewRects = arrRunReviewAreas[ReviewAreaIndex];
var ReviewPolygon = new CPolygon();
ReviewPolygon.fill(arrRunReviewRects);
var PolygonPaths = ReviewPolygon.GetPaths(0);
pGraphics.p_color(REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b, 255);
for (var PolygonIndex = 0, PolygonsCount = PolygonPaths.length; PolygonIndex < PolygonsCount; ++PolygonIndex)
{
var Path = PolygonPaths[PolygonIndex];
pGraphics.DrawPolygon(Path, 1, 0);
}
}
}
},
Internal_Draw_6 : function(CurPage, pGraphics, Pr)
......@@ -13829,23 +13868,7 @@ CParaDrawingRangeLines.prototype =
{
var PrevEl = this.Elements[Count - 1];
if (Math.abs(PrevEl.y0 - Element.y0) < 0.001
&& Math.abs(PrevEl.y1 - Element.y1) < 0.001
&& Math.abs(PrevEl.x1 - Element.x0) < 0.001
&& Math.abs(PrevEl.w - Element.w) < 0.001
&& PrevEl.r === Element.r
&& PrevEl.g === Element.g
&& PrevEl.b === Element.b
&& (false
|| (undefined === PrevEl.Additional
&& undefined === Element.Additional)
|| (undefined !== PrevEl.Additional
&& undefined !== Element.Additional
&& (false
|| (undefined !== PrevEl.Additional.Active
&& PrevEl.Additional.Active === Element.Additional.Active)
|| (undefined !== PrevEl.Additional.RunPr
&& true === Element.Additional.RunPr.Is_Equal(PrevEl.Additional.RunPr))))))
if (this.private_CanUnionElements(PrevEl, Element))
{
Element.x0 = PrevEl.x0;
Count--;
......@@ -13859,6 +13882,63 @@ CParaDrawingRangeLines.prototype =
return Element;
},
Get_NextForward : function()
{
var Count = this.Elements.length;
if (Count <= 0)
return null;
var Element = this.Elements[0];
var Pos = 1;
while (Pos < Count)
{
var NextEl = this.Elements[Pos];
if (this.private_CanUnionElements(NextEl, Element))
{
Element.x1 = NextEl.x1;
Pos++;
}
else
break;
}
this.Elements.splice(0, Pos);
return Element;
},
private_CanUnionElements : function(PrevEl, Element)
{
if (true
&& Math.abs(PrevEl.y0 - Element.y0) < 0.001
&& Math.abs(PrevEl.y1 - Element.y1) < 0.001
&& Math.abs(PrevEl.x1 - Element.x0) < 0.001
&& Math.abs(PrevEl.w - Element.w) < 0.001
&& PrevEl.r === Element.r
&& PrevEl.g === Element.g
&& PrevEl.b === Element.b
&& (false
|| (true
&& undefined === PrevEl.Additional
&& undefined === Element.Additional)
|| (true
&& undefined !== PrevEl.Additional
&& undefined !== Element.Additional
&& (false
|| (true
&& undefined !== PrevEl.Additional.Active
&& PrevEl.Additional.Active === Element.Additional.Active)
|| (true
&& undefined !== PrevEl.Additional.RunPr
&& true === Element.Additional.RunPr.Is_Equal(PrevEl.Additional.RunPr))))))
{
return true;
}
return false;
},
Correct_w_ForUnderline : function()
{
var Count = this.Elements.length;
......
......@@ -4201,7 +4201,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
var ReviewType = this.Get_ReviewType();
if (reviewtype_Add === ReviewType || reviewtype_Remove === ReviewType)
{
pGraphics.b_color1(255, 0, 0, 255);
pGraphics.b_color1(REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b, 255);
}
else if (CurTextPr.Unifill)
{
......@@ -4286,7 +4286,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
if (reviewtype_Add === ReviewType || reviewtype_Remove === ReviewType)
{
pGraphics.b_color1(255, 0, 0, 255);
pGraphics.b_color1(REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b, 255);
}
else if (RGBA)
{
......@@ -4333,7 +4333,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
if (reviewtype_Common !== ReviewType)
{
pGraphics.SetTextPr(EndTextPr, PDSE.Theme);
pGraphics.b_color1(255, 0, 0, 255);
pGraphics.b_color1(REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b, 255);
}
else if (EndTextPr.Unifill)
{
......@@ -4539,14 +4539,14 @@ ParaRun.prototype.Draw_Lines = function(PDSL)
if ( para_Drawing != ItemType || drawing_Anchor != Item.DrawingType )
{
if (true === bRemReview)
aStrikeout.Add(StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, 255, 0, 0);
aStrikeout.Add(StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b);
else if (true === CurTextPr.DStrikeout)
aDStrikeout.Add( StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
else if ( true === CurTextPr.Strikeout )
aStrikeout.Add( StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
if (true === bAddReview)
aUnderline.Add(UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, 255, 0, 0);
aUnderline.Add(UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b);
else if (true === CurTextPr.Underline)
aUnderline.Add(UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
......@@ -4564,14 +4564,14 @@ ParaRun.prototype.Draw_Lines = function(PDSL)
if ( PDSL.Spaces > 0 )
{
if (true === bRemReview)
aStrikeout.Add(StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, 255, 0, 0);
aStrikeout.Add(StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b);
else if (true === CurTextPr.DStrikeout)
aDStrikeout.Add( StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
else if ( true === CurTextPr.Strikeout )
aStrikeout.Add( StrikeoutY, StrikeoutY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
if (true === bAddReview)
aUnderline.Add(UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, 255, 0, 0);
aUnderline.Add(UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, REVIEW_COLOR.r, REVIEW_COLOR.g, REVIEW_COLOR.b);
else if (true === CurTextPr.Underline)
aUnderline.Add( UnderlineY, UnderlineY, X, X + ItemWidthVisible, LineW, CurColor.r, CurColor.g, CurColor.b, undefined, CurTextPr );
......
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