Commit a688ab64 authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed several problems with working with content control track.

parent 3fdb8aa7
......@@ -6246,6 +6246,7 @@ function CDrawingDocument()
var _old = this.ContentControlObjectState;
if (pos.X > _x && pos.X < _r && pos.Y > _y && pos.Y < _b)
{
oWordControl.m_oLogicDocument.SelectContentControl(this.ContentControlObject.id);
this.ContentControlObjectState = 1;
this.InlineTextTrackEnabled = true;
......@@ -6459,16 +6460,13 @@ function CDrawingDocument()
if (this.InlineTextTrack) // значит был MouseMove
{
this.InlineTextTrack = oWordControl.m_oLogicDocument.Get_NearestPos(pos.Page, pos.X, pos.Y);
// TODO:
//this.m_oWordControl.m_oLogicDocument.On_ContentControlTrackEnd(this.ContentControlObject.id, this.InlineTextTrack, AscCommon.global_keyboardEvent.CtrlKey);
this.m_oWordControl.m_oLogicDocument.OnContentControlTrackEnd(this.ContentControlObject.id, this.InlineTextTrack, AscCommon.global_keyboardEvent.CtrlKey);
this.InlineTextTrackEnabled = false;
this.InlineTextTrack = null;
this.InlineTextTrackPage = -1;
}
else
{
// TODO: Select?
this.InlineTextTrackEnabled = false;
}
}
......
......@@ -15145,6 +15145,9 @@ CDocument.prototype.MoveToFillingForm = function(bNext)
};
CDocument.prototype.DrawContentControls = function(PageAbs, MouseX, MouseY, MousePage)
{
if (null !== this.FullRecalc.Id && (this.FullRecalc.PageIndex < PageAbs || this.FullRecalc.PageIndex < MousePage))
return false;
var oBlockLevelSdt = this.Controller.IsInBlockLevelSdt();
if (null !== oBlockLevelSdt)
{
......@@ -15155,6 +15158,52 @@ CDocument.prototype.DrawContentControls = function(PageAbs, MouseX, MouseY, Mous
this.Controller.DrawContentControlsHover(MouseX, MouseY, MousePage);
}
};
CDocument.prototype.SelectContentControl = function(Id)
{
var oBlockLevelSdt = this.TableId.Get_ById(Id);
if (oBlockLevelSdt)
{
this.RemoveSelection();
oBlockLevelSdt.SelectAll(1);
oBlockLevelSdt.Set_CurrentElement(false, 0, oBlockLevelSdt.Content);
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
this.Document_UpdateSelectionState();
}
};
CDocument.prototype.OnContentControlTrackEnd = function(Id, NearestPos, isCopy)
{
if (true === this.Comments.Is_Use())
{
this.Select_Comment(null, false);
editor.sync_HideComment();
}
var oParagraph = NearestPos.Paragraph;
// Сначала нам надо проверить попадаем ли мы обратно в выделенный текст, если да, тогда ничего не делаем,
// а если нет, тогда удаляем выделенный текст и вставляем его в заданное место.
if (true === this.CheckPosInSelection(0, 0, 0, NearestPos))
{
this.RemoveSelection();
// Нам надо снять селект и поставить курсор в то место, где была ближайшая позиция
oParagraph.Cursor_MoveToNearPos(NearestPos);
oParagraph.Document_SetThisElementCurrent(false);
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
}
else
{
console.log("нормально");
}
};
function CDocumentSelectionState()
{
......
......@@ -113,14 +113,18 @@ CBlockLevelSdt.prototype.Reset_RecalculateCache = function()
CBlockLevelSdt.prototype.Write_ToBinary2 = function(Writer)
{
Writer.WriteLong(AscDFH.historyitem_type_BlockLevelSdt);
// String : Id
// String : Content id
Writer.WriteString2(this.GetId());
Writer.WriteString2(this.Content.GetId());
};
CBlockLevelSdt.prototype.Read_FromBinary2 = function(Reader)
{
this.LogicDocument = editor.WordControl.m_oLogicDocument;
// String : Id
// String : Content id
this.Id = Reader.GetString2();
this.Content = this.LogicDocument.Get_TableId().Get_ById(Reader.GetString2());
};
CBlockLevelSdt.prototype.Draw = function(CurPage, oGraphics)
......
......@@ -1792,7 +1792,7 @@ CTableCell.prototype =
{
}
};
CTableCell.private_TransformXY = function(X, Y)
CTableCell.prototype.private_TransformXY = function(X, Y)
{
// TODO: Везде, где идет такой код заменить на данную функцию
......
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