From 83aeabb62375e6da8ae5e67418423c196b2f446c Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 18 Sep 2019 16:12:39 +0300 Subject: [PATCH 1/7] =?UTF-8?q?[DE]=20Line=20Numbers=20=D0=90=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D1=80:=20Julia=20Svinareva=20=20=D0=94=D0=B0=D1=82=D0=B0:=2019=20=D1=81=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D1=8F=D0=B1=D1=80=D1=8F=202019=20=D0=B3.=2010:20:21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/app/controller/Toolbar.js | 31 ++- .../main/app/template/Toolbar.template | 1 + .../main/app/view/LineNumbersDialog.js | 194 ++++++++++++++++++ apps/documenteditor/main/app/view/Toolbar.js | 61 +++++- 4 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 apps/documenteditor/main/app/view/LineNumbersDialog.js diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index b2b2974bf..fa5398ffd 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -60,7 +60,8 @@ define([ 'documenteditor/main/app/view/WatermarkSettingsDialog', 'documenteditor/main/app/view/CompareSettingsDialog', 'documenteditor/main/app/view/ListSettingsDialog', - 'documenteditor/main/app/view/DateTimeDialog' + 'documenteditor/main/app/view/DateTimeDialog', + 'documenteditor/main/app/view/LineNumbersDialog' ], function () { 'use strict'; @@ -334,6 +335,7 @@ define([ toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this)); toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this)); toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this)); + toolbar.btnLineNumbers.menu.on('item:click', _.bind(this.onLineNumbersSelect, this)); Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this)); $('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this)); @@ -1674,6 +1676,33 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onLineNumbersSelect: function(menu, item) { + switch (item.value) { + case 0: + break; + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + var win, + me = this; + win = new DE.Views.LineNumbersDialog({ + handler: function(dlg, result) { + if (result == 'ok') { + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + } + }); + win.show(); + break; + } + }, + onColorSchemaClick: function(menu, item) { if (this.api) { this.api.asc_ChangeColorSchemeByIdx(item.value); diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index ad2a425a7..255dbd46a 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -130,6 +130,7 @@ +
diff --git a/apps/documenteditor/main/app/view/LineNumbersDialog.js b/apps/documenteditor/main/app/view/LineNumbersDialog.js new file mode 100644 index 000000000..30645d25f --- /dev/null +++ b/apps/documenteditor/main/app/view/LineNumbersDialog.js @@ -0,0 +1,194 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * +*/ +/** + * LineNumbersDialog.js + * + * Created by Julia Svinareva on 18/09/19 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/component/Window', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/MetricSpinner' +], function () { 'use strict'; + + DE.Views.LineNumbersDialog = Common.UI.Window.extend(_.extend({ + options: { + width: 300, + header: true, + style: 'min-width: 216px;', + cls: 'modal-dlg' + }, + + initialize : function(options) { + _.extend(this.options, { + title: this.textTitle + }, options || {}); + + this.template = [ + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + + this.spinners = []; + this._noApply = false; + + Common.UI.Window.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + this.chAddLineNumbering = new Common.UI.CheckBox({ + el: $('#line-numbers-add-line-numbering'), + labelText: this.textAddLineNumbering + }); + + this.spnStartAt = new Common.UI.MetricSpinner({ + el: $('#line-numbers-start-at'), + step: 1, + width: 80, + defaultUnit : '', + value: 1, + maxValue: 32767, + minValue: 1 + }); + + this.spnFromText = new Common.UI.MetricSpinner({ + el: $('#line-numbers-from-text'), + step: 0.1, + width: 80, + defaultUnit : 'cm', + value: 0.4, + maxValue: 55.87, + minValue: 0 + }); + this.spinners.push(this.spnFromText); + + this.spnCountBy = new Common.UI.MetricSpinner({ + el: $('#line-numbers-count-by'), + step: 1, + width: 80, + defaultUnit : '', + value: 1, + maxValue: 100, + minValue: 1 + }); + + this.rbRestartEachPage = new Common.UI.RadioBox({ + el: $('#line-numbers-restart-each-page'), + labelText: this.textRestartEachPage, + name: 'asc-radio-line-numbers' + }); + + this.rbRestartEachSection = new Common.UI.RadioBox({ + el: $('#line-numbers-restart-each-section'), + labelText: this.textRestartEachSection, + name: 'asc-radio-line-numbers' + }); + + this.rbContinuous = new Common.UI.RadioBox({ + el: $('#line-numbers-continuous'), + labelText: this.textContinuous, + name: 'asc-radio-line-numbers' + }); + + + this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + + this.updateMetricUnit(); + }, + + _handleInput: function(state) { + if (this.options.handler) { + this.options.handler.call(this, this, state); + } + + this.close(); + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + onPrimary: function() { + this._handleInput('ok'); + return false; + }, + + getSettings: function() { + return this; + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i Date: Thu, 19 Sep 2019 10:20:21 +0300 Subject: [PATCH 2/7] [DE] Line Numbers --- .../ParagraphSettingsAdvanced.template | 5 +++ .../main/app/view/LineNumbersDialog.js | 45 +++++++++++++------ .../app/view/ParagraphSettingsAdvanced.js | 8 +++- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template b/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template index 8fa069f2c..b97fe4433 100644 --- a/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template +++ b/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template @@ -79,6 +79,11 @@
+ + +
+ +
diff --git a/apps/documenteditor/main/app/view/LineNumbersDialog.js b/apps/documenteditor/main/app/view/LineNumbersDialog.js index 30645d25f..68a483c48 100644 --- a/apps/documenteditor/main/app/view/LineNumbersDialog.js +++ b/apps/documenteditor/main/app/view/LineNumbersDialog.js @@ -46,9 +46,9 @@ define([ DE.Views.LineNumbersDialog = Common.UI.Window.extend(_.extend({ options: { - width: 300, + width: 290, header: true, - style: 'min-width: 216px;', + style: 'min-width: 290px;', cls: 'modal-dlg' }, @@ -59,16 +59,16 @@ define([ this.template = [ '
', - '
', - '
', - '
', - '
', + '
', + '
', + '
', + '
', '
', '
', - '
', - '
', - '
', - '
', + '
', + '
', + '
', + '
', '
', '', - '' ].join(''); @@ -107,7 +105,8 @@ define([ defaultUnit : '', value: 1, maxValue: 32767, - minValue: 1 + minValue: 1, + disabled: true }); this.spnFromText = new Common.UI.MetricSpinner({ @@ -118,7 +117,8 @@ define([ value: 'Auto', maxValue: 55.87, minValue: 0.1, - allowAuto: true + allowAuto: true, + disabled: true }); this.spinners.push(this.spnFromText); @@ -129,25 +129,30 @@ define([ defaultUnit : '', value: 1, maxValue: 100, - minValue: 1 + minValue: 1, + disabled: true }); this.rbRestartEachPage = new Common.UI.RadioBox({ el: $('#line-numbers-restart-each-page'), labelText: this.textRestartEachPage, - name: 'asc-radio-line-numbers' + name: 'asc-radio-line-numbers', + disabled: true, + checked: true }); this.rbRestartEachSection = new Common.UI.RadioBox({ el: $('#line-numbers-restart-each-section'), labelText: this.textRestartEachSection, - name: 'asc-radio-line-numbers' + name: 'asc-radio-line-numbers', + disabled: true }); this.rbContinuous = new Common.UI.RadioBox({ el: $('#line-numbers-continuous'), labelText: this.textContinuous, - name: 'asc-radio-line-numbers' + name: 'asc-radio-line-numbers', + disabled: true }); @@ -157,11 +162,21 @@ define([ }, afterRender: function() { - this._setDefaults(); }, - _setDefaults: function() { - + setSettings: function (props) { + if (props) { + // var type = props.asc_getType(); + // this.chAddLineNumbering.setValue(type !== case Asc.None); + // switch (type) { + // case Asc.Continuous: this.rbContinuous.setValue(true, true); break; + // case Asc.Page: this.rbRestartEachPage.setValue(true, true); break; + // case Asc.Section: this.rbRestartEachSection.setValue(true, true); break; + // } + // this.spnStartAt.setValue(props.get_StartAt()!==null ? props.get_StartAt() : '', true); + // this.spnFromText.setValue(props.get_FromText()!==null ? (props.get_FromText()<0 ? -1 : Common.Utils.Metric.fnRecalcFromMM(props.get_FromText())) : '', true); + // this.spnCountBy.setValue(props.get_Count()!==null ? props.get_Count() : '', true); + } }, _handleInput: function(state) { @@ -182,7 +197,22 @@ define([ }, getSettings: function() { - return this; + // var props = new Asc.CDocumentLineNumberProps(); + // if (this.chAddLineNumbering.getValue()!=='checked') { + // props.put_Type(Asc.None); + // } else { + // if (this.rbContinuous.getValue()) + // props.put_Type(Asc.Continuous); + // else if (this.rbRestartEachPage.getValue()) + // props.put_Type(Asc.Page); + // else if (this.rbRestartEachSection.getValue()) + // props.put_Type(Asc.Section); + // props.put_StartAt(this.spnStartAt.getNumberValue()); + // var value = this.spnFromText.getNumberValue(); + // props.put_FromText(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM()); + // props.put_Count(this.spnCountBy.getNumberValue()); + // } + // return props; }, updateMetricUnit: function() { @@ -196,9 +226,7 @@ define([ }, - textTitle: 'Line Numbers Settings', - cancelButtonText: 'Cancel', - okButtonText: 'Ok', + textTitle: 'Line Numbers', textAddLineNumbering: 'Add line numbering', textStartAt: 'Start at', textFromText: 'From text', diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index 558a2a49d..b79f5a641 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -350,6 +350,11 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem el: $('#paragraphadv-checkbox-suppress-line-numbers'), labelText: this.strSuppressLineNumbers }); + this.chLineNumbers.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + // this._changedProps.put_SuppressLineNumbers(field.getValue()=='checked'); + } + }, this)); // Borders @@ -779,6 +784,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this.chKeepNext.setValue((props.get_KeepNext() !== null && props.get_KeepNext() !== undefined) ? props.get_KeepNext() : 'indeterminate', true); this.chOrphan.setValue((props.get_WidowControl() !== null && props.get_WidowControl() !== undefined) ? props.get_WidowControl() : 'indeterminate', true); + // this.chLineNumbers.setValue((props.get_SuppressLineNumbers() !== null && props.get_SuppressLineNumbers() !== undefined) ? props.get_SuppressLineNumbers() : 'indeterminate', true); + this.Borders = new Asc.asc_CParagraphBorders(props.get_Borders()); // Margins diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 7ae282680..4d01f9555 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1009,15 +1009,13 @@ define([ { caption: this.textSuppressForCurrentParagraph, checkable: true, - toggleGroup: 'menuLineNumbers', + allowDepress: true, value: 4 }, {caption: '--'}, { caption: this.textCustomLineNumbers, - value: 5, - checkable: true, - toggleGroup: 'menuLineNumbers' + value: 5 } ] }) @@ -2420,8 +2418,8 @@ define([ textRestartEachPage: 'Restart Each Page', textRestartEachSection: 'Restart Each Section', textSuppressForCurrentParagraph: 'Suppress for Current Paragraph', - textCustomLineNumbers: 'Custom Line Numbers', - tipLineNumbers: 'Line Numbers' + textCustomLineNumbers: 'Line Numbering Options', + tipLineNumbers: 'Show line numbers' } })(), DE.Views.Toolbar || {})); }); From b76e5ce940544aa40f0050a4c69de4e07b365b21 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 28 Sep 2020 15:37:43 +0300 Subject: [PATCH 4/7] [DE] Add icons --- apps/documenteditor/main/app/view/Toolbar.js | 2 +- .../img/toolbar/1.25x/big/btn-line-numbering.png | Bin 0 -> 311 bytes .../img/toolbar/1.5x/big/btn-line-numbering.png | Bin 0 -> 343 bytes .../img/toolbar/1.75x/big/btn-line-numbering.png | Bin 0 -> 343 bytes .../img/toolbar/1x/big/btn-line-numbering.png | Bin 0 -> 238 bytes .../img/toolbar/2x/big/btn-line-numbering.png | Bin 0 -> 375 bytes 6 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-line-numbering.png create mode 100644 apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-line-numbering.png create mode 100644 apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-line-numbering.png create mode 100644 apps/documenteditor/main/resources/img/toolbar/1x/big/btn-line-numbering.png create mode 100644 apps/documenteditor/main/resources/img/toolbar/2x/big/btn-line-numbering.png diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 4d01f9555..ede840dd5 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -977,7 +977,7 @@ define([ this.btnLineNumbers = new Common.UI.Button({ id: 'tlbtn-line-numbers', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-columns', + iconCls: 'toolbar__icon btn-line-numbering', caption: me.capBtnLineNumbers, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', diff --git a/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-line-numbering.png b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/btn-line-numbering.png new file mode 100644 index 0000000000000000000000000000000000000000..a2f0d3a2bdf459d06e6e7964686b90f404c2e19e GIT binary patch literal 311 zcmV-70m%M|P)STlx!lTb5uM1T=b)5t(0 zo+i-f2BS^tRHAB_y$K?iy$OHfGli4#83*pBmp47@k2OQWy|R1I>_2gUT3< z(ByXz!~$-j8P`NJm_abg*cQB-tUnMi$yLU(chh&H!*rP1cmnGcRz3ME{0IO5002ov JPDHLkV1m-*eKP<6 literal 0 HcmV?d00001 diff --git a/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-line-numbering.png b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/btn-line-numbering.png new file mode 100644 index 0000000000000000000000000000000000000000..4fd62505912903b64548510f7951c7e4ae441275 GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^AwaCf!3-p&=Jq%NDdPa25LY1W0tT+GuK!^GC;()7 zcz6IwXJ=;!*TKO7!jRA`t_EroED7=pW~l#vABY+n6cp}n*r4$K{UINZy+FxBo-U3d z6^w7Eb)Gt`Ai(yud$ron{(b*1Pun097Zk~o{EoJpw%{4z|$G_|32~YM$5Hr+eqiPq^|h=#I&UWz+9`ValAMG+Avk%hIF$P0OzK zZ(6qc#b@)yzSoyJyqu;zY1d?ryPQkksrcUQoaN=@8(VVqf62Ljua9q8EFFBOB+NzM9|+0%f5Bz|N8E~^fs@Ta^9?p%SxhZYtuwMq|175IJ5t7_#LEH{?>x+ruP58 RQb6A@c)I$ztaD0e0s!DdpEm#i literal 0 HcmV?d00001 diff --git a/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-line-numbering.png b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/btn-line-numbering.png new file mode 100644 index 0000000000000000000000000000000000000000..4fd62505912903b64548510f7951c7e4ae441275 GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^AwaCf!3-p&=Jq%NDdPa25LY1W0tT+GuK!^GC;()7 zcz6IwXJ=;!*TKO7!jRA`t_EroED7=pW~l#vABY+n6cp}n*r4$K{UINZy+FxBo-U3d z6^w7Eb)Gt`Ai(yud$ron{(b*1Pun097Zk~o{EoJpw%{4z|$G_|32~YM$5Hr+eqiPq^|h=#I&UWz+9`ValAMG+Avk%hIF$P0OzK zZ(6qc#b@)yzSoyJyqu;zY1d?ryPQkksrcUQoaN=@8(VVqf62Ljua9q8EFFBOB+NzM9|+0%f5Bz|N8E~^fs@Ta^9?p%SxhZYtuwMq|175IJ5t7_#LEH{?>x+ruP58 RQb6A@c)I$ztaD0e0s!DdpEm#i literal 0 HcmV?d00001 diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-line-numbering.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-line-numbering.png new file mode 100644 index 0000000000000000000000000000000000000000..9f86dc4a47f796fb728c46a68e6b5626fcaba7d3 GIT binary patch literal 238 zcmV=T(Fs=bd(xYet1+k6*Zy#ph-zDceJD=)YoYMJ_cyS$R5q?Ak zEM?;i!vGl0oM&?qouu6P5MU~2C17fwVW<|Z$Xx_%kdz=vx1ttc=*@x*&sh|5f_14i z4wBT0LnJ-mni&STR)%$rQFud4(#~DleGXqAi&)I+v53XgK5w&tf9djv!QaGl;2XM2 oV=*Z!#>7g|))k|V55U`f1+S017RBMV1^@s607*qoM6N<$f~pB*qW}N^ literal 0 HcmV?d00001 diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-line-numbering.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-line-numbering.png new file mode 100644 index 0000000000000000000000000000000000000000..7af7e67ecc46d04142b4a62a9a18010609e6fa21 GIT binary patch literal 375 zcmeAS@N?(olHy`uVBq!ia0vp^1wd@U!3-pYOnWMTltF+`h%1nGadB~Wb_SBJuCD)) z08j+TgOET4PEJlh?)%2ID}Z_gN`m}?8UDw=zYoIo^$iX86B5=P*4Ye{d*lz>5nior1UTjX;ulzMr(YT^Up!I!|j*Q%&!=@qo7VJs`bLXgboRyH! zG!IT$a-(~r!tw`FO!F2f=?lpe^5@R#++2J)0F17O89LKk<{j5#L zo7&kwNB_G0J@KBHyjkz_$G)pJvohXE-rqULS^4YQg{P$N+lXy6RcX%t@#<*PW|pQ^ wu1A%Y%@b|DA;<0W*4gK^L-2ktua_qC_Q&&H@4X}z3iL69r>mdKI;Vst0E0fM0{{R3 literal 0 HcmV?d00001 From 21cb4c099424ce11078276f81c5b63f64d68ef26 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 28 Sep 2020 23:49:46 +0300 Subject: [PATCH 5/7] [DE] Apply line numbering --- .../main/app/controller/Toolbar.js | 46 +++++------ .../main/app/view/LineNumbersDialog.js | 79 ++++++++++++------- .../app/view/ParagraphSettingsAdvanced.js | 4 +- 3 files changed, 75 insertions(+), 54 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 7e06507a9..f310a187a 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -102,7 +102,8 @@ define([ pgmargins: undefined, fontsize: undefined, in_equation: false, - in_chart: false + in_chart: false, + linenum_apply: Asc.c_oAscSectionApplyType.All }; this.flg = {}; this.diagramEditor = null; @@ -1683,54 +1684,55 @@ define([ switch (item.value) { case 0: + this.api.asc_SetLineNumbersProps(this._state.linenum_apply, null); + break; case 1: case 2: case 3: this._state.linenum = undefined; if (this.api && item.checked) { - + var props = new Asc.CSectionLnNumType(); + props.put_Restart(item.value==1 ? Asc.c_oAscLineNumberRestartType.Continuous : (item.value==2 ? Asc.c_oAscLineNumberRestartType.NewPage : Asc.c_oAscLineNumberRestartType.NewSection)); + this.api.asc_SetLineNumbersProps(this._state.linenum_apply, props); } break; case 4: - this.api && this.api.put_ParagraphSuppressLineNumbers(item.checked); + this.api && this.api.asc_SetParagraphSuppressLineNumbers(item.checked); break; case 5: var win, me = this; win = new DE.Views.LineNumbersDialog({ + applyTo: me._state.linenum_apply, handler: function(dlg, result) { if (result == 'ok') { - // var props = dlg.getSettings(); - // me.api.asc_SetLineNumbersProps(props); + var settings = dlg.getSettings(); + me.api.asc_SetLineNumbersProps(settings.type, settings.props); + me._state.linenum_apply = settings.type; Common.NotificationCenter.trigger('edit:complete', me.toolbar); } } }); win.show(); - // win.setSettings(me.api.asc_GetLineNumbersProps()); + win.setSettings(me.api.asc_GetLineNumbersProps()); break; } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, onLineNumbersProps: function(props) { + var index = 0; if (props) { - // var type = props.asc_getType(); - var index = -1; - // switch (type) { - // case Asc.None: index = 0; break; - // case Asc.Continuous: index = 1; break; - // case Asc.Page: index = 2; break; - // case Asc.Section: index = 3; break; - // } - if (this._state.linenum === index) - return; - if (index < 0) - this.toolbar.btnLineNumbers.menu.clearAll(); - else - this.toolbar.btnLineNumbers.menu.items[index].setChecked(true); - - this._state.linenum = index; + switch (props.get_Restart()) { + case Asc.c_oAscLineNumberRestartType.Continuous: index = 1; break; + case Asc.c_oAscLineNumberRestartType.NewPage: index = 2; break; + case Asc.c_oAscLineNumberRestartType.NewSection: index = 3; break; + } } + if (this._state.linenum === index) + return; + this.toolbar.btnLineNumbers.menu.items[index].setChecked(true); + this._state.linenum = index; }, onColorSchemaClick: function(menu, item) { diff --git a/apps/documenteditor/main/app/view/LineNumbersDialog.js b/apps/documenteditor/main/app/view/LineNumbersDialog.js index ba57aa7fe..f1c37058e 100644 --- a/apps/documenteditor/main/app/view/LineNumbersDialog.js +++ b/apps/documenteditor/main/app/view/LineNumbersDialog.js @@ -47,7 +47,7 @@ define([ DE.Views.LineNumbersDialog = Common.UI.Window.extend(_.extend({ options: { width: 290, - height: 273, + height: 308, header: true, style: 'min-width: 290px;', cls: 'modal-dlg', @@ -70,7 +70,10 @@ define([ '
', '
', '
', - '
', + '
', + '
', + '
', + '
', '
' ].join(''); @@ -155,6 +158,18 @@ define([ disabled: true }); + this.cmbApply = new Common.UI.ComboBox({ + el: $('#line-numbers-combo-apply'), + cls: 'input-group-nr', + menuStyle: 'min-width: 125px;', + editable: false, + data: [ + { displayValue: this.textSection, value: Asc.c_oAscSectionApplyType.Current }, + { displayValue: this.textForward, value: Asc.c_oAscSectionApplyType.ToEnd }, + { displayValue: this.textDocument, value: Asc.c_oAscSectionApplyType.All } + ] + }); + this.cmbApply.setValue(this.options.applyTo); this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); @@ -166,17 +181,18 @@ define([ setSettings: function (props) { if (props) { - // var type = props.asc_getType(); - // this.chAddLineNumbering.setValue(type !== case Asc.None); - // switch (type) { - // case Asc.Continuous: this.rbContinuous.setValue(true, true); break; - // case Asc.Page: this.rbRestartEachPage.setValue(true, true); break; - // case Asc.Section: this.rbRestartEachSection.setValue(true, true); break; - // } - // this.spnStartAt.setValue(props.get_StartAt()!==null ? props.get_StartAt() : '', true); - // this.spnFromText.setValue(props.get_FromText()!==null ? (props.get_FromText()<0 ? -1 : Common.Utils.Metric.fnRecalcFromMM(props.get_FromText())) : '', true); - // this.spnCountBy.setValue(props.get_Count()!==null ? props.get_Count() : '', true); - } + var type = props.get_Restart(); + this.chAddLineNumbering.setValue(true); + switch (type) { + case Asc.c_oAscLineNumberRestartType.Continuous: this.rbContinuous.setValue(true, true); break; + case Asc.c_oAscLineNumberRestartType.NewPage: this.rbRestartEachPage.setValue(true, true); break; + case Asc.c_oAscLineNumberRestartType.NewSection: this.rbRestartEachSection.setValue(true, true); break; + } + this.spnStartAt.setValue(props.get_Start()!==null && props.get_Start()!==undefined ? props.get_Start() : '', true); + this.spnFromText.setValue(props.get_Distance()!==null && props.get_Distance()!==undefined ? Common.Utils.Metric.fnRecalcFromMM(props.get_Distance() * 25.4 / 20 / 72.0) : -1, true); + this.spnCountBy.setValue(props.get_CountBy()!==null && props.get_CountBy()!==undefined ? props.get_CountBy() : '', true); + } else + this.chAddLineNumbering.setValue(false); }, _handleInput: function(state) { @@ -197,22 +213,21 @@ define([ }, getSettings: function() { - // var props = new Asc.CDocumentLineNumberProps(); - // if (this.chAddLineNumbering.getValue()!=='checked') { - // props.put_Type(Asc.None); - // } else { - // if (this.rbContinuous.getValue()) - // props.put_Type(Asc.Continuous); - // else if (this.rbRestartEachPage.getValue()) - // props.put_Type(Asc.Page); - // else if (this.rbRestartEachSection.getValue()) - // props.put_Type(Asc.Section); - // props.put_StartAt(this.spnStartAt.getNumberValue()); - // var value = this.spnFromText.getNumberValue(); - // props.put_FromText(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM()); - // props.put_Count(this.spnCountBy.getNumberValue()); - // } - // return props; + var props; + if (this.chAddLineNumbering.getValue()==='checked') { + props = new Asc.CSectionLnNumType(); + if (this.rbContinuous.getValue()) + props.put_Restart(Asc.c_oAscLineNumberRestartType.Continuous); + else if (this.rbRestartEachPage.getValue()) + props.put_Restart(Asc.c_oAscLineNumberRestartType.NewPage); + else if (this.rbRestartEachSection.getValue()) + props.put_Restart(Asc.c_oAscLineNumberRestartType.NewSection); + props.put_Start(this.spnStartAt.getValue()!=='' ? this.spnStartAt.getNumberValue() : undefined); + var value = this.spnFromText.getNumberValue(); + props.put_Distance(value<0 ? null : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4)); + props.put_CountBy(this.spnCountBy.getValue()!=='' ? this.spnCountBy.getNumberValue() : undefined); + } + return {props: props, type: this.cmbApply.getValue()}; }, updateMetricUnit: function() { @@ -234,6 +249,10 @@ define([ textNumbering: 'Numbering', textRestartEachPage: 'Restart Each Page', textRestartEachSection: 'Restart Each Section', - textContinuous: 'Continuous' + textContinuous: 'Continuous', + textApplyTo: 'Apply changes to', + textDocument: 'Whole document', + textSection: 'Current section', + textForward: 'This point forward' }, DE.Views.LineNumbersDialog || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index b79f5a641..5cddca362 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -352,7 +352,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem }); this.chLineNumbers.on('change', _.bind(function(field, newValue, oldValue, eOpts){ if (this._changedProps) { - // this._changedProps.put_SuppressLineNumbers(field.getValue()=='checked'); + this._changedProps.put_SuppressLineNumbers(field.getValue()=='checked'); } }, this)); @@ -784,7 +784,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this.chKeepNext.setValue((props.get_KeepNext() !== null && props.get_KeepNext() !== undefined) ? props.get_KeepNext() : 'indeterminate', true); this.chOrphan.setValue((props.get_WidowControl() !== null && props.get_WidowControl() !== undefined) ? props.get_WidowControl() : 'indeterminate', true); - // this.chLineNumbers.setValue((props.get_SuppressLineNumbers() !== null && props.get_SuppressLineNumbers() !== undefined) ? props.get_SuppressLineNumbers() : 'indeterminate', true); + this.chLineNumbers.setValue((props.get_SuppressLineNumbers() !== null && props.get_SuppressLineNumbers() !== undefined) ? props.get_SuppressLineNumbers() : 'indeterminate', true); this.Borders = new Asc.asc_CParagraphBorders(props.get_Borders()); From a3ae81e07286e9fadcf9920c95ccae067e28156e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 28 Sep 2020 23:54:36 +0300 Subject: [PATCH 6/7] [DE] Add translation --- apps/documenteditor/main/locale/en.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index c31af1caf..684de3619 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1795,6 +1795,19 @@ "DE.Views.LeftMenu.tipTitles": "Titles", "DE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE", "DE.Views.LeftMenu.txtTrial": "TRIAL MODE", + "DE.Views.LineNumbersDialog.textTitle": "Line Numbers", + "DE.Views.LineNumbersDialog.textAddLineNumbering": "Add line numbering", + "DE.Views.LineNumbersDialog.textStartAt": "Start at", + "DE.Views.LineNumbersDialog.textFromText": "From text", + "DE.Views.LineNumbersDialog.textCountBy": "Count by", + "DE.Views.LineNumbersDialog.textNumbering": "Numbering", + "DE.Views.LineNumbersDialog.textRestartEachPage": "Restart Each Page", + "DE.Views.LineNumbersDialog.textRestartEachSection": "Restart Each Section", + "DE.Views.LineNumbersDialog.textContinuous": "Continuous", + "DE.Views.LineNumbersDialog.textApplyTo": "Apply changes to", + "DE.Views.LineNumbersDialog.textDocument": "Whole document", + "DE.Views.LineNumbersDialog.textSection": "Current section", + "DE.Views.LineNumbersDialog.textForward": "This point forward", "DE.Views.Links.capBtnBookmarks": "Bookmark", "DE.Views.Links.capBtnCaption": "Caption", "DE.Views.Links.capBtnContentsUpdate": "Refresh", @@ -2030,6 +2043,7 @@ "DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only", "DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto", "DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders", + "DE.Views.ParagraphSettingsAdvanced.strSuppressLineNumbers": "Suppress line numbers", "DE.Views.RightMenu.txtChartSettings": "Chart settings", "DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings", "DE.Views.RightMenu.txtImageSettings": "Image settings", @@ -2498,6 +2512,13 @@ "DE.Views.Toolbar.txtScheme7": "Equity", "DE.Views.Toolbar.txtScheme8": "Flow", "DE.Views.Toolbar.txtScheme9": "Foundry", + "DE.Views.Toolbar.capBtnLineNumbers": "Line Numbers", + "DE.Views.Toolbar.textContinuous": "Continuous", + "DE.Views.Toolbar.textRestartEachPage": "Restart Each Page", + "DE.Views.Toolbar.textRestartEachSection": "Restart Each Section", + "DE.Views.Toolbar.textSuppressForCurrentParagraph": "Suppress for Current Paragraph", + "DE.Views.Toolbar.textCustomLineNumbers": "Line Numbering Options", + "DE.Views.Toolbar.tipLineNumbers": "Show line numbers", "DE.Views.WatermarkSettingsDialog.textAuto": "Auto", "DE.Views.WatermarkSettingsDialog.textBold": "Bold", "DE.Views.WatermarkSettingsDialog.textColor": "Text color", From 301af74045342acb8c0cd64852bcfc20b92bbba4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 29 Sep 2020 00:02:30 +0300 Subject: [PATCH 7/7] [DE] Fix line numbering --- .../main/app/template/ParagraphSettingsAdvanced.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template b/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template index b97fe4433..99fcd8786 100644 --- a/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template +++ b/apps/documenteditor/main/app/template/ParagraphSettingsAdvanced.template @@ -80,7 +80,7 @@ - +