2019-12-04 10:35:56 +00:00
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* (c) Copyright Ascensio System SIA 2010-2019
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2019-12-17 13:02:28 +00:00
|
|
|
|
* ListSettingsDialog.js
|
2019-12-04 10:35:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Created by Julia Radzhabova on 03.12.2019
|
|
|
|
|
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (Common === undefined)
|
|
|
|
|
var Common = {};
|
|
|
|
|
|
|
|
|
|
define([
|
|
|
|
|
'common/main/lib/component/Window',
|
|
|
|
|
'common/main/lib/component/MetricSpinner',
|
|
|
|
|
'common/main/lib/component/ThemeColorPalette',
|
|
|
|
|
'common/main/lib/component/ColorButton',
|
2019-12-18 13:48:36 +00:00
|
|
|
|
'common/main/lib/component/ComboBox',
|
2022-11-16 16:57:02 +00:00
|
|
|
|
'common/main/lib/view/SymbolTableDialog',
|
|
|
|
|
'documenteditor/main/app/view/ListTypesAdvanced'
|
2019-12-04 10:35:56 +00:00
|
|
|
|
], function () { 'use strict';
|
2022-10-12 13:48:30 +00:00
|
|
|
|
var nMaxRecent = 5;
|
2019-12-04 10:35:56 +00:00
|
|
|
|
|
2019-12-17 13:02:28 +00:00
|
|
|
|
DE.Views.ListSettingsDialog = Common.UI.Window.extend(_.extend({
|
2019-12-04 10:35:56 +00:00
|
|
|
|
options: {
|
2019-12-17 14:25:12 +00:00
|
|
|
|
type: 0, // 0 - markers, 1 - numbers, 2 - multilevel
|
2019-12-26 12:06:53 +00:00
|
|
|
|
width: 300,
|
2022-09-21 09:39:25 +00:00
|
|
|
|
height: 460,
|
2019-12-04 10:35:56 +00:00
|
|
|
|
style: 'min-width: 240px;',
|
|
|
|
|
cls: 'modal-dlg',
|
|
|
|
|
split: false,
|
|
|
|
|
buttons: ['ok', 'cancel']
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize : function(options) {
|
2019-12-17 14:25:12 +00:00
|
|
|
|
this.type = options.type || 0;
|
2019-12-17 11:52:30 +00:00
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
_.extend(this.options, {
|
2019-12-26 12:06:53 +00:00
|
|
|
|
title: this.txtTitle,
|
2022-10-10 14:38:02 +00:00
|
|
|
|
height: (this.type==2) ? 520 : 424,
|
2022-09-21 09:39:25 +00:00
|
|
|
|
width: (this.type==2) ? 460 : 300
|
2019-12-26 12:06:53 +00:00
|
|
|
|
}, options || {});
|
2019-12-04 10:35:56 +00:00
|
|
|
|
|
|
|
|
|
this.template = [
|
|
|
|
|
'<div class="box">',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'<% if (type == 2) { %>',
|
|
|
|
|
'<table cols="4" style="width: 100%;">',
|
|
|
|
|
'<tr>',
|
2022-11-16 21:04:18 +00:00
|
|
|
|
'<td style="padding-right: 5px;">',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'<label class="input-label">' + this.txtType + '</label>',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
'<div id="id-dlg-numbering-format" class="input-group-nr" style="width: 120px;margin-bottom: 10px;"></div>',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'</td>',
|
2022-11-16 21:04:18 +00:00
|
|
|
|
'<td style="padding-left: 5px;padding-right: 5px;">',
|
|
|
|
|
'<label class="input-label"></label>',
|
|
|
|
|
'<div id="id-dlg-chk-tabstop" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-right: 5px;">',
|
|
|
|
|
'<label class="input-label"></label>',
|
|
|
|
|
'<div id="id-dlg-num-tabstop" style="margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'<td style="padding-left: 5px;">',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
'<label class="input-label"></label>',
|
|
|
|
|
'<div id="id-dlg-numbering-restart" style="width: 100%;margin-bottom: 10px;"></div>',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
2022-11-16 21:04:18 +00:00
|
|
|
|
'</table>',
|
|
|
|
|
'<table cols="4" style="width: 100%;">',
|
2022-09-21 09:39:25 +00:00
|
|
|
|
'<tr>',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
'<td colspan="2" style="padding-right: 5px;width: 100%;">',
|
2022-09-21 09:39:25 +00:00
|
|
|
|
'<label class="input-label">' + this.txtNumFormatString + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-format-str" style="width: 100%;height:22px;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
2022-10-05 18:25:40 +00:00
|
|
|
|
'<td style="padding-left: 5px;padding-right: 5px;">',
|
2022-09-21 09:39:25 +00:00
|
|
|
|
'<label class="input-label">' + this.txtInclcudeLevel + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-format-lvl" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
2022-10-05 18:25:40 +00:00
|
|
|
|
'<td style="padding-left: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtStart + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-spin-start" style="margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
2022-09-21 09:39:25 +00:00
|
|
|
|
'</tr>',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
'</table>',
|
|
|
|
|
'<table cols="4" style="width: 100%;">',
|
|
|
|
|
'<tr>',
|
|
|
|
|
'<td style="padding-right: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtAlign + '</label>',
|
|
|
|
|
'<div id="id-dlg-bullet-align" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-left: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtAlignAt + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-align-at" style="margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-left: 5px;padding-right: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtIndent + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-indent" style="margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-left: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtFollow + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-follow" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
|
|
|
|
'</table>',
|
|
|
|
|
'<table cols="4" style="width: 100%;">',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'<tr>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<td colspan="3" style="padding-right: 5px;">',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'<label class="input-label" style="display: block;">' + this.txtFontName + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-font-name" style="display: inline-block;width: 200px;height:22px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-numbering-bold" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-numbering-italic" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<div id="id-dlg-bullet-color" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'</td>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<td style="padding-left: 5px;">',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'<label class="input-label">' + this.txtSize + '</label>',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
'<div id="id-dlg-bullet-size" class="input-group-nr" style="width: 115px;margin-bottom: 10px;"></div>',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'</td>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'</tr>',
|
|
|
|
|
'</table>',
|
|
|
|
|
'<% } else if (type == 0) {%>', // bullets
|
|
|
|
|
'<table cols="2" style="width: 100%;">',
|
|
|
|
|
'<tr>',
|
|
|
|
|
'<td style="padding-right: 5px;">',
|
2022-10-11 15:48:23 +00:00
|
|
|
|
'<label class="input-label">' + this.txtType + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-format" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'</td>',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'<td style="padding-left: 5px;">',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<label class="input-label">' + this.txtAlign + '</label>',
|
|
|
|
|
'<div id="id-dlg-bullet-align" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
|
|
|
|
'<tr>',
|
|
|
|
|
'<td colspan="2">',
|
|
|
|
|
'<label class="input-label" style="display: block;">' + this.txtSize + '</label>',
|
2022-10-11 15:48:23 +00:00
|
|
|
|
'<div id="id-dlg-bullet-size" class="input-group-nr" style="width: 129px;display: inline-block;margin-bottom: 10px;vertical-align: middle;"></div>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<div id="id-dlg-numbering-bold" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-numbering-italic" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-bullet-color" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'</table>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<% } else { %>', // numbering
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'<table cols="2" style="width: 100%;">',
|
|
|
|
|
'<tr>',
|
|
|
|
|
'<td style="padding-right: 5px;">',
|
2019-12-17 11:52:30 +00:00
|
|
|
|
'<label class="input-label">' + this.txtType + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-format" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-left: 5px;">',
|
|
|
|
|
'<label class="input-label">' + this.txtAlign + '</label>',
|
|
|
|
|
'<div id="id-dlg-bullet-align" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
2022-10-11 12:20:04 +00:00
|
|
|
|
'<tr>',
|
|
|
|
|
'<td colspan="2" style="width: 100%;">',
|
|
|
|
|
'<label class="input-label">' + this.txtNumFormatString + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-format-str" style="width: 100%;height:22px;margin-bottom: 10px;"></div>',
|
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'</table>',
|
|
|
|
|
'<table cols="2" style="width: 100%;">',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'<tr>',
|
|
|
|
|
'<td style="padding-right: 5px;">',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<label class="input-label" style="display: block;">' + this.txtFontName + '</label>',
|
|
|
|
|
'<div id="id-dlg-numbering-font-name" style="display: inline-block;width: 90px;height:22px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-numbering-bold" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-numbering-italic" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
|
|
|
|
'<div id="id-dlg-bullet-color" style="display: inline-block;margin-left: 4px;margin-bottom: 10px;vertical-align: middle;"></div>',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'<td style="padding-left: 5px;">',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'<label class="input-label">' + this.txtSize + '</label>',
|
|
|
|
|
'<div id="id-dlg-bullet-size" class="input-group-nr" style="width: 85px;margin-bottom: 10px;"></div>',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
2022-10-11 10:27:35 +00:00
|
|
|
|
'</table>',
|
2019-12-26 12:06:53 +00:00
|
|
|
|
'<% } %>',
|
2019-12-17 14:25:12 +00:00
|
|
|
|
'<table cols="2" style="width: 100%;">',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'<tr>',
|
2019-12-17 14:25:12 +00:00
|
|
|
|
'<td class="<% if (type != 2) { %> hidden <% } %>" style="width: 50px; padding-right: 10px;">',
|
|
|
|
|
'<label>' + this.textLevel + '</label>',
|
2019-12-25 09:10:42 +00:00
|
|
|
|
'<div id="levels-list" class="no-borders" style="width:100%; height:208px;margin-top: 2px; "></div>',
|
2019-12-17 14:25:12 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'<td>',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'<label>' + this.textPreview + '</label>',
|
2021-04-20 13:37:46 +00:00
|
|
|
|
'<div id="bulleted-list-preview"></div>',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
'</td>',
|
|
|
|
|
'</tr>',
|
|
|
|
|
'</table>',
|
|
|
|
|
'</div>'
|
|
|
|
|
].join('');
|
|
|
|
|
|
|
|
|
|
this.props = options.props;
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this.level = options.level || 0;
|
2019-12-17 14:25:12 +00:00
|
|
|
|
this.api = options.api;
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.fontStore = options.fontStore;
|
2022-10-11 13:12:17 +00:00
|
|
|
|
this.fontName = '';
|
2019-12-04 10:35:56 +00:00
|
|
|
|
this.options.tpl = _.template(this.template)(this.options);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this.levels = [];
|
2022-10-06 20:16:04 +00:00
|
|
|
|
this.formatString = {
|
|
|
|
|
selectionStart: 0,
|
|
|
|
|
selectionEnd: 0,
|
|
|
|
|
text: '',
|
|
|
|
|
lvlIndexes: []
|
|
|
|
|
};
|
2022-10-10 14:38:02 +00:00
|
|
|
|
this.spinners = [];
|
2022-10-12 13:48:30 +00:00
|
|
|
|
this.recentBullets = [];
|
2022-11-16 16:57:02 +00:00
|
|
|
|
this.recentNumTypes = [];
|
|
|
|
|
this.lang = this.api.asc_GetPossibleNumberingLanguage();
|
2019-12-04 10:35:56 +00:00
|
|
|
|
Common.UI.Window.prototype.initialize.call(this, this.options);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
|
Common.UI.Window.prototype.render.call(this);
|
|
|
|
|
|
|
|
|
|
var me = this,
|
|
|
|
|
$window = this.getChild();
|
|
|
|
|
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
|
|
|
|
|
2022-10-11 10:27:35 +00:00
|
|
|
|
this.btnColor = new Common.UI.ButtonColored({
|
2020-04-29 14:37:59 +00:00
|
|
|
|
parentEl: $window.find('#id-dlg-bullet-color'),
|
2022-10-11 10:27:35 +00:00
|
|
|
|
cls : 'btn-toolbar',
|
|
|
|
|
iconCls : 'toolbar__icon btn-fontcolor',
|
|
|
|
|
hint : this.txtColor,
|
|
|
|
|
menu: true,
|
2020-04-29 14:37:59 +00:00
|
|
|
|
additionalItems: [{
|
|
|
|
|
id: 'id-dlg-bullet-text-color',
|
|
|
|
|
caption: this.txtLikeText,
|
|
|
|
|
checkable: true,
|
2020-09-27 13:48:28 +00:00
|
|
|
|
toggleGroup: 'list-settings-color',
|
|
|
|
|
style: 'padding-left: 20px;'
|
2020-04-29 14:37:59 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'id-dlg-bullet-auto-color',
|
|
|
|
|
caption: this.textAuto,
|
|
|
|
|
checkable: true,
|
2020-09-27 13:48:28 +00:00
|
|
|
|
toggleGroup: 'list-settings-color',
|
|
|
|
|
style: 'padding-left: 20px;'
|
2020-04-29 14:37:59 +00:00
|
|
|
|
},
|
|
|
|
|
{caption: '--'}],
|
2022-10-11 10:27:35 +00:00
|
|
|
|
additionalAlign: this.menuAddAlign
|
2019-12-04 10:35:56 +00:00
|
|
|
|
});
|
2022-10-11 10:27:35 +00:00
|
|
|
|
this.btnColor.setMenu();
|
2020-04-29 14:37:59 +00:00
|
|
|
|
this.btnColor.on('color:select', _.bind(this.onColorsSelect, this));
|
2019-12-19 12:01:49 +00:00
|
|
|
|
this.btnColor.menu.items[0].on('toggle', _.bind(this.onLikeTextColor, this));
|
|
|
|
|
this.btnColor.menu.items[1].on('toggle', _.bind(this.onAutoColor, this));
|
2020-04-29 14:37:59 +00:00
|
|
|
|
this.colors = this.btnColor.getPicker();
|
2019-12-04 10:35:56 +00:00
|
|
|
|
|
2019-12-18 13:48:36 +00:00
|
|
|
|
var itemsTemplate =
|
|
|
|
|
[
|
|
|
|
|
'<% _.each(items, function(item) { %>',
|
|
|
|
|
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',
|
|
|
|
|
'<%= item.displayValue %><% if (item.value === Asc.c_oAscNumberingFormat.Bullet) { %><span style="font-family:<%=item.font%>;"><%=item.symbol%></span><% } %>',
|
|
|
|
|
'</a></li>',
|
|
|
|
|
'<% }); %>'
|
|
|
|
|
];
|
|
|
|
|
var template = [
|
|
|
|
|
'<div class="input-group combobox input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
|
2022-11-16 16:57:02 +00:00
|
|
|
|
'<div class="form-control" style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top:3px; line-height: 14px; cursor: pointer; <%= style %>"></div>',
|
2019-12-18 13:48:36 +00:00
|
|
|
|
'<div style="display: table-cell;"></div>',
|
2021-04-19 12:34:00 +00:00
|
|
|
|
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>',
|
2019-12-18 13:48:36 +00:00
|
|
|
|
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">'].concat(itemsTemplate).concat([
|
|
|
|
|
'</ul>',
|
|
|
|
|
'</div>'
|
|
|
|
|
]);
|
2022-10-11 15:48:23 +00:00
|
|
|
|
this._arrNumbers = [
|
2022-07-26 17:49:50 +00:00
|
|
|
|
{ displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal },
|
|
|
|
|
{ displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter },
|
|
|
|
|
{ displayValue: 'A, B, C,...', value: Asc.c_oAscNumberingFormat.UpperLetter },
|
|
|
|
|
{ displayValue: 'i, ii, iii,...', value: Asc.c_oAscNumberingFormat.LowerRoman },
|
|
|
|
|
{ displayValue: 'I, II, III,...', value: Asc.c_oAscNumberingFormat.UpperRoman }
|
|
|
|
|
];
|
2022-08-31 16:16:36 +00:00
|
|
|
|
if (Common.Locale.getDefaultLanguage() === 'ru') {
|
2022-10-11 15:48:23 +00:00
|
|
|
|
this._arrNumbers = this._arrNumbers.concat([
|
2022-07-26 17:49:50 +00:00
|
|
|
|
{ displayValue: 'а, б, в,...', value: Asc.c_oAscNumberingFormat.RussianLower },
|
|
|
|
|
{ displayValue: 'А, Б, В,...', value: Asc.c_oAscNumberingFormat.RussianUpper }
|
|
|
|
|
]);
|
|
|
|
|
}
|
2022-10-11 15:48:23 +00:00
|
|
|
|
this._arrBullets = [
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "·", font: 'Symbol' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "o", font: 'Courier New' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "§", font: 'Wingdings' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "v", font: 'Wingdings' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "Ø", font: 'Wingdings' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "ü", font: 'Wingdings' },
|
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "¨", font: 'Symbol' },
|
2022-10-12 13:48:30 +00:00
|
|
|
|
{ displayValue: this.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: "–", font: 'Arial' }
|
2022-10-11 15:48:23 +00:00
|
|
|
|
];
|
2022-10-12 13:48:30 +00:00
|
|
|
|
this._itemNoneBullet = { displayValue: this.txtNone, value: Asc.c_oAscNumberingFormat.None };
|
|
|
|
|
this._itemNewBullet = { displayValue: this.txtNewBullet, value: -1 };
|
2022-11-16 16:57:02 +00:00
|
|
|
|
this._itemMoreTypes = { displayValue: this.txtMoreTypes, value: -2 };
|
2022-10-12 13:48:30 +00:00
|
|
|
|
this.loadRecent();
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this.cmbFormat = new Common.UI.ComboBoxCustom({
|
2019-12-17 11:52:30 +00:00
|
|
|
|
el : $window.find('#id-dlg-numbering-format'),
|
2022-07-26 17:49:50 +00:00
|
|
|
|
menuStyle : 'min-width: 100%;max-height: 220px;',
|
2022-10-12 13:48:30 +00:00
|
|
|
|
style : this.type===2 ? "width: 107px;" : "width: 129px;",
|
2019-12-17 11:52:30 +00:00
|
|
|
|
editable : false,
|
2019-12-18 13:48:36 +00:00
|
|
|
|
template : _.template(template.join('')),
|
|
|
|
|
itemsTemplate: _.template(itemsTemplate.join('')),
|
2020-10-15 17:21:56 +00:00
|
|
|
|
takeFocusOnClose: true,
|
2022-11-16 16:57:02 +00:00
|
|
|
|
data : [],
|
2019-12-18 13:48:36 +00:00
|
|
|
|
updateFormControl: function(record) {
|
|
|
|
|
var formcontrol = $(this.el).find('.form-control');
|
|
|
|
|
if (record) {
|
|
|
|
|
if (record.get('value')==Asc.c_oAscNumberingFormat.Bullet)
|
2019-12-19 14:14:05 +00:00
|
|
|
|
formcontrol[0].innerHTML = record.get('displayValue') + '<span style="font-family:' + (record.get('font') || 'Arial') + '">' + record.get('symbol') + '</span>';
|
2019-12-18 13:48:36 +00:00
|
|
|
|
else
|
|
|
|
|
formcontrol[0].innerHTML = record.get('displayValue');
|
|
|
|
|
} else
|
|
|
|
|
formcontrol[0].innerHTML = '';
|
|
|
|
|
}
|
2019-12-17 11:52:30 +00:00
|
|
|
|
});
|
|
|
|
|
this.cmbFormat.on('selected', _.bind(function (combo, record) {
|
2019-12-18 13:48:36 +00:00
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
if (record.value == -1) {
|
|
|
|
|
var callback = function(result) {
|
2022-10-11 13:12:17 +00:00
|
|
|
|
me.fillLevelProps(me.levels[me.level]);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
};
|
|
|
|
|
this.addNewBullet(callback);
|
2022-11-16 16:57:02 +00:00
|
|
|
|
} else if (record.value == -2) {
|
|
|
|
|
var callback = function(result) {
|
|
|
|
|
me.fillLevelProps(me.levels[me.level]);
|
|
|
|
|
};
|
|
|
|
|
this.addNewListType(callback);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
} else {
|
2019-12-27 14:16:06 +00:00
|
|
|
|
var oldformat = this._changedProps.get_Format();
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this._changedProps.put_Format(record.value);
|
|
|
|
|
if (record.value == Asc.c_oAscNumberingFormat.Bullet) {
|
2022-10-12 22:09:13 +00:00
|
|
|
|
this.bulletProps.font = record.font ? record.font : undefined;
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this.bulletProps.symbol = record.symbol;
|
2022-10-12 13:48:30 +00:00
|
|
|
|
this._changedProps.put_FontFamily(this.bulletProps.font);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
|
|
|
|
|
this._changedProps.put_Text([new Asc.CAscNumberingLvlText()]);
|
|
|
|
|
this._changedProps.get_Text()[0].put_Value(this.bulletProps.symbol);
|
2022-10-05 17:55:30 +00:00
|
|
|
|
} else if (oldformat == Asc.c_oAscNumberingFormat.Bullet) {
|
2022-10-12 13:48:30 +00:00
|
|
|
|
this._changedProps.put_FontFamily(undefined);
|
2019-12-27 14:16:06 +00:00
|
|
|
|
|
|
|
|
|
this._changedProps.put_Text([new Asc.CAscNumberingLvlText()]);
|
|
|
|
|
this._changedProps.get_Text()[0].put_Type(Asc.c_oAscNumberingLvlTextType.Num);
|
|
|
|
|
this._changedProps.get_Text()[0].put_Value(this.level);
|
2022-10-07 15:13:50 +00:00
|
|
|
|
} else if (oldformat == Asc.c_oAscNumberingFormat.None) {
|
|
|
|
|
if (!this.formatString.lvlIndexes[this.level][this.level]) {
|
|
|
|
|
var selectionStart = this.txtNumFormat.$el.find('input')[0].selectionStart;
|
|
|
|
|
this._changedProps.get_Text().splice(selectionStart, 0, new Asc.CAscNumberingLvlText(Asc.c_oAscNumberingLvlTextType.Num, this.level));
|
|
|
|
|
}
|
2019-12-18 13:48:36 +00:00
|
|
|
|
}
|
2022-10-11 13:12:17 +00:00
|
|
|
|
this.fillLevelProps(this.levels[this.level]);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-17 11:52:30 +00:00
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-17 11:52:30 +00:00
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
this.cmbAlign = new Common.UI.ComboBox({
|
|
|
|
|
el : $window.find('#id-dlg-bullet-align'),
|
|
|
|
|
menuStyle : 'min-width: 100%;',
|
|
|
|
|
editable : false,
|
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
|
data : [
|
|
|
|
|
{ value: AscCommon.align_Left, displayValue: this.textLeft },
|
|
|
|
|
{ value: AscCommon.align_Center, displayValue: this.textCenter },
|
|
|
|
|
{ value: AscCommon.align_Right, displayValue: this.textRight }
|
2020-10-15 17:21:56 +00:00
|
|
|
|
],
|
|
|
|
|
takeFocusOnClose: true
|
2019-12-04 10:35:56 +00:00
|
|
|
|
});
|
|
|
|
|
this.cmbAlign.on('selected', _.bind(function (combo, record) {
|
|
|
|
|
if (this._changedProps)
|
|
|
|
|
this._changedProps.put_Align(record.value);
|
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
|
|
this.cmbSize = new Common.UI.ComboBox({
|
|
|
|
|
el : $window.find('#id-dlg-bullet-size'),
|
2019-12-17 09:32:15 +00:00
|
|
|
|
menuStyle : 'min-width: 100%;max-height: 183px;',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
editable : false,
|
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
|
data : [
|
2019-12-17 11:52:30 +00:00
|
|
|
|
{ value: -1, displayValue: this.txtLikeText },
|
2019-12-04 10:35:56 +00:00
|
|
|
|
{ value: 8, displayValue: "8" },
|
|
|
|
|
{ value: 9, displayValue: "9" },
|
|
|
|
|
{ value: 10, displayValue: "10" },
|
|
|
|
|
{ value: 11, displayValue: "11" },
|
|
|
|
|
{ value: 12, displayValue: "12" },
|
|
|
|
|
{ value: 14, displayValue: "14" },
|
|
|
|
|
{ value: 16, displayValue: "16" },
|
|
|
|
|
{ value: 18, displayValue: "18" },
|
|
|
|
|
{ value: 20, displayValue: "20" },
|
|
|
|
|
{ value: 22, displayValue: "22" },
|
|
|
|
|
{ value: 24, displayValue: "24" },
|
|
|
|
|
{ value: 26, displayValue: "26" },
|
|
|
|
|
{ value: 28, displayValue: "28" },
|
|
|
|
|
{ value: 36, displayValue: "36" },
|
|
|
|
|
{ value: 48, displayValue: "48" },
|
|
|
|
|
{ value: 72, displayValue: "72" },
|
|
|
|
|
{ value: 96, displayValue: "96" }
|
2020-10-15 17:21:56 +00:00
|
|
|
|
],
|
|
|
|
|
takeFocusOnClose: true
|
2019-12-04 10:35:56 +00:00
|
|
|
|
});
|
|
|
|
|
this.cmbSize.on('selected', _.bind(function (combo, record) {
|
|
|
|
|
if (this._changedProps) {
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this._changedProps.put_FontSize((record.value>0) ? record.value : undefined);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
2019-12-17 14:25:12 +00:00
|
|
|
|
var levels = [];
|
|
|
|
|
for (var i=0; i<9; i++)
|
2019-12-18 13:48:36 +00:00
|
|
|
|
levels.push({value: i});
|
2019-12-17 14:25:12 +00:00
|
|
|
|
this.levelsList = new Common.UI.ListView({
|
|
|
|
|
el: $('#levels-list', this.$window),
|
|
|
|
|
store: new Common.UI.DataViewStore(levels),
|
2020-10-15 17:21:56 +00:00
|
|
|
|
tabindex: 1,
|
2019-12-19 14:14:05 +00:00
|
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;overflow: hidden; text-overflow: ellipsis;line-height: 15px;"><%= (value+1) %></div>')
|
2019-12-17 14:25:12 +00:00
|
|
|
|
});
|
2019-12-18 13:48:36 +00:00
|
|
|
|
this.levelsList.on('item:select', _.bind(this.onSelectLevel, this));
|
2019-12-17 14:25:12 +00:00
|
|
|
|
|
2022-09-21 09:39:25 +00:00
|
|
|
|
this.txtNumFormat = new Common.UI.InputField({
|
|
|
|
|
el : $window.find('#id-dlg-numbering-format-str'),
|
|
|
|
|
allowBlank : true,
|
|
|
|
|
value : ''
|
|
|
|
|
});
|
|
|
|
|
var $formatInput = this.txtNumFormat.$el.find('input');
|
2022-10-07 18:31:14 +00:00
|
|
|
|
$formatInput.on('keydown', _.bind(this.onKeyDown, this));
|
|
|
|
|
$formatInput.on('keyup', _.bind(this.onKeyUp, this));
|
2022-10-06 20:16:04 +00:00
|
|
|
|
$formatInput.on('input', _.bind(this.onFormatInput, this));
|
2022-09-21 09:39:25 +00:00
|
|
|
|
|
2022-10-07 15:13:50 +00:00
|
|
|
|
var onMouseUp = function (e) {
|
|
|
|
|
me.checkMousePosition($formatInput[0]);
|
|
|
|
|
$(document).off('mouseup', onMouseUp);
|
|
|
|
|
};
|
|
|
|
|
var onMouseDown = function (e) {
|
|
|
|
|
$(document).on('mouseup', onMouseUp);
|
|
|
|
|
};
|
|
|
|
|
$formatInput.on('mousedown', _.bind(onMouseDown, this));
|
2022-10-07 18:31:14 +00:00
|
|
|
|
$formatInput.on('contextmenu', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2022-10-07 15:13:50 +00:00
|
|
|
|
|
2022-09-21 09:39:25 +00:00
|
|
|
|
this.cmbLevel = new Common.UI.ComboBox({
|
|
|
|
|
el : $window.find('#id-dlg-numbering-format-lvl'),
|
|
|
|
|
menuStyle : 'min-width: 100%;',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
style : "width: 130px;",
|
2022-09-21 09:39:25 +00:00
|
|
|
|
editable : false,
|
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
|
data : [],
|
|
|
|
|
takeFocusOnClose: true
|
|
|
|
|
});
|
|
|
|
|
this.cmbLevel.on('selected', _.bind(this.onIncludeLevelSelected, this));
|
|
|
|
|
|
2022-10-05 18:25:40 +00:00
|
|
|
|
this.spnStart = new Common.UI.MetricSpinner({
|
|
|
|
|
el: $window.find('#id-dlg-numbering-spin-start'),
|
|
|
|
|
step: 1,
|
2022-10-10 14:38:02 +00:00
|
|
|
|
width: 85,
|
2022-10-05 18:25:40 +00:00
|
|
|
|
defaultUnit : "",
|
|
|
|
|
value: 1,
|
|
|
|
|
maxValue: 16383,
|
|
|
|
|
minValue: 1,
|
|
|
|
|
allowDecimal: false
|
|
|
|
|
});
|
|
|
|
|
this.spnStart.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_Start(field.getNumberValue());
|
|
|
|
|
this.makeFormatStr(this._changedProps);
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.cmbFonts = new Common.UI.ComboBoxFonts({
|
|
|
|
|
el : $window.find('#id-dlg-numbering-font-name'),
|
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
|
style : 'width: 100%;',
|
|
|
|
|
menuCls : 'scrollable-menu',
|
|
|
|
|
menuStyle : 'min-width: 100%;max-height: 270px;',
|
|
|
|
|
store : new Common.Collections.Fonts(),
|
|
|
|
|
recent : 0,
|
|
|
|
|
hint : this.tipFontName,
|
|
|
|
|
takeFocusOnClose: true
|
|
|
|
|
}).on('selected', _.bind(this.onFontName, this));
|
|
|
|
|
|
|
|
|
|
this.btnBold = new Common.UI.Button({
|
|
|
|
|
parentEl: $window.find('#id-dlg-numbering-bold'),
|
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
|
iconCls: 'toolbar__icon btn-bold',
|
|
|
|
|
enableToggle: true,
|
|
|
|
|
hint: this.textBold
|
|
|
|
|
});
|
|
|
|
|
this.btnBold.on('click', _.bind(this.onBoldClick, this));
|
|
|
|
|
|
|
|
|
|
this.btnItalic = new Common.UI.Button({
|
|
|
|
|
parentEl: $window.find('#id-dlg-numbering-italic'),
|
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
|
iconCls: 'toolbar__icon btn-italic',
|
|
|
|
|
enableToggle: true,
|
|
|
|
|
hint: this.textItalic
|
|
|
|
|
});
|
|
|
|
|
this.btnItalic.on('click', _.bind(this.onItalicClick, this));
|
|
|
|
|
|
2022-10-10 14:38:02 +00:00
|
|
|
|
this.spnAlign = new Common.UI.MetricSpinner({
|
|
|
|
|
el: $window.findById('#id-dlg-numbering-align-at'),
|
|
|
|
|
step: .1,
|
|
|
|
|
width: 85,
|
|
|
|
|
defaultUnit : "cm",
|
|
|
|
|
defaultValue : 0,
|
|
|
|
|
value: '0 cm',
|
|
|
|
|
maxValue: 55.87,
|
|
|
|
|
minValue: 0
|
|
|
|
|
});
|
|
|
|
|
this.spinners.push(this.spnAlign);
|
|
|
|
|
this.spnAlign.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_NumberPosition(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
2022-11-16 21:04:18 +00:00
|
|
|
|
this.spnTabStop.setMinValue(field.getNumberValue());
|
|
|
|
|
this.spnTabStop.setValue(this.spnTabStop.getValue(), true);
|
2022-10-10 14:38:02 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
|
|
this.spnIndents = new Common.UI.MetricSpinner({
|
|
|
|
|
el: $window.findById('#id-dlg-numbering-indent'),
|
|
|
|
|
step: .1,
|
|
|
|
|
width: 85,
|
|
|
|
|
defaultUnit : "cm",
|
|
|
|
|
defaultValue : 0,
|
|
|
|
|
value: '0 cm',
|
|
|
|
|
maxValue: 55.87,
|
|
|
|
|
minValue: 0
|
|
|
|
|
});
|
|
|
|
|
this.spinners.push(this.spnIndents);
|
|
|
|
|
this.spnIndents.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_IndentSize(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
|
|
this.cmbFollow = new Common.UI.ComboBox({
|
|
|
|
|
el : $window.find('#id-dlg-numbering-follow'),
|
|
|
|
|
menuStyle : 'min-width: 100%;',
|
|
|
|
|
editable : false,
|
|
|
|
|
cls : 'input-group-nr',
|
|
|
|
|
data : [
|
|
|
|
|
{ value: Asc.c_oAscNumberingSuff.Tab, displayValue: this.textTab },
|
|
|
|
|
{ value: Asc.c_oAscNumberingSuff.Space, displayValue: this.textSpace },
|
|
|
|
|
{ value: Asc.c_oAscNumberingSuff.None, displayValue: this.txtNone }
|
|
|
|
|
],
|
|
|
|
|
takeFocusOnClose: true
|
|
|
|
|
});
|
|
|
|
|
this.cmbFollow.on('selected', _.bind(function (combo, record) {
|
|
|
|
|
if (this._changedProps)
|
|
|
|
|
this._changedProps.put_Suff(record.value);
|
2022-11-16 21:04:18 +00:00
|
|
|
|
this.chTabStop.setDisabled(record.value!==Asc.c_oAscNumberingSuff.Tab);
|
|
|
|
|
this.spnTabStop.setDisabled(record.value!==Asc.c_oAscNumberingSuff.Tab || this.chTabStop.getValue()!=='checked');
|
2022-10-10 14:38:02 +00:00
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
|
|
this.chRestart = new Common.UI.CheckBox({
|
|
|
|
|
el: $window.find('#id-dlg-numbering-restart'),
|
|
|
|
|
labelText: this.txtRestart
|
|
|
|
|
});
|
|
|
|
|
this.chRestart.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_Restart(field.getValue()=='checked' ? -1 : 0);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
2022-11-16 21:04:18 +00:00
|
|
|
|
this.chTabStop = new Common.UI.CheckBox({
|
|
|
|
|
el: $window.find('#id-dlg-chk-tabstop'),
|
|
|
|
|
labelText: this.txtTabStop
|
|
|
|
|
});
|
|
|
|
|
this.chTabStop.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_StopTab(field.getValue()==='checked' ? Common.Utils.Metric.fnRecalcToMM(this.spnTabStop.getNumberValue()) : null);
|
|
|
|
|
this.spnTabStop.setDisabled(field.getValue()!=='checked' || this.cmbFollow.getValue()!==Asc.c_oAscNumberingSuff.Tab);
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
|
|
|
|
this.spnTabStop = new Common.UI.MetricSpinner({
|
|
|
|
|
el: $window.findById('#id-dlg-num-tabstop'),
|
|
|
|
|
step: .1,
|
|
|
|
|
width: 85,
|
|
|
|
|
defaultUnit : "cm",
|
|
|
|
|
defaultValue : 0,
|
|
|
|
|
value: '0 cm',
|
|
|
|
|
maxValue: 55.87,
|
|
|
|
|
minValue: 0
|
|
|
|
|
});
|
|
|
|
|
this.spinners.push(this.spnTabStop);
|
|
|
|
|
this.spnTabStop.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_StopTab(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
}, this));
|
|
|
|
|
|
2021-05-05 16:03:08 +00:00
|
|
|
|
this.on('animate:after', _.bind(this.onAnimateAfter, this));
|
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
this.afterRender();
|
|
|
|
|
},
|
|
|
|
|
|
2020-10-15 17:21:56 +00:00
|
|
|
|
getFocusedComponents: function() {
|
2022-10-11 15:48:23 +00:00
|
|
|
|
return [this.cmbFormat, this.cmbAlign, this.cmbSize, this.btnColor, this.levelsList];
|
2020-10-15 17:21:56 +00:00
|
|
|
|
},
|
|
|
|
|
|
2020-10-21 08:10:11 +00:00
|
|
|
|
getDefaultFocusableComponent: function () {
|
2022-10-11 15:48:23 +00:00
|
|
|
|
return this.cmbFormat;
|
2020-10-21 07:37:42 +00:00
|
|
|
|
},
|
|
|
|
|
|
2021-05-05 16:03:08 +00:00
|
|
|
|
onAnimateAfter: function() {
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
afterRender: function() {
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.cmbFonts.fillFonts(this.fontStore);
|
|
|
|
|
this.cmbFonts.selectRecord(this.fontStore.findWhere({name: this.fontName}));
|
|
|
|
|
|
2022-10-10 14:38:02 +00:00
|
|
|
|
this.updateMetricUnit();
|
2019-12-04 10:35:56 +00:00
|
|
|
|
this.updateThemeColors();
|
|
|
|
|
this._setDefaults(this.props);
|
2019-12-25 09:10:42 +00:00
|
|
|
|
var me = this;
|
|
|
|
|
var onApiLevelChange = function(level) {
|
|
|
|
|
me.levelsList.selectByIndex(level);
|
|
|
|
|
};
|
|
|
|
|
this.api.asc_registerCallback('asc_onPreviewLevelChange', onApiLevelChange);
|
|
|
|
|
this.on('close', function(obj){
|
|
|
|
|
me.api.asc_unregisterCallback('asc_onPreviewLevelChange', onApiLevelChange);
|
|
|
|
|
});
|
2019-12-04 10:35:56 +00:00
|
|
|
|
},
|
|
|
|
|
|
2022-10-10 14:38:02 +00:00
|
|
|
|
updateMetricUnit: function() {
|
|
|
|
|
if (this.spinners) {
|
|
|
|
|
for (var i=0; i<this.spinners.length; i++) {
|
|
|
|
|
var spinner = this.spinners[i];
|
|
|
|
|
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
|
|
|
|
|
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
updateThemeColors: function() {
|
|
|
|
|
this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-19 12:01:49 +00:00
|
|
|
|
onAutoColor: function(item, state) {
|
|
|
|
|
if (!!state) {
|
|
|
|
|
var color = Common.Utils.ThemeColor.getHexColor(0, 0, 0);
|
|
|
|
|
this.btnColor.setColor(color);
|
|
|
|
|
this.colors.clearSelection();
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
var color = new Asc.asc_CColor();
|
|
|
|
|
color.put_auto(true);
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this._changedProps.put_Color(color);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
}
|
2019-12-17 09:32:15 +00:00
|
|
|
|
}
|
2019-12-04 10:35:56 +00:00
|
|
|
|
},
|
|
|
|
|
|
2019-12-19 12:01:49 +00:00
|
|
|
|
onLikeTextColor: function(item, state) {
|
|
|
|
|
if (!!state) {
|
2021-05-04 11:24:28 +00:00
|
|
|
|
var color = Common.Utils.ThemeColor.getHexColor(0, 0, 0);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
this.btnColor.setColor(color);
|
|
|
|
|
this.colors.clearSelection();
|
|
|
|
|
if (this._changedProps) {
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this._changedProps.put_Color(undefined);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
}
|
2019-12-18 14:42:01 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-29 14:37:59 +00:00
|
|
|
|
onColorsSelect: function(btn, color) {
|
2019-12-04 10:35:56 +00:00
|
|
|
|
if (this._changedProps) {
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this._changedProps.put_Color(Common.Utils.ThemeColor.getRgbColor(color));
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
2019-12-18 14:42:01 +00:00
|
|
|
|
this.btnColor.menu.items[0].setChecked(false, true);
|
2019-12-19 12:01:49 +00:00
|
|
|
|
this.btnColor.menu.items[1].setChecked(false, true);
|
2019-12-17 09:32:15 +00:00
|
|
|
|
if (this.api) {
|
2019-12-25 09:33:20 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-17 09:32:15 +00:00
|
|
|
|
}
|
2019-12-04 10:35:56 +00:00
|
|
|
|
},
|
|
|
|
|
|
2019-12-18 13:48:36 +00:00
|
|
|
|
addNewBullet: function(callback) {
|
2019-12-04 10:35:56 +00:00
|
|
|
|
var me = this,
|
|
|
|
|
props = me.bulletProps,
|
|
|
|
|
handler = function(dlg, result, settings) {
|
|
|
|
|
if (result == 'ok') {
|
|
|
|
|
props.changed = true;
|
|
|
|
|
props.code = settings.code;
|
|
|
|
|
props.font = settings.font;
|
|
|
|
|
props.symbol = settings.symbol;
|
|
|
|
|
if (me._changedProps) {
|
2019-12-18 13:48:36 +00:00
|
|
|
|
me._changedProps.put_Format(Asc.c_oAscNumberingFormat.Bullet);
|
2022-10-12 13:48:30 +00:00
|
|
|
|
me._changedProps.put_FontFamily(props.font);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
|
2019-12-18 13:48:36 +00:00
|
|
|
|
me._changedProps.put_Text([new Asc.CAscNumberingLvlText()]);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
me._changedProps.get_Text()[0].put_Value(props.symbol);
|
2019-12-26 10:57:55 +00:00
|
|
|
|
if (me.api) {
|
|
|
|
|
me.api.SetDrawImagePreviewBullet('bulleted-list-preview', me.props, me.level, me.type==2);
|
|
|
|
|
}
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-18 13:48:36 +00:00
|
|
|
|
callback && callback.call(me, result);
|
2019-12-04 10:35:56 +00:00
|
|
|
|
},
|
|
|
|
|
win = new Common.Views.SymbolTableDialog({
|
|
|
|
|
api: me.options.api,
|
|
|
|
|
lang: me.options.interfaceLang,
|
|
|
|
|
modal: true,
|
|
|
|
|
type: 0,
|
|
|
|
|
font: props.font,
|
|
|
|
|
symbol: props.symbol,
|
|
|
|
|
handler: handler
|
|
|
|
|
});
|
|
|
|
|
win.show();
|
|
|
|
|
win.on('symbol:dblclick', handler);
|
|
|
|
|
},
|
|
|
|
|
|
2022-11-16 16:57:02 +00:00
|
|
|
|
addNewListType: function(callback) {
|
|
|
|
|
var me = this,
|
|
|
|
|
handler = function(result, value) {
|
|
|
|
|
if (result == 'ok') {
|
|
|
|
|
if (me._changedProps) {
|
|
|
|
|
me._changedProps.put_Format(value);
|
|
|
|
|
if (me.api) {
|
|
|
|
|
me.api.SetDrawImagePreviewBullet('bulleted-list-preview', me.props, me.level, me.type==2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
callback && callback.call(me, result);
|
|
|
|
|
},
|
|
|
|
|
win = new DE.Views.ListTypesAdvanced({
|
|
|
|
|
modal: true,
|
|
|
|
|
lang: me.lang,
|
|
|
|
|
handler: handler
|
|
|
|
|
});
|
|
|
|
|
win.show();
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-04 10:35:56 +00:00
|
|
|
|
_handleInput: function(state) {
|
|
|
|
|
if (this.options.handler) {
|
2019-12-18 13:48:36 +00:00
|
|
|
|
var props = [], lvlnum = [];
|
|
|
|
|
for (var i=0; i<9; i++) {
|
|
|
|
|
if (!this.levels[i]) continue;
|
|
|
|
|
props.push(this.levels[i]);
|
|
|
|
|
lvlnum.push(i);
|
|
|
|
|
}
|
|
|
|
|
this.options.handler.call(this, state, {props: (props.length==1) ? props[0] : props, num: (lvlnum.length==1) ? lvlnum[0] : lvlnum});
|
2019-12-04 10:35:56 +00:00
|
|
|
|
}
|
|
|
|
|
this.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onBtnClick: function(event) {
|
|
|
|
|
this._handleInput(event.currentTarget.attributes['result'].value);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onPrimary: function(event) {
|
|
|
|
|
this._handleInput('ok');
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_setDefaults: function (props) {
|
|
|
|
|
this.bulletProps = {};
|
|
|
|
|
if (props) {
|
2019-12-18 13:48:36 +00:00
|
|
|
|
var levelProps = props.get_Lvl(this.level);
|
|
|
|
|
(this.level<0) && (this.level = 0);
|
|
|
|
|
this.levels[this.level] = levelProps || new Asc.CAscNumberingLvl(this.level);
|
|
|
|
|
|
|
|
|
|
if (this.type==2) {
|
|
|
|
|
this.levelsList.selectByIndex(this.level);
|
|
|
|
|
} else
|
|
|
|
|
this.fillLevelProps(this.levels[this.level]);
|
|
|
|
|
}
|
|
|
|
|
this._changedProps = this.levels[this.level];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSelectLevel: function(listView, itemView, record) {
|
|
|
|
|
this.level = record.get('value');
|
|
|
|
|
if (this.levels[this.level] === undefined)
|
|
|
|
|
this.levels[this.level] = this.props.get_Lvl(this.level);
|
|
|
|
|
this.fillLevelProps(this.levels[this.level]);
|
|
|
|
|
this._changedProps = this.levels[this.level];
|
2022-07-21 18:24:44 +00:00
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
2019-12-18 13:48:36 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
fillLevelProps: function(levelProps) {
|
|
|
|
|
if (!levelProps) return;
|
|
|
|
|
|
2022-10-12 13:48:30 +00:00
|
|
|
|
var me = this;
|
|
|
|
|
|
2019-12-18 14:51:18 +00:00
|
|
|
|
this.cmbAlign.setValue((levelProps.get_Align()!==undefined) ? levelProps.get_Align() : '');
|
2019-12-18 13:48:36 +00:00
|
|
|
|
var format = levelProps.get_Format(),
|
|
|
|
|
text = levelProps.get_Text();
|
|
|
|
|
if (text && format == Asc.c_oAscNumberingFormat.Bullet) {
|
|
|
|
|
this.bulletProps.symbol = text[0].get_Value();
|
|
|
|
|
}
|
2022-10-07 20:31:54 +00:00
|
|
|
|
|
|
|
|
|
this.cmbSize.setValue(levelProps.get_FontSize() || -1);
|
|
|
|
|
|
|
|
|
|
var font = levelProps.get_FontFamily();
|
|
|
|
|
if (font) {
|
|
|
|
|
var rec = this.cmbFonts.store.findWhere({name: font});
|
|
|
|
|
this.fontName = (rec) ? rec.get('name') : font;
|
|
|
|
|
this.cmbFonts.setValue(this.fontName);
|
2022-10-11 13:12:17 +00:00
|
|
|
|
} else
|
|
|
|
|
this.cmbFonts.setValue('');
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.bulletProps.font = font;
|
|
|
|
|
|
|
|
|
|
this.btnBold.toggle(levelProps.get_Bold() === true, true);
|
|
|
|
|
this.btnItalic.toggle(levelProps.get_Italic() === true, true);
|
|
|
|
|
|
|
|
|
|
var color = levelProps.get_Color();
|
|
|
|
|
this.btnColor.menu.items[0].setChecked(color===undefined, true);
|
|
|
|
|
this.btnColor.menu.items[1].setChecked(!!color && color.get_auto(), true);
|
|
|
|
|
if (color && !color.get_auto()) {
|
|
|
|
|
if ( typeof(color) == 'object' ) {
|
|
|
|
|
var isselected = false;
|
|
|
|
|
for (var i=0; i<10; i++) {
|
|
|
|
|
if ( Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue ) {
|
|
|
|
|
this.colors.select(color,true);
|
|
|
|
|
isselected = true;
|
|
|
|
|
break;
|
2019-12-18 13:48:36 +00:00
|
|
|
|
}
|
2022-10-07 20:31:54 +00:00
|
|
|
|
}
|
|
|
|
|
if (!isselected) this.colors.clearSelection();
|
|
|
|
|
color = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
|
|
|
|
|
} else
|
|
|
|
|
this.colors.select(color,true);
|
|
|
|
|
} else {
|
|
|
|
|
this.colors.clearSelection();
|
|
|
|
|
color = '000000';
|
2019-12-18 13:48:36 +00:00
|
|
|
|
}
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.btnColor.setColor(color);
|
|
|
|
|
|
2022-10-12 13:48:30 +00:00
|
|
|
|
if (this.type===1) { // numbers
|
2022-11-16 16:57:02 +00:00
|
|
|
|
if (format !== Asc.c_oAscNumberingFormat.None || this.cmbFormat.store.length<1) {
|
|
|
|
|
this.checkRecentNum(format);
|
|
|
|
|
}
|
|
|
|
|
var store = [this._itemNoneBullet].concat(this._arrNumbers);
|
|
|
|
|
this.recentNumTypes.forEach(function(item) {
|
|
|
|
|
if (item) {
|
|
|
|
|
item = parseInt(item);
|
|
|
|
|
store.push({ displayValue: AscCommon.IntToNumberFormat(1, item, me.lang) + ', ' + AscCommon.IntToNumberFormat(2, item, me.lang) + ', ' + AscCommon.IntToNumberFormat(3, item, me.lang) + ',...', value: item });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
store.push(this._itemMoreTypes);
|
|
|
|
|
this.cmbFormat.setData(store);
|
2022-10-11 15:48:23 +00:00
|
|
|
|
this.cmbFormat.setValue((format!==undefined) ? format : '');
|
2022-10-11 12:20:04 +00:00
|
|
|
|
this.makeFormatStr(levelProps);
|
2022-10-12 13:48:30 +00:00
|
|
|
|
} else {
|
2022-11-16 16:57:02 +00:00
|
|
|
|
if (format !== Asc.c_oAscNumberingFormat.None || this.cmbFormat.store.length<1) {
|
|
|
|
|
if (format === Asc.c_oAscNumberingFormat.Bullet)
|
|
|
|
|
this.checkRecent(this.bulletProps.symbol, this.bulletProps.font);
|
|
|
|
|
else if (format !== Asc.c_oAscNumberingFormat.None)
|
|
|
|
|
this.checkRecentNum(format);
|
2022-10-12 13:48:30 +00:00
|
|
|
|
var store = (this.type===2) ? [this._itemNoneBullet].concat(this._arrNumbers) : [];
|
2022-11-16 16:57:02 +00:00
|
|
|
|
if (this.type===2) {
|
|
|
|
|
this.recentNumTypes.forEach(function(item) {
|
|
|
|
|
if (item) {
|
|
|
|
|
item = parseInt(item);
|
|
|
|
|
store.push({ displayValue: AscCommon.IntToNumberFormat(1, item, me.lang) + ', ' + AscCommon.IntToNumberFormat(2, item, me.lang) + ', ' + AscCommon.IntToNumberFormat(3, item, me.lang) + ',...', value: item });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-10-12 13:48:30 +00:00
|
|
|
|
store = store.concat(this._arrBullets);
|
|
|
|
|
this.recentBullets.forEach(function(item) {
|
|
|
|
|
store.push({ displayValue: me.txtSymbol + ': ', value: Asc.c_oAscNumberingFormat.Bullet, symbol: item.symbol, font: item.font });
|
|
|
|
|
});
|
2022-11-16 16:57:02 +00:00
|
|
|
|
(this.type===2) && store.push(this._itemMoreTypes);
|
2022-10-12 13:48:30 +00:00
|
|
|
|
store.push(this._itemNewBullet);
|
|
|
|
|
this.cmbFormat.setData(store);
|
|
|
|
|
}
|
|
|
|
|
if (format == Asc.c_oAscNumberingFormat.Bullet)
|
2022-10-12 22:09:13 +00:00
|
|
|
|
this.cmbFormat.selectRecord(this.cmbFormat.store.findWhere({value: Asc.c_oAscNumberingFormat.Bullet, symbol: this.bulletProps.symbol, font: this.bulletProps.font || ''}));
|
2022-10-12 13:48:30 +00:00
|
|
|
|
else
|
|
|
|
|
this.cmbFormat.setValue((format!==undefined) ? format : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.type===2) {
|
2022-10-11 12:20:04 +00:00
|
|
|
|
this.spnStart.setValue(levelProps.get_Start(), true);
|
|
|
|
|
this.spnAlign.setValue(Common.Utils.Metric.fnRecalcFromMM(levelProps.get_NumberPosition()), true);
|
|
|
|
|
this.spnIndents.setValue(Common.Utils.Metric.fnRecalcFromMM(levelProps.get_IndentSize()), true);
|
|
|
|
|
this.cmbFollow.setValue(levelProps.get_Suff());
|
2022-11-17 13:17:59 +00:00
|
|
|
|
this.chRestart.setValue(levelProps.get_Restart()===-1, true);
|
|
|
|
|
this.chTabStop.setValue(levelProps.get_StopTab()!==null, true);
|
|
|
|
|
this.spnTabStop.setMinValue(this.spnAlign.getNumberValue());
|
|
|
|
|
this.spnTabStop.setValue(levelProps.get_StopTab()!==null ? Common.Utils.Metric.fnRecalcFromMM(levelProps.get_StopTab()) : this.spnIndents.getNumberValue(), true);
|
2022-10-11 12:20:04 +00:00
|
|
|
|
|
2022-09-21 09:39:25 +00:00
|
|
|
|
this.txtNumFormat.setDisabled(format == Asc.c_oAscNumberingFormat.Bullet);
|
2022-10-07 20:31:54 +00:00
|
|
|
|
this.spnStart.setDisabled(format == Asc.c_oAscNumberingFormat.Bullet);
|
2022-10-10 14:38:02 +00:00
|
|
|
|
this.chRestart.setDisabled(this.level===0);
|
2022-11-16 21:04:18 +00:00
|
|
|
|
this.chTabStop.setDisabled(levelProps.get_Suff()!==Asc.c_oAscNumberingSuff.Tab);
|
|
|
|
|
this.spnTabStop.setDisabled(levelProps.get_StopTab()===null || levelProps.get_Suff()!==Asc.c_oAscNumberingSuff.Tab);
|
2022-10-07 20:31:54 +00:00
|
|
|
|
|
2022-09-21 09:39:25 +00:00
|
|
|
|
var arr = [];
|
|
|
|
|
var me = this;
|
|
|
|
|
for (var lvl=0; lvl<this.level; lvl++) {
|
2022-10-05 17:55:30 +00:00
|
|
|
|
var frmt = this.props.get_Lvl(lvl).get_Format();
|
|
|
|
|
if (frmt !== Asc.c_oAscNumberingFormat.None && frmt !== Asc.c_oAscNumberingFormat.Bullet) {
|
|
|
|
|
arr.push({ displayValue: me.textLevel + ' ' + (lvl+1), value: lvl });
|
|
|
|
|
}
|
2022-09-21 09:39:25 +00:00
|
|
|
|
}
|
|
|
|
|
this.cmbLevel.setData(arr);
|
|
|
|
|
this.cmbLevel.setValue('');
|
2022-10-05 17:55:30 +00:00
|
|
|
|
this.cmbLevel.setDisabled(format == Asc.c_oAscNumberingFormat.Bullet || this.level===0 || arr.length<1);
|
|
|
|
|
this.makeFormatStr(levelProps);
|
2022-09-21 09:39:25 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2022-10-05 17:55:30 +00:00
|
|
|
|
makeFormatStr: function(props) {
|
|
|
|
|
var formatStr = '';
|
2022-10-06 20:16:04 +00:00
|
|
|
|
this.formatString.lvlIndexes[this.level] = [];
|
2022-10-05 17:55:30 +00:00
|
|
|
|
if (props) {
|
|
|
|
|
if (props.get_Format() !== Asc.c_oAscNumberingFormat.Bullet) {
|
|
|
|
|
var text = props.get_Text();
|
|
|
|
|
var me = this;
|
2022-10-06 20:16:04 +00:00
|
|
|
|
var arr = this.formatString.lvlIndexes[this.level];
|
2022-10-05 17:55:30 +00:00
|
|
|
|
text.forEach(function (item, index) {
|
|
|
|
|
if (item.get_Type() === Asc.c_oAscNumberingLvlTextType.Text) {
|
|
|
|
|
formatStr += item.get_Value().toString();
|
|
|
|
|
} else if (item.get_Type() === Asc.c_oAscNumberingLvlTextType.Num) {
|
|
|
|
|
var num = item.get_Value();
|
|
|
|
|
if (me.levels[num] === undefined)
|
|
|
|
|
me.levels[num] = me.props.get_Lvl(num);
|
|
|
|
|
arr[num] = {start: formatStr.length, index: index};
|
|
|
|
|
var lvl = me.levels[num];
|
2022-11-16 16:57:02 +00:00
|
|
|
|
formatStr += AscCommon.IntToNumberFormat(lvl.get_Start(), lvl.get_Format(), me.lang);
|
2022-10-05 17:55:30 +00:00
|
|
|
|
arr[num].end = formatStr.length;
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-10-12 22:09:13 +00:00
|
|
|
|
this.txtNumFormat.$el.find('input').css('font-family', 'inherit');
|
|
|
|
|
} else {
|
|
|
|
|
formatStr = this.bulletProps.symbol;
|
|
|
|
|
this.txtNumFormat.$el.find('input').css('font-family', this.bulletProps.font || 'inherit');
|
2022-10-05 17:55:30 +00:00
|
|
|
|
}
|
2022-09-21 09:39:25 +00:00
|
|
|
|
}
|
2022-10-06 20:16:04 +00:00
|
|
|
|
this.formatString.text = formatStr;
|
2022-10-05 17:55:30 +00:00
|
|
|
|
this.txtNumFormat.setValue(formatStr);
|
2022-09-21 09:39:25 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onIncludeLevelSelected: function (combo, record) {
|
|
|
|
|
var $txt = this.txtNumFormat.$el.find('input'),
|
2022-10-05 17:55:30 +00:00
|
|
|
|
selectionStart = $txt[0].selectionStart;
|
2022-09-21 09:39:25 +00:00
|
|
|
|
|
|
|
|
|
if (this._changedProps) {
|
2022-10-05 17:55:30 +00:00
|
|
|
|
var text = this._changedProps.get_Text(),
|
2022-10-06 20:16:04 +00:00
|
|
|
|
arr = this.formatString.lvlIndexes[this.level];
|
2022-10-05 17:55:30 +00:00
|
|
|
|
for (var i=0; i<arr.length; i++) {
|
|
|
|
|
if (arr[i]) {
|
|
|
|
|
var item = arr[i];
|
|
|
|
|
if (i===record.value) {
|
|
|
|
|
text.splice(item.index, 1);
|
|
|
|
|
if (item.end<selectionStart)
|
|
|
|
|
selectionStart -= (item.end - item.start);
|
|
|
|
|
} else {
|
|
|
|
|
if (item.end<selectionStart)
|
|
|
|
|
selectionStart -= (item.end - item.start - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
text.splice(selectionStart, 0, new Asc.CAscNumberingLvlText(Asc.c_oAscNumberingLvlTextType.Num, record.value));
|
|
|
|
|
this._changedProps.put_Text(text);
|
|
|
|
|
this.makeFormatStr(this._changedProps);
|
2022-10-07 15:13:50 +00:00
|
|
|
|
this.cmbLevel.setValue('');
|
2022-09-21 09:39:25 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
2019-12-04 10:35:56 +00:00
|
|
|
|
},
|
|
|
|
|
|
2022-10-06 20:16:04 +00:00
|
|
|
|
posToIndex: function (position) {
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
var arr = this.formatString.lvlIndexes[this.level];
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (arr[i]) {
|
|
|
|
|
var item = arr[i];
|
|
|
|
|
if (item.end < position)
|
|
|
|
|
position -= (item.end - item.start - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return position;
|
|
|
|
|
},
|
|
|
|
|
|
2022-10-07 15:13:50 +00:00
|
|
|
|
isPosInRange: function (position, toEnd) {
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
var arr = this.formatString.lvlIndexes[this.level];
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
if (arr[i]) {
|
|
|
|
|
var item = arr[i];
|
|
|
|
|
if (position > item.start && position < item.end)
|
|
|
|
|
return toEnd ? item.end : item.start;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
checkMousePosition: function(target) {
|
2022-10-06 20:16:04 +00:00
|
|
|
|
var me = this;
|
|
|
|
|
setTimeout(function () {
|
2022-10-07 15:13:50 +00:00
|
|
|
|
if (target.selectionStart===target.selectionEnd) {
|
|
|
|
|
var res = me.isPosInRange(target.selectionStart);
|
|
|
|
|
if (res !== undefined)
|
|
|
|
|
target.selectionStart = target.selectionEnd = res;
|
|
|
|
|
} else {
|
|
|
|
|
var res = me.isPosInRange(target.selectionStart);
|
|
|
|
|
if (res !== undefined)
|
|
|
|
|
target.selectionStart = res;
|
|
|
|
|
res = me.isPosInRange(target.selectionEnd, true);
|
|
|
|
|
if (res !== undefined)
|
|
|
|
|
target.selectionEnd = res;
|
|
|
|
|
}
|
|
|
|
|
me.formatString.selectionStart = target.selectionStart;
|
|
|
|
|
me.formatString.selectionEnd = target.selectionEnd;
|
2022-10-06 20:16:04 +00:00
|
|
|
|
}, 0);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onFormatInput: function(e) {
|
|
|
|
|
var newValue = $(e.target).val(),
|
|
|
|
|
oldStr = this.formatString.text,
|
|
|
|
|
newStr = newValue.slice(this.formatString.selectionStart, newValue.length - (oldStr.length - this.formatString.selectionEnd)),
|
|
|
|
|
startIdx = this.posToIndex(this.formatString.selectionStart),
|
|
|
|
|
endIdx = this.posToIndex(this.formatString.selectionEnd);
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
var text = this._changedProps.get_Text();
|
|
|
|
|
var arr = text.slice(0, startIdx);
|
|
|
|
|
newStr.split('').forEach(function(str){
|
|
|
|
|
arr.push(new Asc.CAscNumberingLvlText(Asc.c_oAscNumberingLvlTextType.Text, str));
|
|
|
|
|
});
|
|
|
|
|
arr = arr.concat(text.slice(endIdx, text.length));
|
|
|
|
|
this._changedProps.put_Text(arr);
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
this.makeFormatStr(this._changedProps);
|
2022-10-07 15:13:50 +00:00
|
|
|
|
if (!this.formatString.lvlIndexes[this.level][this.level]) {
|
|
|
|
|
this._changedProps.put_Format(Asc.c_oAscNumberingFormat.None);
|
|
|
|
|
this.cmbFormat.setValue(Asc.c_oAscNumberingFormat.None);
|
|
|
|
|
}
|
2022-10-06 20:16:04 +00:00
|
|
|
|
}
|
2022-10-07 18:31:14 +00:00
|
|
|
|
this.formatString.selectionStart = e.target.selectionStart;
|
|
|
|
|
this.formatString.selectionEnd = e.target.selectionEnd;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onKeyDown: function(event) {
|
|
|
|
|
var me = this,
|
|
|
|
|
key = event.keyCode,
|
|
|
|
|
shift = event.shiftKey;
|
|
|
|
|
if (key === Common.UI.Keys.LEFT) {
|
|
|
|
|
var res = me.isPosInRange(event.target.selectionStart-1);
|
|
|
|
|
if (res !== undefined)
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
event.target.selectionStart = res;
|
|
|
|
|
!shift && (event.target.selectionEnd = res);
|
|
|
|
|
me.formatString.selectionStart = event.target.selectionStart;
|
|
|
|
|
me.formatString.selectionEnd = event.target.selectionEnd;
|
|
|
|
|
}, 0);
|
|
|
|
|
} else if (key === Common.UI.Keys.RIGHT) {
|
|
|
|
|
res = me.isPosInRange(event.target.selectionEnd+1, true);
|
|
|
|
|
if (res !== undefined)
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
event.target.selectionEnd = res;
|
|
|
|
|
!shift && (event.target.selectionStart = res);
|
|
|
|
|
me.formatString.selectionStart = event.target.selectionStart;
|
|
|
|
|
me.formatString.selectionEnd = event.target.selectionEnd;
|
|
|
|
|
}, 0);
|
|
|
|
|
} else if (key === Common.UI.Keys.BACKSPACE) {
|
|
|
|
|
if (event.target.selectionStart === event.target.selectionEnd) {
|
|
|
|
|
this.formatString.selectionStart = event.target.selectionStart-1;
|
|
|
|
|
this.formatString.selectionEnd = event.target.selectionEnd;
|
|
|
|
|
}
|
|
|
|
|
}else if (key === Common.UI.Keys.DELETE) {
|
|
|
|
|
if (event.target.selectionStart === event.target.selectionEnd) {
|
|
|
|
|
this.formatString.selectionStart = event.target.selectionStart;
|
|
|
|
|
this.formatString.selectionEnd = event.target.selectionEnd+1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onKeyUp: function(event) {
|
|
|
|
|
this.formatString.selectionStart = event.target.selectionStart;
|
|
|
|
|
this.formatString.selectionEnd = event.target.selectionEnd;
|
2022-10-06 20:16:04 +00:00
|
|
|
|
},
|
|
|
|
|
|
2022-10-07 20:31:54 +00:00
|
|
|
|
onFontName: function(combo, record) {
|
|
|
|
|
if (this._changedProps) {
|
2022-10-12 22:09:13 +00:00
|
|
|
|
this._changedProps.put_FontFamily(record.name ? record.name : undefined);
|
|
|
|
|
if (this._changedProps.get_Format() === Asc.c_oAscNumberingFormat.Bullet) {
|
|
|
|
|
this.fillLevelProps(this._changedProps);
|
|
|
|
|
}
|
2022-10-07 20:31:54 +00:00
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onBoldClick: function() {
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_Bold(this.btnBold.isActive());
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onItalicClick: function() {
|
|
|
|
|
if (this._changedProps) {
|
|
|
|
|
this._changedProps.put_Italic(this.btnItalic.isActive());
|
|
|
|
|
}
|
|
|
|
|
if (this.api) {
|
|
|
|
|
this.api.SetDrawImagePreviewBullet('bulleted-list-preview', this.props, this.level, this.type==2);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2022-10-12 13:48:30 +00:00
|
|
|
|
loadRecent: function(){
|
|
|
|
|
var sRecents = Common.localStorage.getItem('de-recent-bullets');
|
|
|
|
|
if(sRecents !== ''){
|
|
|
|
|
sRecents = JSON.parse(sRecents);
|
|
|
|
|
}
|
|
|
|
|
if(_.isArray(sRecents)){
|
|
|
|
|
this.recentBullets = sRecents;
|
2022-10-12 22:09:13 +00:00
|
|
|
|
for (var i = 0; i < this.recentBullets.length; ++i){
|
|
|
|
|
if(!this.recentBullets[i].symbol){
|
|
|
|
|
this.recentBullets.splice(i, 1);
|
|
|
|
|
i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-12 13:48:30 +00:00
|
|
|
|
}
|
2022-11-16 16:57:02 +00:00
|
|
|
|
|
|
|
|
|
sRecents = Common.localStorage.getItem('de-recent-list-formats');
|
|
|
|
|
if(sRecents !== ''){
|
|
|
|
|
sRecents = JSON.parse(sRecents);
|
|
|
|
|
}
|
|
|
|
|
if(_.isArray(sRecents)){
|
|
|
|
|
this.recentNumTypes = sRecents;
|
|
|
|
|
}
|
2022-10-12 13:48:30 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
saveRecent: function(){
|
|
|
|
|
var sJSON = JSON.stringify(this.recentBullets);
|
|
|
|
|
Common.localStorage.setItem('de-recent-bullets', sJSON);
|
|
|
|
|
},
|
|
|
|
|
|
2022-11-16 16:57:02 +00:00
|
|
|
|
saveRecentNum: function(){
|
|
|
|
|
var sJSON = JSON.stringify(this.recentNumTypes);
|
|
|
|
|
Common.localStorage.setItem('de-recent-list-formats', sJSON);
|
|
|
|
|
},
|
|
|
|
|
|
2022-10-12 13:48:30 +00:00
|
|
|
|
checkRecent: function(sSymbol, sFont){
|
2022-10-12 22:09:13 +00:00
|
|
|
|
if (!sSymbol) return;
|
|
|
|
|
sFont = sFont || '';
|
|
|
|
|
|
2022-10-12 13:48:30 +00:00
|
|
|
|
for(var i = 0; i < this._arrBullets.length; ++i){
|
|
|
|
|
if(this._arrBullets[i].symbol === sSymbol && this._arrBullets[i].font === sFont){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(this.recentBullets.length === 0){
|
|
|
|
|
this.recentBullets.push({symbol: sSymbol, font: sFont});
|
|
|
|
|
this.saveRecent();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-10-12 22:09:13 +00:00
|
|
|
|
for (var i = 0; i < this.recentBullets.length; ++i){
|
2022-10-12 13:48:30 +00:00
|
|
|
|
if(this.recentBullets[i].symbol === sSymbol && this.recentBullets[i].font === sFont){
|
|
|
|
|
this.recentBullets.splice(i, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.recentBullets.splice(0, 0, {symbol: sSymbol, font: sFont});
|
|
|
|
|
if(this.recentBullets.length > nMaxRecent){
|
|
|
|
|
this.recentBullets.splice(nMaxRecent, this.recentBullets.length - nMaxRecent);
|
|
|
|
|
}
|
|
|
|
|
this.saveRecent();
|
|
|
|
|
},
|
|
|
|
|
|
2022-11-16 16:57:02 +00:00
|
|
|
|
checkRecentNum: function(format){
|
|
|
|
|
if (format===null || format===undefined) return;
|
|
|
|
|
|
|
|
|
|
for(var i = 0; i < this._arrNumbers.length; ++i){
|
|
|
|
|
if(this._arrNumbers[i].value === format){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(this.recentNumTypes.length === 0){
|
|
|
|
|
this.recentNumTypes.push(format);
|
|
|
|
|
this.saveRecentNum();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < this.recentNumTypes.length; ++i){
|
|
|
|
|
if(this.recentNumTypes[i] === format){
|
|
|
|
|
this.recentNumTypes.splice(i, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.recentNumTypes.splice(0, 0, format);
|
|
|
|
|
if(this.recentNumTypes.length > nMaxRecent){
|
|
|
|
|
this.recentNumTypes.splice(nMaxRecent, this.recentNumTypes.length - nMaxRecent);
|
|
|
|
|
}
|
|
|
|
|
this.saveRecentNum();
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-17 11:52:30 +00:00
|
|
|
|
txtTitle: 'List Settings',
|
2019-12-04 10:35:56 +00:00
|
|
|
|
txtSize: 'Size',
|
|
|
|
|
txtColor: 'Color',
|
|
|
|
|
txtBullet: 'Bullet',
|
|
|
|
|
txtAlign: 'Alignment',
|
|
|
|
|
textLeft: 'Left',
|
|
|
|
|
textCenter: 'Center',
|
|
|
|
|
textRight: 'Right',
|
2019-12-19 12:01:49 +00:00
|
|
|
|
textAuto: 'Automatic',
|
2019-12-17 11:52:30 +00:00
|
|
|
|
textPreview: 'Preview',
|
|
|
|
|
txtType: 'Type',
|
2019-12-17 14:25:12 +00:00
|
|
|
|
txtLikeText: 'Like a text',
|
2019-12-18 13:48:36 +00:00
|
|
|
|
textLevel: 'Level',
|
|
|
|
|
txtNone: 'None',
|
2019-12-19 11:01:19 +00:00
|
|
|
|
txtNewBullet: 'New bullet',
|
2022-09-21 09:39:25 +00:00
|
|
|
|
txtSymbol: 'Symbol',
|
|
|
|
|
txtNumFormatString: 'Number format',
|
2022-10-05 18:25:40 +00:00
|
|
|
|
txtInclcudeLevel: 'Include level number',
|
2022-10-07 20:31:54 +00:00
|
|
|
|
txtStart: 'Start at',
|
|
|
|
|
txtFontName: 'Font',
|
|
|
|
|
textBold: 'Bold',
|
2022-10-10 14:38:02 +00:00
|
|
|
|
textItalic: 'Italic',
|
|
|
|
|
textTab: 'Tab character',
|
|
|
|
|
textSpace: 'Space',
|
|
|
|
|
txtAlignAt: 'Align at',
|
|
|
|
|
txtIndent: 'Text Indent',
|
|
|
|
|
txtFollow: 'Follow number with',
|
2022-11-16 16:57:02 +00:00
|
|
|
|
txtRestart: 'Restart list',
|
2022-11-16 21:04:18 +00:00
|
|
|
|
txtMoreTypes: 'More types',
|
|
|
|
|
txtTabStop: 'Add tab stop at'
|
2022-10-07 20:31:54 +00:00
|
|
|
|
|
2019-12-17 13:02:28 +00:00
|
|
|
|
}, DE.Views.ListSettingsDialog || {}))
|
2019-12-04 10:35:56 +00:00
|
|
|
|
});
|