diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index acf1823b57..2a35dbcf2d 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/ListSettingsDialog',
'documenteditor/main/app/view/DateTimeDialog',
'documenteditor/main/app/view/LineNumbersDialog',
- 'documenteditor/main/app/view/TextToTableDialog'
+ 'documenteditor/main/app/view/TextToTableDialog',
+ 'documenteditor/main/app/view/HyphenationDialog'
], function () {
'use strict';
@@ -381,6 +382,8 @@ define([
toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this));
toolbar.btnLineNumbers.menu.on('item:click', _.bind(this.onLineNumbersSelect, this));
toolbar.btnLineNumbers.menu.on('show:after', _.bind(this.onLineNumbersShow, this));
+ toolbar.btnHyphenation.menu.on('item:click', _.bind(this.onHyphenationSelect, this));
+ toolbar.btnHyphenation.menu.on('show:after', _.bind(this.onHyphenationShow, this));
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
Common.Gateway.on('setrequestedspreadsheet', _.bind(this.setRequestedSpreadsheet, this));
@@ -2005,6 +2008,33 @@ define([
menu.items[4].setChecked(this._state.suppress_num);
},
+ onHyphenationSelect: function(menu, item) {
+ if (_.isUndefined(item.value))
+ return;
+
+ if (item.value==='custom') {
+ var win,
+ me = this;
+ win = new DE.Views.HyphenationDialog({
+ handler: function(dlg, result) {
+ if (result == 'ok') {
+ me.api.asc_SetHyphenationProps(dlg.getSettings());
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ }
+ }
+ });
+ win.show();
+ me.api && win.setSettings({auto: this.api.asc_isAutoHyphenation(), caps: this.api.asc_isHyphenateCaps(), limits: this.api.asc_getConsecutiveHyphenLimit()});
+ } else {
+ this.api && this.api.asc_setAutoHyphenation(!!item.value);
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.toolbar);
+ },
+
+ onHyphenationShow: function(menu) {
+ this.api && menu.items[this.api.asc_isAutoHyphenation() ? 1 : 0].setChecked(true);
+ },
+
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 ee73788f0e..ea39260e67 100644
--- a/apps/documenteditor/main/app/template/Toolbar.template
+++ b/apps/documenteditor/main/app/template/Toolbar.template
@@ -142,6 +142,7 @@
+
diff --git a/apps/documenteditor/main/app/view/HyphenationDialog.js b/apps/documenteditor/main/app/view/HyphenationDialog.js
new file mode 100644
index 0000000000..40c23e2c69
--- /dev/null
+++ b/apps/documenteditor/main/app/view/HyphenationDialog.js
@@ -0,0 +1,171 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2023
+ *
+ * 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-6 Ernesta Birznieka-Upish
+ * 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
+ *
+ */
+/**
+ * HyphenationDialog.js
+ *
+ * Created by Julia Radzhabova on 24/08/23
+ * Copyright (c) 2023 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.HyphenationDialog = Common.UI.Window.extend(_.extend({
+ options: {
+ width: 290,
+ height: 'auto',
+ header: true,
+ style: 'min-width: 290px;',
+ cls: 'modal-dlg',
+ id: 'window-hyphenation-dlg',
+ buttons: ['ok', 'cancel']
+ },
+
+ initialize : function(options) {
+ _.extend(this.options, {
+ title: this.textTitle
+ }, options || {});
+
+ this.template = [
+ '
',
+ '
',
+ '
',
+ '
' + this.textLimit + ' ',
+ '
',
+ '
'
+ ].join('');
+
+ this.options.tpl = _.template(this.template)(this.options);
+ this._changedProps = null;
+ this._noApply = false;
+
+ Common.UI.Window.prototype.initialize.call(this, this.options);
+ },
+
+ render: function() {
+ Common.UI.Window.prototype.render.call(this);
+ var $window = this.getChild();
+
+ this.chAuto = new Common.UI.CheckBox({
+ el: $window.find('#hyphenation-chk-auto'),
+ labelText: this.textAuto
+ }).on('change', _.bind(function(field, newValue, oldValue, eOpts){
+ if (this._changedProps)
+ this._changedProps.put_Auto(field.getValue()==='checked');
+ }, this));
+
+ this.chCaps = new Common.UI.CheckBox({
+ el: $window.find('#hyphenation-chk-caps'),
+ labelText: this.textCaps
+ }).on('change', _.bind(function(field, newValue, oldValue, eOpts){
+ if (this._changedProps)
+ this._changedProps.put_Caps(field.getValue()==='checked');
+ }, this));
+
+ this.spnLimit = new Common.UI.MetricSpinner({
+ el: $window.find('#hyphenation-num-limit'),
+ step: 1,
+ width: 80,
+ defaultUnit : '',
+ value: -1,
+ autoText: this.textNoLimit,
+ allowAuto: true,
+ maxValue: 32767,
+ minValue: 1
+ });
+ this.spnLimit.setValue(-1);
+ this.spnLimit.on('change', _.bind(function(field, newValue, oldValue, eOpts){
+ if (this._changedProps) {
+ var value = field.getNumberValue();
+ this._changedProps.put_Limit(value<0 ? 0 : value);
+ }
+ }, this));
+ this.spnLimit.on('changing', _.bind(function(field, newValue, oldValue, eOpts){
+ if (parseInt(newValue)===0) field.setValue(-1);
+ }, this));
+
+ this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
+ },
+
+ getFocusedComponents: function() {
+ return [this.chAuto, this.chCaps, this.spnLimit];
+ },
+
+ getDefaultFocusableComponent: function () {
+ return this.chAuto;
+ },
+
+ afterRender: function() {
+ },
+
+ setSettings: function (props) {
+ if (props) {
+ this.chAuto.setValue(!!props.auto, true);
+ this.chCaps.setValue(!!props.caps, true);
+ var value = props.limits || 0;
+ this.spnLimit.setValue(value!==null && value!==undefined ? (value===0 ? -1 : value) : '', true);
+ }
+ // this._changedProps = new Asc.asc_CHyphenationProperty();
+ },
+
+ _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._changedProps;
+ },
+
+ textTitle: 'Hyphenation',
+ textAuto: 'Automatically hyphenate document',
+ textCaps: 'Hyphenate words in CAPS',
+ textLimit: 'Limit consecutive hyphens to',
+ textNoLimit: 'No limit'
+ }, DE.Views.HyphenationDialog || {}))
+});
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js
index 1a7c106335..8382d976b4 100644
--- a/apps/documenteditor/main/app/view/Toolbar.js
+++ b/apps/documenteditor/main/app/view/Toolbar.js
@@ -1325,6 +1325,40 @@ define([
});
this.toolbarControls.push(this.btnLineNumbers);
+ this.btnHyphenation = new Common.UI.Button({
+ id: 'tlbtn-line-hyphenation',
+ cls: 'btn-toolbar x-huge icon-top',
+ iconCls: 'toolbar__icon btn-line-hyphenation',
+ lock: [_set.docPropsLock, _set.inImagePara, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments],
+ caption: this.capBtnHyphenation,
+ menu: new Common.UI.Menu({
+ cls: 'ppm-toolbar',
+ items: [
+ {
+ caption: this.textNone,
+ checkable: true,
+ toggleGroup: 'menuHyphenation',
+ value: 0
+ },
+ {
+ caption: this.textAuto,
+ checkable: true,
+ toggleGroup: 'menuHyphenation',
+ value: 1
+ },
+ {caption: '--'},
+ {
+ caption: this.textCustomHyphen,
+ value: 'custom'
+ }
+ ]
+ }),
+ dataHint: '1',
+ dataHintDirection: 'bottom',
+ dataHintOffset: 'small'
+ });
+ this.toolbarControls.push(this.btnHyphenation);
+
this.btnClearStyle = new Common.UI.Button({
id: 'id-toolbar-btn-clearstyle',
cls: 'btn-toolbar',
@@ -1764,6 +1798,7 @@ define([
_injectComponent('#slot-img-movebkwd', this.btnImgBackward);
_injectComponent('#slot-img-wrapping', this.btnImgWrapping);
_injectComponent('#slot-btn-watermark', this.btnWatermark);
+ _injectComponent('#slot-btn-hyphenation', this.btnHyphenation);
this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'toolbar__icon btn-pagebreak', this.capBtnInsPagebreak,
[Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.inEquation, Common.enumLock.richDelLock,
@@ -2149,6 +2184,7 @@ define([
this.btnCopyStyle.updateHint(this.tipCopyStyle + Common.Utils.String.platformKey('Alt+Ctrl+C'));
this.btnColorSchemas.updateHint(this.tipColorSchemas);
this.btnMailRecepients.updateHint(this.tipMailRecepients);
+ this.btnHyphenation.updateHint(this.tipHyphenation);
// set menus
@@ -3337,7 +3373,11 @@ define([
textSquareRoot: 'Square Root',
textTilde: 'Tilde',
textTradeMark: 'Trade Mark Sign',
- textYen: 'Yen Sign'
+ textYen: 'Yen Sign',
+ capBtnHyphenation: 'Hyphenation',
+ textAuto: 'Automatic',
+ textCustomHyphen: 'Hyphenation options',
+ tipHyphenation: 'Change hyphenation'
}
})(), DE.Views.Toolbar || {}));
});
diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json
index 2afa22763e..9145349879 100644
--- a/apps/documenteditor/main/locale/en.json
+++ b/apps/documenteditor/main/locale/en.json
@@ -2296,6 +2296,11 @@
"DE.Views.HyperlinkSettingsDialog.txtHeadings": "Headings",
"DE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"DE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters",
+ "DE.Views.HyphenationDialog.textTitle": "Hyphenation",
+ "DE.Views.HyphenationDialog.textAuto": "Automatically hyphenate document",
+ "DE.Views.HyphenationDialog.textCaps": "Hyphenate words in CAPS",
+ "DE.Views.HyphenationDialog.textLimit": "Limit consecutive hyphens to",
+ "DE.Views.HyphenationDialog.textNoLimit": "No limit",
"DE.Views.ImageSettings.textAdvanced": "Show advanced settings",
"DE.Views.ImageSettings.textCrop": "Crop",
"DE.Views.ImageSettings.textCropFill": "Fill",
@@ -3421,6 +3426,10 @@
"DE.Views.Toolbar.txtScheme7": "Equity",
"DE.Views.Toolbar.txtScheme8": "Flow",
"DE.Views.Toolbar.txtScheme9": "Foundry",
+ "DE.Views.Toolbar.capBtnHyphenation": "Hyphenation",
+ "DE.Views.Toolbar.textAuto": "Automatic",
+ "DE.Views.Toolbar.textCustomHyphen": "Hyphenation options",
+ "DE.Views.Toolbar.tipHyphenation": "Change hyphenation",
"DE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar",
"DE.Views.ViewTab.textDarkDocument": "Dark Document",
"DE.Views.ViewTab.textFitToPage": "Fit To Page",
diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json
index 3cae88dff4..0d2251859e 100644
--- a/apps/documenteditor/main/locale/ru.json
+++ b/apps/documenteditor/main/locale/ru.json
@@ -2296,6 +2296,11 @@
"DE.Views.HyperlinkSettingsDialog.txtHeadings": "Заголовки",
"DE.Views.HyperlinkSettingsDialog.txtNotUrl": "Это поле должно быть URL-адресом в формате \"http://www.example.com\"",
"DE.Views.HyperlinkSettingsDialog.txtSizeLimit": "Это поле может содержать не более 2083 символов",
+ "DE.Views.HyphenationDialog.textTitle": "Расстановка переносов",
+ "DE.Views.HyphenationDialog.textAuto": "Автоматическая расстановка переносов",
+ "DE.Views.HyphenationDialog.textCaps": "Переносы в словах из ПРОПИСНЫХ БУКВ",
+ "DE.Views.HyphenationDialog.textLimit": "Макс. число последовательных переносов",
+ "DE.Views.HyphenationDialog.textNoLimit": "(нет)",
"DE.Views.ImageSettings.textAdvanced": "Дополнительные параметры",
"DE.Views.ImageSettings.textCrop": "Обрезать",
"DE.Views.ImageSettings.textCropFill": "Заливка",