diff --git a/apps/common/main/lib/view/ListSettingsDialog.js b/apps/common/main/lib/view/ListSettingsDialog.js index 7acce541d..aa77d226c 100644 --- a/apps/common/main/lib/view/ListSettingsDialog.js +++ b/apps/common/main/lib/view/ListSettingsDialog.js @@ -62,8 +62,7 @@ define([ }, initialize : function(options) { - this.type = (options.type>0) ? 1 : 0; - this.subtype = (options.subtype>=0) ? options.subtype : 1; + this.type = options.type || 0; _.extend(this.options, { title: this.txtTitle @@ -173,7 +172,7 @@ define([ this._changedProps.asc_putListType(1, record.value); } }, this)); - this.cmbNumFormat.setValue(this.subtype); + this.cmbNumFormat.setValue(1); var itemsTemplate = [ @@ -222,7 +221,9 @@ define([ formcontrol[0].innerHTML = ''; } }); - this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.at(1)); + var rec = this.cmbBulletFormat.store.at(1); + this.cmbBulletFormat.selectRecord(rec); + this.bulletProps = {symbol: rec.get('symbol'), font: rec.get('font')}; this.cmbBulletFormat.on('selected', _.bind(function (combo, record) { if (this._changedProps) { if (record.value === 1) { @@ -348,7 +349,14 @@ define([ if (this.options.handler) { var type = this.btnBullet.pressed ? 0 : 1; - if (this._changedProps && (this.type !== type)) { + if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { + this._changedProps = new Asc.asc_CBullet(); + this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)); + this._changedProps.asc_putSize(this.spnSize.getNumberValue()); + } + + if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE || + this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR && type==1 || this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM && type==0) { // changed list type if (type==0) {//markers if (this.cmbBulletFormat.getValue()==-1) { this._changedProps.asc_putListType(0, -1); @@ -357,8 +365,7 @@ define([ this._changedProps.asc_putSymbol(this.bulletProps.symbol); } } else { - var value = this.cmbNumFormat.getValue(); - this._changedProps.asc_putListType(1, value); + this._changedProps.asc_putListType(1, this.cmbNumFormat.getValue()); this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue()); } } @@ -378,11 +385,11 @@ define([ _setDefaults: function (props) { if (props) { - (this.type == 0) ? this.btnBullet.toggle(true) : this.btnNumbering.toggle(true); - this.ShowHideElem(this.type); - + var type = 0; var bullet = props.asc_getBullet(); if (bullet) { + this.originalType = bullet.asc_getType(); + this.spnSize.setValue(bullet.asc_getSize() || '', true); var color = bullet.asc_getColor(); @@ -394,6 +401,7 @@ define([ } } else color = 'transparent'; + this.color = Common.Utils.ThemeColor.colorValue2EffectId(color); this.btnColor.setColor(color); if ( typeof(color) == 'object' ) { var isselected = false; @@ -408,41 +416,42 @@ define([ } else this.colors.select(color,true); - var symbol = bullet.asc_getSymbol(); - if (symbol===undefined) { // numbered - this.cmbNumFormat.setValue(this.subtype, ''); - var rec = this.cmbBulletFormat.store.at(1); - this.cmbBulletFormat.selectRecord(rec); - this.bulletProps = {symbol: rec.get('symbol'), font: rec.get('font')}; - - var value = bullet.asc_getNumStartAt(); - this.spnStart.setValue(value || '', true); - this.spnStart.setDisabled(value===null); - } else { - this.bulletProps = {symbol: (symbol!==null) ? symbol : '', font: bullet.asc_getFont()}; - if (symbol!==null) { + if (this.originalType == AscFormat.BULLET_TYPE_BULLET_NONE) { + this.cmbNumFormat.setValue(-1); + this.cmbBulletFormat.setValue(-1); + type = this.type; + } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_CHAR) { + var symbol = bullet.asc_getSymbol(); + if (symbol) { + this.bulletProps = {symbol: symbol, font: bullet.asc_getFont()}; if (!this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})) this.cmbBulletFormat.store.add({ displayValue: this.txtSymbol + ': ', value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font }, {at: this.cmbBulletFormat.store.length-1}); this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models); this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value: 0, symbol: this.bulletProps.symbol, font: this.bulletProps.font})); } else this.cmbBulletFormat.setValue(''); - this.cmbNumFormat.setValue(1); + this._changedProps = bullet; + type = 0; + } else if (this.originalType == AscFormat.BULLET_TYPE_BULLET_AUTONUM) { + var autonum = bullet.asc_getAutoNumType(); + this.cmbNumFormat.setValue(autonum, ''); + + var value = bullet.asc_getNumStartAt(); + this.spnStart.setValue(value || '', true); + this.spnStart.setDisabled(value===null); + this._changedProps = bullet; + type = 1; } - this._changedProps = bullet; - } - } - if (!this._changedProps) { - this._changedProps = new Asc.asc_CBullet(); - this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)); - this._changedProps.asc_putSize(this.spnSize.getNumberValue()); - if (this.type==0) { - this._changedProps.asc_putListType(0, this.cmbBulletFormat.getValue()); - } else { - this._changedProps.asc_putListType(1, this.cmbNumFormat.getValue()); - this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue()); + } else {// different bullet types + this.cmbNumFormat.setValue(-1); + this.cmbBulletFormat.setValue(-1); + this._changedProps = new Asc.asc_CBullet(); + type = this.type; } } + + (type == 1) ? this.btnNumbering.toggle(true) : this.btnBullet.toggle(true); + this.ShowHideElem(type); }, txtTitle: 'List Settings', diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 9e012cc0f..eff06972e 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -486,7 +486,6 @@ define([ this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype, true); else this.toolbar.mnuMarkersPicker.deselectAll(true); - this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(this._state.bullets.subtype<0); break; case 1: var idx = 0; @@ -515,7 +514,6 @@ define([ } this.toolbar.btnNumbers.toggle(true, true); this.toolbar.mnuNumbersPicker.selectByIndex(idx, true); - this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(idx==0); break; } } @@ -1136,17 +1134,12 @@ define([ api: me.api, props: props, type: type, - subtype: this._state.bullets.subtype, interfaceLang: me.toolbar.mode.lang, handler: function(result, value) { if (result == 'ok') { if (me.api) { - if (value==-1) - me.api.put_ListType(0, -1); - else { - props.asc_putBullet(value); - me.api.paraApply(props); - } + props.asc_putBullet(value); + me.api.paraApply(props); } } Common.NotificationCenter.trigger('edit:complete', me.toolbar); @@ -1715,8 +1708,6 @@ define([ this.toolbar.mnuMarkersPicker.selectByIndex(0, true); this.toolbar.mnuNumbersPicker.selectByIndex(0, true); - this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(true); - this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(true); }, _getApiTextSize: function () { diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 4537f48c0..e3b673fbe 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1111,7 +1111,6 @@ define([ {template: _.template('')}, this.mnuMarkerSettings = new Common.UI.MenuItem({ caption: this.textListSettings, - disabled: (this.mnuMarkersPicker.conf.index || 0)==0, value: 'settings' }) ] @@ -1124,7 +1123,6 @@ define([ {template: _.template('')}, this.mnuNumberSettings = new Common.UI.MenuItem({ caption: this.textListSettings, - disabled: (this.mnuNumbersPicker.conf.index || 0)==0, value: 'settings' }) ] diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 5b32ada45..03743a1a8 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -777,8 +777,7 @@ define([ (new Common.Views.ListSettingsDialog({ api: me.api, props: props, - type: listtype.get_ListType(), - subtype: listtype.get_ListSubType(), + type: 0, interfaceLang: me.permissions.lang, handler: function(result, value) { if (result == 'ok') {