'].join(''));
this.initialize.call(this, opts);
@@ -126,6 +132,16 @@ define([
setCaption: function(text) {
this.$el.find('> span').text(text);
+ },
+
+ changeIconState: function(visible, title) {
+ if (this.iconCls.length) {
+ this.iconVisible = visible;
+ this.iconTitle = title || '';
+ this[visible ? 'addClass' : 'removeClass']('icon-visible');
+ if (title)
+ this.$el.find('.' + this.iconCls).attr('title', title);
+ }
}
});
diff --git a/apps/common/main/lib/view/EditNameDialog.js b/apps/common/main/lib/view/EditNameDialog.js
new file mode 100644
index 000000000..d4f6d4f51
--- /dev/null
+++ b/apps/common/main/lib/view/EditNameDialog.js
@@ -0,0 +1,127 @@
+/*
+ *
+ * (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
+ *
+*/
+/**
+ * EditNameDialog.js
+ *
+ * Created by Julia Radzhabova on 10.07.2020
+ * Copyright (c) 2020 Ascensio System SIA. All rights reserved.
+ *
+ */
+
+define([
+ 'common/main/lib/component/Window',
+ 'common/main/lib/component/InputField'
+], function () { 'use strict';
+
+ Common.Views.EditNameDialog = Common.UI.Window.extend(_.extend({
+ options: {
+ width: 330,
+ header: false,
+ cls: 'modal-dlg',
+ buttons: ['ok', 'cancel']
+ },
+
+ initialize : function(options) {
+ _.extend(this.options, options || {});
+
+ this.template = [
+ '
diff --git a/apps/documenteditor/main/app/view/CrossReferenceDialog.js b/apps/documenteditor/main/app/view/CrossReferenceDialog.js
new file mode 100644
index 000000000..cfc5b6f61
--- /dev/null
+++ b/apps/documenteditor/main/app/view/CrossReferenceDialog.js
@@ -0,0 +1,459 @@
+/*
+ *
+ * (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
+ *
+ */
+
+/**
+ * CrossReferenceDialog.js
+ *
+ * Created by Julia Radzhabova on 22.09.2020
+ * Copyright (c) 2020 Ascensio System SIA. All rights reserved.
+ *
+ */
+define([
+ 'common/main/lib/component/Window',
+ 'common/main/lib/component/ComboBox'
+], function () { 'use strict';
+
+ DE.Views.CrossReferenceDialog = Common.UI.Window.extend(_.extend({
+ options: {
+ width: 400,
+ height: 407,
+ style: 'min-width: 240px;',
+ cls: 'modal-dlg',
+ modal: false
+ },
+
+ initialize : function(options) {
+ _.extend(this.options, {
+ title: this.txtTitle,
+ buttons: [{value: 'ok', caption: this.textInsert}, 'close']
+ }, options || {});
+
+ this.template = [
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ '
',
+ '
',
+ '',
+ '',
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ '
',
+ '
',
+ '
',
+ '
'
+ ].join('');
+
+ this.crossRefProps = options.crossRefProps;
+ this.api = options.api;
+ this.options.tpl = _.template(this.template)(this.options);
+ this._locked = false;
+
+ 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));
+
+ var arr = Common.Utils.InternalSettings.get("de-settings-captions");
+ if (arr==null || arr==undefined) {
+ arr = Common.localStorage.getItem("de-settings-captions") || '';
+ Common.Utils.InternalSettings.set("de-settings-captions", arr);
+ }
+ arr = arr ? JSON.parse(arr) : [];
+
+ // 0 - not removable
+ arr = arr.concat([{ value: 5, displayValue: this.textEquation },
+ { value: 6, displayValue: this.textFigure },
+ { value: 7, displayValue: this.textTable }
+ ]);
+ arr.sort(function(a,b){
+ var sa = a.displayValue.toLowerCase(),
+ sb = b.displayValue.toLowerCase();
+ return sa>sb ? 1 : (sa<%= value %>')
+ });
+ this.refList.on('entervalue', _.bind(this.onPrimary, this))
+ .on('item:dblclick', _.bind(this.onPrimary, this));
+
+ this.lblWhich = $window.find('#id-dlg-cross-which');
+
+ this.btnInsert = new Common.UI.Button({
+ el: $window.find('.primary'),
+ disabled: true
+ });
+
+ this.afterRender();
+ },
+
+ afterRender: function() {
+ this._setDefaults();
+ },
+
+ _handleInput: function(state, fromButton) {
+ if (this.options.handler) {
+ this.options.handler.call(this, state);
+ }
+ if (state=='ok') {
+ if(!fromButton && document.activeElement && document.activeElement.localName == 'textarea' && /area_id/.test(document.activeElement.id)){
+ return;
+ }
+ !this.btnInsert.isDisabled() && this.insertReference();
+ return;
+ }
+ this.close();
+ },
+
+ onBtnClick: function(event) {
+ this._handleInput(event.currentTarget.attributes['result'].value, true);
+ },
+
+ onPrimary: function(event) {
+ this._handleInput('ok');
+ return false;
+ },
+
+ getSettings: function() {
+ return {type: this.cmbType.getValue(), refType: this.cmbReference.getValue()};
+ },
+
+ _setDefaults: function () {
+ var rec,
+ currentRef;
+ if (this.crossRefProps) {
+ rec = this.cmbType.store.findWhere({value: this.crossRefProps.type});
+ rec && (currentRef = this.crossRefProps.refType);
+ }
+ rec ? this.cmbType.selectRecord(rec) : this.cmbType.setValue(0);
+ this.refreshReferenceTypes(this.cmbType.getSelectedRecord(), currentRef);
+ },
+
+ insertReference: function() {
+ var record = this.refList.getSelectedRec(),
+ typeRec = this.cmbType.getSelectedRecord(),
+ type = (typeRec.type==1 || typeRec.value>4) ? 5 : typeRec.value,
+ reftype = this.cmbReference.getValue(),
+ link = this.chInsertAs.getValue()=='checked',
+ below = this.chBelowAbove.getValue()=='checked',
+ separator = (this.chSeparator.getValue()=='checked') ? this.inputSeparator.getValue() : undefined;
+
+ switch (type) {
+ case 0: // paragraph
+ case 1: // heading
+ this.api.asc_AddCrossRefToParagraph(record.get('para'), reftype, link, below, separator);
+ break;
+ case 2: // bookmark
+ this.api.asc_AddCrossRefToBookmark(record.get('value'), reftype, link, below, separator);
+ break;
+ case 3: // footnote
+ case 4: // endnote
+ this.api.asc_AddCrossRefToNote(record.get('para'), reftype, link, below);
+ break;
+ case 5: // caption
+ if (reftype==Asc.c_oAscDocumentRefenceToType.OnlyCaptionText && record.get('para').asc_canAddRefToCaptionText(typeRec.displayValue)===false) {
+ Common.UI.warning({
+ msg : this.textEmpty
+ });
+ } else
+ this.api.asc_AddCrossRefToCaption(typeRec.displayValue, record.get('para'), reftype, link, below);
+ break;
+ }
+ },
+
+ onTypeSelected: function (combo, record) {
+ this.refreshReferenceTypes(record);
+ },
+
+ refreshReferenceTypes: function(record, currentRef) {
+ var arr = [],
+ str = this.textWhich, type = 5;
+ if (record.type==1 || record.value > 4) {
+ // custom labels from caption dialog and Equation, Figure, Table
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textCaption },
+ { value: Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber, displayValue: this.textLabelNum },
+ { value: Asc.c_oAscDocumentRefenceToType.OnlyCaptionText, displayValue: this.textOnlyCaption },
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
+ ];
+ } else {
+ type = record.value;
+ switch (record.value) {
+ case 0: // paragraph
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull },
+ { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textText },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
+ ];
+ str = this.textWhichPara;
+ break;
+ case 1: // heading
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textHeadingText },
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textHeadingNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textHeadingNumNo },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textHeadingNumFull },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
+ ];
+ str = this.textWhichHeading;
+ break;
+ case 2: // bookmark
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textBookmarkText },
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo },
+ { value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
+ ];
+ str = this.textWhichBookmark;
+ break;
+ case 3: // note
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textNoteNum },
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow },
+ { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textNoteNumForm }
+ ];
+ str = this.textWhichNote;
+ break;
+ case 4: // end note
+ arr = [
+ { value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textEndNoteNum },
+ { value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
+ { value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow },
+ { value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textEndNoteNumForm }
+ ];
+ str = this.textWhichEndnote;
+ break;
+ }
+ }
+ this.cmbReference.setData(arr);
+ this.cmbReference.setValue(currentRef ? currentRef : arr[0].value);
+ this.onReferenceSelected(this.cmbReference, this.cmbReference.getSelectedRecord());
+ this.lblWhich.text(str);
+ this.refreshReferences(type);
+ },
+
+ refreshReferences: function(type) {
+ var store = this.refList.store,
+ arr = [],
+ props;
+ switch (type) {
+ case 0: // paragraph
+ props = this.api.asc_GetAllNumberedParagraphs();
+ break;
+ case 1: // heading
+ props = this.api.asc_GetAllHeadingParagraphs();
+ break;
+ case 2: // bookmark
+ props = this.api.asc_GetBookmarksManager();
+ break;
+ case 3: // footnote
+ props = this.api.asc_GetAllFootNoteParagraphs();
+ break;
+ case 4: // endnote
+ props = this.api.asc_GetAllEndNoteParagraphs();
+ break;
+ case 5: // caption
+ props = this.api.asc_GetAllCaptionParagraphs(this.cmbType.getSelectedRecord().displayValue);
+ break;
+ }
+ if (type==2) { // bookmark
+ var count = props.asc_GetCount();
+ for (var i=0; i0) {
+ var rec = store.at(0);
+ this.refList.selectRecord(rec);
+ this.refList.scrollToRecord(rec);
+ }
+ this.btnInsert.setDisabled(arr.length<1 || this._locked);
+ },
+
+ onReferenceSelected: function(combo, record) {
+ var refType = record.value,
+ typeRec = this.cmbType.getSelectedRecord(),
+ type = (typeRec.type==1 || typeRec.value>4) ? 5 : typeRec.value;
+ var disable = (type==5 && refType!==Asc.c_oAscDocumentRefenceToType.PageNum) || (type<5) && (refType==Asc.c_oAscDocumentRefenceToType.Text || refType==Asc.c_oAscDocumentRefenceToType.AboveBelow);
+ this.chBelowAbove.setDisabled(disable);
+ disable = !(type==0 || type==2) || (refType!==Asc.c_oAscDocumentRefenceToType.ParaNumFullContex);
+ this.chSeparator.setDisabled(disable);
+ this.inputSeparator.setDisabled(disable || this.chSeparator.getValue()!=='checked');
+ },
+
+ setLocked: function(locked){
+ this._locked = locked;
+ this.btnInsert.setDisabled(this.refList.store.length<1 || this._locked);
+ },
+
+ txtTitle: 'Cross-reference',
+ txtType: 'Reference type',
+ txtReference: 'Insert reference to',
+ textInsertAs: 'Insert as hyperlink',
+ textSeparate: 'Separate numbers with',
+ textIncludeAbove: 'Include above/below',
+ textPageNum: 'Page number',
+ textParaNum: 'Paragraph number',
+ textParaNumNo: 'Paragraph number (no context)',
+ textParaNumFull: 'Paragraph number (full context)',
+ textText: 'Paragraph text',
+ textAboveBelow: 'Above/below',
+ textHeadingText: 'Heading text',
+ textHeadingNum: 'Heading number',
+ textHeadingNumNo: 'Heading number (no context)',
+ textHeadingNumFull: 'Heading number (full context)',
+ textBookmarkText: 'Bookmark text',
+ textNoteNum: 'Footnote number',
+ textNoteNumForm: 'Footnote number (formatted)',
+ textEndNoteNum: 'Endnote number',
+ textEndNoteNumForm: 'Endnote number (formatted)',
+ textCaption: 'Entire caption',
+ textLabelNum: 'Only label and number',
+ textOnlyCaption: 'Only caption text',
+ textParagraph: 'Numbered item',
+ textHeading: 'Heading',
+ textBookmark: 'Bookmark',
+ textFootnote: 'Footnote',
+ textEndnote: 'Endnote',
+ textEquation: 'Equation',
+ textFigure: 'Figure',
+ textTable: 'Table',
+ textInsert: 'Insert',
+ textWhich: 'For which caption',
+ textWhichHeading: 'For which heading',
+ textWhichBookmark: 'For which bookmark',
+ textWhichNote: 'For which footnote',
+ textWhichEndnote: 'For which endnote',
+ textWhichPara: 'For which numbered item',
+ textEmpty: 'The request reference is empty.'
+
+ }, DE.Views.CrossReferenceDialog || {}))
+});
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/view/LineNumbersDialog.js b/apps/documenteditor/main/app/view/LineNumbersDialog.js
new file mode 100644
index 000000000..f1c37058e
--- /dev/null
+++ b/apps/documenteditor/main/app/view/LineNumbersDialog.js
@@ -0,0 +1,258 @@
+/*
+ *
+ * (c) Copyright Ascensio System SIA 2010-2020
+ *
+ * This program is a free software product. You can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License (AGPL)
+ * version 3 as published by the Free Software Foundation. In accordance with
+ * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
+ * that Ascensio System SIA expressly excludes the warranty of non-infringement
+ * of any third-party rights.
+ *
+ * This program is distributed WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
+ * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
+ *
+ * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of the Program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU AGPL version 3.
+ *
+ * Pursuant to Section 7(b) of the License you must retain the original Product
+ * logo when distributing the program. Pursuant to Section 7(e) we decline to
+ * grant you any rights under trademark law for use of our trademarks.
+ *
+ * All the Product's GUI elements, including illustrations and icon sets, as
+ * well as technical writing content are licensed under the terms of the
+ * Creative Commons Attribution-ShareAlike 4.0 International. See the License
+ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
+ *
+*/
+/**
+ * LineNumbersDialog.js
+ *
+ * Created by Julia Svinareva on 18/09/19
+ * Copyright (c) 2020 Ascensio System SIA. All rights reserved.
+ *
+ */
+
+define([
+ 'common/main/lib/component/Window',
+ 'common/main/lib/component/CheckBox',
+ 'common/main/lib/component/MetricSpinner'
+], function () { 'use strict';
+
+ DE.Views.LineNumbersDialog = Common.UI.Window.extend(_.extend({
+ options: {
+ width: 290,
+ height: 308,
+ header: true,
+ style: 'min-width: 290px;',
+ cls: 'modal-dlg',
+ buttons: ['ok', 'cancel']
+ },
+
+ initialize : function(options) {
+ _.extend(this.options, {
+ title: this.textTitle
+ }, options || {});
+
+ this.template = [
+ '
',
+ '',
+ '
',
+ '
',
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ '',
+ '',
+ '
',
+ '',
+ '
',
+ '
'
+ ].join('');
+
+ this.options.tpl = _.template(this.template)(this.options);
+
+ this.spinners = [];
+ this._noApply = false;
+
+ Common.UI.Window.prototype.initialize.call(this, this.options);
+ },
+
+ render: function() {
+ Common.UI.Window.prototype.render.call(this);
+
+ this.chAddLineNumbering = new Common.UI.CheckBox({
+ el: $('#line-numbers-add-line-numbering'),
+ labelText: this.textAddLineNumbering
+ }).on('change', _.bind(function(field, newValue, oldValue, eOpts){
+ var checked = field.getValue()!=='checked';
+ this.spnStartAt.setDisabled(checked);
+ this.spnFromText.setDisabled(checked);
+ this.spnCountBy.setDisabled(checked);
+ this.rbRestartEachPage.setDisabled(checked);
+ this.rbRestartEachSection.setDisabled(checked);
+ this.rbContinuous.setDisabled(checked);
+ }, this));
+
+ this.spnStartAt = new Common.UI.MetricSpinner({
+ el: $('#line-numbers-start-at'),
+ step: 1,
+ width: 80,
+ defaultUnit : '',
+ value: 1,
+ maxValue: 32767,
+ minValue: 1,
+ disabled: true
+ });
+
+ this.spnFromText = new Common.UI.MetricSpinner({
+ el: $('#line-numbers-from-text'),
+ step: 0.1,
+ width: 80,
+ defaultUnit : 'cm',
+ value: 'Auto',
+ maxValue: 55.87,
+ minValue: 0.1,
+ allowAuto: true,
+ disabled: true
+ });
+ this.spinners.push(this.spnFromText);
+
+ this.spnCountBy = new Common.UI.MetricSpinner({
+ el: $('#line-numbers-count-by'),
+ step: 1,
+ width: 80,
+ defaultUnit : '',
+ value: 1,
+ maxValue: 100,
+ minValue: 1,
+ disabled: true
+ });
+
+ this.rbRestartEachPage = new Common.UI.RadioBox({
+ el: $('#line-numbers-restart-each-page'),
+ labelText: this.textRestartEachPage,
+ name: 'asc-radio-line-numbers',
+ disabled: true,
+ checked: true
+ });
+
+ this.rbRestartEachSection = new Common.UI.RadioBox({
+ el: $('#line-numbers-restart-each-section'),
+ labelText: this.textRestartEachSection,
+ name: 'asc-radio-line-numbers',
+ disabled: true
+ });
+
+ this.rbContinuous = new Common.UI.RadioBox({
+ el: $('#line-numbers-continuous'),
+ labelText: this.textContinuous,
+ name: 'asc-radio-line-numbers',
+ disabled: true
+ });
+
+ this.cmbApply = new Common.UI.ComboBox({
+ el: $('#line-numbers-combo-apply'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 125px;',
+ editable: false,
+ data: [
+ { displayValue: this.textSection, value: Asc.c_oAscSectionApplyType.Current },
+ { displayValue: this.textForward, value: Asc.c_oAscSectionApplyType.ToEnd },
+ { displayValue: this.textDocument, value: Asc.c_oAscSectionApplyType.All }
+ ]
+ });
+ this.cmbApply.setValue(this.options.applyTo);
+
+ this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
+
+ this.updateMetricUnit();
+ },
+
+ afterRender: function() {
+ },
+
+ setSettings: function (props) {
+ if (props) {
+ var type = props.get_Restart();
+ this.chAddLineNumbering.setValue(true);
+ switch (type) {
+ case Asc.c_oAscLineNumberRestartType.Continuous: this.rbContinuous.setValue(true, true); break;
+ case Asc.c_oAscLineNumberRestartType.NewPage: this.rbRestartEachPage.setValue(true, true); break;
+ case Asc.c_oAscLineNumberRestartType.NewSection: this.rbRestartEachSection.setValue(true, true); break;
+ }
+ this.spnStartAt.setValue(props.get_Start()!==null && props.get_Start()!==undefined ? props.get_Start() : '', true);
+ this.spnFromText.setValue(props.get_Distance()!==null && props.get_Distance()!==undefined ? Common.Utils.Metric.fnRecalcFromMM(props.get_Distance() * 25.4 / 20 / 72.0) : -1, true);
+ this.spnCountBy.setValue(props.get_CountBy()!==null && props.get_CountBy()!==undefined ? props.get_CountBy() : '', true);
+ } else
+ this.chAddLineNumbering.setValue(false);
+ },
+
+ _handleInput: function(state) {
+ if (this.options.handler) {
+ this.options.handler.call(this, this, state);
+ }
+
+ this.close();
+ },
+
+ onBtnClick: function(event) {
+ this._handleInput(event.currentTarget.attributes['result'].value);
+ },
+
+ onPrimary: function() {
+ this._handleInput('ok');
+ return false;
+ },
+
+ getSettings: function() {
+ var props;
+ if (this.chAddLineNumbering.getValue()==='checked') {
+ props = new Asc.CSectionLnNumType();
+ if (this.rbContinuous.getValue())
+ props.put_Restart(Asc.c_oAscLineNumberRestartType.Continuous);
+ else if (this.rbRestartEachPage.getValue())
+ props.put_Restart(Asc.c_oAscLineNumberRestartType.NewPage);
+ else if (this.rbRestartEachSection.getValue())
+ props.put_Restart(Asc.c_oAscLineNumberRestartType.NewSection);
+ props.put_Start(this.spnStartAt.getValue()!=='' ? this.spnStartAt.getNumberValue() : undefined);
+ var value = this.spnFromText.getNumberValue();
+ props.put_Distance(value<0 ? null : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4));
+ props.put_CountBy(this.spnCountBy.getValue()!=='' ? this.spnCountBy.getNumberValue() : undefined);
+ }
+ return {props: props, type: this.cmbApply.getValue()};
+ },
+
+ updateMetricUnit: function() {
+ if (this.spinners) {
+ for (var i=0; i0 ? me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined,
+ symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
handler: function(dlg, result, settings) {
if (result == 'ok') {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
diff --git a/apps/spreadsheeteditor/main/app.js b/apps/spreadsheeteditor/main/app.js
index f274e5365..98f81f10a 100644
--- a/apps/spreadsheeteditor/main/app.js
+++ b/apps/spreadsheeteditor/main/app.js
@@ -158,6 +158,7 @@ require([
'Main',
'PivotTable',
'DataTab',
+ 'ViewTab',
'Common.Controllers.Fonts',
'Common.Controllers.Chat',
'Common.Controllers.Comments',
@@ -181,6 +182,7 @@ require([
'spreadsheeteditor/main/app/controller/Print',
'spreadsheeteditor/main/app/controller/PivotTable',
'spreadsheeteditor/main/app/controller/DataTab',
+ 'spreadsheeteditor/main/app/controller/ViewTab',
'spreadsheeteditor/main/app/view/FileMenuPanels',
'spreadsheeteditor/main/app/view/ParagraphSettings',
'spreadsheeteditor/main/app/view/ImageSettings',
diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js
index 659f72cbc..cb92d6915 100644
--- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js
+++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js
@@ -309,6 +309,11 @@ define([
onLockDefNameManager: function(state) {
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
+ },
+
+ disableEditing: function(disabled) {
+ this.editor.$btnfunc[!disabled?'removeClass':'addClass']('disabled');
+ this.editor.btnNamedRanges.setVisible(!disabled);
}
});
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
index 4a0b94ab2..a85e080f1 100644
--- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
+++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
@@ -1959,6 +1959,7 @@ define([
documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot);
documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot);
documentHolder.pmiInsFunction.setDisabled(isCellLocked || inPivot);
+ documentHolder.pmiFreezePanes.setDisabled(this.api.asc_isWorksheetLockedOrDeleted(this.api.asc_getActiveWorksheetIndex()));
if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event);
} else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) {
diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
index de93a8e20..40d66fe24 100644
--- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
+++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
@@ -188,6 +188,15 @@ define([
return this;
},
+ disableEditing: function(disabled) {
+ this.leftMenu.btnComments.setDisabled(disabled);
+ this.leftMenu.btnChat.setDisabled(disabled);
+ this.leftMenu.btnPlugins.setDisabled(disabled);
+ this.leftMenu.btnSpellcheck.setDisabled(disabled);
+
+ this.leftMenu.getMenu('file').disableEditing(disabled);
+ },
+
createDelayedElements: function() {
/** coauthoring begin **/
if ( this.mode.canCoAuthoring ) {
diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js
index 431e08729..5017242a1 100644
--- a/apps/spreadsheeteditor/main/app/controller/Main.js
+++ b/apps/spreadsheeteditor/main/app/controller/Main.js
@@ -358,6 +358,7 @@ define([
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
this.appOptions.canFeaturePivot = true;
+ this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views");
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
@@ -1149,7 +1150,7 @@ define([
}
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && me.appOptions.canFeaturePivot)
- application.getController('PivotTable').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
+ application.getController('PivotTable').setMode(me.appOptions);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.applyEditorMode();
@@ -1533,6 +1534,10 @@ define([
config.msg = this.errorMoveSlicerError;
break;
+ case Asc.c_oAscError.ID.LockedEditView:
+ config.msg = this.errorEditView;
+ break;
+
default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break;
@@ -2220,13 +2225,16 @@ define([
disablefunc: function (disable) {
me.disableEditing(disable);
var app = me.getApplication();
+ app.getController('Toolbar').DisableToolbar(disable,disable);
app.getController('RightMenu').SetDisabled(disable, true);
app.getController('Statusbar').SetDisabled(disable);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
app.getController('DocumentHolder').SetDisabled(disable, true);
var leftMenu = app.getController('LeftMenu');
- leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
leftMenu.setPreviewMode(disable);
+ leftMenu.disableEditing(disable);
+ app.getController('CellEditor').disableEditing(disable);
+ app.getController('Viewport').disableEditing(disable);
var comments = app.getController('Common.Controllers.Comments');
if (comments) comments.setPreviewMode(disable);
}});
@@ -2662,7 +2670,8 @@ define([
errorPasteSlicerError: 'Table slicers cannot be copied from one workbook to another.',
errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters. Please edit it and try again.',
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values, cell references, and/or names.',
- errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another. Try again by selecting the entire table and the slicers.'
+ errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another. Try again by selecting the entire table and the slicers.',
+ errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.'
}
})(), SSE.Controllers.Main || {}))
});
diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js
index f826afaea..3b1cba876 100644
--- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js
+++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js
@@ -89,12 +89,10 @@ define([
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
},
- setConfig: function (data, api) {
- this.view = this.createView('PivotTable');
- this.setApi(api);
- if (data) {
- this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
- }
+ setConfig: function (config) {
+ this.view = this.createView('PivotTable', {
+ toolbar: config.toolbar.toolbar
+ });
},
setApi: function (api) {
@@ -106,6 +104,7 @@ define([
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
}
+ return this;
},
setMode: function(mode) {
@@ -400,7 +399,7 @@ define([
Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
Common.Utils.lockControls(SSE.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls});
- Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: [this.view.btnAddPivot]});
+ Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot});
if (pivotInfo)
this.ChangeSettings(pivotInfo);
diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js
index b0318ecce..76477378c 100644
--- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js
+++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js
@@ -413,7 +413,7 @@ define([
SetDisabled: function(disabled, allowSignature) {
this.setMode({isEdit: !disabled});
- if (this.rightmenu) {
+ if (this.rightmenu && this.rightmenu.paragraphSettings) {
this.rightmenu.paragraphSettings.disableControls(disabled);
this.rightmenu.shapeSettings.disableControls(disabled);
this.rightmenu.imageSettings.disableControls(disabled);
diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js
index 779b1c9d0..fdc2310b2 100644
--- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js
@@ -104,6 +104,7 @@ define([
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
this.api.asc_registerCallback('asc_onFilterInfo', _.bind(this.onApiFilterInfo , this));
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this));
+ this.api.asc_registerCallback('asc_onRefreshNamedSheetViewList', _.bind(this.onRefreshNamedSheetViewList, this));
this.statusbar.setApi(api);
},
@@ -711,12 +712,61 @@ define([
onApiActiveSheetChanged: function (index) {
this.statusbar.tabMenu.hide();
+ if (this._sheetViewTip && this._sheetViewTip.isVisible() && this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(index)) { // hide tip when sheet in the default mode
+ this._sheetViewTip.hide();
+ }
+ },
+
+ onRefreshNamedSheetViewList: function() {
+ var views = this.api.asc_getNamedSheetViews(),
+ active = false,
+ name="",
+ me = this;
+ for (var i=0; i0 ? me.api.asc_getCellInfo().asc_getXfs().asc_getFontName() : undefined,
+ symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
handler: function(dlg, result, settings) {
if (result == 'ok') {
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
@@ -3314,6 +3317,7 @@ define([
if ( config.canFeaturePivot ) {
tab = {action: 'pivot', caption: me.textPivot};
var pivottab = me.getApplication().getController('PivotTable');
+ pivottab.setApi(me.api).setConfig({toolbar: me});
$panel = pivottab.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 5);
@@ -3342,6 +3346,10 @@ define([
me.toolbar.addTab(tab, $panel, 7);
}
}
+
+ var viewtab = me.getApplication().getController('ViewTab');
+ viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
+ Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
}
}
},
diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js
new file mode 100644
index 000000000..8a38b83bb
--- /dev/null
+++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js
@@ -0,0 +1,218 @@
+/*
+ *
+ * (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
+ *
+ */
+
+/**
+ * ViewTab.js
+ *
+ * Created by Julia Radzhabova on 08.07.2020
+ * Copyright (c) 2020 Ascensio System SIA. All rights reserved.
+ *
+ */
+
+define([
+ 'core',
+ 'spreadsheeteditor/main/app/view/ViewTab',
+ 'spreadsheeteditor/main/app/view/ViewManagerDlg'
+], function () {
+ 'use strict';
+
+ SSE.Controllers.ViewTab = Backbone.Controller.extend(_.extend({
+ models : [],
+ collections : [
+ ],
+ views : [
+ 'ViewTab'
+ ],
+ sdkViewName : '#id_main',
+
+ initialize: function () {
+ },
+ onLaunch: function () {
+ this._state = {};
+ },
+
+ setApi: function (api) {
+ if (api) {
+ this.api = api;
+ this.api.asc_registerCallback('asc_onZoomChanged', this.onApiZoomChange.bind(this));
+ this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
+ this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this));
+ this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
+ this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
+ this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
+ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
+ }
+ return this;
+ },
+
+ setConfig: function(config) {
+ this.toolbar = config.toolbar;
+ this.view = this.createView('ViewTab', {
+ toolbar: this.toolbar.toolbar,
+ mode: config.mode
+ });
+ this.addListeners({
+ 'ViewTab': {
+ 'viewtab:freeze': this.onFreeze,
+ 'viewtab:formula': this.onViewSettings,
+ 'viewtab:headings': this.onViewSettings,
+ 'viewtab:gridlines': this.onViewSettings,
+ 'viewtab:zoom': this.onZoom,
+ 'viewtab:showview': this.onShowView,
+ 'viewtab:openview': this.onOpenView,
+ 'viewtab:createview': this.onCreateView,
+ 'viewtab:manager': this.onOpenManager
+ },
+ 'Statusbar': {
+ 'sheet:changed': this.onApiSheetChanged.bind(this)
+ }
+ });
+ Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));
+ },
+
+ 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);
+ },
+
+ onSelectionChanged: function(info) {
+ if (!this.toolbar.editMode || !this.view) return;
+ },
+
+ onFreeze: function(state) {
+ if (this.api) {
+ this.api.asc_freezePane();
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.view);
+ },
+
+ onZoom: function(zoom) {
+ if (this.api) {
+ this.api.asc_setZoom(zoom/100);
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.view);
+ },
+
+ onViewSettings: function(type, value){
+ if (this.api) {
+ switch (type) {
+ case 0: this.getApplication().getController('Viewport').header.fireEvent('formulabar:hide', [ value!=='checked']); break;
+ case 1: this.api.asc_setDisplayHeadings(value=='checked'); break;
+ case 2: this.api.asc_setDisplayGridlines( value=='checked'); break;
+ }
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.view);
+ },
+
+ onShowView: function() {
+ var views = this.api.asc_getNamedSheetViews(),
+ menu = this.view.btnSheetView.menu._innerMenu,
+ active = false;
+
+ menu.removeItems(1, menu.items.length-1);
+ _.each(views, function(item, index) {
+ menu.addItem(new Common.UI.MenuItem({
+ caption : item.asc_getName(),
+ checkable: true,
+ allowDepress: false,
+ checked : item.asc_getIsActive()
+ }));
+ if (item.asc_getIsActive())
+ active = true;
+ });
+ menu.items[0].setChecked(!active, true);
+ },
+
+ onOpenView: function(item) {
+ this.api && this.api.asc_setActiveNamedSheetView((item.value == 'default') ? null : item.name);
+ },
+
+ onCreateView: function(item) {
+ this.api && this.api.asc_addNamedSheetView(null, true);
+ },
+
+ onOpenManager: function(item) {
+ var me = this;
+ (new SSE.Views.ViewManagerDlg({
+ api: this.api,
+ handler: function(result, value) {
+ if (result == 'ok' && value) {
+ if (me.api) {
+ me.api.asc_setActiveNamedSheetView(value);
+ }
+ }
+ Common.NotificationCenter.trigger('edit:complete', me.view);
+ },
+ views: this.api.asc_getNamedSheetViews()
+ })).on('close', function(win){
+ }).show();
+ },
+
+ onWorksheetLocked: function(index,locked) {
+ if (index == this.api.asc_getActiveWorksheetIndex()) {
+ Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes]});
+ }
+ },
+
+ onApiSheetChanged: function() {
+ if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
+
+ var params = this.api.asc_getSheetViewSettings();
+ this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true);
+ this.view.chGridlines.setValue(!!params.asc_getShowGridLines(), true);
+ this.view.btnFreezePanes.toggle(!!params.asc_getIsFreezePane(), true);
+
+ var currentSheet = this.api.asc_getActiveWorksheetIndex();
+ this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
+ },
+
+ onLayoutChanged: function(area) {
+ if (area=='celleditor' && arguments[1]) {
+ this.view.chFormula.setValue(arguments[1]=='showed', true);
+ }
+ },
+
+ onApiZoomChange: function(zf, type){
+ var value = Math.floor((zf + .005) * 100);
+ this.view.cmbZoom.setValue(value, value + '%');
+ }
+ }, SSE.Controllers.ViewTab || {}));
+});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js
index 5db842009..0a90ed4f9 100644
--- a/apps/spreadsheeteditor/main/app/controller/Viewport.js
+++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js
@@ -127,6 +127,7 @@ define([
this.api.asc_registerCallback('asc_onZoomChanged', this.onApiZoomChange.bind(this));
this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
+ this.api.asc_registerCallback('asc_onWorksheetLocked', this.onWorksheetLocked.bind(this));
this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',this.onApiCoAuthoringDisconnect.bind(this));
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
@@ -209,7 +210,7 @@ define([
}, this));
}
- var mnuitemHideFormulaBar = new Common.UI.MenuItem({
+ me.header.mnuitemHideFormulaBar = new Common.UI.MenuItem({
caption : me.textHideFBar,
checked : Common.localStorage.getBool('sse-hidden-formula'),
checkable : true,
@@ -220,6 +221,7 @@ define([
caption : me.textHideHeadings,
checkable : true,
checked : me.header.mnuitemHideHeadings.isChecked(),
+ disabled : me.header.mnuitemHideHeadings.isDisabled(),
value : 'headings'
});
@@ -227,6 +229,7 @@ define([
caption : me.textHideGridlines,
checkable : true,
checked : me.header.mnuitemHideGridlines.isChecked(),
+ disabled : me.header.mnuitemHideGridlines.isDisabled(),
value : 'gridlines'
});
@@ -234,6 +237,7 @@ define([
caption : me.textFreezePanes,
checkable : true,
checked : me.header.mnuitemFreezePanes.isChecked(),
+ disabled : me.header.mnuitemFreezePanes.isDisabled(),
value : 'freezepanes'
});
@@ -270,7 +274,7 @@ define([
style: 'min-width: 180px;',
items: [
me.header.mnuitemCompactToolbar,
- mnuitemHideFormulaBar,
+ me.header.mnuitemHideFormulaBar,
{caption:'--'},
me.header.mnuitemHideHeadings,
me.header.mnuitemHideGridlines,
@@ -400,6 +404,7 @@ define([
case 'celleditor':
if (arguments[1]) {
this.boxSdk.css('border-top', arguments[1]=='hidden'?'none':'');
+ this.header.mnuitemHideFormulaBar && this.header.mnuitemHideFormulaBar.setChecked(arguments[1]=='hidden', true);
}
this.viewport.celayout.doLayout();
break;
@@ -442,6 +447,21 @@ define([
me.header.mnuitemHideHeadings.setChecked(!params.asc_getShowRowColHeaders());
me.header.mnuitemHideGridlines.setChecked(!params.asc_getShowGridLines());
me.header.mnuitemFreezePanes.setChecked(params.asc_getIsFreezePane());
+
+ var currentSheet = me.api.asc_getActiveWorksheetIndex();
+ this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
+ }
+ },
+
+ onWorksheetLocked: function(index,locked) {
+ var me = this;
+ var appConfig = me.viewport.mode;
+ if ( !!appConfig && !appConfig.isEditDiagram && !appConfig.isEditMailMerge ) {
+ if (index == this.api.asc_getActiveWorksheetIndex()) {
+ me.header.mnuitemHideHeadings.setDisabled(locked);
+ me.header.mnuitemHideGridlines.setDisabled(locked);
+ me.header.mnuitemFreezePanes.setDisabled(locked);
+ }
}
},
@@ -484,6 +504,10 @@ define([
}
},
+ disableEditing: function (disabled) {
+ this.header.btnOptions.menu.items[6].setDisabled(disabled);
+ },
+
textHideFBar: 'Hide Formula Bar',
textHideHeadings: 'Hide Headings',
textHideGridlines: 'Hide Gridlines',
diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template
index daef46a62..4408cfbd0 100644
--- a/apps/spreadsheeteditor/main/app/template/Toolbar.template
+++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template
@@ -120,6 +120,7 @@