diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js index 72a29504c..069079566 100644 --- a/apps/common/main/lib/component/InputField.js +++ b/apps/common/main/lib/component/InputField.js @@ -246,6 +246,10 @@ define([ if (e.keyCode === Common.UI.Keys.RETURN) this._doChange(e); + if (e.keyCode == Common.UI.Keys.ESC) + this.setValue(this.value); + if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC) + this.trigger('inputleave', this); }, onKeyUp: function(e) { diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index f7c13b5f9..065ad2352 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -234,10 +234,7 @@ define([ }, getNumberValue: function(){ - if (this.options.allowAuto && this.value==this.options.autoText) - return -1; - else - return parseFloat(this.value); + return this.checkAutoText(this.value) ? -1 : parseFloat(this.value); }, getUnitValue: function(){ @@ -262,7 +259,7 @@ define([ this.lastValue = this.value; if ( typeof value === 'undefined' || value === ''){ this.value = ''; - } else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) { + } else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || this.checkAutoText(value))) { this.value = this.options.autoText; } else { var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0); @@ -450,8 +447,8 @@ define([ val = this.getRawValue(); val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); } else if(me.getValue() !== '') { - if (me.options.allowAuto && me.getValue()==me.options.autoText) { - val = me.options.minValue-me.options.step; + if (me.checkAutoText(me.getValue())) { + val = me.options.defaultValue-me.options.step; } else val = Common.Utils.String.parseFloat(me.getValue()); if (isNaN(val)) @@ -471,7 +468,7 @@ define([ val = this.getRawValue(); val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); } else if(me.getValue() !== '') { - if (me.options.allowAuto && me.getValue()==me.options.autoText) { + if (me.checkAutoText(me.getValue())) { val = me.options.minValue; } else val = Common.Utils.String.parseFloat(me.getValue()); @@ -541,6 +538,18 @@ define([ focus: function() { if (this.$input) this.$input.focus(); + }, + + setDefaultValue: function(value) { + this.options.defaultValue = value; + }, + + checkAutoText: function(value) { + if (this.options.allowAuto && typeof value == 'string') { + var val = value.toLowerCase(); + return (val==this.options.autoText.toLowerCase() || val=='auto'); + } + return false; } }); diff --git a/apps/common/main/lib/component/TextareaField.js b/apps/common/main/lib/component/TextareaField.js new file mode 100644 index 000000000..757642483 --- /dev/null +++ b/apps/common/main/lib/component/TextareaField.js @@ -0,0 +1,201 @@ +/* + * + * (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 + * + */ +/** + * TextareaField.js + * + * Created by Julia Radzhabova on 29/09/20 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +if (Common === undefined) + var Common = {}; + +define([ + 'common/main/lib/component/BaseView', + 'common/main/lib/component/Tooltip' +], function () { 'use strict'; + + Common.UI.TextareaField = Common.UI.BaseView.extend((function() { + return { + options : { + id : null, + cls : '', + style : '', + value : '', + maxlength : undefined, + placeHolder : '', + spellcheck : false, + disabled: false + }, + + template: _.template([ + '
', + '', + '
' + ].join('')), + + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + this.id = me.options.id || Common.UI.getId(); + this.cls = me.options.cls; + this.style = me.options.style; + this.value = me.options.value; + this.placeHolder = me.options.placeHolder; + this.template = me.options.template || me.template; + this.disabled = me.options.disabled; + this.spellcheck = me.options.spellcheck; + this.maxLength = me.options.maxLength; + + me.rendered = me.options.rendered || false; + + if (me.options.el) { + me.render(); + } + }, + + render : function(parentEl) { + var me = this; + + if (!me.rendered) { + this.cmpEl = $(this.template({ + id : this.id, + cls : this.cls, + style : this.style, + placeHolder : this.placeHolder, + spellcheck : this.spellcheck, + scope : me + })); + + if (parentEl) { + this.setElement(parentEl, false); + parentEl.html(this.cmpEl); + } else { + this.$el.html(this.cmpEl); + } + } else { + this.cmpEl = this.$el; + } + + if (!me.rendered) { + var el = this.cmpEl; + + this._input = this.cmpEl.find('textarea').addBack().filter('textarea'); + this._input.on('blur', _.bind(this.onInputChanged, this)); + this._input.on('keydown', _.bind(this.onKeyDown, this)); + if (this.maxLength) this._input.attr('maxlength', this.maxLength); + + if (this.disabled) + this.setDisabled(this.disabled); + } + + me.rendered = true; + + return this; + }, + + _doChange: function(e, extra) { + // skip processing for internally-generated synthetic event + // to avoid double processing + if (extra && extra.synthetic) + return; + + var newValue = $(e.target).val(), + oldValue = this.value; + + this.trigger('changed:before', this, newValue, oldValue, e); + + if (e.isDefaultPrevented()) + return; + + this.value = newValue; + + // trigger changed event + this.trigger('changed:after', this, newValue, oldValue, e); + }, + + onInputChanged: function(e, extra) { + this._doChange(e, extra); + }, + + onKeyDown: function(e) { + this.trigger('keydown:before', this, e); + + if (e.isDefaultPrevented()) + return; + + if (e.keyCode === Common.UI.Keys.RETURN) + this._doChange(e); + if (e.keyCode == Common.UI.Keys.ESC) + this.setValue(this.value); + if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC) + this.trigger('inputleave', this); + }, + + setDisabled: function(disabled) { + this.disabled = disabled; + $(this.el).toggleClass('disabled', disabled); + disabled + ? this._input.attr('disabled', true) + : this._input.removeAttr('disabled'); + }, + + isDisabled: function() { + return this.disabled; + }, + + setValue: function(value) { + this.value = value; + + if (this.rendered){ + this._input.val(value); + } + }, + + getValue: function() { + return this.value; + }, + + focus: function() { + this._input.focus(); + } + } + })()); +}); diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 4c663a01a..1e25b9fe3 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -746,7 +746,7 @@ define([ leftMenu.setPreviewMode(disable); if (this.view) { - this.view.$el.find('.no-group-mask').css('opacity', 1); + this.view.$el.find('.no-group-mask.review').css('opacity', 1); this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) { if ( button ) { diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index e00a3b8b7..68b5f826d 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -106,7 +106,8 @@ Common.Utils = _.extend(new(function() { Signature : 9, Pivot : 10, Cell : 11, - Slicer : 12 + Slicer : 12, + Form : 13 }, importTextType = { DRM: 0, diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 570356601..33cf281dd 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -57,7 +57,7 @@ define([ Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){ var template = '
' + - '
' + + '
' + '' + '' + '
' + @@ -70,7 +70,7 @@ define([ '
' + '' + '
' + - '
' + + '
' + '' + '
' + '
' + @@ -84,11 +84,11 @@ define([ '' + '
' + '
' + - '
' + + '
' + '' + '
' + '
' + - '
' + + '
' + '' + '
' + '
'; @@ -647,7 +647,7 @@ define([ button.setDisabled(state); } }, this); - this.btnChat && this.btnChat.setDisabled(state); + // this.btnChat && this.btnChat.setDisabled(state); this.btnCommentRemove && this.btnCommentRemove.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment")); }, diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png b/apps/common/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png similarity index 100% rename from apps/spreadsheeteditor/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png rename to apps/common/main/resources/img/toolbar/1.25x/big/btn-sheet-view.png diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-sheet-view.png b/apps/common/main/resources/img/toolbar/1.5x/big/btn-sheet-view.png similarity index 100% rename from apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-sheet-view.png rename to apps/common/main/resources/img/toolbar/1.5x/big/btn-sheet-view.png diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-sheet-view.png b/apps/common/main/resources/img/toolbar/1.75x/big/btn-sheet-view.png similarity index 100% rename from apps/spreadsheeteditor/main/resources/img/toolbar/1.75x/big/btn-sheet-view.png rename to apps/common/main/resources/img/toolbar/1.75x/big/btn-sheet-view.png diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-sheet-view.png b/apps/common/main/resources/img/toolbar/1x/big/btn-sheet-view.png similarity index 100% rename from apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-sheet-view.png rename to apps/common/main/resources/img/toolbar/1x/big/btn-sheet-view.png diff --git a/apps/common/main/resources/img/toolbar/1x/btn-arrow-down.png b/apps/common/main/resources/img/toolbar/1x/btn-arrow-down.png new file mode 100644 index 000000000..77b1c0c64 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1x/btn-arrow-down.png differ diff --git a/apps/common/main/resources/img/toolbar/1x/btn-arrow-up.png b/apps/common/main/resources/img/toolbar/1x/btn-arrow-up.png new file mode 100644 index 000000000..8b08b1fb8 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1x/btn-arrow-up.png differ diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-sheet-view.png b/apps/common/main/resources/img/toolbar/2x/big/btn-sheet-view.png similarity index 100% rename from apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-sheet-view.png rename to apps/common/main/resources/img/toolbar/2x/big/btn-sheet-view.png diff --git a/apps/common/main/resources/img/toolbar/2x/btn-arrow-down.png b/apps/common/main/resources/img/toolbar/2x/btn-arrow-down.png new file mode 100644 index 000000000..c01427ae7 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/2x/btn-arrow-down.png differ diff --git a/apps/common/main/resources/img/toolbar/2x/btn-arrow-up.png b/apps/common/main/resources/img/toolbar/2x/btn-arrow-up.png new file mode 100644 index 000000000..7de6f592e Binary files /dev/null and b/apps/common/main/resources/img/toolbar/2x/btn-arrow-up.png differ diff --git a/apps/documenteditor/main/app.js b/apps/documenteditor/main/app.js index bd53d3271..87306dd58 100644 --- a/apps/documenteditor/main/app.js +++ b/apps/documenteditor/main/app.js @@ -151,6 +151,7 @@ require([ 'Toolbar', 'Statusbar', 'Links', + 'FormsTab', 'Navigation', 'RightMenu', 'LeftMenu', @@ -176,6 +177,7 @@ require([ 'documenteditor/main/app/controller/DocumentHolder', 'documenteditor/main/app/controller/Toolbar', 'documenteditor/main/app/controller/Statusbar', + 'documenteditor/main/app/controller/FormsTab', 'documenteditor/main/app/controller/Links', 'documenteditor/main/app/controller/Navigation', 'documenteditor/main/app/controller/RightMenu', diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js new file mode 100644 index 000000000..91d7b619d --- /dev/null +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -0,0 +1,290 @@ +/* + * + * (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 + * + */ + +/** + * FormsTab.js + * + * Created by Julia Radzhabova on 06.10.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core', + 'documenteditor/main/app/view/FormsTab' +], function () { + 'use strict'; + + DE.Controllers.FormsTab = Backbone.Controller.extend(_.extend({ + models : [], + collections : [ + ], + views : [ + 'FormsTab' + ], + sdkViewName : '#id_main', + + initialize: function () { + }, + onLaunch: function () { + this._state = { + prcontrolsdisable:undefined + }; + }, + + setApi: function (api) { + if (api) { + this.api = api; + this.api.asc_registerCallback('asc_onFocusObject', this.onApiFocusObject.bind(this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onChangeSpecialFormsGlobalSettings', _.bind(this.onChangeSpecialFormsGlobalSettings, this)); + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + + // this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this)); + // this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this)); + } + return this; + }, + + setConfig: function(config) { + this.toolbar = config.toolbar; + this.view = this.createView('FormsTab', { + toolbar: this.toolbar.toolbar + }); + this.addListeners({ + 'FormsTab': { + 'forms:insert': this.onControlsSelect, + 'forms:new-color': this.onNewControlsColor, + 'forms:clear': this.onClearClick, + 'forms:no-color': this.onNoControlsColor, + 'forms:select-color': this.onSelectControlsColor, + 'forms:open-color': this.onColorsShow, + 'forms:mode': this.onModeClick + } + }); + }, + + SetDisabled: function(state) { + this.view && this.view.SetDisabled(state); + }, + + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); + }, + + onCoAuthoringDisconnect: function() { + this.SetDisabled(true); + }, + + onApiFocusObject: function(selectedObjects) { + if (!this.toolbar.editMode) return; + + var pr, i = -1, type, + paragraph_locked = false, + header_locked = false; + + while (++i < selectedObjects.length) { + type = selectedObjects[i].get_ObjectType(); + pr = selectedObjects[i].get_ObjectValue(); + + if (type === Asc.c_oAscTypeSelectElement.Paragraph) { + paragraph_locked = pr.get_Locked(); + } else if (type === Asc.c_oAscTypeSelectElement.Header) { + header_locked = pr.get_Locked(); + } + } + var in_control = this.api.asc_IsContentControl(); + var control_props = in_control ? this.api.asc_GetContentControlProperties() : null, + lock_type = (in_control&&control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked, + control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false; + (lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked); + var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked; + var need_disable = (paragraph_locked || header_locked || control_plain || content_locked); + if (this._state.prcontrolsdisable !== need_disable) { + this.view.btnTextField.setDisabled(need_disable); + this.view.btnComboBox.setDisabled(need_disable); + this.view.btnDropDown.setDisabled(need_disable); + this.view.btnCheckBox.setDisabled(need_disable); + this.view.btnRadioBox.setDisabled(need_disable); + this.view.btnImageField.setDisabled(need_disable); + this.view.btnTextField.setDisabled(need_disable); + this._state.prcontrolsdisable = need_disable; + } + }, + + onSendThemeColors: function() { + this._needUpdateColors = true; + }, + + updateThemeColors: function() { + var updateColors = function(picker, defaultColorIndex) { + if (picker) { + var clr; + + var effectcolors = Common.Utils.ThemeColor.getEffectColors(); + for (var i = 0; i < effectcolors.length; i++) { + if (typeof(picker.currentColor) == 'object' && + clr === undefined && + picker.currentColor.effectId == effectcolors[i].effectId) + clr = effectcolors[i]; + } + + picker.updateColors(effectcolors, Common.Utils.ThemeColor.getStandartColors()); + if (picker.currentColor === undefined) { + picker.currentColor = effectcolors[defaultColorIndex]; + } else if ( clr!==undefined ) { + picker.currentColor = clr; + } + } + }; + + this.view && this.view.mnuFormsColorPicker && updateColors(this.view.mnuFormsColorPicker, 1); + this.onChangeSpecialFormsGlobalSettings(); + }, + + onChangeSpecialFormsGlobalSettings: function() { + if (this.view && this.view.mnuFormsColorPicker) { + var clr = this.api.asc_GetSpecialFormsHighlightColor(), + show = !!clr; + this.view.mnuNoFormsColor.setChecked(!show, true); + this.view.mnuFormsColorPicker.clearSelection(); + if (clr) { + clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b()); + this.view.mnuFormsColorPicker.selectByRGB(clr, true); + } + this.view.btnHighlight.currentColor = clr; + $('.btn-color-value-line', this.view.btnHighlight.cmpEl).css('background-color', clr ? '#' + clr : 'transparent'); + } + }, + + onColorsShow: function(menu) { + this._needUpdateColors && this.updateThemeColors(); + this._needUpdateColors = false; + }, + + onControlsSelect: function(type) { + if (!(this.toolbar.mode && this.toolbar.mode.canFeatureContentControl)) return; + + var oPr, + oFormPr = new AscCommon.CSdtFormPr(); + this.toolbar.toolbar.fireEvent('insertcontrol', this.toolbar.toolbar); + if (type == 'picture') + this.api.asc_AddContentControlPicture(oFormPr); + else if (type == 'checkbox' || type == 'radiobox') { + oPr = new AscCommon.CSdtCheckBoxPr(); + (type == 'radiobox') && oPr.put_GroupKey('Group 1'); + this.api.asc_AddContentControlCheckBox(oPr, oFormPr); + } else if (type == 'combobox' || type == 'dropdown') + this.api.asc_AddContentControlList(type == 'combobox', oPr, oFormPr); + else if (type == 'text') { + oPr = new AscCommon.CSdtTextFormPr(); + this.api.asc_AddContentControlTextForm(oPr, oFormPr); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onModeClick: function(state) { + if (this.api) { + this.disableEditing(state); + this.api.asc_setRestriction(state ? Asc.c_oAscRestrictionType.OnlyForms : Asc.c_oAscRestrictionType.None); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onClearClick: function() { + if (this.api) { + this.api.asc_ClearAllSpecialForms(); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onNewControlsColor: function() { + this.view.mnuFormsColorPicker.addNewColor(); + }, + + onNoControlsColor: function(item) { + if (!item.isChecked()) + this.api.asc_SetSpecialFormsHighlightColor(255, 192, 0); + else + this.api.asc_SetSpecialFormsHighlightColor(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onSelectControlsColor: function(color) { + var clr = Common.Utils.ThemeColor.getRgbColor(color); + if (this.api) { + this.api.asc_SetSpecialFormsHighlightColor(clr.get_r(), clr.get_g(), clr.get_b()); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + disableEditing: function(disable) { + if (this._state.DisabledEditing != disable) { + this._state.DisabledEditing = disable; + + var app = this.getApplication(); + var rightMenuController = app.getController('RightMenu'); + rightMenuController.getView('RightMenu').clearSelection(); + rightMenuController.SetDisabled(disable); + app.getController('Toolbar').DisableToolbar(disable, false, false, true); + app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); + app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable); + app.getController('DocumentHolder').getView().SetDisabled(disable); + app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable); + app.getController('LeftMenu').setPreviewMode(disable); + var comments = app.getController('Common.Controllers.Comments'); + if (comments) + comments.setPreviewMode(disable); + if (this.view) + this.view.$el.find('.no-group-mask.form-view').css('opacity', 1); + } + }, + + onAppReady: function (config) { + var me = this; + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + if (config.canEditContentControl) { + var clr = me.api.asc_GetSpecialFormsHighlightColor(); + clr && (clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b())); + me.view.btnHighlight.currentColor = clr; + } + }); + } + + }, DE.Controllers.FormsTab || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 0d90807a3..860a60da3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1357,6 +1357,7 @@ define([ toolbarView.on('insertshape', _.bind(me.onInsertShape, me)); toolbarView.on('inserttextart', _.bind(me.onInsertTextArt, me)); toolbarView.on('insertchart', _.bind(me.onInsertChart, me)); + toolbarView.on('insertcontrol', _.bind(me.onInsertControl, me)); } var value = Common.localStorage.getItem('de-settings-unit'); @@ -2033,6 +2034,10 @@ define([ this.getApplication().getController('RightMenu').onInsertTextArt(); }, + onInsertControl: function() { + this.getApplication().getController('RightMenu').onInsertControl(); + }, + unitsChanged: function(m) { var value = Common.localStorage.getItem("de-settings-unit"); value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index f33f7e4cf..d15dec586 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -80,6 +80,7 @@ define([ this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false}; this._settings[Common.Utils.documentSettingsType.MailMerge] = {panelId: "id-mail-merge-settings", panel: rightMenu.mergeSettings, btn: rightMenu.btnMailMerge, hidden: 1, props: {}, locked: false}; this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false}; + this._settings[Common.Utils.documentSettingsType.Form] = {panelId: "id-form-settings", panel: rightMenu.formSettings, btn: rightMenu.btnForm, hidden: 1, props: {}, locked: false}; }, setApi: function(api) { @@ -124,6 +125,8 @@ define([ this._settings[Common.Utils.documentSettingsType.Signature].locked = false; var isChart = false; + var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null, + control_lock = false; for (i=0; i 0) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 6f8025a92..37bae74aa 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -790,11 +790,12 @@ define([ toolbar.btnContentControls.setDisabled(paragraph_locked || header_locked); if (!(paragraph_locked || header_locked)) { - var control_disable = control_plain || content_locked; - for (var i=0; i<14; i++) + var control_disable = control_plain || content_locked, + if_form = control_props && control_props.get_FormPr(); + for (var i=0; i<7; i++) toolbar.btnContentControls.menu.items[i].setDisabled(control_disable); - toolbar.btnContentControls.menu.items[15].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); - toolbar.btnContentControls.menu.items[17].setDisabled(!in_control); + toolbar.btnContentControls.menu.items[8].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked || if_form); + toolbar.btnContentControls.menu.items[10].setDisabled(!in_control || if_form); } var need_text_disable = paragraph_locked || header_locked || in_chart || rich_edit_lock || plain_edit_lock; @@ -1905,6 +1906,7 @@ define([ oPr, oFormPr; if (isnew) { oFormPr = new AscCommon.CSdtFormPr(); + this.toolbar.fireEvent('insertcontrol', this.toolbar); } if (item.value == 'plain' || item.value == 'rich') this.api.asc_AddContentControl((item.value=='plain') ? Asc.c_oAscSdtLevelType.Inline : Asc.c_oAscSdtLevelType.Block); @@ -2967,27 +2969,36 @@ define([ this.DisableToolbar(true, true); }, - DisableToolbar: function(disable, viewMode, reviewmode) { + DisableToolbar: function(disable, viewMode, reviewmode, fillformmode) { if (viewMode!==undefined) this.editMode = !viewMode; disable = disable || !this.editMode; var toolbar_mask = $('.toolbar-mask'), group_mask = $('.toolbar-group-mask'), - mask = reviewmode ? group_mask : toolbar_mask; + mask = (reviewmode || fillformmode) ? group_mask : toolbar_mask; if (disable && mask.length>0 || !disable && mask.length==0) return; var toolbar = this.toolbar; if(disable) { if (reviewmode) { - mask = $("
").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask)')); + mask = $("
").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.review)')); + } else if (fillformmode) { + mask = $("
").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.form-view)')); } else mask = $("
").appendTo(toolbar.$el.find('.toolbar')); } else { mask.remove(); } - $('.no-group-mask').css('opacity', (reviewmode || !disable) ? 1 : 0.4); + $('.no-group-mask').each(function(index, item){ + var $el = $(item); + if ($el.find('.toolbar-group-mask').length>0) + $el.css('opacity', 0.4); + else { + $el.css('opacity', reviewmode || fillformmode || !disable ? 1 : 0.4); + } + }); - disable = disable || (reviewmode ? toolbar_mask.length>0 : group_mask.length>0); + disable = disable || ((reviewmode || fillformmode) ? toolbar_mask.length>0 : group_mask.length>0); toolbar.$el.find('.toolbar').toggleClass('masked', disable); if ( toolbar.synchTooltip ) toolbar.synchTooltip.hide(); @@ -3053,7 +3064,7 @@ define([ var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel(); if ( $panel ) - me.toolbar.addTab(tab, $panel, 4); + me.toolbar.addTab(tab, $panel, 5); if ( config.isEdit ) { me.toolbar.setMode(config); @@ -3077,13 +3088,22 @@ define([ tab = {action: 'protect', caption: me.toolbar.textTabProtect}; $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); - if ($panel) me.toolbar.addTab(tab, $panel, 5); + if ($panel) me.toolbar.addTab(tab, $panel, 6); } } var links = me.getApplication().getController('Links'); links.setApi(me.api).setConfig({toolbar: me}); Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons()); + + if (config.canFeatureContentControl) { + tab = {caption: me.textTabForms, action: 'forms'}; + var forms = me.getApplication().getController('FormsTab'); + forms.setApi(me.api).setConfig({toolbar: me}); + me.toolbar.addTab(tab, $panel, 4); + me.toolbar.setVisible('forms', true); + Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons()); + } } }, @@ -3505,7 +3525,8 @@ define([ notcriticalErrorTitle: 'Warning', txtMarginsW: 'Left and right margins are too high for a given page wight', txtMarginsH: 'Top and bottom margins are too high for a given page height', - textInsert: 'Insert' + textInsert: 'Insert', + textTabForms: 'Forms' }, DE.Controllers.Toolbar || {})); }); diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template new file mode 100644 index 000000000..414110449 --- /dev/null +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+ + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/apps/documenteditor/main/app/template/RightMenu.template b/apps/documenteditor/main/app/template/RightMenu.template index 7b4bb1ba8..a42d7b2f8 100644 --- a/apps/documenteditor/main/app/template/RightMenu.template +++ b/apps/documenteditor/main/app/template/RightMenu.template @@ -18,6 +18,8 @@
+
+
@@ -30,5 +32,6 @@ +
\ No newline at end of file diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index dab715882..ceb4d53d4 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -173,6 +173,29 @@
+
+
+ + + + + + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
\ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ControlSettingsDialog.js b/apps/documenteditor/main/app/view/ControlSettingsDialog.js index d013b740a..863793b91 100644 --- a/apps/documenteditor/main/app/view/ControlSettingsDialog.js +++ b/apps/documenteditor/main/app/view/ControlSettingsDialog.js @@ -313,7 +313,8 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', step: .1, width: 80, defaultUnit : "cm", - value: '3 cm', + value: 'Auto', + allowAuto: true, maxValue: 55.88, minValue: 0.1 }); @@ -550,7 +551,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', this.spnMaxChars.setValue(val && val>=0 ? val : 10); val = formTextPr.get_Width(); - this.spnWidth.setValue(val ? val : '', true); + this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true); } if ((type == Asc.c_oAscContentControlSpecificType.CheckBox || type == Asc.c_oAscContentControlSpecificType.Picture) && !formPr ) {// standart checkbox or picture @@ -563,7 +564,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', var props = new AscCommon.CContentControlPr(); props.put_Alias(this.txtName.getValue()); props.put_Tag(this.txtTag.getValue()); - props.put_PlaceholderText(this.txtPlaceholder.getValue()); + props.put_PlaceholderText(this.txtPlaceholder.getValue() || ' '); props.put_Appearance(this.cmbShow.getValue()); if (this.isSystemColor) { @@ -639,8 +640,12 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', if (this.btnsCategory[5].isVisible()) { var formTextPr = new AscCommon.CSdtTextFormPr(); - if (this.spnWidth.getValue()) - formTextPr.put_Width(this.spnWidth.getNumberValue()); + if (this.spnWidth.getValue()) { + var value = this.spnWidth.getNumberValue(); + formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4)); + } else + formTextPr.put_Width(0); + if (this.placeholder && this.placeholder.changed) { formTextPr.put_PlaceHolderSymbol(this.placeholder.code); formTextPr.put_PlaceHolderFont(this.placeholder.font); @@ -650,7 +655,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', var checked = (this.chMaxChars.getValue()=='checked' || this.chComb.getValue()=='checked'); formTextPr.put_MaxCharacters(checked); if (checked) - formTextPr.put_MaxCharacters(this.spnMaxChars.getNumberValue() || 12); + formTextPr.put_MaxCharacters(this.spnMaxChars.getNumberValue() || 10); props.put_TextFormPr(formTextPr); } diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 68cc1e0f9..b5e1e7163 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -491,20 +491,24 @@ define([ var showPoint, ToolTip, type = moveData.get_Type(); - if (type==1 || type==3) { // 1 - hyperlink, 3 - footnote + if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink || type==Asc.c_oAscMouseMoveDataTypes.Footnote || type==Asc.c_oAscMouseMoveDataTypes.Form) { // 1 - hyperlink, 3 - footnote if (isTooltipHiding) { mouseMoveData = moveData; return; } - if (type==1) { + if (type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) { var hyperProps = moveData.get_Hyperlink(); if (!hyperProps) return; ToolTip = (_.isEmpty(hyperProps.get_ToolTip())) ? hyperProps.get_Value() : hyperProps.get_ToolTip(); - } else { + } else if (type == Asc.c_oAscMouseMoveDataTypes.Footnote) { ToolTip = moveData.get_FootnoteText(); if (ToolTip.length>1000) ToolTip = ToolTip.substr(0, 1000) + '...'; + } else if (type==Asc.c_oAscMouseMoveDataTypes.Form) { + ToolTip = moveData.get_FormHelpText(); + if (ToolTip.length>1000) + ToolTip = ToolTip.substr(0, 1000) + '...'; } var recalc = false; @@ -513,7 +517,7 @@ define([ ToolTip = Common.Utils.String.htmlEncode(ToolTip); if (screenTip.tipType !== type || screenTip.tipLength !== ToolTip.length || screenTip.strTip.indexOf(ToolTip)<0 ) { - screenTip.toolTip.setTitle((type==1) ? (ToolTip + '
' + me.txtPressLink + '') : ToolTip); + screenTip.toolTip.setTitle((type==Asc.c_oAscMouseMoveDataTypes.Hyperlink) ? (ToolTip + '
' + me.txtPressLink + '') : ToolTip); screenTip.tipLength = ToolTip.length; screenTip.strTip = ToolTip; screenTip.tipType = type; @@ -547,7 +551,7 @@ define([ screenTip.toolTip.getBSTip().$tip.css({top: showPoint[1] + 'px', left: showPoint[0] + 'px'}); } /** coauthoring begin **/ - else if (moveData.get_Type()==2 && me.mode.isEdit) { // 2 - locked object + else if (moveData.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject && me.mode.isEdit) { // 2 - locked object var src; if (me.usertipcount >= me.usertips.length) { src = $(document.createElement("div")); @@ -2793,13 +2797,14 @@ define([ }); var menuTableRemoveControl = new Common.UI.MenuItem({ + iconCls: 'menu__icon cc-remove', caption: me.textRemove, value: 'remove' }).on('click', _.bind(me.onControlsSelect, me)); var menuTableControlSettings = new Common.UI.MenuItem({ - caption: me.textSettings, - value: 'settings' + caption: me.textSettings, + value: 'settings' }).on('click', _.bind(me.onControlsSelect, me)); var menuTableControl = new Common.UI.MenuItem({ @@ -3229,9 +3234,11 @@ define([ menuTableControl.setVisible(in_control); if (in_control) { var control_props = me.api.asc_GetContentControlProperties(), - lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked; + lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked, + is_form = control_props && control_props.get_FormPr(); menuTableRemoveControl.setDisabled(lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); - menuTableControlSettings.setVisible(me.mode.canEditContentControl); + menuTableRemoveControl.setCaption(is_form ? me.getControlLabel(control_props) : me.textRemoveControl); + menuTableControlSettings.setVisible(me.mode.canEditContentControl && !is_form); var spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None; control_lock = control_lock || spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || @@ -3676,6 +3683,7 @@ define([ }); var menuParaRemoveControl = new Common.UI.MenuItem({ + iconCls: 'menu__icon cc-remove', caption: me.textRemoveControl, value: 'remove' }).on('click', _.bind(me.onControlsSelect, me)); @@ -3908,14 +3916,16 @@ define([ !value.paraProps.value.can_DeleteInlineContentControl() || !value.paraProps.value.can_EditInlineContentControl()) : false; var in_toc = me.api.asc_GetTableOfContentsPr(true), - in_control = !in_toc && me.api.asc_IsContentControl() ; + in_control = !in_toc && me.api.asc_IsContentControl(), + control_props = in_control ? me.api.asc_GetContentControlProperties() : null, + is_form = control_props && control_props.get_FormPr(); menuParaRemoveControl.setVisible(in_control); - menuParaControlSettings.setVisible(in_control && me.mode.canEditContentControl); + menuParaControlSettings.setVisible(in_control && me.mode.canEditContentControl && !is_form); menuParaControlSeparator.setVisible(in_control); if (in_control) { - var control_props = me.api.asc_GetContentControlProperties(), - lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked; + var lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked; menuParaRemoveControl.setDisabled(lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); + menuParaRemoveControl.setCaption(is_form ? me.getControlLabel(control_props) : me.textRemoveControl); var spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None; control_lock = control_lock || spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || @@ -4236,6 +4246,7 @@ define([ var type = obj.type, props = obj.pr, specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(), + isForm = !!props.get_FormPr(), menu = this.listControlMenu, menuContainer = menu ? this.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, me = this; @@ -4272,14 +4283,25 @@ define([ }); } if (specProps) { + if (isForm){ // for dropdown and combobox form control always add placeholder item + menu.addItem(new Common.UI.MenuItem({ + caption : props.get_PlaceholderText(), + value : '', + template : _.template([ + ' opacity: 0.6 <% } %>">', + '<%= caption %>', + '' + ].join('')) + })); + } var count = specProps.get_ItemsCount(); for (var i=0; i'].join('')), + itemTemplate: _.template([ + '
', + // '
<%= name %>
', + '
<%= name %>
', + '
' + ].join('')) + }); + this.list.on('item:select', _.bind(this.onSelectItem, this)); + this.lockedControls.push(this.list); + + this.btnListAdd = new Common.UI.Button({ + parentEl: $markup.findById('#form-list-add'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-zoomup', + hint: this.textTipAdd + }); + this.btnListAdd.on('click', _.bind(this.onAddItem, this)); + this.lockedControls.push(this.btnListAdd); + + this.btnListDelete = new Common.UI.Button({ + parentEl: $markup.findById('#form-list-delete'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon cc-remove', + hint: this.textTipDelete + }); + this.btnListDelete.on('click', _.bind(this.onDeleteItem, this)); + this.lockedControls.push(this.btnListDelete); + + this.btnListUp = new Common.UI.Button({ + parentEl: $markup.findById('#form-list-up'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-up', + hint: this.textTipUp + }); + this.btnListUp.on('click', _.bind(this.onMoveItem, this, true)); + this.lockedControls.push(this.btnListUp); + + this.btnListDown = new Common.UI.Button({ + parentEl: $markup.findById('#form-list-down'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-down', + hint: this.textTipDown + }); + this.btnListDown.on('click', _.bind(this.onMoveItem, this, false)); + this.lockedControls.push(this.btnListDown); + + // image props + this.btnSelectImage = new Common.UI.Button({ + parentEl: $('#form-button-replace'), + cls: 'btn-text-menu-default', + caption: this.textSelectImage, + style: "width:100%;", + menu: new Common.UI.Menu({ + style: 'min-width: 194px;', + maxHeight: 200, + items: [ + {caption: this.textFromFile, value: 0}, + {caption: this.textFromUrl, value: 1}, + {caption: this.textFromStorage, value: 2} + ] + }) + }); + this.lockedControls.push(this.btnSelectImage); + this.btnSelectImage.menu.on('item:click', _.bind(this.onImageSelect, this)); + this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); + + this.btnRemForm = new Common.UI.Button({ + parentEl: $markup.findById('#form-btn-delete'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon cc-remove', + caption : this.textDelete, + style : 'text-align: left;' + }); + this.btnRemForm.on('click', _.bind(function(btn){ + this.api.asc_RemoveContentControlWrapper(this._state.id); + }, this)); + this.lockedControls.push(this.btnRemForm); + + this.btnLockForm = new Common.UI.Button({ + parentEl: $markup.findById('#form-btn-lock'), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-lock', + caption : this.textLock, + style : 'text-align: left;' + }); + this.btnLockForm.on('click', _.bind(function(btn){ + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + props.put_Lock(!this._state.LockDelete ? Asc.c_oAscSdtLockType.SdtLocked : Asc.c_oAscSdtLockType.Unlocked); + this.api.asc_SetContentControlProperties(props, this.internalId); + } + }, this)); + + this.updateMetricUnit(); + this.UpdateThemeColors(); + }, + + setApi: function(api) { + this.api = api; + if (this.api) { + // this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this)); + } + return this; + }, + + setMode: function(mode) { + this.mode = mode; + }, + + onKeyChanged: function(combo, record) { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + formPr.put_Key(record.value); + props.put_FormPr(formPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onPlaceholderChanged: function(input, newValue, oldValue, e) { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + props.put_PlaceholderText(newValue || ' '); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onHelpChanged: function(input, newValue, oldValue, e) { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + formPr.put_HelpText(newValue); + props.put_FormPr(formPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onChMaxCharsChanged: function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + this.spnMaxChars.setDisabled(!checked); + if (!checked) { + this.chComb.setValue(false, true); + this.spnWidth.setDisabled(true); + } + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + (!checked) && formTextPr.put_Comb(checked); + formTextPr.put_MaxCharacters(checked ? (this.spnMaxChars.getNumberValue() || 10) : checked); + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onMaxCharsChange: function(field, newValue, oldValue, eOpts){ + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + var checked = (this.chMaxChars.getValue()=='checked' || this.chComb.getValue()=='checked'); + formTextPr.put_MaxCharacters(checked ? (field.getNumberValue() || 10) : checked); + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onChCombChanged: function(field, newValue, oldValue, eOpts){ + var checked = (field.getValue()=='checked'); + if (checked) { + this.chMaxChars.setValue(true, true); + this.spnMaxChars.setDisabled(false); + } + this.spnWidth.setDisabled(!checked); + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + formTextPr.put_Comb(checked); + if (checked) { + formTextPr.put_MaxCharacters(this.spnMaxChars.getNumberValue() || 10); + if (this.spnWidth.getValue()) { + var value = this.spnWidth.getNumberValue(); + formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4)); + } else + formTextPr.put_Width(0); + } + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onWidthChange: function(field, newValue, oldValue, eOpts){ + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + if (this.spnWidth.getValue()) { + var value = this.spnWidth.getNumberValue(); + formTextPr.put_Width(value<=0 ? 0 : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4)); + } else + formTextPr.put_Width(0); + + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onGroupKeyChanged: function(combo, record) { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var specProps = this._originalCheckProps || new AscCommon.CSdtCheckBoxPr(); + specProps.put_GroupKey(record.value); + props.put_CheckBoxPr(specProps); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + fillListProps: function() { + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var specProps = this._originalListProps || new AscCommon.CSdtComboBoxPr(); + specProps.clear(); + this.list.store.each(function (item, index) { + specProps.add_Item(item.get('name'), item.get('value')); + }); + (this.type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.put_ComboBoxPr(specProps) : props.put_DropDownListPr(specProps); + this.api.asc_SetContentControlProperties(props, this.internalId); + } + }, + + onAddItem: function() { + var store = this.list.store, + value = this.txtNewValue.getValue(); + if (value!=='') { + var rec = store.findWhere({value: value}); + if (!rec) { + store.add({value: value, name: value}); + this.fillListProps(); + } + } + this.fireEvent('editcomplete', this); + }, + + onDeleteItem: function(btn, eOpts){ + var rec = this.list.getSelectedRec(); + if (rec) { + var store = this.list.store; + store.remove(rec); + this.fillListProps(); + } + this.fireEvent('editcomplete', this); + }, + + onMoveItem: function(up) { + var store = this.list.store, + length = store.length, + rec = this.list.getSelectedRec(); + if (rec) { + var index = store.indexOf(rec); + store.add(store.remove(rec), {at: up ? Math.max(0, index-1) : Math.min(length-1, index+1)}); + this.fillListProps(); + } + this.fireEvent('editcomplete', this); + }, + + setImageUrl: function(url, token) { + this.api.asc_SetContentControlPictureUrl(url, this.internalId, token); + }, + + insertImageFromStorage: function(data) { + if (data && data.url && data.c=='control') { + this.setImageUrl(data.url, data.token); + } + }, + + onImageSelect: function(menu, item) { + if (item.value==1) { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.setImageUrl(checkUrl); + } + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + } else if (item.value==2) { + Common.NotificationCenter.trigger('storage:image-load', 'control'); + } else { + if (this._isFromFile) return; + this._isFromFile = true; + if (this.api) this.api.asc_addImage(this._originalProps); + this.fireEvent('editcomplete', this); + this._isFromFile = false; + } + }, + + onColorPickerSelect: function(btn, color) { + this.BorderColor = color; + this._state.BorderColor = this.BorderColor; + + if (this.api && !this._noApply) { + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formTextPr = this._originalTextFormProps || new AscCommon.CSdtTextFormPr(); + if (color == 'transparent') { + formTextPr.put_CombBorder(); + } else { + var brd = formTextPr.get_CombBorder(); + if (!brd) + brd = new Asc.asc_CTextBorder(); + brd.put_Value(1); + brd.put_Color(Common.Utils.ThemeColor.getRgbColor(color)); + formTextPr.put_CombBorder(brd); + } + props.put_TextFormPr(formTextPr); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + if (props) { + this._originalProps = props; + + this._noApply = true; + + this.internalId = props.get_InternalId(); + + var val = props.get_PlaceholderText(); + if (this._state.placeholder !== val) { + this.txtPlaceholder.setValue(val ? val : ''); + this._state.placeholder = val; + } + + val = props.get_Lock(); + (val===undefined) && (val = Asc.c_oAscSdtLockType.Unlocked); + if (this._state.LockDelete !== (val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked)) { + this._state.LockDelete = (val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked); + this.btnLockForm.setCaption(this._state.LockDelete ? this.textUnlock : this.textLock); + } + this.disableControls(this._locked); + + var type = props.get_SpecificType(); + var specProps; + //for list controls + if (type == Asc.c_oAscContentControlSpecificType.ComboBox || type == Asc.c_oAscContentControlSpecificType.DropDownList) { + this.labelFormName.text(type == Asc.c_oAscContentControlSpecificType.ComboBox ? this.textCombobox : this.textDropDown); + specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(); + if (specProps) { + this._originalListProps = specProps; + var count = specProps.get_ItemsCount(); + var arr = []; + for (var i=0; i0.1) { + this.spnWidth.setValue(val!==0 && val!==undefined ? Common.Utils.Metric.fnRecalcFromMM(val * 25.4 / 20 / 72.0) : -1, true); + this._state.Width=val; + } + + val = this.api.asc_GetTextFormAutoWidth(); + if ( (this._state.WidthPlaceholder!==val) || Math.abs(this._state.WidthPlaceholder-val)>0.01) { + this.spnWidth.setDefaultValue(val!==undefined && val!==null ? Common.Utils.Metric.fnRecalcFromMM(val) : this.spnWidth.options.minValue); + this._state.WidthPlaceholder=val; + } + + val = formTextPr.get_MaxCharacters(); + this.chMaxChars.setValue(val && val>=0); + this.spnMaxChars.setDisabled(!val || val<0); + this.spnMaxChars.setValue(val && val>=0 ? val : 10); + + var brd = formTextPr.get_CombBorder(); + if (brd) { + var color = brd.get_Color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BorderColor = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else { + this.BorderColor = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + } else + this.BorderColor = 'transparent'; + } else + this.BorderColor = 'transparent'; + + var type1 = typeof(this.BorderColor), + type2 = typeof(this._state.BorderColor); + if ( (type1 !== type2) || (type1=='object' && + (this.BorderColor.effectValue!==this._state.BorderColor.effectValue || this._state.BorderColor.color.indexOf(this.BorderColor.color)<0)) || + (type1!='object' && this._state.BorderColor.indexOf(this.BorderColor)<0 )) { + + this.btnColor.setColor(this.BorderColor); + this.mnuColorPicker.clearSelection(); + this.mnuColorPicker.selectByRGB(typeof(this.BorderColor) == 'object' ? this.BorderColor.color : this.BorderColor,true); + this._state.BorderColor = this.BorderColor; + } + } + + this._noApply = false; + + if (this.type !== type || type == Asc.c_oAscContentControlSpecificType.CheckBox) + this.showHideControls(type, formTextPr, specProps); + this.type = type; + } + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i')}, + {template: _.template('' + me.textNewColor + '')} + ] + })); + me.mnuFormsColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#id-toolbar-menu-form-color') + }); + var colorVal = $('
'); + $('button:first-child', me.btnHighlight.cmpEl).append(colorVal); + colorVal.css('background-color', me.btnHighlight.currentColor ? '#' + me.btnHighlight.currentColor : 'transparent'); + } else { + me.btnHighlight.cmpEl.parents('.group').hide().prev('.separator').hide(); + } + + me.btnTextField.updateHint(me.tipTextField); + me.btnComboBox.updateHint(me.tipComboBox); + me.btnDropDown.updateHint(me.tipDropDown); + me.btnCheckBox.updateHint(me.tipCheckBox); + me.btnRadioBox.updateHint(me.tipRadioBox); + me.btnImageField.updateHint(me.tipImageField); + me.btnViewForm.updateHint(me.tipViewForm); + + setEvents.call(me); + }); + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this); + this.fireEvent('show', this); + }, + + getButtons: function() { + return this.paragraphControls; + }, + + SetDisabled: function (state) { + this._state.disabled = state; + this.paragraphControls.forEach(function(button) { + if ( button ) { + button.setDisabled(state); + } + }, this); + }, + + capBtnText: 'Text Field', + capBtnComboBox: 'Combo Box', + capBtnDropDown: 'Dropdown', + capBtnCheckBox: 'Checkbox', + capBtnRadioBox: 'Radio Button', + capBtnImage: 'Image', + capBtnView: 'View Form', + textClearFields: 'Clear All Fields', + textHighlight: 'Highlight Settings', + tipTextField: 'Insert text field', + tipComboBox: 'Insert combo box', + tipDropDown: 'Insert dropdown list', + tipCheckBox: 'Insert checkbox', + tipRadioBox: 'Insert radio button', + tipImageField: 'Insert image', + tipViewForm: 'Fill form mode', + textNoHighlight: 'No highlighting', + textNewColor: 'Add New Custom Color' + } + }()), DE.Views.FormsTab || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index a56cdb917..778dbc362 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -58,6 +58,7 @@ define([ 'documenteditor/main/app/view/MailMergeSettings', 'documenteditor/main/app/view/TextArtSettings', 'documenteditor/main/app/view/SignatureSettings', + 'documenteditor/main/app/view/FormSettings', 'common/main/lib/component/Scroller' ], function (menuTemplate, $, _, Backbone) { 'use strict'; @@ -210,6 +211,22 @@ define([ this.signatureSettings = new DE.Views.SignatureSettings(); } + if (mode && mode.canFeatureContentControl && mode.canEditContentControl) { + this.btnForm = new Common.UI.Button({ + hint: this.txtFormSettings, + asctype: Common.Utils.documentSettingsType.Form, + enableToggle: true, + disabled: true, + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + this._settings[Common.Utils.documentSettingsType.Form] = {panel: "id-form-settings", btn: this.btnForm}; + this.btnForm.setElement($markup.findById('#id-right-menu-form'), false); this.btnForm.render().setVisible(true); + this.btnForm.on('click', this.onBtnMenuClick.bind(this)); + this.formSettings = new DE.Views.FormSettings(); + } + + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.right-panel'), @@ -242,12 +259,14 @@ define([ this.textartSettings.setApi(api).on('editcomplete', _fire_editcomplete); if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _fire_editcomplete); if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _fire_editcomplete); + if (this.formSettings) this.formSettings.setApi(api).on('editcomplete', _fire_editcomplete); }, setMode: function(mode) { this.mergeSettings && this.mergeSettings.setMode(mode); this.imageSettings && this.imageSettings.setMode(mode); this.shapeSettings && this.shapeSettings.setMode(mode); + this.formSettings && this.formSettings.setMode(mode); }, onBtnMenuClick: function(btn, e) { @@ -326,6 +345,7 @@ define([ txtTextArtSettings: 'Text Art Settings', txtChartSettings: 'Chart Settings', txtMailMergeSettings: 'Mail Merge Settings', - txtSignatureSettings: 'Signature Settings' + txtSignatureSettings: 'Signature Settings', + txtFormSettings: 'Form Settings' }, DE.Views.RightMenu || {})); }); \ 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 ede840dd5..085ec7b83 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -645,31 +645,6 @@ define([ value: 'checkbox' }, {caption: '--'}, - { - caption: this.textNewFieldControl, - value: 'new-field' - }, - { - caption: this.textNewPictureControl, - value: 'new-picture' - }, - { - caption: this.textNewComboboxControl, - value: 'new-combobox' - }, - { - caption: this.textNewDropdownControl, - value: 'new-dropdown' - }, - { - caption: this.textNewCheckboxControl, - value: 'new-checkbox' - }, - { - caption: this.textNewRadioboxControl, - value: 'new-radiobox' - }, - {caption: '--'}, { caption: this.textRemoveControl, iconCls: 'menu__icon cc-remove', @@ -2041,7 +2016,7 @@ define([ this.btnMailRecepients.setVisible(mode.canCoAuthoring == true && mode.canUseMailMerge); this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles); - this.btnContentControls.menu.items[17].setVisible(mode.canEditContentControl); + this.btnContentControls.menu.items[10].setVisible(mode.canEditContentControl); this.mnuInsertImage.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); }, @@ -2407,12 +2382,6 @@ define([ textListSettings: 'List Settings', capBtnDateTime: 'Date & Time', tipDateTime: 'Insert current date and time', - textNewFieldControl: 'New text field', - textNewPictureControl: 'New picture', - textNewComboboxControl: 'New combo box', - textNewCheckboxControl: 'New check box', - textNewRadioboxControl: 'New radio box', - textNewDropdownControl: 'New drop-down list', capBtnLineNumbers: 'Line Numbers', textContinuous: 'Continuous', textRestartEachPage: 'Restart Each Page', diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js index ea9a07eba..b0333ef3f 100644 --- a/apps/documenteditor/main/app_dev.js +++ b/apps/documenteditor/main/app_dev.js @@ -141,6 +141,7 @@ require([ 'Toolbar', 'Statusbar', 'Links', + 'FormsTab', 'Navigation', 'RightMenu', 'LeftMenu', @@ -166,6 +167,7 @@ require([ 'documenteditor/main/app/controller/DocumentHolder', 'documenteditor/main/app/controller/Toolbar', 'documenteditor/main/app/controller/Links', + 'documenteditor/main/app/controller/FormsTab', 'documenteditor/main/app/controller/Navigation', 'documenteditor/main/app/controller/Statusbar', 'documenteditor/main/app/controller/RightMenu', diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-checkbox.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-checkbox.png new file mode 100644 index 000000000..b69f2d9a4 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-checkbox.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-combo-box.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-combo-box.png new file mode 100644 index 000000000..e834d58e9 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-combo-box.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-dropdown.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-dropdown.png new file mode 100644 index 000000000..0e66a01b1 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-dropdown.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-radio-button.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-radio-button.png new file mode 100644 index 000000000..7886bc624 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-radio-button.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-text-field.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-text-field.png new file mode 100644 index 000000000..ea4a208e3 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/btn-text-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/btn-field.png b/apps/documenteditor/main/resources/img/toolbar/1x/btn-field.png new file mode 100644 index 000000000..a94a87e54 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/btn-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/btn-lock.png b/apps/documenteditor/main/resources/img/toolbar/1x/btn-lock.png new file mode 100644 index 000000000..e29b72f4d Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/btn-lock.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-checkbox.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-checkbox.png new file mode 100644 index 000000000..0701af707 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-checkbox.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-combo-box.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-combo-box.png new file mode 100644 index 000000000..ca0e29b04 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-combo-box.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-dropdown.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-dropdown.png new file mode 100644 index 000000000..e50cb92cb Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-dropdown.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-radio-button.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-radio-button.png new file mode 100644 index 000000000..7a7bfbf96 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-radio-button.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-text-field.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-text-field.png new file mode 100644 index 000000000..ac66fd2e3 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/btn-text-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/btn-field.png b/apps/documenteditor/main/resources/img/toolbar/2x/btn-field.png new file mode 100644 index 000000000..54cfa8845 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/btn-field.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/btn-lock.png b/apps/documenteditor/main/resources/img/toolbar/2x/btn-lock.png new file mode 100644 index 000000000..656f7406e Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/btn-lock.png differ