Commit 75b29efc 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@62416 954022d7-b5bf-4e40-9824-e11837661b57
parent aaf05cde
......@@ -481,11 +481,14 @@ DrawingObjectsController.prototype =
group.resetInternalSelection();
this.changeCurrentState(new PreMoveInGroupState(this, group, x, y, e.ShiftKey, e.CtrlKey, object, is_selected));
}
if(e.ClickCount > 1 && !e.ShiftKey && !e.CtrlKey && ((this.selection.groupSelection && this.selection.groupSelection.selectedObjects.length === 1) || this.selectedObjects.length === 1)
&& object.getObjectType() === historyitem_type_ChartSpace && this.handleChartDoubleClick)
if(e.ClickCount > 1 && !e.ShiftKey && !e.CtrlKey && ((this.selection.groupSelection && this.selection.groupSelection.selectedObjects.length === 1) || this.selectedObjects.length === 1))
{
var drawing = this.selectedObjects[0].parent;
if (object.getObjectType() === historyitem_type_ChartSpace && this.handleChartDoubleClick)
this.handleChartDoubleClick(drawing, object, e, x, y, pageIndex);
else if (2 == e.ClickCount && drawing instanceof ParaDrawing && drawing.Is_MathEquation())
this.handleMathDrawingDoubleClick(drawing, e, x, y, pageIndex);
}
}
return true;
......
......@@ -467,10 +467,12 @@ function handleInlineHitNoText(drawing, drawingObjects, e, x, y, pageIndex)
drawingObjects.resetSelection();
drawing.select(drawingObjects, pageIndex);
drawingObjects.changeCurrentState(new PreMoveInlineObject(drawingObjects, drawing, bIsSelected, true, pageIndex, x, y));
if(e.ClickCount > 1 && !e.ShiftKey && !e.CtrlKey && ((drawingObjects.selection.groupSelection && drawingObjects.selection.groupSelection.selectedObjects.length === 1) || drawingObjects.selectedObjects.length === 1)
&& drawing.getObjectType() === historyitem_type_ChartSpace && drawingObjects.handleChartDoubleClick)
if(e.ClickCount > 1 && !e.ShiftKey && !e.CtrlKey && ((drawingObjects.selection.groupSelection && drawingObjects.selection.groupSelection.selectedObjects.length === 1) || drawingObjects.selectedObjects.length === 1))
{
if (drawing.getObjectType() === historyitem_type_ChartSpace && drawingObjects.handleChartDoubleClick)
drawingObjects.handleChartDoubleClick(drawing.parent, drawing, e, x, y, pageIndex);
else if (2 == e.ClickCount && drawing.parent instanceof ParaDrawing && drawing.parent.Is_MathEquation())
drawingObjects.handleMathDrawingDoubleClick(drawing.parent, e, x, y, pageIndex);
}
drawingObjects.updateOverlay();
return true;
......
......@@ -1560,6 +1560,7 @@ var historydescription_Presentation_TableMoveFromRulers = 0x011d;
var historydescription_Presentation_TableMoveFromRulersInline = 0x011e;
var historydescription_Presentation_PasteOnThumbnails = 0x011f;
var historydescription_Presentation_PasteOnThumbnailsSafari = 0x0120;
var historydescription_Document_ConvertOldEquation = 0x0121;
......@@ -1863,6 +1864,7 @@ function Get_HistoryPointStringDescription(nDescription)
case historydescription_Presentation_TableMoveFromRulersInline : sString = "Presentation_TableMoveFromRulersInline "; break;
case historydescription_Presentation_PasteOnThumbnails : sString = "Presentation_PasteOnThumbnails "; break;
case historydescription_Presentation_PasteOnThumbnailsSafari : sString = "Presentation_PasteOnThumbnailsSafari "; break;
case historydescription_Document_ConvertOldEquation : sString = "Document_ConvertOldEquation "; break;
}
return sString;
}
......@@ -1043,6 +1043,13 @@ CGraphicObjects.prototype =
this.document.OnMouseUp(e, x, y, pageIndex);
},
handleMathDrawingDoubleClick : function(drawing, e, x, y, pageIndex)
{
drawing.Convert_ToMathObject();
this.changeCurrentState(new NullState(this));
this.document.OnMouseUp(e, x, y, pageIndex);
},
addInlineImage: function( W, H, Img, Chart, bFlow )
{
var content = this.getTargetDocContent();
......
......@@ -12402,6 +12402,36 @@ Paragraph.prototype.Start_SelectionFromCurPos = function()
this.Set_SelectionContentPos(ContentPos, ContentPos);
};
/*
Возвращается объект CParagraphContentPos по заданому Id ParaDrawing, если объект
не найдет, вернется null.
*/
Paragraph.prototype.Get_PosByDrawing = function(Id)
{
var ContentPos = new CParagraphContentPos();
var ContentLen = this.Content.length;
var bFind = false;
for (var CurPos = 0; CurPos < ContentLen; CurPos++)
{
var Element = this.Content[CurPos];
ContentPos.Update(CurPos, 0);
if (true === Element.Get_PosByDrawing(Id, ContentPos, 1))
{
bFind = true;
break;
}
}
if (false === bFind || ContentPos.Depth <= 0)
return null;
return ContentPos;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
......@@ -6609,6 +6609,63 @@ ParaDrawing.prototype =
Restart_CheckSpelling : function()
{
this.GraphicObj && this.GraphicObj.Restart_CheckSpelling && this.GraphicObj.Restart_CheckSpelling();
},
Is_MathEquation : function()
{
if (undefined !== this.ParaMath && null !== this.ParaMath)
return true;
return false;
},
Convert_ToMathObject : function()
{
var Para = this.Get_Paragraph();
if (undefined === Para || null === Para || !(Para instanceof Paragraph))
return;
var ParaContentPos = Para.Get_PosByDrawing(this.Get_Id());
if (null === ParaContentPos)
return;
var Depth = ParaContentPos.Get_Depth();
var TopElementPos = ParaContentPos.Get(0);
var BotElementPos = ParaContentPos.Get(Depth);
var TopElement = Para.Content[TopElementPos];
// Уменьшаем глубину на 1, чтобы получить позицию родительского класса
var RunPos = ParaContentPos.Copy();
RunPos.Decrease_Depth(1);
var Run = Para.Get_ElementByPos(RunPos);
if (undefined === TopElement || undefined === TopElement.Content || !(Run instanceof ParaRun))
return;
var LogicDocument = editor.WordControl.m_oLogicDocument;
if (false === LogicDocument.Document_Is_SelectionLocked(changestype_None, {Type : changestype_2_Element_and_Type, Element : Para, CheckType : changestype_Paragraph_Content}))
{
LogicDocument.Create_NewHistoryPoint(historydescription_Document_ConvertOldEquation);
// Сначала удаляем Drawing из рана
Run.Remove_FromContent(BotElementPos, 1);
// Теперь разделяем параграф по заданной позиции и добавляем туда новую формулу.
var RightElement = TopElement.Split(ParaContentPos, 1);
Para.Add_ToContent(TopElementPos + 1, RightElement);
Para.Add_ToContent(TopElementPos + 1, this.ParaMath);
// Устанавливаем курсор в начало правого элемента, полученного после Split
LogicDocument.Selection_Remove();
RightElement.Cursor_MoveToStartPos();
Para.CurPos.ContentPos = TopElementPos + 2;
Para.Document_SetThisElementCurrent();
LogicDocument.Recalculate();
LogicDocument.Document_UpdateSelectionState();
LogicDocument.Document_UpdateInterfaceState();
}
}
};
......
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