Commit f18d2521 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented select and drag-n-drop for the new class CInlineLevelSdt.

parent 73306911
...@@ -15164,8 +15164,7 @@ CDocument.prototype.SelectContentControl = function(Id) ...@@ -15164,8 +15164,7 @@ CDocument.prototype.SelectContentControl = function(Id)
if (oBlockLevelSdt) if (oBlockLevelSdt)
{ {
this.RemoveSelection(); this.RemoveSelection();
oBlockLevelSdt.SelectAll(1); oBlockLevelSdt.SelectContentControl();
oBlockLevelSdt.Set_CurrentElement(false, 0, oBlockLevelSdt.Content);
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState(); this.Document_UpdateRulersState();
......
...@@ -2705,6 +2705,33 @@ CParagraphContentWithParagraphLikeContent.prototype.Is_UseInParagraph = function ...@@ -2705,6 +2705,33 @@ CParagraphContentWithParagraphLikeContent.prototype.Is_UseInParagraph = function
return true; return true;
}; };
CParagraphContentWithParagraphLikeContent.prototype.SelectThisElement = function(nDirection)
{
var ContentPos = this.Paragraph.Get_PosByElement(this);
if (!ContentPos)
return false;
var StartPos = ContentPos.Copy();
var EndPos = ContentPos.Copy();
if (nDirection > 0)
{
this.Get_StartPos(StartPos, StartPos.Get_Depth() + 1);
this.Get_EndPos(true, EndPos, EndPos.Get_Depth() + 1);
}
else
{
this.Get_StartPos(EndPos, EndPos.Get_Depth() + 1);
this.Get_EndPos(true, StartPos, StartPos.Get_Depth() + 1);
}
this.Paragraph.Selection.Use = true;
this.Paragraph.Selection.Start = false;
this.Paragraph.Set_SelectionContentPos(StartPos, EndPos, false);
this.Paragraph.Document_SetThisElementCurrent(false);
return true;
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках // Функции, которые должны быть реализованы в классах наследниках
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
......
...@@ -851,6 +851,11 @@ CBlockLevelSdt.prototype.GetMargins = function() ...@@ -851,6 +851,11 @@ CBlockLevelSdt.prototype.GetMargins = function()
{ {
return this.Parent.GetMargins(); return this.Parent.GetMargins();
}; };
CBlockLevelSdt.prototype.SelectContentControl = function()
{
this.SelectAll(1);
this.Set_CurrentElement(false, 0, this.Content);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt.prototype.SetPr = function(oPr) CBlockLevelSdt.prototype.SetPr = function(oPr)
{ {
......
...@@ -361,6 +361,10 @@ CInlineLevelSdt.prototype.DrawContentControlsTrack = function(isHover) ...@@ -361,6 +361,10 @@ CInlineLevelSdt.prototype.DrawContentControlsTrack = function(isHover)
var oDrawingDocument = this.Paragraph.LogicDocument.Get_DrawingDocument(); var oDrawingDocument = this.Paragraph.LogicDocument.Get_DrawingDocument();
oDrawingDocument.OnDrawContentControl(this.GetId(), isHover ? c_oContentControlTrack.Hover : c_oContentControlTrack.In, this.GetBoundingPolygon(), this.Paragraph.Get_ParentTextTransform()); oDrawingDocument.OnDrawContentControl(this.GetId(), isHover ? c_oContentControlTrack.Hover : c_oContentControlTrack.In, this.GetBoundingPolygon(), this.Paragraph.Get_ParentTextTransform());
}; };
CInlineLevelSdt.prototype.SelectContentControl = function()
{
this.SelectThisElement(1);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Выставление настроек // Выставление настроек
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
...@@ -504,3 +508,24 @@ function TEST_ADD_SDT() ...@@ -504,3 +508,24 @@ function TEST_ADD_SDT()
return oInlineContentControl ? oInlineContentControl.GetId() : null; return oInlineContentControl ? oInlineContentControl.GetId() : null;
} }
function TEST_ADD_SDT2()
{
var oLogicDocument = editor.WordControl.m_oLogicDocument;
oLogicDocument.Create_NewHistoryPoint();
var oSdt = oLogicDocument.AddContentControl();
oSdt.AddToParagraph(new ParaText("S"));
oSdt.AddToParagraph(new ParaText("d"));
oSdt.AddToParagraph(new ParaText("t"));
oLogicDocument.Recalculate();
oLogicDocument.Document_UpdateSelectionState();
oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateRulersState();
return oSdt;
}
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