Commit 726c80c3 authored by Oleg Korshul's avatar Oleg Korshul

reporter mode developing...

parent f0c9151b
......@@ -56,6 +56,8 @@
AscCommon.stopEvent = function(e)
{
if (!e)
return;
if (e.preventDefault)
e.preventDefault();
if (e.stopPropagation)
......
......@@ -785,6 +785,11 @@ function CEditorPage(api)
window.onkeydown = this.onKeyDown;
window.onkeyup = this.onKeyUp;
if ( window.attachEvent )
window.attachEvent('onmessage', this.m_oApi.DemonstrationToReporterMessages);
else
window.addEventListener('message', this.m_oApi.DemonstrationToReporterMessages, false);
}
// --------------------------------------------------------------------------
......
......@@ -3215,6 +3215,9 @@ function CDemonstrationManager(htmlpage)
if (!this.Mode)
return;
if (this.HtmlPage.m_oApi.isReporterMode)
window.postMessage("{ \"reporter_command\" : \"go_to_slide\", \"slide\" : " + slideNum + " }", "*");
this.CorrectSlideNum();
if ((slideNum == this.SlideNum) || (slideNum < 0) || (slideNum >= this.SlidesCount))
......@@ -3242,11 +3245,9 @@ function CDemonstrationManager(htmlpage)
}
// manipulators
this.onKeyDown = function(e)
this.onKeyDownCode = function(code)
{
AscCommon.check_KeyboardEvent(e);
switch (AscCommon.global_keyboardEvent.KeyCode)
switch (code)
{
case 13: // enter
case 32: // space
......@@ -3282,6 +3283,25 @@ function CDemonstrationManager(htmlpage)
default:
break;
}
}
this.onKeyDown = function(e)
{
AscCommon.check_KeyboardEvent(e);
if (oThis.HtmlPage.m_oApi.reporterWindow)
{
var _msg_ = {
"main_command" : true,
"keyCode" : AscCommon.global_keyboardEvent.KeyCode
};
oThis.HtmlPage.m_oApi.reporterWindow.postMessage(JSON.stringify(_msg_), "*");
oThis.HtmlPage.IsKeyDownButNoPress = true;
return false;
}
this.onKeyDownCode(AscCommon.global_keyboardEvent.KeyCode);
oThis.HtmlPage.IsKeyDownButNoPress = true;
return false;
......@@ -3301,6 +3321,19 @@ function CDemonstrationManager(htmlpage)
this.onMouseUp = function(e)
{
if (oThis.HtmlPage.m_oApi.reporterWindow)
{
var _msg_ = {
"main_command" : true,
"mouseUp" : true
};
oThis.HtmlPage.m_oApi.reporterWindow.postMessage(JSON.stringify(_msg_), "*");
AscCommon.stopEvent(e);
return false;
}
// next slide
oThis.CorrectSlideNum();
......@@ -3327,10 +3360,22 @@ function CDemonstrationManager(htmlpage)
}
}
e.preventDefault();
AscCommon.stopEvent(e);
return false;
}
this.onMouseWheelDelta = function(delta)
{
if (delta > 0)
{
this.NextSlide();
}
else
{
this.PrevSlide();
}
}
this.onMouseWhell = function(e)
{
if (undefined !== window["AscDesktopEditor"])
......@@ -3345,21 +3390,36 @@ function CDemonstrationManager(htmlpage)
else
delta = (e.detail > 0) ? 1 : -1;
if (delta > 0)
{
oThis.NextSlide();
}
else
if (oThis.HtmlPage.m_oApi.reporterWindow)
{
oThis.PrevSlide();
var _msg_ = {
"main_command" : true,
"mouseWhell" : delta
};
oThis.HtmlPage.m_oApi.reporterWindow.postMessage(JSON.stringify(_msg_), "*");
AscCommon.stopEvent(e);
return false;
}
e.preventDefault();
oThis.onMouseWheelDelta(delta);
AscCommon.stopEvent(e);
return false;
}
this.Resize = function()
{
if (oThis.HtmlPage.m_oApi.reporterWindow)
{
var _msg_ = {
"main_command" : true,
"resize" : true
};
oThis.HtmlPage.m_oApi.reporterWindow.postMessage(JSON.stringify(_msg_), "*");
}
if (!this.Mode)
return;
......
......@@ -5945,6 +5945,10 @@ background-repeat: no-repeat;\
_this.DemonstrationGoToSlide(_obj["slide"]);
break;
}
case "go_to_slide":
{
_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);
}
default:
break;
}
......@@ -5954,6 +5958,39 @@ background-repeat: no-repeat;\
}
};
asc_docs_api.prototype.DemonstrationToReporterMessages = function(e)
{
var _this = window.editor;
try
{
var _obj = JSON.parse(e.data);
if (undefined == _obj["main_command"])
return;
if (undefined !== _obj["keyCode"])
{
_this.WordControl.DemonstrationManager.onKeyDownCode(_obj["keyCode"]);
}
else if (undefined !== _obj["mouseUp"])
{
_this.WordControl.DemonstrationManager.onMouseUp({});
}
else if (undefined !== _obj["mouseWhell"])
{
_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);
}
else if (undefined !== _obj["resize"])
{
_this.WordControl.DemonstrationManager.Resize();
}
}
catch (err)
{
}
};
asc_docs_api.prototype.DemonstrationPlay = function()
{
if (undefined !== this.EndShowMessage)
......
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