Commit b124f435 authored by Oleg Korshul's avatar Oleg Korshul

insert content control bugs

pptx - notes enable/disable
parent efb4307e
......@@ -92,7 +92,7 @@ var GlobalSkinFlat = {
STYLE_THUMBNAIL_WIDTH : 109,
STYLE_THUMBNAIL_HEIGHT : 45,
BorderSplitterColor : "#CBCBCB",
SupportNotes : false,
SupportNotes : true,
SplitterWidthMM : 1,
ThumbnailScrollWidthNullIfNoScrolling : false
};
......@@ -120,7 +120,7 @@ function CEditorPage(api)
{
// ------------------------------------------------------------------
this.Name = "";
this.IsSupportNotes = false;
this.IsSupportNotes = true;
this.EditorType = "presentations";
......@@ -381,7 +381,7 @@ function CEditorPage(api)
this.Splitter1PosMin = 20;
this.Splitter1PosMax = 80;
this.Splitter2PosMin = 0;
this.Splitter2PosMin = 20;
this.Splitter2PosMax = 100;
var ScrollWidthMm = this.ScrollWidthPx * g_dKoef_pix_to_mm;
......@@ -556,6 +556,12 @@ function CEditorPage(api)
this.MobileTouchManagerThumbnails.Init(this.m_oApi);
}
if (this.IsSupportNotes)
{
this.m_oNotes.HtmlElement.style.backgroundColor = GlobalSkin.BackgroundColor;
this.m_oNotes.HtmlElement.style.borderBottom = ("1px solid " + GlobalSkin.BorderSplitterColor);
}
this.m_oOverlayApi.m_oControl = this.m_oOverlay;
this.m_oOverlayApi.m_oHtmlPage = this;
this.m_oOverlayApi.Clear();
......@@ -651,6 +657,10 @@ function CEditorPage(api)
this.m_oOverlay.HtmlElement.onmousemove = this.onMouseMove;
this.m_oOverlay.HtmlElement.onmouseup = this.onMouseUp;
this.m_oNotes.HtmlElement.onmousedown = this.onMouseDownNotes;
this.m_oNotes.HtmlElement.onmousemove = this.onMouseMoveNotes;
this.m_oNotes.HtmlElement.onmouseup = this.onMouseUpNotes;
var _cur = document.getElementById('id_target_cursor');
_cur.onmousedown = this.onMouseDown;
_cur.onmousemove = this.onMouseMove;
......@@ -871,8 +881,7 @@ function CEditorPage(api)
if (this.bIsRetinaSupport)
w /= AscCommon.AscBrowser.retinaPixelRatio;
var h = (((this.m_oBody.AbsolutePosition.B - this.m_oBody.AbsolutePosition.T) -
(this.m_oTopRuler.AbsolutePosition.B - this.m_oTopRuler.AbsolutePosition.T)) * g_dKoef_mm_to_pix) >> 0;
var h = ((this.m_oMainView.AbsolutePosition.B - this.m_oMainView.AbsolutePosition.T) * g_dKoef_mm_to_pix) >> 0;
var _pageWidth = this.m_oLogicDocument.Width * g_dKoef_mm_to_pix;
var _pageHeight = this.m_oLogicDocument.Height * g_dKoef_mm_to_pix;
......@@ -1522,10 +1531,13 @@ function CEditorPage(api)
{
var _max = oWordControl.Height - parseInt(oWordControl.Splitter2PosMin * g_dKoef_mm_to_pix);
var _min = oWordControl.Height - parseInt(oWordControl.Splitter2PosMax * g_dKoef_mm_to_pix);
if (_y < _min)
_y = _min;
var _c = parseInt(oWordControl.Splitter2PosMin * g_dKoef_mm_to_pix);
if (_y > (_max + (_c / 2)))
_y = oWordControl.Height;
else if (_y > _max)
_y = _max;
else if (_y < _min)
_y = _min;
oWordControl.m_oBody.HtmlElement.style.cursor = "s-resize";
oWordControl.SplitterDiv.style.top = (_y - parseInt(GlobalSkin.SplitterWidthMM * g_dKoef_mm_to_pix)) + "px";
......@@ -1557,6 +1569,8 @@ function CEditorPage(api)
{
this.m_oMainContent.Bounds.L = this.Splitter1Pos + GlobalSkin.SplitterWidthMM;
this.m_oMainContent.Bounds.B = GlobalSkin.SupportNotes ? this.Splitter2Pos + GlobalSkin.SplitterWidthMM : 1000;
this.m_oMainContent.Bounds.isAbsB = GlobalSkin.SupportNotes;
this.m_oNotesContainer.Bounds.L = this.Splitter1Pos + GlobalSkin.SplitterWidthMM;
this.m_oNotesContainer.Bounds.AbsH = this.Splitter2Pos;
......@@ -1569,6 +1583,7 @@ function CEditorPage(api)
{
this.m_oMainContent.Bounds.L = 0;
this.m_oMainContent.Bounds.B = GlobalSkin.SupportNotes ? this.Splitter2Pos + GlobalSkin.SplitterWidthMM : 1000;
this.m_oMainContent.Bounds.isAbsB = GlobalSkin.SupportNotes;
this.m_oNotesContainer.Bounds.L = 0;
this.m_oNotesContainer.Bounds.AbsH = this.Splitter2Pos;
......@@ -1578,6 +1593,11 @@ function CEditorPage(api)
this.m_oMainContent.HtmlElement.style.borderLeft = "1px" + GlobalSkin.BorderSplitterColor + " none";
}
if (this.Splitter2Pos < 1)
this.m_oNotesContainer.HtmlElement.style.display = "none";
else
this.m_oNotesContainer.HtmlElement.style.display = "block";
this.OnResize2(true);
};
......@@ -1831,6 +1851,46 @@ function CEditorPage(api)
oWordControl.EndUpdateOverlay();
};
this.onMouseDownNotes = function(e)
{
AscCommon.check_MouseDownEvent(e, true);
global_mouseEvent.LockMouse();
oThis.Thumbnails.SetFocusElement(FOCUS_OBJECT_MAIN);
var _x = global_mouseEvent.X - oThis.X - ((oThis.m_oNotesContainer.AbsolutePosition.L * g_dKoef_mm_to_pix + 0.5) >> 0);
var _y = global_mouseEvent.Y - oThis.Y - ((oThis.m_oNotesContainer.AbsolutePosition.T * g_dKoef_mm_to_pix + 0.5) >> 0);
console.log(_x + ", " + _y);
};
this.onMouseMoveNotes = function(e)
{
AscCommon.check_MouseMoveEvent(e);
};
this.onMouseUpNotes = function(e)
{
AscCommon.check_MouseUpEvent(e);
var _x = global_mouseEvent.X - oThis.X - ((oThis.m_oNotesContainer.AbsolutePosition.L * g_dKoef_mm_to_pix + 0.5) >> 0);
var _y = global_mouseEvent.Y - oThis.Y - ((oThis.m_oNotesContainer.AbsolutePosition.T * g_dKoef_mm_to_pix + 0.5) >> 0);
console.log(_x + ", " + _y);
};
this.setNodesEnable = function(bEnabled)
{
GlobalSkin.SupportNotes = bEnabled;
this.IsSupportNotes = bEnabled;
this.Splitter2Pos = 0;
if (bEnabled)
this.m_oMainContent.HtmlElement.style.borderBottom = ("1px solid " + GlobalSkin.BorderSplitterColor);
else
this.m_oMainContent.HtmlElement.style.borderBottom = "none";
this.OnResizeSplitter();
};
this.onMouseUpExternal = function(x, y)
{
if (false === oThis.m_oApi.bInit_word_control)
......
......@@ -430,6 +430,8 @@
if (0 == this.current)
LogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_InsertDocumentsByUrls);
var _obj = null;
while (this.current < this.documents.length) // no recursion
{
if (false === LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_Content_Add))
......@@ -439,38 +441,39 @@
var _content_control_pr;
var _blockStd;
if (_current.Url !== undefined || _current.Script !== undefined)
if (_current["Url"] !== undefined || _current["Script"] !== undefined)
{
if (undefined !== _current.Props.InternalId)
if (undefined !== _current["Props"]["InternalId"])
{
// remove block sdt
LogicDocument.SelectContentControl(_current.Props.InternalId);
LogicDocument.RemoveContentControl(_current.Props.InternalId);
LogicDocument.SelectContentControl(_current["Props"]["InternalId"]);
LogicDocument.RemoveContentControl(_current["Props"]["InternalId"]);
}
_content_control_pr = new CContentControlPr();
_content_control_pr.Id = _current.Props.Id;
_content_control_pr.Tag = _current.Props.Tag;
_content_control_pr.Id = _current["Props"]["Id"];
_content_control_pr.Tag = _current["Props"]["Tag"];
_content_control_pr.Lock = sdtlock_Unlocked;
_content_control_pr.InternalId = _current.Props.InternalId;
_content_control_pr.InternalId = _current["Props"]["InternalId"];
var _blockStd = LogicDocument.AddContentControl(AscCommonWord.sdttype_BlockLevel);
_blockStd.SetContentControlPr(_content_control_pr);
this.returnDocuments.push(_blockStd.GetContentControlPr());
_obj = _blockStd.GetContentControlPr();
this.returnDocuments.push({"Tag" : _obj.Tag, "Id" : _obj.Id, "Lock" : _obj.Lock, "InternalId" : _obj.InternalId});
}
if (_current.Url !== undefined)
if (_current["Url"] !== undefined)
{
// insert/replace document
this.api.insertDocumentUrlsData = {imageMap: null, documents: [{url : _current.Url, format: _current.Format}], endCallback : function(_api) {
this.api.insertDocumentUrlsData = {imageMap: null, documents: [{url : _current["Url"], format: _current["Format"]}], endCallback : function(_api) {
_blockStd.Content.Remove_FromContent(_blockStd.Content.Get_ElementsCount() - 1 , 1);
_blockStd.MoveCursorToEndPos(false, false);
var _worker = _api.__content_control_worker;
if (_worker.documents[_worker.current].Props)
_blockStd.SetContentControlPr({ Lock : _worker.documents[_worker.current].Props.Lock });
if (_worker.documents[_worker.current]["Props"])
_blockStd.SetContentControlPr({ Lock : _worker.documents[_worker.current]["Props"]["Lock"] });
_worker = null;
_blockStd = null;
......@@ -482,10 +485,10 @@
this.api.asc_DownloadAs(Asc.c_oAscFileType.CANVAS_WORD);
return;
}
else if (_current.Script !== undefined)
else if (_current["Script"] !== undefined)
{
// insert/replace script
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + _current.Script + "\n})();";
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + _current["Script"] + "\n})();";
eval(_script);
if(_blockStd.Content.Get_ElementsCount() > 1)
......@@ -496,8 +499,8 @@
LogicDocument.MoveCursorRight(false, false, true);
var _worker = _api.__content_control_worker;
if (_worker.documents[_worker.current].Props)
_blockStd.SetContentControlPr({ Lock : _worker.documents[_worker.current].Props.Lock });
if (_worker.documents[_worker.current]["Props"])
_blockStd.SetContentControlPr({ Lock : _worker.documents[_worker.current]["Props"]["Lock"] });
_worker = null;
var _fonts = LogicDocument.Document_Get_AllFontNames();
......@@ -530,7 +533,9 @@
// change properties
var _blockStd = LogicDocument.GetContentControl(_content_control_pr.InternalId);
_blockStd.SetContentControlPr(_content_control_pr);
this.returnDocuments.push(_blockStd.GetContentControlPr());
_obj = _blockStd.GetContentControlPr();
this.returnDocuments.push({"Tag" : _obj.Tag, "Id" : _obj.Id, "Lock" : _obj.Lock, "InternalId" : _obj.InternalId});
}
}
......@@ -551,11 +556,11 @@
var arrContentControl = [];
for (var i = 0; i < this.documents.length; i++)
{
var oContentControl = g_oTableId.Get_ById(this.documents[i].InternalId);
var oContentControl = g_oTableId.Get_ById(this.documents[i]["InternalId"]);
if (oContentControl
&& (oContentControl instanceof AscCommonWord.CBlockLevelSdt
|| oContentControl instanceof AscCommonWord.CInlineLevelSdt))
arrContentControl.push(g_oTableId.Get_ById(this.documents[i].InternalId));
arrContentControl.push(g_oTableId.Get_ById(this.documents[i]["InternalId"]));
}
LogicDocument.SetCheckContentControlsLock(false);
......@@ -568,7 +573,7 @@
LogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_InsertDocumentsByUrls);
for (var i = 0; i < this.documents.length; i++)
{
LogicDocument.RemoveContentControl(this.documents[i].InternalId);
LogicDocument.RemoveContentControl(this.documents[i]["InternalId"]);
}
}
LogicDocument.SetCheckContentControlsLock(true);
......@@ -7981,9 +7986,11 @@ background-repeat: no-repeat;\
{
var _blocks = this.WordControl.m_oLogicDocument.GetAllContentControls();
var _ret = [];
var _obj = null;
for (var i = 0; i < _blocks.length; i++)
{
_ret.push(_blocks[i].GetContentControlPr());
_obj = _blocks[i].GetContentControlPr();
_ret.push({"Tag" : _obj.Tag, "Id" : _obj.Id, "Lock" : _obj.Lock, "InternalId" : _obj.InternalId});
}
return _ret;
};
......
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