Commit 95d2ab4a authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 28313 - JS ошибка после отмены вставки автофигуры "произвольная линия"

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60664 954022d7-b5bf-4e40-9824-e11837661b57
parent 55caa00e
......@@ -621,42 +621,106 @@ DrawingObjectsController.prototype =
getContextMenuPosition: function(pageIndex)
{
var i, aDrawings, dX, dY, oTargetTextObject, oDocContent;
oTargetTextObject = getTargetTextObject(this);
if(oTargetTextObject)
var i, aDrawings, dX, dY, oTargetTextObject, oDocContent, oTransformText;
if(this.selectedObjects.length > 0)
{
if(oTargetTextObject.getObjectType() === historyitem_type_Shape)
{
oDocContent = oTargetTextObject.getDocContent();
}
else if(oTargetTextObject.getObjectType() === historyitem_type_GraphicFrame)
oTargetTextObject = getTargetTextObject(this);
if(oTargetTextObject)
{
if(oTargetTextObject.getObjectType() === historyitem_type_Shape || oTargetTextObject.getObjectType() === historyitem_type_Title)
{
oDocContent = oTargetTextObject.getDocContent();
oTransformText = oTargetTextObject.transformText;
dX = oTransformText.TransformPointX(oDocContent.CurPos.X, oDocContent.CurPos.Y);
dY = oTransformText.TransformPointY(oDocContent.CurPos.X, oDocContent.CurPos.Y);
return {X: dX, Y: dY, PageIndex: this.selectedObjects[0].selectStartPage};
}
else if(oTargetTextObject.getObjectType() === historyitem_type_GraphicFrame)
{
var Doc = oTargetTextObject.graphicObject, dPosX = 0, dPosY = 0;
if ( true === Doc.Is_SelectionUse() && !Doc.Selection_IsEmpty())
{
switch( Doc.Selection.Type )
{
case table_Selection_Cell:
{
var Row_prev_index = -1;
for ( var Index = 0; Index < this.Selection.Data.length; Index++ )
{
var Pos = this.Selection.Data[Index];
var Row = this.Content[Pos.Row];
var Cell = Row.Get_Cell( Pos.Cell );
var CellInfo = Row.Get_CellInfo( Pos.Cell );
var CellMar = Cell.Get_Margins();
if ( -1 === Row_prev_index || Row_prev_index != Pos.Row )
Row_prev_index = Pos.Row;
var X_start = ( 0 === Pos.Cell ? CellInfo.X_content_start : CellInfo.X_cell_start );
var X_end = CellInfo.X_cell_end;
var Cell_Pages = Cell.Content_Get_PagesCount();
var Cell_PageRel = Page_abs - Cell.Content.Get_StartPage_Absolute();
if ( Cell_PageRel < 0 || Cell_PageRel >= Cell_Pages )
continue;
var Bounds = Cell.Content_Get_PageBounds( Cell_PageRel );
var Y_offset = Cell.Temp.Y_VAlign_offset[Cell_PageRel];
if ( 0 != Cell_PageRel )
{
// мы должны определить ряд, на котором случился перенос на новую страницу
var TempRowIndex = this.Pages[CurPage].FirstRow;
this.DrawingDocument.AddPageSelection( Page_abs, X_start, this.RowsInfo[TempRowIndex].Y[CurPage] + this.RowsInfo[TempRowIndex].TopDy[CurPage] + CellMar.Top.W + Y_offset, X_end - X_start, Bounds.Bottom - Bounds.Top );
}
else
{
this.DrawingDocument.AddPageSelection( Page_abs, X_start, this.RowsInfo[Pos.Row].Y[CurPage] + this.RowsInfo[Pos.Row].TopDy[CurPage] + CellMar.Top.W + Y_offset, X_end - X_start, Bounds.Bottom - Bounds.Top );
}
}
break;
}
case table_Selection_Text:
{
var Cell = this.Content[this.Selection.StartPos.Pos.Row].Get_Cell( this.Selection.StartPos.Pos.Cell );
Cell.Content.Selection_Draw_Page(Page_abs);
break;
}
}
Doc.Selection_Draw_Page(this.parent.num);
drawingDocument.SelectShow();
}
else /*if(this.parent.elementsManipulator.Document.CurPos.Type == docpostype_FlowObjects ) */
{
drawingDocument.SelectEnabled(false);
Doc.RecalculateCurPos();
drawingDocument.UpdateTargetTransform(this.transform);
drawingDocument.TargetShow();
}
}
}
}
else if(this.selection.groupSelection)
{
if(this.selection.groupSelection.selectStartPage !== pageIndex)
{
return {X: 0, Y: 0};
}
aDrawings = this.selection.groupSelection.arrGraphicObjects;
for(i = aDrawings.length-1; i > -1; --i)
else if(this.selection.groupSelection)
{
if(aDrawings[i].selected)
aDrawings = this.selection.groupSelection.arrGraphicObjects;
for(i = aDrawings.length-1; i > -1; --i)
{
dX = aDrawings[i].transform.TransformPointX(aDrawings[i].extX/2, aDrawings[i].extY/2) - aDrawings[i].extX/2;
dY = aDrawings[i].transform.TransformPointY(aDrawings[i].extX/2, aDrawings[i].extY/2) - aDrawings[i].extY/2;
return {X: dX, Y: dY};
if(aDrawings[i].selected)
{
dX = aDrawings[i].transform.TransformPointX(aDrawings[i].extX/2, aDrawings[i].extY/2) - aDrawings[i].extX/2;
dY = aDrawings[i].transform.TransformPointY(aDrawings[i].extX/2, aDrawings[i].extY/2) - aDrawings[i].extY/2;
return {X: dX, Y: dY, PageIndex: this.selection.groupSelection.selectStartPage};
}
}
}
}
else
{
return this.getLeftTopSelectedObject(pageIndex);
else
{
return this.getLeftTopSelectedObject(pageIndex);
}
}
return {X: 0, Y: 0};
return {X: 0, Y: 0, PageIndex: pageIndex};
},
drawSelect: function(pageIndex, drawingDocument)
......@@ -4909,6 +4973,7 @@ DrawingObjectsController.prototype =
this.clearPreTrackObjects();
this.clearTrackObjects();
this.resetSelection();
this.changeCurrentState(new NullState(this));
if(selection_state.textObject)
{
this.selectObject(selection_state.textObject, selection_state.selectStartPage);
......
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