diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 8dac6cc17..8ffba1130 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -126,7 +126,8 @@ define([ 'insert:shape' : this.onInsertShape.bind(this), 'add:slide' : this.onAddSlide.bind(this), 'change:slide' : this.onChangeSlide.bind(this), - 'change:compact' : this.onClickChangeCompact + 'change:compact' : this.onClickChangeCompact, + 'add:chart' : this.onSelectChart }, 'FileMenu': { 'menu:hide': this.onFileMenu.bind(this, 'hide'), @@ -308,7 +309,6 @@ define([ toolbar.btnColorSchemas.menu.on('item:click', _.bind(this.onColorSchemaClick, this)); toolbar.btnColorSchemas.menu.on('show:after', _.bind(this.onColorSchemaShow, this)); toolbar.btnSlideSize.menu.on('item:click', _.bind(this.onSlideSize, this)); - toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header')); @@ -1585,11 +1585,8 @@ define([ } }, - onSelectChart: function(picker, item, record) { - if (!record) return; - + onSelectChart: function(type) { var me = this, - type = record.get('type'), chart = false; var selectedElements = me.api.getSelectedElements(); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 39bc1c26a..a7e499d94 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -528,12 +528,7 @@ define([ iconCls: 'btn-insertchart', caption: me.capInsertChart, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], - menu: new Common.UI.Menu({ - style: 'width: 435px;', - items: [ - {template: _.template('')} - ] - }) + menu: true }); me.slideOnlyControls.push(me.btnInsertChart); @@ -1088,6 +1083,71 @@ define([ }) ); + this.btnInsertChart.setMenu( new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + {template: _.template('')} + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, + {id: 'menu-chart-group-line', caption: me.textLine}, + {id: 'menu-chart-group-pie', caption: me.textPie}, + {id: 'menu-chart-group-hbar', caption: me.textBar}, + {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, + {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, + {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} + // {id: 'menu-chart-group-surface', caption: me.textSurface} + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} + + ]), + itemTemplate: _.template('
') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('add:chart', [record.get('type')]); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); + // set dataviews var _conf = this.mnuMarkersPicker.conf; @@ -1131,55 +1191,6 @@ define([ }); _conf && this.mnuNumbersPicker.selectByIndex(_conf.index, true); - this.mnuInsertChartPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insertchart'), - parentMenu: this.btnInsertChart.menu, - showLast: false, - restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts }, - { id: 'menu-chart-group-line', caption: me.textLine }, - { id: 'menu-chart-group-pie', caption: me.textPie }, - { id: 'menu-chart-group-hbar', caption: me.textBar }, - { id: 'menu-chart-group-area', caption: me.textArea, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'} - ]), - itemTemplate: _.template('
') - }); - this.mnuTablePicker = new Common.UI.DimensionPicker({ el: $('#id-toolbar-menu-tablepicker'), minRows: 8, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 014468c4d..231ec7a3c 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -70,7 +70,8 @@ define([ this.addListeners({ 'Toolbar': { - 'change:compact': this.onClickChangeCompact.bind(me) + 'change:compact': this.onClickChangeCompact.bind(me), + 'add:chart' : this.onSelectChart }, 'FileMenu': { 'menu:hide': me.onFileMenu.bind(me, 'hide'), @@ -315,7 +316,6 @@ define([ toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this)); toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this)); toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this)); - toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); @@ -975,31 +975,30 @@ define([ } }, - onSelectChart: function(picker, item, record, e) { - if (!this.editMode || !record) return; + onSelectChart: function(group, type) { + if (!this.editMode) return; var me = this, info = me.api.asc_getCellInfo(), - type = info.asc_getFlags().asc_getSelectionType(), - group = record.get('group'), + seltype = info.asc_getFlags().asc_getSelectionType(), isSpark = (group == 'menu-chart-group-sparkcolumn' || group == 'menu-chart-group-sparkline' || group == 'menu-chart-group-sparkwin'); - if (type!=Asc.c_oAscSelectionType.RangeImage && me.api) { + if (seltype!=Asc.c_oAscSelectionType.RangeImage && me.api) { var win, props; - if (isSpark && (type==Asc.c_oAscSelectionType.RangeCells || type==Asc.c_oAscSelectionType.RangeCol || - type==Asc.c_oAscSelectionType.RangeRow || type==Asc.c_oAscSelectionType.RangeMax)) { + if (isSpark && (seltype==Asc.c_oAscSelectionType.RangeCells || seltype==Asc.c_oAscSelectionType.RangeCol || + seltype==Asc.c_oAscSelectionType.RangeRow || seltype==Asc.c_oAscSelectionType.RangeMax)) { var sparkLineInfo = info.asc_getSparklineInfo(); if (!!sparkLineInfo) { var props = new Asc.sparklineGroup(); - props.asc_setType(record.get('type')); + props.asc_setType(type); this.api.asc_setSparklineGroup(sparkLineInfo.asc_getId(), props); } else { // add sparkline } } else if (!isSpark) { - var ischartedit = ( type == Asc.c_oAscSelectionType.RangeChart || type == Asc.c_oAscSelectionType.RangeChartText); + var ischartedit = ( seltype == Asc.c_oAscSelectionType.RangeChart || seltype == Asc.c_oAscSelectionType.RangeChartText); props = me.api.asc_getChartObject(true); // don't lock chart object if (props) { - (ischartedit) ? props.changeType(record.get('type')) : props.putType(record.get('type')); + (ischartedit) ? props.changeType(type) : props.putType(type); var range = props.getRange(), isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !props.getInColumns(), props.getType()); if (isvalid == Asc.c_oAscError.ID.No) { @@ -1017,8 +1016,6 @@ define([ } } } - if (e.type !== 'click') - me.toolbar.btnInsertChart.menu.hide(); Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 79bdbd338..c9e9c6eac 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -668,12 +668,7 @@ define([ iconCls : 'btn-insertchart', lock : [_set.editCell, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], caption : me.capInsertChart, - menu : new Common.UI.Menu({ - style: 'width: 435px;', - items: [ - { template: _.template('') } - ] - }) + menu : true }); me.btnInsertShape = new Common.UI.Button({ @@ -1769,60 +1764,76 @@ define([ } if ( this.btnInsertChart ) { - this.mnuInsertChartPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insertchart'), - parentMenu: this.btnInsertChart.menu, - showLast: false, - restoreHeight: 539, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts }, - { id: 'menu-chart-group-line', caption: me.textLine }, - { id: 'menu-chart-group-pie', caption: me.textPie }, - { id: 'menu-chart-group-hbar', caption: me.textBar }, - { id: 'menu-chart-group-area', caption: me.textArea, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - // ,{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: me.textSparks }, - // { id: 'menu-chart-group-sparkline', inline: true }, - // { id: 'menu-chart-group-sparkwin', inline: true } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'} - // ,{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, - // { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, - // { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} - ]), - itemTemplate: _.template('
') - }); + this.btnInsertChart.setMenu(new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + { template: _.template('') } + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, + {id: 'menu-chart-group-line', caption: me.textLine}, + {id: 'menu-chart-group-pie', caption: me.textPie}, + {id: 'menu-chart-group-hbar', caption: me.textBar}, + {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, + {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, + {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} + // { id: 'menu-chart-group-surface', caption: me.textSurface} + // ,{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: me.textSparks }, + // { id: 'menu-chart-group-sparkline', inline: true }, + // { id: 'menu-chart-group-sparkwin', inline: true } + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} + // ,{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, + // { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, + // { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} + ]), + itemTemplate: _.template('
') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('add:chart', [record.get('group'), record.get('type')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); } if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram)