@ -1,5 +1,5 @@
/ *
* Copyright ( C ) Ascensio System SIA 2012 - 202 0 . All rights reserved
* Copyright ( C ) Ascensio System SIA 2012 - 202 1 . All rights reserved
*
* https : //www.onlyoffice.com/
*
@ -1483,30 +1483,30 @@ function(actionType,options){return false};baseEditorsApi.prototype._printDeskto
actionType ) ; var downloadType ; if ( options . isDownloadEvent ) downloadType = options . oDocumentMailMerge ? DownloadType . MailMerge : 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 [ "jwt" ] =
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 ) } ; 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 ( ) { 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 ; AscCommon . ShowImageFileDialog ( this . documentId , this . documentUserId , this . CoAuthoringApi . get _jwt ( ) ,
function ( error , files ) { t . _uploadCallback ( error , files ) } , 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 ) { 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 ) ; 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 ) 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 [ "pluginMethod_AddOleObject" ] = baseEditorsApi . prototype . asc _addOleObject ; baseEditorsApi . prototype [ "pluginMethod_EditOleObject" ] = baseEditorsApi . prototype . asc _editOleObject ; 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 _showRevision = function ( newObj ) { } ; 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 ] ) } 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 . asc _GetCurrentColorSchemeName =
function ( ) { return "" } ; baseEditorsApi . prototype . sendColorThemes = function ( theme ) { var result = AscCommon . g _oUserColorScheme . slice ( ) ; var _extra = theme . extraClrSchemeLst ; var _count = _extra . length ; var oNameMap = { } ; var nStartIndex = result . length ; for ( var i = 0 ; i < _count ; ++ i ) { var _scheme = _extra [ i ] . clrScheme ; if ( oNameMap [ _scheme . name ] ) continue ; oNameMap [ _scheme . name ] = true ; result . push ( AscCommon . getAscColorScheme ( _scheme , theme ) ) } _scheme = theme . themeElements && theme . themeElements . clrScheme ; if ( _scheme ) if ( ! AscCommon . getColorSchemeByName ( _scheme . name ) &&
! oNameMap [ _scheme . name ] ) result . splice ( nStartIndex , 0 , AscCommon . getAscColorScheme ( _scheme , theme ) ) ; this . sendEvent ( "asc_onSendThemeColorSchemes" , result ) ; return result } ; 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 &&
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 ( ) { 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 ; AscCommon . ShowImageFileDialog ( this . documentId , this . documentUserId , this . CoAuthoringApi . get _jwt ( ) , function ( error , files ) { t . _uploadCallback ( error , files ) } , 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 ) { 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 ) ; 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 ) 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 [ "pluginMethod_AddOleObject" ] = baseEditorsApi . prototype . asc _addOleObject ; baseEditorsApi . prototype [ "pluginMethod_EditOleObject" ] = baseEditorsApi . prototype . asc _editOleObject ;
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 _showRevision = function ( newObj ) { } ; 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 ] ) } 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 . asc _GetCurrentColorSchemeName = function ( ) { return "" } ; baseEditorsApi . prototype . sendColorThemes = function ( theme ) { var result = AscCommon . g _oUserColorScheme . slice ( ) ; var _extra = theme . extraClrSchemeLst ; var _count = _extra . length ; var oNameMap = { } ; var nStartIndex = result . length ; for ( var i = 0 ; i < _count ; ++ i ) { var _scheme = _extra [ i ] . clrScheme ; if ( oNameMap [ _scheme . name ] ) continue ; oNameMap [ _scheme . name ] = true ; result . push ( AscCommon . getAscColorScheme ( _scheme , theme ) ) } _scheme = theme . themeElements && theme . themeElements . clrScheme ;
if ( _scheme ) if ( ! AscCommon . getColorSchemeByName ( _scheme . name ) && ! oNameMap [ _scheme . name ] ) result . splice ( nStartIndex , 0 , AscCommon . getAscColorScheme ( _scheme , theme ) ) ; this . sendEvent ( "asc_onSendThemeColorSchemes" , result ) ; return result } ; 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 ) { if ( null != this . pluginsManager ) this . pluginsManager . register ( basePath , plugins ) } ; baseEditorsApi . prototype . asc _pluginRun = function ( guid , variation , pluginData ) { if ( null != this . pluginsManager ) this . pluginsManager . run ( guid , variation , pluginData ) } ; 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 [ "pluginMethod_GetFontList" ] = function ( ) { return AscFonts . g _fontApplication . g _fontSelections . SerializeList ( ) } ;
baseEditorsApi . prototype [ "pluginMethod_InputText" ] = function ( text , textReplace ) { if ( this . isViewMode || ! AscCommon . g _inputContext ) return ; var codes = [ ] ; for ( var i = text . getUnicodeIterator ( ) ; i . check ( ) ; i . next ( ) ) codes . push ( i . value ( ) ) ; if ( textReplace ) for ( var i = 0 ; i < textReplace . length ; i ++ ) AscCommon . g _inputContext . emulateKeyDownApi ( 8 ) ; AscCommon . g _inputContext . apiInputText ( codes ) ; AscCommon . g _inputContext . keyPressInput = "" } ; baseEditorsApi . prototype [ "pluginMethod_PasteHtml" ] = function ( htmlText ) { if ( ! AscCommon . g _clipboardBase ) return null ;