diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 5f60017b4..df4817e88 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -181,7 +181,18 @@ define([ this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); this.btnEditObject.on('click', _.bind(function(btn){ - if (this.api) this.api.asc_startEditCurrentOleObject(); + if (this.api) { + var oleobj = this.api.asc_canEditTableOleObject(true); + if (oleobj) { + var oleEditor = DE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.setEditMode(true); + oleEditor.show(); + oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj)); + } + } else + this.api.asc_startEditCurrentOleObject(); + } this.fireEvent('editcomplete', this); }, this)); this.btnFitMargins.on('click', _.bind(this.setFitMargins, this)); @@ -424,7 +435,7 @@ define([ if (this._state.isOleObject) { var plugin = DE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); - this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked); + this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked); } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 25bc35c55..9eb8ef3e9 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -148,7 +148,18 @@ define([ this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); this.btnEditObject.on('click', _.bind(function(btn){ - if (this.api) this.api.asc_startEditCurrentOleObject(); + if (this.api) { + var oleobj = this.api.asc_canEditTableOleObject(true); + if (oleobj) { + var oleEditor = PE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.setEditMode(true); + oleEditor.show(); + oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj)); + } + } else + this.api.asc_startEditCurrentOleObject(); + } this.fireEvent('editcomplete', this); }, this)); @@ -348,7 +359,7 @@ define([ if (this._state.isOleObject) { var plugin = PE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); - this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked); + this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked); } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } diff --git a/apps/spreadsheeteditor/main/app.js b/apps/spreadsheeteditor/main/app.js index a9cf9cc1b..cbd99f6a1 100644 --- a/apps/spreadsheeteditor/main/app.js +++ b/apps/spreadsheeteditor/main/app.js @@ -165,6 +165,7 @@ require([ 'Common.Controllers.Chat', 'Common.Controllers.Comments', 'Common.Controllers.Plugins' + ,'Common.Controllers.ExternalOleEditor' ,'Common.Controllers.ReviewChanges' ,'Common.Controllers.Protection' ] @@ -203,6 +204,7 @@ require([ 'common/main/lib/controller/Comments', 'common/main/lib/controller/Chat', 'common/main/lib/controller/Plugins' + ,'common/main/lib/controller/ExternalOleEditor' ,'common/main/lib/controller/ReviewChanges' ,'common/main/lib/controller/Protection' ,'common/main/lib/controller/Themes' diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index fc73b70db..ea87aa03a 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -256,6 +256,28 @@ define([ view.tableTotalMenu.on('item:click', _.bind(me.onTotalMenuClick, me)); view.menuImgMacro.on('click', _.bind(me.onImgMacro, me)); view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me)); + + if (!me.permissions.isEditMailMerge && !me.permissions.isEditDiagram && !me.permissions.isEditOle) { + var oleEditor = me.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (me.api) { + if (oleEditor.isEditMode()) + me.api.asc_editTableOleObject(data); + } + }, me)); + oleEditor.on('hide', _.bind(function(cmp, message) { + if (me.api) { + me.api.asc_enableKeyEvents(true); + } + setTimeout(function(){ + view.fireEvent('editcomplete', view); + }, 10); + }, me)); + } + } } else { view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me)); view.menuViewUndo.on('click', _.bind(me.onUndo, me)); @@ -342,6 +364,8 @@ define([ this.api.asc_registerCallback('asc_onInputMessage', _.bind(this.onInputMessage, this)); this.api.asc_registerCallback('asc_onTableTotalMenu', _.bind(this.onTableTotalMenu, this)); this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this)); + if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle) + this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this)); } this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this)); this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this)); @@ -3954,6 +3978,17 @@ define([ } }, + onDoubleClickOnTableOleObject: function(obj) { + if (this.permissions.isEdit && !this._isDisabled) { + var oleEditor = SSE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor && obj) { + oleEditor.setEditMode(true); + oleEditor.show(); + oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(obj)); + } + } + }, + getUserName: function(id){ var usersStore = SSE.getCollection('Common.Collections.Users'); if (usersStore){ diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 6529ccdb6..cb89960de 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -915,6 +915,7 @@ define([ if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) { pluginsController.setApi(me.api); this.api && this.api.asc_setFrozenPaneBorderType(Common.localStorage.getBool('sse-freeze-shadow', true) ? Asc.c_oAscFrozenPaneBorderType.shadow : Asc.c_oAscFrozenPaneBorderType.line); + application.getController('Common.Controllers.ExternalOleEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization}); } leftMenuView.disableMenu('all',false); @@ -2565,7 +2566,7 @@ define([ setOleData: function(obj) { if (typeof obj === 'object' && this.api) { - this.api.asc_addTableOleObject(obj); + this.api.asc_addTableOleObjectInOleEditor(obj); this.isFrameClosed = false; } }, diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index e8d6404d8..65a3bbf86 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -215,7 +215,18 @@ define([ this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); this.btnEditObject.on('click', _.bind(function(btn){ - if (this.api) this.api.asc_startEditCurrentOleObject(); + if (this.api) { + var oleobj = this.api.asc_canEditTableOleObject(true); + if (oleobj) { + var oleEditor = SSE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.setEditMode(true); + oleEditor.show(); + oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj)); + } + } else + this.api.asc_startEditCurrentOleObject(); + } Common.NotificationCenter.trigger('edit:complete', this); }, this)); @@ -448,7 +459,7 @@ define([ if (this._state.isOleObject) { var plugin = SSE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); - this.btnEditObject.setDisabled(plugin===null || plugin ===undefined || this._locked); + this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked); } else { this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); } diff --git a/apps/spreadsheeteditor/main/app_dev.js b/apps/spreadsheeteditor/main/app_dev.js index 746539606..ff148b677 100644 --- a/apps/spreadsheeteditor/main/app_dev.js +++ b/apps/spreadsheeteditor/main/app_dev.js @@ -155,6 +155,7 @@ require([ 'Common.Controllers.Chat', 'Common.Controllers.Comments', 'Common.Controllers.Plugins' + ,'Common.Controllers.ExternalOleEditor' ,'Common.Controllers.ReviewChanges' ,'Common.Controllers.Protection' ] @@ -193,6 +194,7 @@ require([ 'common/main/lib/controller/Comments', 'common/main/lib/controller/Chat', 'common/main/lib/controller/Plugins' + ,'common/main/lib/controller/ExternalOleEditor' ,'common/main/lib/controller/ReviewChanges' ,'common/main/lib/controller/Protection' ,'common/main/lib/controller/Themes'