From cbb8545bf7aa9a586b7f04cfd5a4a573ffa057c2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 31 May 2022 11:34:43 +0300 Subject: [PATCH] [SSE] Change toolbar for ole editing --- .../main/app/controller/Main.js | 2 +- .../main/app/controller/Toolbar.js | 356 ++++++++++++++++-- .../main/app/template/Toolbar.template | 2 +- .../main/app/template/ToolbarAnother.template | 57 +-- .../main/app/view/Toolbar.js | 201 ++++++++-- .../main/resources/less/toolbar.less | 4 - 6 files changed, 539 insertions(+), 83 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index ddbc934b8..6b779ee90 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -2500,7 +2500,7 @@ define([ me.getApplication().getController('RightMenu').UpdateThemeColors(); }, 50); - !me.appOptions.isEditOle && setTimeout(function(){ + setTimeout(function(){ me.getApplication().getController('Toolbar').updateThemeColors(); }, 50); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 4bc2781cd..f25c907a6 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -308,20 +308,42 @@ define([ toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true)); toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false)); toolbar.btnSearch.on('click', _.bind(this.onSearch, this)); - toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending)); - toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending)); - toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this)); - toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this)); toolbar.btnInsertFormula.on('click', _.bind(this.onInsertFormulaMenu, this)); toolbar.btnInsertFormula.menu.on('item:click', _.bind(this.onInsertFormulaMenu, this)); - toolbar.btnDecDecimal.on('click', _.bind(this.onDecrement, this)); - toolbar.btnIncDecimal.on('click', _.bind(this.onIncrement, this)); toolbar.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this)); toolbar.cmbNumberFormat.on('show:before', _.bind(this.onNumberFormatOpenBefore, this, true)); if (toolbar.cmbNumberFormat.cmpEl) toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this)); + toolbar.btnWrap.on('click', _.bind(this.onWrap, this)); + toolbar.btnTextColor.on('click', _.bind(this.onTextColor, this)); + toolbar.btnTextColor.on('color:select', _.bind(this.onTextColorSelect, this)); + toolbar.btnTextColor.on('auto:select', _.bind(this.onAutoFontColor, this)); + toolbar.btnBackColor.on('click', _.bind(this.onBackColor, this)); + toolbar.btnBackColor.on('color:select', _.bind(this.onBackColorSelect, this)); + toolbar.btnBorders.on('click', _.bind(this.onBorders, this)); + if (toolbar.btnBorders.rendered) { + toolbar.btnBorders.menu.on('item:click', _.bind(this.onBordersMenu, this)); + toolbar.mnuBorderWidth.on('item:toggle', _.bind(this.onBordersWidth, this)); + toolbar.mnuBorderColorPicker.on('select', _.bind(this.onBordersColor, this)); + $('#id-toolbar-menu-auto-bordercolor').on('click', _.bind(this.onAutoBorderColor, this)); + } + toolbar.btnMerge.on('click', _.bind(this.onMergeCellsMenu, this, toolbar.btnMerge.menu, toolbar.btnMerge.menu.items[0])); + toolbar.btnMerge.menu.on('item:click', _.bind(this.onMergeCellsMenu, this)); + toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this)); toolbar.btnVisibleArea.menu.on('item:click', _.bind(this.onVisibleAreaMenu, this)); toolbar.btnVisibleAreaClose.on('click', _.bind(this.onVisibleAreaClose, this)); + toolbar.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); + toolbar.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); + toolbar.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); + toolbar.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this)); + toolbar.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + toolbar.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this)); + toolbar.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true)); + toolbar.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false)); + toolbar.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true)); + toolbar.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this)); + toolbar.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this)); + toolbar.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false)); } else { toolbar.btnPrint.on('click', _.bind(this.onPrint, this)); toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled')); @@ -456,6 +478,8 @@ define([ this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + } else if (config.isEditOle) { + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); } else if (config.isRestrictedEdit) { this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this)); Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this)); @@ -1877,7 +1901,9 @@ define([ this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this)); Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this)); } - + if ( this.appConfig.isEditOle ) { + this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged_OleEditor, this)); + } if ( !this.appConfig.isEditMailMerge ) { this.applyFormulaSettings(); } @@ -3132,11 +3158,14 @@ define([ me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked); + me._state.controlsdisabled.filters = is_image || is_mode_2; + return is_image; }; var selectionType = info.asc_getSelectionType(), xfs = info.asc_getXfs(), + toolbar = this.toolbar, coauth_disable = false, editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable), val, need_disable = false; @@ -3145,24 +3174,195 @@ define([ if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText) return; - if ( !me.toolbar.mode.isEditDiagram ) { - var filterInfo = info.asc_getAutoFilterInfo(); + Common.NotificationCenter.trigger('fonts:change', xfs); - val = filterInfo ? filterInfo.asc_getIsAutoFilter() : null; - if ( this._state.filter !== val ) { - me.toolbar.btnSetAutofilter.toggle(val===true, true); - this._state.filter = val; - } - - need_disable = this._state.controlsdisabled.filters || (val===null); - me.toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable, - { array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] }); - - need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true); - me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]}); + /* read font size */ + var str_size = xfs.asc_getFontSize(); + if (this._state.fontsize !== str_size) { + toolbar.cmbFontSize.setValue((str_size !== undefined) ? str_size : ''); + this._state.fontsize = str_size; } - var val = xfs.asc_getNumFormatInfo(); + /* read font color */ + var clr, + color, + fontColorPicker = toolbar.mnuTextColorPicker, + paragraphColorPicker = toolbar.mnuBackColorPicker; + + if (!fontColorPicker.isDummy) { + color = xfs.asc_getFontColor(); + if (color) { + if (color.get_auto()) { + if (this._state.clrtext !== 'auto') { + fontColorPicker.clearSelection(); + toolbar.btnTextColor.setAutoColor(true); + this._state.clrtext = 'auto'; + } + } else { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else { + clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + var type1 = typeof(clr), + type2 = typeof(this._state.clrtext); + if ( (this._state.clrtext == 'auto') || (type1 !== type2) || (type1=='object' && + (clr.effectValue!==this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color)<0)) || + (type1!='object' && this._state.clrtext!==undefined && this._state.clrtext.indexOf(clr)<0 )) { + + toolbar.btnTextColor.setAutoColor(false); + if (_.isObject(clr)) { + var isselected = false; + for (var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue) { + fontColorPicker.select(clr, true); + isselected = true; + break; + } + } + if (!isselected) fontColorPicker.clearSelection(); + } else { + fontColorPicker.select(clr, true); + } + this._state.clrtext = clr; + } + } + } + this._state.clrtext_asccolor = color; + } + + /* read cell background color */ + if (!paragraphColorPicker.isDummy) { + color = xfs.asc_getFillColor(); + if (color && !color.get_auto()) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else { + clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + } else { + clr = 'transparent'; + } + + type1 = typeof(clr); + type2 = typeof(this._state.clrback); + if ( (type1 !== type2) || (type1=='object' && + (clr.effectValue!==this._state.clrback.effectValue || this._state.clrback.color.indexOf(clr.color)<0)) || + (type1!='object' && this._state.clrback!==undefined && this._state.clrback.indexOf(clr)<0 )) { + + if (_.isObject(clr)) { + var isselected = false; + for (i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue) { + paragraphColorPicker.select(clr, true); + isselected = true; + break; + } + } + if (!isselected) paragraphColorPicker.clearSelection(); + } else { + paragraphColorPicker.select(clr, true); + } + this._state.clrback = clr; + } + this._state.clrshd_asccolor = color; + } + + var filterInfo = info.asc_getAutoFilterInfo(), + formatTableInfo = info.asc_getFormatTableInfo(); + + /* read cell horizontal align */ + /* + var fontparam = xfs.asc_getHorAlign(); + if (this._state.pralign !== fontparam) { + this._state.pralign = fontparam; + + var index = -1, align; + switch (fontparam) { + case AscCommon.align_Left: index = 0; align = 'btn-align-left'; break; + case AscCommon.align_Center: index = 1; align = 'btn-align-center'; break; + case AscCommon.align_Right: index = 2; align = 'btn-align-right'; break; + case AscCommon.align_Justify: index = 3; align = 'btn-align-just'; break; + default: index = -255; align = 'btn-align-left'; break; + } + if (!(index < 0)) { + toolbar.btnAlignRight.toggle(index===2, true); + toolbar.btnAlignLeft.toggle(index===0, true); + toolbar.btnAlignCenter.toggle(index===1, true); + toolbar.btnAlignJust.toggle(index===3, true); + } else if (index == -255) { + toolbar.btnAlignRight.toggle(false, true); + toolbar.btnAlignLeft.toggle(false, true); + toolbar.btnAlignCenter.toggle(false, true); + toolbar.btnAlignJust.toggle(false, true); + } + } + + // read cell vertical align + fontparam = xfs.asc_getVertAlign(); + + if (this._state.valign !== fontparam) { + this._state.valign = fontparam; + + index = -1; align = ''; + switch (fontparam) { + case Asc.c_oAscVAlign.Top: index = 0; align = 'btn-valign-top'; break; + case Asc.c_oAscVAlign.Center: index = 1; align = 'btn-valign-middle'; break; + case Asc.c_oAscVAlign.Bottom: index = 2; align = 'btn-valign-bottom'; break; + } + + toolbar.btnAlignTop.toggle(index===0, true); + toolbar.btnAlignMiddle.toggle(index===1, true); + toolbar.btnAlignBottom.toggle(index===2, true); + } + */ + need_disable = this._state.controlsdisabled.filters || formatTableInfo!==null || filterInfo && filterInfo.asc_getIsAutoFilter()===null; + toolbar.lockToolbar(Common.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge]}); + + val = info.asc_getMerge(); + if (this._state.merge !== val) { + toolbar.btnMerge.toggle(val===Asc.c_oAscMergeOptions.Merge, true); + this._state.merge = val; + } + + /* read cell text wrapping */ + if (!toolbar.btnWrap.isDisabled()) { + val = xfs.asc_getWrapText(); + if (this._state.wrap !== val) { + toolbar.btnWrap.toggle(val===true, true); + this._state.wrap = val; + } + } + + val = (filterInfo) ? filterInfo.asc_getIsAutoFilter() : null; + this._state.filter = val; + need_disable = this._state.controlsdisabled.filters || (val===null); + toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable, { array: [toolbar.btnTableTemplate] }); + + val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null; + if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) { + val = this.toolbar.mnuTableTemplatePicker.store.findWhere({name: val}); + if (val) { + this.toolbar.mnuTableTemplatePicker.selectRecord(val); + this._state.tablestylename = val.get('name'); + } else { + toolbar.mnuTableTemplatePicker.deselectAll(); + this._state.tablestylename = null; + } + } + + this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined; + this._state.filterapplied = this._state.filter && filterInfo.asc_getIsApplyAutoFilter(); + this._state.multiselect = info.asc_getMultiselect(); + toolbar.lockToolbar(Common.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate]}); + + this._state.inpivot = !!info.asc_getPivotTableInfo(); + toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: [toolbar.btnMerge]}); + + need_disable = !this.appConfig.canModifyFilter; + toolbar.lockToolbar(Common.enumLock.cantModifyFilter, need_disable, { array: [toolbar.btnTableTemplate]}); + + val = xfs.asc_getNumFormatInfo(); if ( val ) { this._state.numformat = xfs.asc_getNumFormat(); this._state.numformatinfo = val; @@ -3174,6 +3374,118 @@ define([ } }, + onApiEditorSelectionChanged_OleEditor: function(fontobj) { + if (!this.editMode || $('.asc-window.enable-key-events:visible').length>0) return; + + var toolbar = this.toolbar, + val; + + /* read font name */ + Common.NotificationCenter.trigger('fonts:change', fontobj); + + /* read font params */ + // if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram) { + // val = fontobj.asc_getFontBold(); + // if (this._state.bold !== val) { + // toolbar.btnBold.toggle(val === true, true); + // this._state.bold = val; + // } + // val = fontobj.asc_getFontItalic(); + // if (this._state.italic !== val) { + // toolbar.btnItalic.toggle(val === true, true); + // this._state.italic = val; + // } + // val = fontobj.asc_getFontUnderline(); + // if (this._state.underline !== val) { + // toolbar.btnUnderline.toggle(val === true, true); + // this._state.underline = val; + // } + // val = fontobj.asc_getFontStrikeout(); + // if (this._state.strikeout !== val) { + // toolbar.btnStrikeout.toggle(val === true, true); + // this._state.strikeout = val; + // } + // + // var subsc = fontobj.asc_getFontSubscript(), + // supersc = fontobj.asc_getFontSuperscript(); + // + // if (this._state.subscript !== subsc || this._state.superscript !== supersc) { + // var index = (supersc) ? 0 : (subsc ? 1 : -1), + // btnSubscript = toolbar.btnSubscript; + // + // btnSubscript.toggle(index>-1, true); + // if (index < 0) { + // btnSubscript.menu.clearAll(); + // } else { + // btnSubscript.menu.items[index].setChecked(true); + // if ( btnSubscript.rendered && btnSubscript.$icon ) { + // btnSubscript.$icon.removeClass(btnSubscript.options.icls); + // btnSubscript.options.icls = btnSubscript.menu.items[index].options.icls; + // btnSubscript.$icon.addClass(btnSubscript.options.icls); + // } + // } + // + // this._state.subscript = subsc; + // this._state.superscript = supersc; + // } + // } + + /* read font size */ + var str_size = fontobj.asc_getFontSize(); + if (this._state.fontsize !== str_size) { + toolbar.cmbFontSize.setValue((str_size!==undefined) ? str_size : ''); + this._state.fontsize = str_size; + } + + /* read font color */ + // var clr, + // color, + // fontColorPicker = this.toolbar.mnuTextColorPicker; + // + // if (!fontColorPicker.isDummy) { + // color = fontobj.asc_getFontColor(); + // if (color) { + // if (color.get_auto()) { + // if (this._state.clrtext !== 'auto') { + // fontColorPicker.clearSelection(); + // this.toolbar.btnTextColor.setAutoColor(true); + // this._state.clrtext = 'auto'; + // } + // } else { + // if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + // clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + // } else { + // clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + // } + // var type1 = typeof(clr), + // type2 = typeof(this._state.clrtext); + // if ( (this._state.clrtext == 'auto') || (type1 !== type2) || (type1=='object' && + // (clr.effectValue!==this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color)<0)) || + // (type1!='object' && this._state.clrtext!==undefined && this._state.clrtext.indexOf(clr)<0 )) { + // + // this.toolbar.btnTextColor.setAutoColor(false); + // if (_.isObject(clr)) { + // var isselected = false; + // for (var i = 0; i < 10; i++) { + // if (Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue) { + // fontColorPicker.select(clr, true); + // isselected = true; + // break; + // } + // } + // if (!isselected) fontColorPicker.clearSelection(); + // } else { + // fontColorPicker.select(clr, true); + // } + // this._state.clrtext = clr; + // } + // } + // } + // this._state.clrtext_asccolor = color; + // } + + }, + onApiStyleChange: function() { this.toolbar.btnCopyStyle.toggle(false, true); this.modeAlwaysSetStyle = false; diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 5b9a230d8..502449a0e 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -31,7 +31,7 @@
- + diff --git a/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template b/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template index 6d16013bd..9ae163482 100644 --- a/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template +++ b/apps/spreadsheeteditor/main/app/template/ToolbarAnother.template @@ -78,41 +78,48 @@
- - - + + +
+
+
+ + + +
+
+
+
+
+ + +
+
+
+
+
+ + + +
+
+
+
+
+ +
+
+
-
-
- - -
-
-
-
-
- - -
-
-
-
-
- - - -
-
-
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 006b73d2c..fde018dba 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -266,24 +266,6 @@ define([ dataHintOffset: 'big' }); - me.btnDecDecimal = new Common.UI.Button({ - id : 'id-toolbar-btn-decdecimal', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-decdecimal', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.editVisibleArea], - dataHint : '1', - dataHintDirection: 'bottom' - }); - - me.btnIncDecimal = new Common.UI.Button({ - id : 'id-toolbar-btn-incdecimal', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-incdecimal', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.editVisibleArea], - dataHint : '1', - dataHintDirection: 'bottom' - }); - var formatTemplate = _.template([ '<% _.each(items, function(item) { %>', @@ -309,7 +291,35 @@ define([ dataHintOffset: 'big' }); } + if ( config.isEditMailMerge || config.isEditOle ) { + me.btnSearch = new Common.UI.Button({ + id : 'id-toolbar-btn-search', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-menu-search', + lock : [_set.lostConnect], + dataHint : '1', + dataHintDirection: 'bottom' + }); + } if ( config.isEditDiagram ) { + me.btnDecDecimal = new Common.UI.Button({ + id : 'id-toolbar-btn-decdecimal', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-decdecimal', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.editVisibleArea], + dataHint : '1', + dataHintDirection: 'bottom' + }); + + me.btnIncDecimal = new Common.UI.Button({ + id : 'id-toolbar-btn-incdecimal', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-incdecimal', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.editVisibleArea], + dataHint : '1', + dataHintDirection: 'bottom' + }); + me.btnEditChart = new Common.UI.Button({ id : 'id-toolbar-rtn-edit-chart', cls : 'btn-toolbar btn-text-default auto', @@ -344,16 +354,7 @@ define([ dataHintOffset: 'medium' }); } - if ( config.isEditMailMerge || config.isEditOle ) { - me.btnSearch = new Common.UI.Button({ - id : 'id-toolbar-btn-search', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-menu-search', - lock : [_set.lostConnect], - dataHint : '1', - dataHintDirection: 'bottom' - }); - + if ( config.isEditMailMerge) { me.btnSortDown = new Common.UI.Button({ id : 'id-toolbar-btn-sort-down', cls : 'btn-toolbar', @@ -392,6 +393,147 @@ define([ }); } if ( config.isEditOle ) { + me.cmbFontSize = new Common.UI.ComboBox({ + cls : 'input-group-nr', + menuStyle : 'min-width: 55px;', + hint : me.tipFontSize, + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + data : [ + { value: 8, displayValue: "8" }, + { value: 9, displayValue: "9" }, + { value: 10, displayValue: "10" }, + { value: 11, displayValue: "11" }, + { value: 12, displayValue: "12" }, + { value: 14, displayValue: "14" }, + { value: 16, displayValue: "16" }, + { value: 18, displayValue: "18" }, + { value: 20, displayValue: "20" }, + { value: 22, displayValue: "22" }, + { value: 24, displayValue: "24" }, + { value: 26, displayValue: "26" }, + { value: 28, displayValue: "28" }, + { value: 36, displayValue: "36" }, + { value: 48, displayValue: "48" }, + { value: 72, displayValue: "72" }, + { value: 96, displayValue: "96" } + ], + dataHint: '1', + dataHintDirection: 'bottom' + }); + + me.cmbFontName = new Common.UI.ComboBoxFonts({ + cls : 'input-group-nr', + menuCls : 'scrollable-menu', + menuStyle : 'min-width: 325px;', + hint : me.tipFontName, + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + store : new Common.Collections.Fonts(), + recent : 0, + dataHint: '1', + dataHintDirection: 'bottom' + }); + + me.btnWrap = new Common.UI.Button({ + id : 'id-toolbar-rtn-wrap', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-wrap', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], + enableToggle: true, + allowDepress: true, + dataHint : '1', + dataHintDirection: 'bottom' + }); + + me.btnMerge = new Common.UI.Button({ + id : 'id-toolbar-rtn-merge', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-merge-and-center', + enableToggle: true, + allowDepress: true, + split : true, + lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot, _set.wsLock], + menu : new Common.UI.Menu({ + items: [ + { + caption : me.txtMergeCenter, + iconCls : 'menu__icon btn-merge-and-center', + value : Asc.c_oAscMergeOptions.MergeCenter + }, + { + caption : me.txtMergeAcross, + iconCls : 'menu__icon btn-merge-across', + value : Asc.c_oAscMergeOptions.MergeAcross + }, + { + caption : me.txtMergeCells, + iconCls : 'menu__icon btn-merge-cells', + value : Asc.c_oAscMergeOptions.Merge + }, + { + caption : me.txtUnmerge, + iconCls : 'menu__icon btn-unmerge-cells', + value : Asc.c_oAscMergeOptions.None + } + ] + }), + dataHint : '1', + dataHintDirection: 'bottom' + }); + + me.mnuTextColorPicker = dummyCmp(); + me.btnTextColor = new Common.UI.ButtonColored({ + id : 'id-toolbar-btn-fontcolor', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-fontcolor', + split : true, + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat], + menu: true, + auto: true, + dataHint : '1', + dataHintDirection: 'bottom' + }); + + me.mnuBackColorPicker = dummyCmp(); + me.btnBackColor = new Common.UI.ButtonColored({ + id : 'id-toolbar-btn-fillparag', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-paracolor', + split : true, + lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormatFill], + transparent: true, + menu: true, + dataHint: '1', + dataHintDirection: 'bottom' + }); + + me.btnBorders = new Common.UI.Button({ + id : 'id-toolbar-btn-borders', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-border-out', + icls : 'btn-border-out', + borderId : 'outer', + borderswidth: Asc.c_oAscBorderStyles.Thin, + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], + split : true, + menu : true, + dataHint : '1', + dataHintDirection: 'bottom' + }); + + me.btnTableTemplate = new Common.UI.Button({ + id : 'id-toolbar-btn-ttempl', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-menu-table', + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.wsLock], + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') } + ] + }), + dataHint : '1', + dataHintDirection: 'bottom' + }); + me.btnVisibleArea = new Common.UI.Button({ id : 'id-toolbar-btn-visible-area', cls : 'btn-toolbar btn-icon-default', @@ -416,8 +558,7 @@ define([ visible : false, // style : 'min-width: 120px;', dataHint : '1', - dataHintDirection: 'bottom', - dataHintOffset: 'big' + dataHintDirection: 'bottom' }); } diff --git a/apps/spreadsheeteditor/main/resources/less/toolbar.less b/apps/spreadsheeteditor/main/resources/less/toolbar.less index 7cab7037c..c5f17d9db 100644 --- a/apps/spreadsheeteditor/main/resources/less/toolbar.less +++ b/apps/spreadsheeteditor/main/resources/less/toolbar.less @@ -113,10 +113,6 @@ border: @scaled-one-px-value solid @border-regular-control; } -#slot-field-fontname { - width: 127px; -} - #slot-field-fontsize { width: 45px; }