diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 415fd7d13..359500d0c 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -53,7 +53,8 @@ define([ 'documenteditor/main/app/view/HyperlinkSettingsDialog', 'documenteditor/main/app/view/ParagraphSettingsAdvanced', 'documenteditor/main/app/view/TableSettingsAdvanced', - 'documenteditor/main/app/view/ControlSettingsDialog' + 'documenteditor/main/app/view/ControlSettingsDialog', + 'documenteditor/main/app/view/NumberingValueDialog' ], function ($, _, Backbone, gateway) { 'use strict'; DE.Views.DocumentHolder = Backbone.View.extend(_.extend({ @@ -1891,6 +1892,29 @@ define([ me.fireEvent('editcomplete', me); }, + onContinueNumbering: function(item, e) { + this.api.asc_ContinueNumbering(); + this.fireEvent('editcomplete', this); + }, + + onStartNumbering: function(startfrom, item, e) { + if (startfrom == 1) + this.api.asc_RestartNumbering(1); + else { + var me = this; + (new DE.Views.NumberingValueDialog({ + title: me.textNumberingValue, + props: {format: item.value}, + handler: function (result, value) { + if (result == 'ok') + me.api.asc_RestartNumbering(value); + me.fireEvent('editcomplete', me); + } + })).show(); + } + this.fireEvent('editcomplete', this); + }, + createDelayedElementsViewer: function() { var me = this; @@ -3299,6 +3323,22 @@ define([ caption : '--' }); + var menuParaStartNewList = new Common.UI.MenuItem({ + caption: me.textStartNewList + }).on('click', _.bind(me.onStartNumbering, me, 1)); + + var menuParaStartNumberingFrom = new Common.UI.MenuItem({ + caption: me.textStartNumberingFrom + }).on('click', _.bind(me.onStartNumbering, me)); + + var menuParaContinueNumbering = new Common.UI.MenuItem({ + caption: me.textContinueNumbering + }).on('click', _.bind(me.onContinueNumbering, me)); + + var menuParaNumberingSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + this.textMenu = new Common.UI.Menu({ initMenu: function(value){ var isInShape = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ShapeProperties())); @@ -3421,6 +3461,20 @@ define([ if (in_field) { menuParaRefreshField.options.fieldProps = in_field; } + + var listId = me.api.asc_GetCurrentNumberingId(), + in_list = (listId !== null); + menuParaNumberingSeparator.setVisible(in_list); // hide when first item is selected + menuParaStartNewList.setVisible(in_list); + menuParaStartNumberingFrom.setVisible(in_list); + menuParaContinueNumbering.setVisible(in_list); + if (in_list) { + var format = me.api.asc_GetNumberingPr(listId).get_Lvl(me.api.asc_GetCurrentNumberingLvl()).get_Format(); + menuParaStartNumberingFrom.setVisible(format != Asc.c_oAscNumberingFormat.Bullet); + menuParaStartNumberingFrom.value = format; + menuParaStartNewList.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textSeparateList : me.textStartNewList); + menuParaContinueNumbering.setCaption((format == Asc.c_oAscNumberingFormat.Bullet) ? me.textJoinList : me.textContinueNumbering); + } }, items: [ me.menuSpellPara, @@ -3456,6 +3510,10 @@ define([ menuHyperlinkParaSeparator, menuAddHyperlinkPara, menuHyperlinkPara, + menuParaNumberingSeparator, + menuParaStartNewList, + menuParaStartNumberingFrom, + menuParaContinueNumbering, menuStyleSeparator, menuStyle ] @@ -3776,7 +3834,13 @@ define([ txtPasteSourceFormat: 'Keep source formatting', textReplace: 'Replace image', textFromUrl: 'From URL', - textFromFile: 'From File' + textFromFile: 'From File', + textStartNumberingFrom: 'Set numbering value', + textStartNewList: 'Start new list', + textContinueNumbering: 'Continue numbering', + textSeparateList: 'Separate list', + textJoinList: 'Join to previous list', + textNumberingValue: 'Numbering Value' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/NumberingValueDialog.js b/apps/documenteditor/main/app/view/NumberingValueDialog.js new file mode 100644 index 000000000..c221e01c3 --- /dev/null +++ b/apps/documenteditor/main/app/view/NumberingValueDialog.js @@ -0,0 +1,261 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2018 + * + * 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 Lubanas st. 125a-25, Riga, Latvia, + * EU, LV-1021. + * + * 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 + * +*/ +/** + * NumberingValueDialog.js + * + * Created by Julia Radzhabova on 7/20/18 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/component/Window', + 'common/main/lib/component/MetricSpinner' +], function () { 'use strict'; + + DE.Views.NumberingValueDialog = Common.UI.Window.extend(_.extend({ + options: { + width: 214, + header: true, + style: 'min-width: 214px;', + cls: 'modal-dlg' + }, + + initialize : function(options) { + _.extend(this.options, { + title: this.textTitle + }, options || {}); + + this.template = [ + '