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

Исправлен баг с рассчетом положения картинок при пересчете висячей строки (баг 28373).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61117 954022d7-b5bf-4e40-9824-e11837661b57
parent a64556fa
......@@ -1426,7 +1426,7 @@ CDocument.prototype =
var SectElement = this.SectionsInfo.Get_SectPr( StartIndex );
var OldPage = ( undefined !== this.Pages[PageIndex] ? this.Pages[PageIndex] : null );
if ( true === bStart )
{
this.Pages[PageIndex] = new CDocumentPage();
......
......@@ -3825,6 +3825,7 @@ function ParaDrawing(W, H, GraphicObj, DrawingDocument, DocumentContent, Parent)
this.W = W;
this.H = H;
this.PageNum = 0;
this.LineNum = 0;
this.YOffset = 0;
this.DocumentContent = DocumentContent;
......@@ -4370,7 +4371,7 @@ ParaDrawing.prototype =
return false;
},
Update_Position : function(Paragraph, ParaLayout, PageLimits, PageLimitsOrigin)
Update_Position : function(Paragraph, ParaLayout, PageLimits, PageLimitsOrigin, LineNum)
{
if ( undefined != this.PositionH_Old )
{
......@@ -4427,6 +4428,7 @@ ParaDrawing.prototype =
var OldPageNum = this.PageNum;
this.PageNum = PageNum;
this.LineNum = LineNum;
this.X = this.Internal_Position.CalcX;
this.Y = this.Internal_Position.CalcY;
......
......@@ -1364,10 +1364,31 @@ Paragraph.prototype.private_RecalculateLineEnd = function(CurLine, CurPa
if ( this.Parent instanceof CDocument && true === this.Parent.RecalcInfo.Can_RecalcObject() && 0 === BreakPagePrevLine && ( 1 === CurPage && null != this.Get_DocumentPrev() ) && this.Lines[CurLine - 1].Ranges.length <= 1 )
{
// Вызываем данную функцию для удаления картинок с предыдущей страницы
this.Recalculate_Drawing_AddPageBreak(0, 0, true);
var bBreakPageFromStart = false;
for (var Index = 0, Count = this.Pages[CurPage - 1].Drawings.length; Index < Count; Index++)
{
var Drawing = this.Pages[CurPage - 1].Drawings[Index];
var DrawingLine = Drawing.LineNum;
if (DrawingLine >= CurLine - 1)
{
bBreakPageFromStart = true;
break;
}
}
// Если в строках, которые мы переносим есть картинки, либо, если у нас в параграфе 3 строки,
// тогда сразу начинаем параграф с новой строки
if (true === bBreakPageFromStart || CurLine <= 2)
{
CurLine = 0;
// Вызываем данную функцию для удаления картинок с предыдущей страницы
this.Recalculate_Drawing_AddPageBreak(0, 0, true);
}
else
CurLine = CurLine - 1;
this.Parent.RecalcInfo.Set_WidowControl(this, ( CurLine > 2 ? CurLine - 1 : 0 ) ); // Если у нас в параграфе 3 строки, тогда сразу начинаем параграф с новой строки
this.Parent.RecalcInfo.Set_WidowControl(this, CurLine);
PRS.RecalcResult = recalcresult_PrevPage;
return false;
}
......
......@@ -2565,7 +2565,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
if ( true === Item.Is_Inline() || true === Para.Parent.Is_DrawingShape() )
{
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Para.Get_StartPage_Absolute() + CurPage, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin );
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Para.Get_StartPage_Absolute() + CurPage, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin, _CurLine);
Item.Reset_SavedPosition();
PRSA.X += Item.WidthVisible;
......@@ -2588,7 +2588,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
var oRecalcObj = Item.Save_RecalculateObject();
var Page_abs = Para.Get_StartPage_Absolute() + CurPage;
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin);
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin, _CurLine);
if (Math.abs(Item.X - oRecalcObj.X) > 0.001 || Math.abs(Item.Y - oRecalcObj.Y) > 0.001 || Item.PageNum !== oRecalcObj.PageNum)
{
......@@ -2613,7 +2613,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
if ( true === LDRecalcInfo.Can_RecalcObject() )
{
// Обновляем позицию объекта
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin);
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin, _CurLine);
LDRecalcInfo.Set_FlowObject( Item, 0, recalcresult_NextElement, -1 );
if (0 === PRSA.CurPage && Item.wrappingPolygon.top > PRSA.PageY + 0.001)
......@@ -2643,7 +2643,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
// мы пересчитываем заново текущую страницу, а не предыдущую
// Обновляем позицию объекта
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y, Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin);
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y, Page_abs, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin, _CurLine);
LDRecalcInfo.Set_FlowObject( Item, 0, recalcresult_NextElement, -1 );
LDRecalcInfo.Set_PageBreakBefore( false );
......@@ -2668,7 +2668,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
else
{
// Картинка ложится на или под текст, в данном случае пересчет можно спокойно продолжать
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Para.Get_StartPage_Absolute() + CurPage, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin);
Item.Update_Position(PRSA.Paragraph, new CParagraphLayout( PRSA.X, PRSA.Y , Para.Get_StartPage_Absolute() + CurPage, PRSA.LastW, ColumnStartX, ColumnEndX, X_Left_Margin, X_Right_Margin, Page_Width, Top_Margin, Bottom_Margin, Page_H, PageFields.X, PageFields.Y, Para.Pages[CurPage].Y + Para.Lines[CurLine].Y - Para.Lines[CurLine].Metrics.Ascent, Para.Pages[CurPage].Y), PageLimits, PageLimitsOrigin, _CurLine);
Item.Reset_SavedPosition();
}
}
......
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