diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 586004e7e..a69226716 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -930,7 +930,7 @@ define([ statusbarView && statusbarView.setMode(this.appOptions); // this.getStatusInfo().setDisabled(false); // this.getCellInfo().setMode(this.appOptions); - + app.getController('Toolbar').setMode(this.appOptions); app.getController('DocumentHolder').setMode(this.appOptions); if (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 1abe81872..b4dc39821 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -217,6 +217,11 @@ define([ Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this)); }, + setMode: function(mode) { + this.mode = mode; + this.toolbar.applyLayout(mode); + }, + attachUIEvents: function(toolbar) { var me = this; @@ -1453,7 +1458,7 @@ define([ }, onChangeViewMode: function(item, compact) { - this.toolbar.setFolded(compact); + this.toolbar.setFolded(compact, 1); this.toolbar.fireEvent('view:compact', [this, compact]); Common.localStorage.setBool('sse-compact-toolbar', compact); @@ -2919,7 +2924,7 @@ define([ }, applyFormulaSettings: function() { - if (this.toolbar.btnInsertFormula.rendered) { + if (this.toolbar.btnInsertFormula && this.toolbar.btnInsertFormula.rendered) { var formulas = this.toolbar.btnInsertFormula.menu.items; for (var i=0; i +
+
+
+ + < + + + + > + +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index b5f1b9149..76547cd4a 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -245,7 +245,7 @@ define([ this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); this.miSettings[(this.mode.isEdit || this.mode.canComments)?'show':'hide'](); - this.miSettings.$el.find('+.devider')[(this.mode.isEdit || this.mode.canComments)?'show':'hide'](); + this.miSettings.$el.prev()[(this.mode.isEdit || this.mode.canComments)?'show':'hide'](); this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index 31ab2f74e..46ee90b8b 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -162,7 +162,7 @@ define([ } else { btn.panel['hide'](); } - if (this.mode.isEdit) SSE.getController('Toolbar').DisableToolbar(state==true); + SSE.getController('Toolbar').DisableToolbar(state==true); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 0721cd4d5..b28684839 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -42,6 +42,7 @@ define([ 'backbone', 'text!spreadsheeteditor/main/app/template/Toolbar.template', 'text!spreadsheeteditor/main/app/template/ToolbarAnother.template', + 'text!spreadsheeteditor/main/app/template/ToolbarView.template', 'common/main/lib/collection/Fonts', 'common/main/lib/component/Button', 'common/main/lib/component/ComboBox', @@ -55,7 +56,7 @@ define([ 'common/main/lib/component/ComboDataView' ,'common/main/lib/component/SynchronizeTip' ,'common/main/lib/component/Mixtbar' -], function (Backbone, template, simple) { 'use strict'; +], function (Backbone, template, simple, template_view) { 'use strict'; SSE.enumLock = { editCell: 'cell-editing', @@ -138,38 +139,6 @@ define([ { value: Asc.c_oAscNumFormatType.Text, format: this.ascFormatOptions.Text, displayValue: this.txtText, exampleval: '100' } ]; - var _set = SSE.enumLock; - me.btnCopy = new Common.UI.Button({ - id : 'id-toolbar-btn-copy', - cls : 'btn-toolbar', - iconCls : 'btn-copy' - }); - - me.btnPaste = new Common.UI.Button({ - id : 'id-toolbar-btn-paste', - cls : 'btn-toolbar', - iconCls : 'btn-paste', - lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect] - }); - - me.btnUndo = new Common.UI.Button({ - id : 'id-toolbar-btn-undo', - cls : 'btn-toolbar', - iconCls : 'btn-undo', - disabled : true, - lock : [_set.lostConnect], - signals : ['disabled'] - }); - - me.btnRedo = new Common.UI.Button({ - id : 'id-toolbar-btn-redo', - cls : 'btn-toolbar', - iconCls : 'btn-redo', - disabled : true, - lock : [_set.lostConnect], - signals : ['disabled'] - }); - return this; }, @@ -223,6 +192,38 @@ define([ } var _set = SSE.enumLock; + + me.btnCopy = new Common.UI.Button({ + id : 'id-toolbar-btn-copy', + cls : 'btn-toolbar', + iconCls : 'btn-copy' + }); + + me.btnPaste = new Common.UI.Button({ + id : 'id-toolbar-btn-paste', + cls : 'btn-toolbar', + iconCls : 'btn-paste', + lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect] + }); + + me.btnUndo = new Common.UI.Button({ + id : 'id-toolbar-btn-undo', + cls : 'btn-toolbar', + iconCls : 'btn-undo', + disabled : true, + lock : [_set.lostConnect], + signals : ['disabled'] + }); + + me.btnRedo = new Common.UI.Button({ + id : 'id-toolbar-btn-redo', + cls : 'btn-toolbar', + iconCls : 'btn-redo', + disabled : true, + lock : [_set.lostConnect], + signals : ['disabled'] + }); + if ( config.isEditDiagram ) { me.$layout = $(_.template(simple)(config)); @@ -330,7 +331,8 @@ define([ iconCls : 'btn-clear-filter', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot] }); - } else { + } else + if ( config.isEdit ) { Common.UI.Mixtbar.prototype.initialize.call(this, { template: _.template(template), tabs: [ @@ -1200,39 +1202,66 @@ define([ var hidetip = Common.localStorage.getItem("sse-hide-synch"); me.showSynchTip = !(hidetip && parseInt(hidetip) == 1); // me.needShowSynchTip = false; + } else { + Common.UI.Mixtbar.prototype.initialize.call(this, { + template: _.template(template_view), + tabs: [ + {caption: me.textTabFile, action: 'file', extcls: ''} + ] + } + ); + Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){ + if (action=='plugins' && visible) { + var compactview = false; + if ( Common.localStorage.itemExists("sse-compact-toolbar") ) { + compactview = Common.localStorage.getBool("sse-compact-toolbar"); + } else if ( config.customization && config.customization.compactToolbar ) + compactview = true; + + if (!compactview) { + me.setFolded(false, 1); + me.setTab('plugins'); + me.fireEvent('view:compact', [me, compactview]); + Common.NotificationCenter.trigger('layout:changed', 'toolbar'); + } + } + }, this)); } - me.lockControls = [ - me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold, - me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft, - me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop, - me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, - me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, - me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, - me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, - me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, - me.btnInsertChart, me.btnColorSchemas, - me.btnAutofilter, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint, - /*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle - ]; + if (config.isEdit) { + me.lockControls = [ + me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold, + me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft, + me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop, + me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, + me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, + me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, + me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, + me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, + me.btnInsertChart, me.btnColorSchemas, + me.btnAutofilter, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint, + /*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle + ]; - var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop, - me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign, - me.btnInsertImage, me.btnInsertText, me.btnInsertTextArt, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, - me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnBackColor, - me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas, - me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap, - me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnPrint, - me.btnAutofilter, me.btnSortUp, me.btnSortDown, me.btnTableTemplate, me.btnSetAutofilter, me.btnClearAutofilter, - me.btnSave, me.btnClearStyle, me.btnCopyStyle, me.btnCopy, me.btnPaste]; + var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop, + me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign, + me.btnInsertImage, me.btnInsertText, me.btnInsertTextArt, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, + me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnBackColor, + me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas, + me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap, + me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnPrint, + me.btnAutofilter, me.btnSortUp, me.btnSortDown, me.btnTableTemplate, me.btnSetAutofilter, me.btnClearAutofilter, + me.btnSave, me.btnClearStyle, me.btnCopyStyle, me.btnCopy, me.btnPaste]; - // Enable none paragraph components - _.each(_temp_array, function(cmp) { - if (cmp && _.isFunction(cmp.setDisabled)) - cmp.setDisabled(true); - }); + // Enable none paragraph components + _.each(_temp_array, function(cmp) { + if (cmp && _.isFunction(cmp.setDisabled)) + cmp.setDisabled(true); + }); - this.on('render:after', _.bind(this.onToolbarAfterRender, this)); + this.on('render:after', _.bind(this.onToolbarAfterRender, this)); + } + return this; }, render: function (mode) { @@ -1271,7 +1300,8 @@ define([ } }); - me.setTab('home'); + if ( mode.isEdit ) + me.setTab('home'); if ( me.isCompactView ) me.setFolded(true);