From 60ca0ddafe0338eb9cb71a061c888aade5227454 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 15 Feb 2021 11:35:48 +0300 Subject: [PATCH 1/3] [SSE] Add cell indent --- .../main/app/template/CellSettings.template | 10 ++++++ .../main/app/view/CellSettings.js | 35 +++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 1 + 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/CellSettings.template b/apps/spreadsheeteditor/main/app/template/CellSettings.template index 78fb733e6..94a3e6715 100644 --- a/apps/spreadsheeteditor/main/app/template/CellSettings.template +++ b/apps/spreadsheeteditor/main/app/template/CellSettings.template @@ -109,6 +109,16 @@
+ + + + + + + +
+ + diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 325849ad9..108fcf05a 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -73,6 +73,7 @@ define([ DisabledControls: true, DisabledFillPanels: false, CellAngle: undefined, + CellIndent: undefined, GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR, CellColor: 'transparent', FillType: Asc.c_oAscFill.FILL_TYPE_NOFILL, @@ -150,6 +151,10 @@ define([ this.api && this.api.asc_setCellAngle(field.getNumberValue()); }, + onIndentChange: function(field, newValue, oldValue, eOpts) { + this.api && this.api.asc_setCellIndent(field.getNumberValue()); + }, + render: function () { var el = $(this.el); el.html(this.template({ @@ -429,6 +434,21 @@ define([ }); this.lockedControls.push(this.btnBackColor); + this.spnIndent = new Common.UI.MetricSpinner({ + el: $('#cell-spin-indent'), + step: 1, + width: 60, + defaultUnit : "", + value: '0', + allowDecimal: false, + maxValue: 250, + minValue: 0, + disabled: this._locked + }); + this.lockedControls.push(this.spnIndent); + this.spnIndent.on('change', _.bind(this.onIndentChange, this)); + this.spnIndent.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnAngle = new Common.UI.MetricSpinner({ el: $('#cell-spin-angle'), step: 1, @@ -512,12 +532,21 @@ define([ this._noApply = true; var xfs = props.asc_getXfs(), - value = xfs.asc_getAngle(); + value = xfs.asc_getAngle(), + align = xfs.asc_getHorAlign(); if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) { this.spnAngle.setValue((value !== null) ? (value==255 ? 0 : value) : '', true); this._state.CellAngle = value; } + value = xfs.asc_getIndent(); + if (Math.abs(this._state.CellIndent - value) > 0.1 || (this._state.CellIndent === undefined) && (this._state.CellIndent !== value)) { + this.spnIndent.setValue((value !== null) ? value : '', true); + this._state.CellIndent = value; + } + this._state.IndentDisabled = (this._state.CellAngle>0 || align!==AscCommon.align_Left && align!==AscCommon.align_Right); + this.spnIndent.setDisabled(this._locked || this._state.IndentDisabled); + value = xfs.asc_getWrapText(); if ( this._state.Wrap!==value ) { this.chWrap.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); @@ -898,6 +927,7 @@ define([ item.setDisabled(disable); }); } + this.spnIndent.setDisabled(disable || this._state.IndentDisabled); }, onFillSrcSelect: function(combo, record) { @@ -1319,7 +1349,8 @@ define([ textGradientColor: 'Color', textPosition: 'Position', tipAddGradientPoint: 'Add gradient point', - tipRemoveGradientPoint: 'Remove gradient point' + tipRemoveGradientPoint: 'Remove gradient point', + textIndent: 'Indent' }, SSE.Views.CellSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 1e6d0758a..f25b73cca 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1370,6 +1370,7 @@ "SSE.Views.CellSettings.tipRemoveGradientPoint": "Remove gradient point", "SSE.Views.CellSettings.tipRight": "Set outer right border only", "SSE.Views.CellSettings.tipTop": "Set outer top border only", + "SSE.Views.CellSettings.textIndent": "Indent", "SSE.Views.ChartDataDialog.errorInFormula": "There's an error in formula you entered.", "SSE.Views.ChartDataDialog.errorInvalidReference": "The reference is not valid. Reference must be to an open worksheet.", "SSE.Views.ChartDataDialog.errorMaxPoints": "The maximum number of points in series per chart is 4096.", From 96d8acdf5f4bd3ed15c7902e9623b17c23315050 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 Feb 2021 18:58:37 +0300 Subject: [PATCH 2/3] [SSE] Enable cell indent --- apps/spreadsheeteditor/main/app/view/CellSettings.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 108fcf05a..7c12a57cc 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -532,8 +532,7 @@ define([ this._noApply = true; var xfs = props.asc_getXfs(), - value = xfs.asc_getAngle(), - align = xfs.asc_getHorAlign(); + value = xfs.asc_getAngle(); if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) { this.spnAngle.setValue((value !== null) ? (value==255 ? 0 : value) : '', true); this._state.CellAngle = value; @@ -544,8 +543,6 @@ define([ this.spnIndent.setValue((value !== null) ? value : '', true); this._state.CellIndent = value; } - this._state.IndentDisabled = (this._state.CellAngle>0 || align!==AscCommon.align_Left && align!==AscCommon.align_Right); - this.spnIndent.setDisabled(this._locked || this._state.IndentDisabled); value = xfs.asc_getWrapText(); if ( this._state.Wrap!==value ) { @@ -927,7 +924,6 @@ define([ item.setDisabled(disable); }); } - this.spnIndent.setDisabled(disable || this._state.IndentDisabled); }, onFillSrcSelect: function(combo, record) { From 3a33e84f4549a71c9002d556063ff315b4fc5287 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 Feb 2021 19:40:06 +0300 Subject: [PATCH 3/3] Refactoring --- apps/spreadsheeteditor/main/app/view/CellSettings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 7c12a57cc..a726df8c2 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -148,11 +148,11 @@ define([ }, onAngleChange: function(field, newValue, oldValue, eOpts) { - this.api && this.api.asc_setCellAngle(field.getNumberValue()); + this.api && (newValue!==oldValue) && this.api.asc_setCellAngle(field.getNumberValue()); }, onIndentChange: function(field, newValue, oldValue, eOpts) { - this.api && this.api.asc_setCellIndent(field.getNumberValue()); + this.api && (newValue!==oldValue) && this.api.asc_setCellIndent(field.getNumberValue()); }, render: function () {