diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js
index 4806b55a3..f6f88365f 100644
--- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js
+++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js
@@ -324,15 +324,15 @@ define([
},
SetDisabled: function(disabled) {
- this.editor.$btnfunc[!disabled?'removeClass':'addClass']('disabled');
- this.editor.btnNamedRanges.setVisible(!disabled);
+ this.editor.$btnfunc[!disabled && this.mode.isEdit ?'removeClass':'addClass']('disabled');
+ this.editor.btnNamedRanges.setVisible(!disabled && this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
},
setPreviewMode: function(mode) {
if (this.viewmode === mode) return;
this.viewmode = mode;
- this.editor.$btnfunc[!mode?'removeClass':'addClass']('disabled');
- this.editor.cellNameDisabled(mode);
+ this.editor.$btnfunc[!mode && this.mode.isEdit?'removeClass':'addClass']('disabled');
+ this.editor.cellNameDisabled(mode && !(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge));
}
});
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
index 2127bd08e..3a89c1a73 100644
--- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
+++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
@@ -188,21 +188,28 @@ define([
return this;
},
- SetDisabled: function(disable, disableFileMenu) {
- this.mode.isEdit = !disable;
+ SetDisabled: function(disable, options) {
+ if (this.leftMenu._state.disabled !== disable) {
+ this.leftMenu._state.disabled = disable;
+ if (disable) {
+ this.previsEdit = this.mode.isEdit;
+ this.prevcanEdit = this.mode.canEdit;
+ this.mode.isEdit = this.mode.canEdit = !disable;
+ } else {
+ this.mode.isEdit = this.previsEdit;
+ this.mode.canEdit = this.prevcanEdit;
+ }
+ }
+
if (disable) this.leftMenu.close();
- /** coauthoring begin **/
- this.leftMenu.btnComments.setDisabled(disable);
- var comments = this.getApplication().getController('Common.Controllers.Comments');
- if (comments)
- comments.setPreviewMode(disable);
- this.setPreviewMode(disable);
- this.leftMenu.btnChat.setDisabled(disable);
- /** coauthoring end **/
+ if (!options || options.comments && options.comments.disable)
+ this.leftMenu.btnComments.setDisabled(disable);
+ if (!options || options.chat)
+ this.leftMenu.btnChat.setDisabled(disable);
+
this.leftMenu.btnPlugins.setDisabled(disable);
this.leftMenu.btnSpellcheck.setDisabled(disable);
- if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
},
createDelayedElements: function() {
diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js
index 4d4fcb73c..c5952c7b8 100644
--- a/apps/spreadsheeteditor/main/app/controller/Main.js
+++ b/apps/spreadsheeteditor/main/app/controller/Main.js
@@ -209,7 +209,8 @@ define([
Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this));
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
- Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
+ Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
+ Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
this.stackLongActions = new Common.IrregularStack({
strongCompare : this._compareActionStrong,
@@ -218,6 +219,11 @@ define([
this.stackLongActions.push({id: InitApplication, type: Asc.c_oAscAsyncActionType.BlockInteraction});
+ this.stackDisableActions = new Common.IrregularStack({
+ strongCompare : this._compareActionWeak,
+ weakCompare : this._compareActionWeak
+ });
+
this.isShowOpenDialog = false;
// Initialize api gateway
@@ -670,6 +676,9 @@ define([
if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !( (id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl) ))
this.onEditComplete(this.loadMask, {restorefocus:true});
}
+ if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
+ this.disableEditing(false, true);
+ }
},
setLongActionView: function(action) {
@@ -741,6 +750,12 @@ define([
case LoadingDocument:
title = this.loadingDocumentTitleText + ' ';
break;
+
+ case Asc.c_oAscAsyncAction['Disconnect']:
+ title = this.textDisconnect;
+ this.disableEditing(true, true);
+ break;
+
default:
if (typeof action.id == 'string'){
title = action.id;
@@ -1032,18 +1047,76 @@ define([
}
},
- disableEditing: function(disable) {
+ disableEditing: function(disable, temp) {
+ Common.NotificationCenter.trigger('editing:disable', disable, {
+ viewMode: disable,
+ allowSignature: false,
+ allowProtect: false,
+ rightMenu: {clear: true, disable: true},
+ statusBar: true,
+ leftMenu: {disable: true, previewMode: true},
+ fileMenu: {protect: true, history: temp},
+ comments: {disable: !temp, previewMode: true},
+ chat: true,
+ review: true,
+ viewport: true,
+ documentHolder: true,
+ toolbar: true,
+ celleditor: {previewMode: true}
+ }, temp ? 'reconnect' : 'disconnect');
+ },
+
+ onEditingDisable: function(disable, options, type) {
var app = this.getApplication();
- if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
- app.getController('RightMenu').getView('RightMenu').clearSelection();
- app.getController('RightMenu').SetDisabled(disable, false);
- app.getController('Toolbar').DisableToolbar(disable,disable);
+
+ var action = {type: type, disable: disable, options: options};
+ if (disable && !this.stackDisableActions.get({type: type}))
+ this.stackDisableActions.push(action);
+ !disable && this.stackDisableActions.pop({type: type});
+ var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null;
+
+ if (options.rightMenu && app.getController('RightMenu')) {
+ options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection();
+ options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowSignature);
+ }
+ if (options.statusBar) {
app.getController('Statusbar').SetDisabled(disable);
}
- app.getController('LeftMenu').SetDisabled(disable, true);
- app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
- app.getController('Viewport').SetDisabled(disable);
- app.getController('CellEditor').SetDisabled(disable);
+ if (options.review) {
+ app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
+ }
+ if (options.viewport) {
+ app.getController('Viewport').SetDisabled(disable);
+ }
+ if (options.toolbar) {
+ app.getController('Toolbar').DisableToolbar(disable, options.viewMode);
+ }
+ if (options.documentHolder) {
+ app.getController('DocumentHolder').SetDisabled(disable, options.allowProtect);
+ }
+ if (options.leftMenu) {
+ if (options.leftMenu.disable)
+ app.getController('LeftMenu').SetDisabled(disable, options);
+ if (options.leftMenu.previewMode)
+ app.getController('LeftMenu').setPreviewMode(disable);
+ }
+ if (options.fileMenu) {
+ app.getController('LeftMenu').leftMenu.getMenu('file').SetDisabled(disable, options.fileMenu);
+ if (options.leftMenu.disable)
+ app.getController('LeftMenu').leftMenu.getMenu('file').applyMode();
+ }
+ if (options.comments) {
+ var comments = this.getApplication().getController('Common.Controllers.Comments');
+ if (comments && options.comments.previewMode)
+ comments.setPreviewMode(disable);
+ }
+ if (options.celleditor && options.celleditor.previewMode) {
+ app.getController('CellEditor').setPreviewMode(disable);
+ }
+
+ if (prev_options) {
+ this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);
+ }
},
onOpenDocument: function(progress) {
@@ -2443,15 +2516,7 @@ define([
var me = this;
Common.Utils.warningDocumentIsLocked({
disablefunc: function (disable) {
- me.disableEditing(disable);
- var app = me.getApplication();
- app.getController('DocumentHolder').SetDisabled(disable);
- var leftMenu = app.getController('LeftMenu');
- leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
- leftMenu.setPreviewMode(disable);
-
- var comments = app.getController('Common.Controllers.Comments');
- if (comments) comments.setPreviewMode(disable);
+ me.disableEditing(disable, true);
}});
},
@@ -2953,7 +3018,8 @@ define([
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.
Use the \'Refresh\' button to update the report.',
txtQuarter: 'Qtr',
txtOr: '%1 or %2',
- confirmReplaceFormulaInTable: 'Formulas in the header row will be removed and converted to static text.
Do you want to continue?'
+ confirmReplaceFormulaInTable: 'Formulas in the header row will be removed and converted to static text.
Do you want to continue?',
+ textDisconnect: 'Connection is lost'
}
})(), SSE.Controllers.Main || {}))
});
diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js
index 3b6256650..143e5be61 100644
--- a/apps/spreadsheeteditor/main/app/view/FileMenu.js
+++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js
@@ -253,6 +253,8 @@ define([
},
applyMode: function() {
+ if (!this.rendered) return;
+
if (!this.panels) {
this.panels = {
'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')),
@@ -346,8 +348,7 @@ define([
}
if (!delay) {
- if ( this.rendered )
- this.applyMode();
+ this.applyMode();
}
},
@@ -424,20 +425,16 @@ define([
}
},
- SetDisabled: function(disable) {
+ SetDisabled: function(disable, options) {
if ( !this.panels ) {
this.mode.disableEditing = disable;
} else {
this.panels['opts'].SetDisabled(disable);
}
- var _btn_save = this.getButton('save'),
- _btn_rename = this.getButton('rename'),
- _btn_protect = this.getButton('protect');
+ var _btn_protect = this.getButton('protect');
- _btn_save.setDisabled(disable || !this.mode.isEdit);
- _btn_protect.setDisabled(disable || !this.mode.isEdit);
- _btn_rename.setDisabled(disable || !this.mode.canRename || this.mode.isDesktopApp);
+ options && options.protect && _btn_protect.setDisabled(disable || !this.mode.isEdit);
},
btnSaveCaption : 'Save',
diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
index 928b04cf3..d5a4b1c9c 100644
--- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
+++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
@@ -265,6 +265,7 @@ define([
if ( disabled ) {
$(this.viewSettingsPicker.dataViewItems[1].el).hide();
$(this.viewSettingsPicker.dataViewItems[2].el).hide();
+ this.viewSettingsPicker.selectByIndex(0, true);
} else {
if ( this.mode.canPrint )
$(this.viewSettingsPicker.dataViewItems[1].el).show();
diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js
index 8cca99aab..248bdbf94 100644
--- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js
+++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js
@@ -75,7 +75,7 @@ define([
initialize: function () {
this.minimizedMode = true;
- this._state = {};
+ this._state = {disabled: false};
},
render: function () {
diff --git a/apps/spreadsheeteditor/main/app/view/SignatureSettings.js b/apps/spreadsheeteditor/main/app/view/SignatureSettings.js
index 94bd653c4..53836c5ac 100644
--- a/apps/spreadsheeteditor/main/app/view/SignatureSettings.js
+++ b/apps/spreadsheeteditor/main/app/view/SignatureSettings.js
@@ -393,23 +393,22 @@ define([
if (this._state.DisabledEditing != disable) {
this._state.DisabledEditing = disable;
- var rightMenuController = SSE.getController('RightMenu');
- if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
- rightMenuController.rightmenu.clearSelection();
- rightMenuController.SetDisabled(disable, true);
- SSE.getController('Toolbar').DisableToolbar(disable, disable);
- SSE.getController('Statusbar').SetDisabled(disable);
- SSE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
- SSE.getController('DocumentHolder').SetDisabled(disable, true);
- SSE.getController('CellEditor').setPreviewMode(disable);
- SSE.getController('Viewport').disableEditing(disable);
-
- // var leftMenu = SSE.getController('LeftMenu').leftMenu;
- // leftMenu.btnComments.setDisabled(disable);
- SSE.getController('LeftMenu').setPreviewMode(disable);
- var comments = SSE.getController('Common.Controllers.Comments');
- if (comments)
- comments.setPreviewMode(disable);
+ Common.NotificationCenter.trigger('editing:disable', disable, {
+ viewMode: disable,
+ allowSignature: true,
+ allowProtect: true,
+ rightMenu: {clear: disable && (SSE.getController('RightMenu').rightmenu.GetActivePane() !== 'id-signature-settings'), disable: true},
+ statusBar: true,
+ leftMenu: {disable: false, previewMode: true},
+ fileMenu: false,
+ comments: {disable: false, previewMode: true},
+ chat: false,
+ review: true,
+ viewport: true,
+ documentHolder: true,
+ toolbar: true,
+ celleditor: {previewMode: true}
+ }, 'signature');
}
},