|
|
|
@ -1657,39 +1657,39 @@ function(){};baseEditorsApi.prototype._downloadAs=function(){};baseEditorsApi.pr
|
|
|
|
|
actionType===c_oAscAsyncAction.Print?DownloadType.Print:DownloadType.Download;else downloadType=DownloadType.None;var isNoBase64=typeof ArrayBuffer!=="undefined"&&!isCloudCrypto;var dataContainer={data:null,part:null,index:0,count:0};var oAdditionalData={};oAdditionalData["c"]="save";oAdditionalData["id"]=this.documentId;oAdditionalData["userid"]=this.documentUserId;oAdditionalData["tokenSession"]=this.CoAuthoringApi.get_jwt();oAdditionalData["outputformat"]=options.fileType;oAdditionalData["title"]=
|
|
|
|
|
AscCommon.changeFileExtention(this.documentTitle,AscCommon.getExtentionByFormat(options.fileType),Asc.c_nMaxDownloadTitleLen);oAdditionalData["nobase64"]=isNoBase64;if(DownloadType.Print===downloadType)oAdditionalData["inline"]=1;if(this._downloadAs(actionType,options,oAdditionalData,dataContainer))return;var t=this;this.fCurCallback=null;if(!options.callback)this.fCurCallback=function(input,status){var error=403===status?c_oAscError.ID.AccessDeny:c_oAscError.ID.Unknown;if(null!=input&&oAdditionalData["c"]===
|
|
|
|
|
input["type"])if("ok"===input["status"]){var url=input["data"];if(url){error=c_oAscError.ID.No;t.processSavedFile(url,downloadType)}}else error=AscCommon.mapAscServerErrorToAscError(parseInt(input["data"]),AscCommon.c_oAscAdvancedOptionsAction.Save);if(c_oAscError.ID.No!==error){t.endInsertDocumentUrls();t.sendEvent("asc_onError",options.errorDirect||error,c_oAscError.Level.NoCritical)}if(actionType)t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType)};if(window.parent.APP.printPdf&&
|
|
|
|
|
(DownloadType.Print===downloadType||!downloadType)){window.parent.APP.printPdf(dataContainer,options.callback||this.fCurCallback);return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=
|
|
|
|
|
function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};
|
|
|
|
|
baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});
|
|
|
|
|
return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=
|
|
|
|
|
this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};
|
|
|
|
|
baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);
|
|
|
|
|
var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},
|
|
|
|
|
this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
|
|
|
|
|
AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
|
|
|
|
|
var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
|
|
|
|
|
sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
|
|
|
|
|
function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
|
|
|
|
|
else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};
|
|
|
|
|
baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,
|
|
|
|
|
options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};
|
|
|
|
|
baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=
|
|
|
|
|
function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=
|
|
|
|
|
function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();
|
|
|
|
|
if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;
|
|
|
|
|
var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;
|
|
|
|
|
var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};
|
|
|
|
|
baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();
|
|
|
|
|
var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;
|
|
|
|
|
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
|
|
|
|
|
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
|
|
|
|
|
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
|
|
|
|
|
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
|
|
|
|
|
extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
|
|
|
|
|
plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
|
|
|
|
|
baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
|
|
|
|
|
function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
|
|
|
|
|
c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
|
|
|
|
|
baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
|
|
|
|
(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
|
|
|
|
|
function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
|
|
|
|
|
elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
|
|
|
|
|
t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
|
|
|
|
|
c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
|
|
|
|
|
else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
|
|
|
|
|
function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
|
|
|
|
|
data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
|
|
|
|
|
oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
|
|
|
|
|
function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
|
|
|
|
|
function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
|
|
|
|
|
value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
|
|
|
|
|
if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
|
|
|
|
|
newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
|
|
|
|
|
this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
|
|
|
|
|
false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
|
|
|
|
|
0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
|
|
|
|
|
this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
|
|
|
|
|
this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
|
|
|
|
|
baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
|
|
|
|
|
function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
|
|
|
|
|
baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
|
|
|
|
|
baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
|
|
|
|
|
aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
|
|
|
|
|
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
|
|
|
|
|
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
|
|
|
|
|
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
|
|
|
|
|
_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
|
|
|
|
|
true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
|
|
|
|
|
baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
|
|
|
|
|
baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
|
|
|
|
|
this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
|
|
|
|
|
this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
|
|
|
|
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
|
|
|
|
|
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
|
|
|
|
|
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
|
|
|
|
|