|
|
|
@ -266,13 +266,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
|
|
|
|
|
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
|
|
|
|
|
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"sessionTimeConnect":this._sessionTimeConnect,"sessionTimeIdle":opt_isIdle>=0?opt_isIdle:0,"documentFormatSave":this._documentFormatSave,"view":this._isViewer,"isCloseCoAuthoring":this.isCloseCoAuthoring,"openCmd":opt_openCmd,"lang":this.lang,
|
|
|
|
|
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
|
|
|
|
|
Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
|
|
|
|
|
return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
|
|
|
|
|
false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
|
|
|
|
|
break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
|
|
|
|
|
break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
|
|
|
|
|
null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
|
|
|
|
|
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
|
|
|
|
Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};
|
|
|
|
|
sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);
|
|
|
|
|
break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);
|
|
|
|
|
break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);
|
|
|
|
|
break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=
|
|
|
|
|
c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=
|
|
|
|
|
setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
|
|
|
|
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
|
|
|
|
|
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
|
|
|
|
|
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
|
|
|
|
@ -2005,22 +2005,24 @@ function(slideNum){this.sendEvent("asc_onDemonstrationSlideChanged",slideNum)};a
|
|
|
|
|
true);else this.WordControl.DemonstrationManager.Start(div_id,slidestart_num,true);if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}};asc_docs_api.prototype.EndDemonstration=function(isNoUseFullScreen){if(this.windowReporter)this.windowReporter.close();this.WordControl.DemonstrationManager.End(isNoUseFullScreen)};asc_docs_api.prototype.DemonstrationReporterStart=function(startObject){this.reporterStartObject=
|
|
|
|
|
startObject;this.reporterStartObject["translate"]=AscCommon.translateManager.mapTranslate;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["startReporter"](window.location.href);this.reporterWindow={};return}var dualScreenLeft=window.screenLeft!=undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!=undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;
|
|
|
|
|
var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var w=800;var h=600;var left=width/2-w/2+dualScreenLeft;var top=height/2-h/2+dualScreenTop;var _windowPos="width="+w+",height="+h+",left="+left+",top="+top;var _url="index.reporter.html";if(this.locale)_url+="?lang="+this.locale;this.reporterWindow=window.open(_url,"_blank","resizable=yes,status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=0,"+_windowPos);
|
|
|
|
|
if(!this.reporterWindow)return;this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,
|
|
|
|
|
false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;
|
|
|
|
|
this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=
|
|
|
|
|
null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();
|
|
|
|
|
break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);
|
|
|
|
|
break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=
|
|
|
|
|
data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=
|
|
|
|
|
this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);
|
|
|
|
|
return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}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({},true,true);else if(undefined!==
|
|
|
|
|
_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=
|
|
|
|
|
_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();
|
|
|
|
|
var _elem=document.getElementById("dem_id_play_span");if(_elem&&_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=
|
|
|
|
|
this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=
|
|
|
|
|
message};asc_docs_api.prototype.DemonstrationNextSlide=function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);
|
|
|
|
|
if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);
|
|
|
|
|
var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
|
|
|
|
|
if(!this.reporterWindow)return;var w=this.reporterWindow;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,Util){var msgEv=Util.mkEvent();window.addEventListener("message",function(msg){if(msg.source!==w)return;msgEv.fire(msg)});var postMsg=function(data){w.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){var send=function(obj){chan.event("CMD",obj)};chan.on("CMD",function(obj){if(obj.type!=="auth")return;send({type:"authChanges",changes:[]});
|
|
|
|
|
send({type:"auth",result:1,sessionId:"06348ca8f861a0af3548ae38360aa617",participants:[],locks:[],changes:[],changesIndex:0,indexUser:0,buildVersion:"5.2.6",buildNumber:2,licenseType:3});send({type:"documentOpen",data:{"type":"open","status":"ok","data":{"Editor.bin":editor.reporterStartObject.url}}})})})});this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;
|
|
|
|
|
if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;
|
|
|
|
|
if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var bin=editor.asc_nativeGetFile();
|
|
|
|
|
var blob=new Blob([bin],{type:"plain/text"});var url=URL.createObjectURL(blob);_this.reporterStartObject.url=url;var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=
|
|
|
|
|
JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],
|
|
|
|
|
_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=
|
|
|
|
|
AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=
|
|
|
|
|
true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};
|
|
|
|
|
asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=
|
|
|
|
|
function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}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({},true,true);else if(undefined!==_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);
|
|
|
|
|
else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);
|
|
|
|
|
var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();var _elem=document.getElementById("dem_id_play_span");if(_elem&&
|
|
|
|
|
_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);
|
|
|
|
|
if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=message};asc_docs_api.prototype.DemonstrationNextSlide=
|
|
|
|
|
function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+
|
|
|
|
|
slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;
|
|
|
|
|
var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
|
|
|
|
|
asc_docs_api.prototype.SlideTimingApplyToAll=function(){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming,{All:true})===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTimingToAll);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;var _slides=this.WordControl.m_oLogicDocument.Slides;if(_cur<0||_cur>=_count)return;var _curSlide=_slides[_cur];_curSlide.timing.makeDuplicate(this.WordControl.m_oLogicDocument.DefaultSlideTiming);
|
|
|
|
|
var _default=this.WordControl.m_oLogicDocument.DefaultSlideTiming;for(var i=0;i<_count;i++){if(i==_cur)continue;_slides[i].applyTiming(_default)}}};asc_docs_api.prototype.SlideTransitionPlay=function(){var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var _timing=this.WordControl.m_oLogicDocument.Slides[_cur].timing;var _tr=this.WordControl.m_oDrawingDocument.TransitionSlide;_tr.Type=_timing.TransitionType;
|
|
|
|
|
_tr.Param=_timing.TransitionOption;_tr.Duration=_timing.TransitionDuration;_tr.Start(true)};asc_docs_api.prototype.asc_HideSlides=function(isHide){this.WordControl.m_oLogicDocument.hideSlides(isHide)};asc_docs_api.prototype.sync_EndAddShape=function(){editor.sendEvent("asc_onEndAddShape");if(this.WordControl.m_oDrawingDocument.m_sLockedCursorType=="crosshair")this.WordControl.m_oDrawingDocument.UnlockCursorType()};asc_docs_api.prototype.asc_getChartObject=function(type){this.isChartEditor=true;if(!AscFormat.isRealNumber(type)){this.asc_onOpenChartFrame();
|
|
|
|
|