From 8d88fe6acaa8077f0d5fa38c422bff5953dbbb77 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Mar 2020 15:06:40 +0300 Subject: [PATCH 01/11] [SSE] Bug 43869 --- .../main/app/controller/Toolbar.js | 29 +- .../main/app/template/Toolbar.template | 1 + .../main/app/view/PrintTitlesDialog.js | 291 ++++++++++++++++++ .../main/app/view/Toolbar.js | 16 +- 4 files changed, 333 insertions(+), 4 deletions(-) create mode 100644 apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index da6f0cf76..3840c907c 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -57,6 +57,7 @@ define([ 'spreadsheeteditor/main/app/view/FormatSettingsDialog', 'spreadsheeteditor/main/app/view/PageMarginsDialog', 'spreadsheeteditor/main/app/view/HeaderFooterDialog', + 'spreadsheeteditor/main/app/view/PrintTitlesDialog', 'spreadsheeteditor/main/app/view/ScaleDialog' ], function () { 'use strict'; @@ -380,6 +381,7 @@ define([ toolbar.btnsEditHeader.forEach(function(button) { button.on('click', _.bind(me.onEditHeaderClick, me)); }); + toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this)); Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); @@ -1878,14 +1880,14 @@ define([ onApiLockDocumentProps: function(nIndex) { if (this._state.lock_doc!==true && nIndex == this.api.asc_getActiveWorksheetIndex()) { - this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale]}); + this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); this._state.lock_doc = true; } }, onApiUnLockDocumentProps: function(nIndex) { if (this._state.lock_doc!==false && nIndex == this.api.asc_getActiveWorksheetIndex()) { - this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale]}); + this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); this._state.lock_doc = false; } }, @@ -3453,6 +3455,29 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onPrintTitlesClick: function(btn) { + if (this.api) { + var win, props, + me = this; + win = new SSE.Views.PrintTitlesDialog({ + api: me.api, + handler: function(dlg, result) { + if (result == 'ok') { + props = dlg.getSettings(); + me.api.asc_changePrintTitles(props); + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + } + }); + win.show(); + win.setSettings(me.api.asc_getPageOptions(me.api.asc_getActiveWorksheetIndex())); + + Common.component.Analytics.trackEvent('ToolBar', 'Print Titles'); + } + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + textEmptyImgUrl : 'You need to specify image URL.', warnMergeLostData : 'Operation can destroy data in the selected cells.
Continue?', textWarning : 'Warning', diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 4b871de62..0cc1fe7b9 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -153,6 +153,7 @@ +
diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js new file mode 100644 index 000000000..a38da1735 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -0,0 +1,291 @@ +/* + * + * (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 + * + */ + +/** + * PrintTitlesDialog.js + * + * Created by Julia Radzhabova on 17.03.2020 + * Copyright (c) 2020 Ascensio System SIA. All rights reserved. + * + */ +define([ + 'common/main/lib/component/Window', + 'common/main/lib/component/MetricSpinner' +], function () { 'use strict'; + + SSE.Views.PrintTitlesDialog = Common.UI.Window.extend(_.extend({ + options: { + width: 300, + header: true, + style: 'min-width: 216px;', + cls: 'modal-dlg', + id: 'window-page-margins', + 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.api = this.options.api; + Common.UI.Window.prototype.initialize.call(this, this.options); + this.dataRangeTop = ''; + this.dataRangeLeft = ''; + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + var me = this; + this.menuAddAlign = function(menuRoot, left, top) { + var self = this; + if (!$window.hasClass('notransform')) { + $window.addClass('notransform'); + menuRoot.addClass('hidden'); + setTimeout(function() { + menuRoot.removeClass('hidden'); + menuRoot.css({left: left, top: top}); + self.options.additionalAlign = null; + }, 300); + } else { + menuRoot.css({left: left, top: top}); + self.options.additionalAlign = null; + } + }; + + this.txtRangeTop = new Common.UI.InputField({ + el : $('#print-titles-txt-top'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true, + validation : function(value) { + if (_.isEmpty(value)) { + return true; + } + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + } + }); + + this.btnPresetsTop = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: new Common.UI.Menu({ + style: 'min-width: 100px;', + maxHeight: 200, + additionalAlign: this.menuAddAlign, + items: [ + {caption: this.textSelectRange, value: 'select'}, + {caption: this.textFrozenRows, value: Asc.c_oAscHeaderFooterField.pageCount}, + {caption: this.textFirstRow, value: Asc.c_oAscHeaderFooterField.date}, + {caption: '--'}, + {caption: this.textNoRepeat, value: 'empty'} + ] + }) + }); + this.btnPresetsTop.render( $('#print-titles-presets-top')) ; + this.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, 'top')); + + this.txtRangeLeft = new Common.UI.InputField({ + el : $('#print-titles-txt-left'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true, + validation : function(value) { + if (_.isEmpty(value)) { + return true; + } + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + } + }); + + this.btnPresetsLeft = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: new Common.UI.Menu({ + style: 'min-width: 100px;', + maxHeight: 200, + additionalAlign: this.menuAddAlign, + items: [ + {caption: this.textSelectRange, value: 'select'}, + {caption: this.textFrozenCols, value: Asc.c_oAscHeaderFooterField.pageCount}, + {caption: this.textFirstCol, value: Asc.c_oAscHeaderFooterField.date}, + {caption: '--'}, + {caption: this.textNoRepeat, value: 'empty'} + ] + }) + }); + this.btnPresetsLeft.render( $('#print-titles-presets-left')) ; + this.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, 'left')); + + var $window = this.getChild(); + $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); + }, + + _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); + }, + + onKeyPress: function(event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + this._handleInput('ok'); + } + }, + + setSettings: function (props) { + if (props) { + // var value = props.asc_getPrintTitlesWidth(); + // this.txtRangeTop.setValue((value) ? value : ''); + // this.dataRangeTop = value; + // + // value = props.asc_getPrintTitlesHeight(); + // this.txtRangeLeft.setValue((value) ? value : ''); + // this.dataRangeLeft = value; + } + }, + + getSettings: function() { + var props = new Asc.asc_CPageOptions(); + props.asc_setPrintTitlesWidth(this.txtRangeTop.getValue()); + props.asc_setPrintTitlesHeight(this.txtRangeLeft.getValue()); + return props; + }, + + onPresetSelect: function(type, menu, item) { + var txtRange = (type=='top') ? this.txtRangeTop : this.txtRangeLeft, + dataRangeValid = (type=='top') ? this.dataRangeTop : this.dataRangeLeft; + if (type=='top') { + + } else { + + } + if (item.value == 'select') { + var me = this; + if (me.api) { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var valid = dlg.getSettings(); + if (type=='top') + me.dataRangeTop = valid; + else + me.dataRangeLeft = valid; + txtRange.setValue(valid); + txtRange.checkValidate(); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : dataRangeValid, + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + } else if (item.value == 'empty') { + txtRange.setValue(''); + if (type=='top') + this.dataRangeTop = ''; + else + this.dataRangeLeft = ''; + } + }, + + textTitle: 'Print Titles', + textTop: 'Repeat rows at top', + textLeft: 'Repeat columns at left', + textRepeat: 'Repeat...', + textNoRepeat: 'Not repeat', + textSelectRange: 'Select range...', + textFrozenRows: 'Frozen rows', + textFrozenCols: 'Frozen columns', + textFirstRow: 'First row', + textFirstCol: 'First column', + textInvalidRange: 'ERROR! Invalid cells range' + + }, SSE.Views.PrintTitlesDialog || {})) +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index e4a9fd5e6..349857648 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1338,6 +1338,14 @@ define([ me.mnuScale = me.btnScale.menu; me.mnuScale.on('show:after', _.bind(me.onAfterShowMenuScale, me)); + me.btnPrintTitles = new Common.UI.Button({ + id: 'tlbtn-printtitles', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-printtitles', + caption: me.capBtnPrintTitles, + lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth] + }); + me.btnImgAlign = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-img-align', @@ -1393,7 +1401,7 @@ define([ me.btnInsertChart, me.btnColorSchemas, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint, /*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle, - me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnPrintArea, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup, me.btnScale + me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnPrintArea, me.btnPrintTitles, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup, me.btnScale ]; _.each(me.lockControls.concat([me.btnSave]), function(cmp) { @@ -1588,6 +1596,7 @@ define([ _injectComponent('#slot-btn-pagemargins', this.btnPageMargins); _injectComponent('#slot-btn-pagesize', this.btnPageSize); _injectComponent('#slot-btn-printarea', this.btnPrintArea); + _injectComponent('#slot-btn-printtitles', this.btnPrintTitles); _injectComponent('#slot-img-align', this.btnImgAlign); _injectComponent('#slot-img-group', this.btnImgGroup); _injectComponent('#slot-img-movefrwd', this.btnImgForward); @@ -1664,6 +1673,7 @@ define([ _updateHint(this.btnPageSize, this.tipPageSize); _updateHint(this.btnPageMargins, this.tipPageMargins); _updateHint(this.btnPrintArea, this.tipPrintArea); + _updateHint(this.btnPrintTitles, this.tipPrintTitles); _updateHint(this.btnScale, this.tipScale); this.btnsEditHeader.forEach(function (btn) { _updateHint(btn, me.tipEditHeader); @@ -2381,6 +2391,8 @@ define([ capBtnAddComment: 'Add Comment', capBtnInsSymbol: 'Symbol', tipInsertSymbol: 'Insert symbol', - txtAutosumTip: 'Summation' + txtAutosumTip: 'Summation', + capBtnPrintTitles: 'Print Titles', + tipPrintTitles: 'Print titles' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file From 42ccd216305b56154ed3f7fc74d2fb0850e8b2f5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Mar 2020 15:24:23 +0300 Subject: [PATCH 02/11] [SSE] Fix printing tities --- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 3840c907c..adc795ea5 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3464,7 +3464,7 @@ define([ handler: function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); - me.api.asc_changePrintTitles(props); + me.api.asc_changePrintTitles(props.width, props.height, me.api.asc_getActiveWorksheetIndex()); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } } diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index a38da1735..db0b714bd 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -222,10 +222,7 @@ define([ }, getSettings: function() { - var props = new Asc.asc_CPageOptions(); - props.asc_setPrintTitlesWidth(this.txtRangeTop.getValue()); - props.asc_setPrintTitlesHeight(this.txtRangeLeft.getValue()); - return props; + return {width: this.txtRangeTop.getValue(), height: this.txtRangeLeft.getValue()}; }, onPresetSelect: function(type, menu, item) { From c7f6ede2a4f71b8570335763e919aa928c4a5397 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Mar 2020 15:37:59 +0300 Subject: [PATCH 03/11] [SSE] Print titles: fix presets --- .../main/app/view/PrintTitlesDialog.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index db0b714bd..d1d0001c2 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -143,8 +143,8 @@ define([ additionalAlign: this.menuAddAlign, items: [ {caption: this.textSelectRange, value: 'select'}, - {caption: this.textFrozenRows, value: Asc.c_oAscHeaderFooterField.pageCount}, - {caption: this.textFirstRow, value: Asc.c_oAscHeaderFooterField.date}, + {caption: this.textFrozenRows, value: 'frozen'}, + {caption: this.textFirstRow, value: 'first'}, {caption: '--'}, {caption: this.textNoRepeat, value: 'empty'} ] @@ -177,8 +177,8 @@ define([ additionalAlign: this.menuAddAlign, items: [ {caption: this.textSelectRange, value: 'select'}, - {caption: this.textFrozenCols, value: Asc.c_oAscHeaderFooterField.pageCount}, - {caption: this.textFirstCol, value: Asc.c_oAscHeaderFooterField.date}, + {caption: this.textFrozenCols, value: 'frozen'}, + {caption: this.textFirstCol, value: 'first'}, {caption: '--'}, {caption: this.textNoRepeat, value: 'empty'} ] @@ -226,13 +226,7 @@ define([ }, onPresetSelect: function(type, menu, item) { - var txtRange = (type=='top') ? this.txtRangeTop : this.txtRangeLeft, - dataRangeValid = (type=='top') ? this.dataRangeTop : this.dataRangeLeft; - if (type=='top') { - - } else { - - } + var txtRange = (type=='top') ? this.txtRangeTop : this.txtRangeLeft; if (item.value == 'select') { var me = this; if (me.api) { @@ -259,16 +253,22 @@ define([ win.show(xy.left + 160, xy.top + 125); win.setSettings({ api : me.api, - range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : dataRangeValid, + range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft), type : Asc.c_oAscSelectionDialogType.Chart }); } - } else if (item.value == 'empty') { - txtRange.setValue(''); + } else { + var value = ''; + if (item.value == 'frozen') + value = this.api.asc_getFrozen(type=='top'); + else if (item.value == 'first') + value = this.api.asc_getFirst(type=='top'); + txtRange.setValue(value); + txtRange.checkValidate(); if (type=='top') - this.dataRangeTop = ''; + this.dataRangeTop = value; else - this.dataRangeLeft = ''; + this.dataRangeLeft = value; } }, From a882b4530cbbcc7d10b68316b8d1611cd6143413 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Mar 2020 17:55:37 +0300 Subject: [PATCH 04/11] [SSE] Add "Print titles" option to print dialog and page options --- .../main/app/controller/Print.js | 112 +++++++++++++++++- .../main/app/template/PrintSettings.template | 18 +++ .../main/app/view/FileMenuPanels.js | 57 ++++++++- .../main/app/view/PrintSettings.js | 41 ++++++- 4 files changed, 223 insertions(+), 5 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 532047783..d4d40886a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -72,6 +72,7 @@ define([ onAfterRender: function(view) { this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings)); this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this)); + this.fillComponents(this.printSettings); this.registerControlEvents(this.printSettings); }, @@ -157,6 +158,14 @@ define([ panel.chPrintGrid.setValue(props.asc_getGridLines(), true); panel.chPrintRows.setValue(props.asc_getHeadings(), true); + + // var value = props.asc_getPrintTitlesWidth(); + // panel.txtRangeTop.setValue((value) ? value : ''); + // panel.dataRangeTop = value; + // + // value = props.asc_getPrintTitlesHeight(); + // panel.txtRangeLeft.setValue((value) ? value : ''); + // panel.dataRangeLeft = value; }, fillPrintOptions: function(props) { @@ -214,6 +223,9 @@ define([ props.asc_setPageMargins(opt); + props.asc_setPrintTitlesWidth(panel.txtRangeTop.getValue()); + props.asc_setPrintTitlesHeight(panel.txtRangeLeft.getValue()); + return props; }, @@ -253,6 +265,7 @@ define([ this._changedProps = []; this.updateSettings(this.printSettingsDlg); this.printSettingsDlg.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettingsDlg)); + this.fillComponents(this.printSettingsDlg, true); this.fillPrintOptions(this.adjPrintParams); this.registerControlEvents(this.printSettingsDlg); },this) @@ -353,6 +366,8 @@ define([ panel.spnMarginRight.on('change', _.bind(this.propertyChange, this, panel)); panel.chPrintGrid.on('change', _.bind(this.propertyChange, this, panel)); panel.chPrintRows.on('change', _.bind(this.propertyChange, this, panel)); + panel.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'top')); + panel.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'left')); }, propertyChange: function(panel, scale, combo, record) { @@ -407,9 +422,104 @@ define([ panel.cmbLayout.setValue(value, true); }, + fillComponents: function(panel, selectdata) { + var me = this; + panel.txtRangeTop.validation = function(value) { + if (_.isEmpty(value)) { + return true; + } + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + }; + panel.txtRangeLeft.validation = function(value) { + if (_.isEmpty(value)) { + return true; + } + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; + }; + var data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([ + {caption: this.textFrozenRows, value: 'frozen'}, + {caption: this.textFirstRow, value: 'first'}, + {caption: '--'}, + {caption: this.textNoRepeat, value: 'empty'} + ]); + panel.btnPresetsTop.setMenu(new Common.UI.Menu({ + style: 'min-width: 100px;', + maxHeight: 200, + items: data + })); + data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([ + {caption: this.textFrozenCols, value: 'frozen'}, + {caption: this.textFirstCol, value: 'first'}, + {caption: '--'}, + {caption: this.textNoRepeat, value: 'empty'} + ]); + panel.btnPresetsLeft.setMenu(new Common.UI.Menu({ + style: 'min-width: 100px;', + maxHeight: 200, + items: data + })); + }, + + onPresetSelect: function(panel, type, menu, item) { + var txtRange = (type=='top') ? panel.txtRangeTop : panel.txtRangeLeft; + if (item.value == 'select') { + var me = this; + if (me.api) { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var valid = dlg.getSettings(); + if (type=='top') + panel.dataRangeTop = valid; + else + panel.dataRangeLeft = valid; + txtRange.setValue(valid); + txtRange.checkValidate(); + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + panel.show(); + }); + + var xy = panel.$window.offset(); + panel.hide(); + win.show(xy.left + 160, xy.top + 125); + win.setSettings({ + api : me.api, + range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft), + type : Asc.c_oAscSelectionDialogType.Chart + }); + } + } else { + var value = ''; + if (item.value == 'frozen') + value = this.api.asc_getFrozen(type=='top'); + else if (item.value == 'first') + value = this.api.asc_getFirst(type=='top'); + txtRange.setValue(value); + txtRange.checkValidate(); + if (type=='top') + panel.dataRangeTop = value; + else + panel.dataRangeLeft = value; + } + }, + warnCheckMargings: 'Margins are incorrect', strAllSheets: 'All Sheets', textWarning: 'Warning', - txtCustom: 'Custom' + txtCustom: 'Custom', + textInvalidRange: 'ERROR! Invalid cells range', + textRepeat: 'Repeat...', + textNoRepeat: 'Not repeat', + textSelectRange: 'Select range...', + textFrozenRows: 'Frozen rows', + textFrozenCols: 'Frozen columns', + textFirstRow: 'First row', + textFirstCol: 'First column' }, SSE.Controllers.Print || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/template/PrintSettings.template b/apps/spreadsheeteditor/main/app/template/PrintSettings.template index fb527a994..370f4af71 100644 --- a/apps/spreadsheeteditor/main/app/template/PrintSettings.template +++ b/apps/spreadsheeteditor/main/app/template/PrintSettings.template @@ -17,6 +17,24 @@
+
+ + + + + + + + + + + + + + + +
+
diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index d5060d933..f7cdbfcb9 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -273,6 +273,27 @@ define([ '', '', '','', + '', + '', + '', + '','', '', '', '','', '', '', - '', @@ -466,7 +466,7 @@ define([ this.txtRangeTop = new Common.UI.InputField({ el : $markup.findById('#advsettings-txt-top'), - style : 'width: 100%;', + style : 'width: 147px', allowBlank : true, validateOnChange: true }); @@ -474,14 +474,14 @@ define([ this.btnPresetsTop = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, - style: 'width: 95px;', + style: 'width: 85px;', menu: true }); this.btnPresetsTop.render( $markup.findById('#advsettings-presets-top')) ; this.txtRangeLeft = new Common.UI.InputField({ el : $markup.findById('#advsettings-txt-left'), - style : 'width: 100%;', + style : 'width: 147px', allowBlank : true, validateOnChange: true }); @@ -489,7 +489,7 @@ define([ this.btnPresetsLeft = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, - style: 'width: 95px;', + style: 'width: 85px;', menu: true }); this.btnPresetsLeft.render( $markup.findById('#advsettings-presets-left')) ; diff --git a/apps/spreadsheeteditor/main/app/view/PrintSettings.js b/apps/spreadsheeteditor/main/app/view/PrintSettings.js index 01b73bbd2..dcc094692 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PrintSettings.js @@ -231,7 +231,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', this.txtRangeTop = new Common.UI.InputField({ el : $('#printadv-dlg-txt-top'), - style : 'width: 100%;', + style : 'width: 147px;', allowBlank : true, validateOnChange: true }); @@ -239,14 +239,14 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', this.btnPresetsTop = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, - style: 'width: 95px;', + style: 'width: 85px;', menu: true }); this.btnPresetsTop.render( $('#printadv-dlg-presets-top')) ; this.txtRangeLeft = new Common.UI.InputField({ el : $('#printadv-dlg-txt-left'), - style : 'width: 100%;', + style : 'width: 147px;', allowBlank : true, validateOnChange: true }); @@ -254,7 +254,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', this.btnPresetsLeft = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, - style: 'width: 95px;', + style: 'width: 85px;', menu: true }); this.btnPresetsLeft.render( $('#printadv-dlg-presets-left')) ; diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index ccc5034f9..d779139f3 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -134,6 +134,7 @@ define([ } }); + var frozen = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, false, this.sheet); this.btnPresetsTop = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, @@ -144,10 +145,10 @@ define([ additionalAlign: this.menuAddAlign, items: [ {caption: this.textSelectRange, value: 'select'}, - {caption: this.textFrozenRows, value: 'frozen'}, - {caption: this.textFirstRow, value: 'first'}, + {caption: this.textFrozenRows, value: 'frozen', range: frozen, disabled: !frozen}, + {caption: this.textFirstRow, value: 'first', range: this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, false, this.sheet)}, {caption: '--'}, - {caption: this.textNoRepeat, value: 'empty'} + {caption: this.textNoRepeat, value: 'empty', range: ''} ] }) }); @@ -168,6 +169,7 @@ define([ } }); + frozen = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, this.sheet); this.btnPresetsLeft = new Common.UI.Button({ cls: 'btn-text-menu-default', caption: this.textRepeat, @@ -178,10 +180,10 @@ define([ additionalAlign: this.menuAddAlign, items: [ {caption: this.textSelectRange, value: 'select'}, - {caption: this.textFrozenCols, value: 'frozen'}, - {caption: this.textFirstCol, value: 'first'}, + {caption: this.textFrozenCols, value: 'frozen', range: frozen, disabled: !frozen}, + {caption: this.textFirstCol, value: 'first', range: this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, true, this.sheet)}, {caption: '--'}, - {caption: this.textNoRepeat, value: 'empty'} + {caption: this.textNoRepeat, value: 'empty', range: ''} ] }) }); @@ -195,9 +197,26 @@ define([ this.setSettings(); }, + isRangeValid: function() { + if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { + this.txtRangeTop.cmpEl.find('input').focus(); + return false; + } + if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeLeft.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { + this.txtRangeLeft.cmpEl.find('input').focus(); + return false; + } + return true; + }, + _handleInput: function(state) { - if (this.options.handler) + if (this.options.handler) { + if (state == 'ok') { + if (!this.isRangeValid()) + return; + } this.options.handler.call(this, this, state); + } this.close(); }, @@ -257,15 +276,11 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.None + type : Asc.c_oAscSelectionDialogType.Chart }); } } else { - var value = ''; - if (item.value == 'frozen') - value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, type=='left', this.sheet); - else if (item.value == 'first') - value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, type=='left', this.sheet); + var value = item.options.range || ''; txtRange.setValue(value); txtRange.checkValidate(); if (type=='top') From 2f2d38d22adf9fa6ab7406fee25a766cd8f907a2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Mar 2020 15:09:39 +0300 Subject: [PATCH 08/11] [SSE] Fix print titles --- .../main/app/controller/Print.js | 22 +++++++++---------- .../main/app/view/PrintTitlesDialog.js | 12 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index ac0876c32..0c2bdca51 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -111,7 +111,7 @@ define([ }, comboSheetsChange: function(panel, combo, record) { - this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value), record.value); + this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value, true), record.value); }, fillPageOptions: function(panel, props, sheet) { @@ -159,12 +159,12 @@ define([ panel.chPrintGrid.setValue(props.asc_getGridLines(), true); panel.chPrintRows.setValue(props.asc_getHeadings(), true); - var value = props.asc_getPrintTitlesWidth(); + var value = props.asc_getPrintTitlesHeight(); panel.txtRangeTop.setValue((value) ? value : ''); panel.txtRangeTop.checkValidate(); panel.dataRangeTop = value; - value = props.asc_getPrintTitlesHeight(); + value = props.asc_getPrintTitlesWidth(); panel.txtRangeLeft.setValue((value) ? value : ''); panel.txtRangeLeft.checkValidate(); panel.dataRangeLeft = value; @@ -228,11 +228,11 @@ define([ props.asc_setPageMargins(opt); - var check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeTop.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; - props.asc_setPrintTitlesWidth(check ? panel.txtRangeTop.getValue() : panel.dataRangeTop); + var check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, panel.txtRangeTop.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; + props.asc_setPrintTitlesHeight(check ? panel.txtRangeTop.getValue() : panel.dataRangeTop); - check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeLeft.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; - props.asc_setPrintTitlesHeight(check ? panel.txtRangeLeft.getValue() : panel.dataRangeLeft); + check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, panel.txtRangeLeft.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; + props.asc_setPrintTitlesWidth(check ? panel.txtRangeLeft.getValue() : panel.dataRangeLeft); return props; }, @@ -383,7 +383,7 @@ define([ propertyChange: function(panel, scale, combo, record) { if (scale === 'scale' && record.value === 'customoptions') { var me = this, - props = (me._changedProps.length > 0 && me._changedProps[panel.cmbSheet.getValue()]) ? me._changedProps[panel.cmbSheet.getValue()] : me.api.asc_getPageOptions(panel.cmbSheet.getValue()); + props = (me._changedProps.length > 0 && me._changedProps[panel.cmbSheet.getValue()]) ? me._changedProps[panel.cmbSheet.getValue()] : me.api.asc_getPageOptions(panel.cmbSheet.getValue(), true); var win = new SSE.Views.ScaleDialog({ api: me.api, props: props, @@ -439,7 +439,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; panel.txtRangeLeft.validation = function(value) { @@ -447,7 +447,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; var data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([ @@ -503,7 +503,7 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.PrintTitles }); } } else { diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index d779139f3..3bc77a06e 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -129,7 +129,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; } }); @@ -164,7 +164,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; } }); @@ -198,11 +198,11 @@ define([ }, isRangeValid: function() { - if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { + if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { this.txtRangeTop.cmpEl.find('input').focus(); return false; } - if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeLeft.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { + if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.PrintTitles, this.txtRangeLeft.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) { this.txtRangeLeft.cmpEl.find('input').focus(); return false; } @@ -244,7 +244,7 @@ define([ }, getSettings: function() { - return {width: this.txtRangeTop.getValue(), height: this.txtRangeLeft.getValue()}; + return {width: this.txtRangeLeft.getValue(), height: this.txtRangeTop.getValue()}; }, onPresetSelect: function(type, menu, item) { @@ -276,7 +276,7 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.PrintTitles }); } } else { From 7fe3294a8ff2fdf3cdab268334a7b63d111a0758 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 19 Mar 2020 11:48:19 +0300 Subject: [PATCH 09/11] [SSE] Add toolbar icons --- apps/spreadsheeteditor/main/app/view/Toolbar.js | 2 +- .../img/toolbar/1.5x/big/btn-print-titles.png | Bin 0 -> 198 bytes .../img/toolbar/1x/big/btn-print-titles.png | Bin 0 -> 180 bytes .../img/toolbar/2x/big/btn-print-titles.png | Bin 0 -> 213 bytes 4 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-print-titles.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-print-titles.png create mode 100644 apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-print-titles.png diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 349857648..eccc8ae5d 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1341,7 +1341,7 @@ define([ me.btnPrintTitles = new Common.UI.Button({ id: 'tlbtn-printtitles', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-printtitles', + iconCls: 'toolbar__icon btn-print-titles', caption: me.capBtnPrintTitles, lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth] }); diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-print-titles.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1.5x/big/btn-print-titles.png new file mode 100644 index 0000000000000000000000000000000000000000..f55a2bb28824f4b8b3d8e4867d4e0f4bd3ce4e34 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^AwaCf!2%@Py|(-YQoWuojv*C{Z>KS`IXm*W6mP%3 z`N=qC zr5E3KDypy{@g@Ize%b2+lt36D=6mD@CcWD?~0UdMi=%m70t!U$YKsJM?tDnm{r-UW|qM1!M literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-print-titles.png b/apps/spreadsheeteditor/main/resources/img/toolbar/1x/big/btn-print-titles.png new file mode 100644 index 0000000000000000000000000000000000000000..c214f956bbb8feb2c3552ea7707db36570ca0464 GIT binary patch literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^7Cj_zCd`UxLaam8feydFsXWIyyg+Esr1TKsuUmWNMl>5+YT!!lkp0#o8|pP){i`lp fxkdYK{90k%=H+qMtP|^i&S3C#^>bP0l+XkKt|LU! literal 0 HcmV?d00001 diff --git a/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-print-titles.png b/apps/spreadsheeteditor/main/resources/img/toolbar/2x/big/btn-print-titles.png new file mode 100644 index 0000000000000000000000000000000000000000..5159a69f6ff7f3148f679b30743ebf526caa794e GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^1wd@U!VDy@A5E+TQv3lvA+A8$+1dI3|Nky7EgTe~ HDWM4fPsC2n literal 0 HcmV?d00001 From e84e07ef0b9467cec6bc6127df95de5a7152dd23 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 19 Mar 2020 12:15:45 +0300 Subject: [PATCH 10/11] [SSE] Print titles: select range only in the active sheet --- apps/spreadsheeteditor/main/app/controller/Print.js | 4 ++++ apps/spreadsheeteditor/main/app/controller/Statusbar.js | 7 ++++--- apps/spreadsheeteditor/main/app/view/Statusbar.js | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 0c2bdca51..d5b06d30e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -169,6 +169,10 @@ define([ panel.txtRangeLeft.checkValidate(); panel.dataRangeLeft = value; + value = (this.api.asc_getActiveWorksheetIndex()==sheet); + (panel.btnPresetsTop.menu.items[0].value == 'select') && panel.btnPresetsTop.menu.items[0].setVisible(value); + (panel.btnPresetsLeft.menu.items[0].value == 'select') && panel.btnPresetsLeft.menu.items[0].setVisible(value); + panel.btnPresetsTop.menu.items[panel.btnPresetsTop.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, false, sheet)); panel.btnPresetsLeft.menu.items[panel.btnPresetsLeft.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, sheet)); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index 0b62d0794..62b0a622d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -150,7 +150,8 @@ define([ onWorkbookLocked: function(locked) { this.statusbar.tabbar[locked?'addClass':'removeClass']('coauth-locked'); this.statusbar.btnAddWorksheet.setDisabled(locked || this.api.isCellEdited || this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.Chart || - this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable); + this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable|| + this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.PrintTitles); var item, i = this.statusbar.tabbar.getCount(); while (i-- > 0) { item = this.statusbar.tabbar.getAt(i); @@ -170,7 +171,7 @@ define([ tab = this.statusbar.tabbar.getAt(i); if (index == tab.sheetindex) { tab[locked?'addClass':'removeClass']('coauth-locked'); - tab.isLockTheDrag = locked || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable); + tab.isLockTheDrag = locked || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable) || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.PrintTitles); tab.$el.children(':first-child').attr('draggable', tab.isLockTheDrag?'false':'true'); break; } @@ -241,7 +242,7 @@ define([ while (i-- > 0) { item = this.statusbar.tabbar.getAt(i); if (item.sheetindex !== currentIdx) { - item.disable(mode==Asc.c_oAscSelectionDialogType.FormatTable); + item.disable(mode==Asc.c_oAscSelectionDialogType.FormatTable || mode==Asc.c_oAscSelectionDialogType.PrintTitles); } item.isLockTheDrag = (item.hasClass('coauth-locked') || (mode!=Asc.c_oAscSelectionDialogType.None)); } diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index 173d6def2..db0460ba6 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -179,7 +179,8 @@ define([ 'tab:contextmenu' : _.bind(this.onTabMenu, this), 'tab:dblclick' : _.bind(function () { if (me.editMode && (me.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) && - (me.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable)) { + (me.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable)&& + (me.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.PrintTitles)) { me.fireEvent('sheet:changename'); } }, this), @@ -509,6 +510,7 @@ define([ var me = this; if (this.mode.isEdit && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) && + (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.PrintTitles) && !this.mode.isDisconnected ) { if (tab && tab.sheetindex >= 0) { var rect = tab.$el.get(0).getBoundingClientRect(), From bce01f5e0e8c99b91c3ed1a40a039d92c5c01a12 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 19 Mar 2020 15:25:41 +0300 Subject: [PATCH 11/11] [SSE] Update translation --- apps/spreadsheeteditor/main/locale/en.json | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 41bcb1048..538d15d9d 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -789,6 +789,14 @@ "SSE.Controllers.Print.textWarning": "Warning", "SSE.Controllers.Print.txtCustom": "Custom", "SSE.Controllers.Print.warnCheckMargings": "Margins are incorrect", + "SSE.Controllers.Print.textInvalidRange": "ERROR! Invalid cells range", + "SSE.Controllers.Print.textRepeat": "Repeat...", + "SSE.Controllers.Print.textNoRepeat": "Not repeat", + "SSE.Controllers.Print.textSelectRange": "Select range...", + "SSE.Controllers.Print.textFrozenRows": "Frozen rows", + "SSE.Controllers.Print.textFrozenCols": "Frozen columns", + "SSE.Controllers.Print.textFirstRow": "First row", + "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Statusbar.errorLastSheet": "Workbook must have at least one visible worksheet.", "SSE.Controllers.Statusbar.errorRemoveSheet": "Cannot delete the worksheet.", "SSE.Controllers.Statusbar.strSheet": "Sheet", @@ -1829,6 +1837,10 @@ "SSE.Views.MainSettingsPrint.textPrintGrid": "Print Gridlines", "SSE.Views.MainSettingsPrint.textPrintHeadings": "Print Row and Column Headings", "SSE.Views.MainSettingsPrint.textSettings": "Settings for", + "SSE.Views.MainSettingsPrint.strPrintTitles": "Print Titles", + "SSE.Views.MainSettingsPrint.textRepeatTop": "Repeat rows at top", + "SSE.Views.MainSettingsPrint.textRepeatLeft": "Repeat columns at left", + "SSE.Views.MainSettingsPrint.textRepeat": "Repeat...", "SSE.Views.NamedRangeEditDlg.errorCreateDefName": "The existing named ranges cannot be edited and the new ones cannot be created
at the moment as some of them are being edited.", "SSE.Views.NamedRangeEditDlg.namePlaceholder": "Defined name", "SSE.Views.NamedRangeEditDlg.notcriticalErrorTitle": "Warning", @@ -2028,6 +2040,21 @@ "SSE.Views.PrintSettings.textShowHeadings": "Show Rows and Columns Headings", "SSE.Views.PrintSettings.textTitle": "Print Settings", "SSE.Views.PrintSettings.textTitlePDF": "PDF Settings", + "SSE.Views.PrintSettings.strPrintTitles": "Print Titles", + "SSE.Views.PrintSettings.textRepeatTop": "Repeat rows at top", + "SSE.Views.PrintSettings.textRepeatLeft": "Repeat columns at left", + "SSE.Views.PrintSettings.textRepeat": "Repeat...", + "SSE.Views.PrintTitlesDialog.textTitle": "Print Titles", + "SSE.Views.PrintTitlesDialog.textTop": "Repeat rows at top", + "SSE.Views.PrintTitlesDialog.textLeft": "Repeat columns at left", + "SSE.Views.PrintTitlesDialog.textRepeat": "Repeat...", + "SSE.Views.PrintTitlesDialog.textNoRepeat": "Not repeat", + "SSE.Views.PrintTitlesDialog.textSelectRange": "Select range...", + "SSE.Views.PrintTitlesDialog.textFrozenRows": "Frozen rows", + "SSE.Views.PrintTitlesDialog.textFrozenCols": "Frozen columns", + "SSE.Views.PrintTitlesDialog.textFirstRow": "First row", + "SSE.Views.PrintTitlesDialog.textFirstCol": "First column", + "SSE.Views.PrintTitlesDialog.textInvalidRange": "ERROR! Invalid cells range", "SSE.Views.RightMenu.txtCellSettings": "Cell settings", "SSE.Views.RightMenu.txtChartSettings": "Chart settings", "SSE.Views.RightMenu.txtImageSettings": "Image settings",
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '
', @@ -443,6 +464,36 @@ define([ }); this.spinners.push(this.spnMarginRight); + this.txtRangeTop = new Common.UI.InputField({ + el : $markup.findById('#advsettings-txt-top'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true + }); + + this.btnPresetsTop = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: true + }); + this.btnPresetsTop.render( $markup.findById('#advsettings-presets-top')) ; + + this.txtRangeLeft = new Common.UI.InputField({ + el : $markup.findById('#advsettings-txt-left'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true + }); + + this.btnPresetsLeft = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: true + }); + this.btnPresetsLeft.render( $markup.findById('#advsettings-presets-left')) ; + this.btnOk = new Common.UI.Button({ el: $markup.findById('#advsettings-print-button-save') }); @@ -539,7 +590,11 @@ define([ textFitCols: 'Fit All Columns on One Page', textFitRows: 'Fit All Rows on One Page', textCustomOptions: 'Custom Options', - textCustom: 'Custom' + textCustom: 'Custom', + strPrintTitles: 'Print Titles', + textRepeatTop: 'Repeat rows at top', + textRepeatLeft: 'Repeat columns at left', + textRepeat: 'Repeat...' }, SSE.Views.MainSettingsPrint || {})); SSE.Views.FileMenuPanels.MainSettingsGeneral = Common.UI.BaseView.extend(_.extend({ diff --git a/apps/spreadsheeteditor/main/app/view/PrintSettings.js b/apps/spreadsheeteditor/main/app/view/PrintSettings.js index cc635dece..01b73bbd2 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PrintSettings.js @@ -51,7 +51,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', options: { alias: 'PrintSettings', contentWidth: 280, - height: 475, + height: 575, buttons: null }, @@ -67,6 +67,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', '
' + this.textPageSize + '
', '
' + this.textPageOrientation + '
', '
' + this.textPageScaling + '
', + '
' + this.strPrintTitles + '
', '
' + this.strMargins + '
', '
' + ((this.type == 'print') ? this.strPrint : this.strShow) + '
', '
', @@ -228,6 +229,36 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', itemsTemplate: itemsTemplate }); + this.txtRangeTop = new Common.UI.InputField({ + el : $('#printadv-dlg-txt-top'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true + }); + + this.btnPresetsTop = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: true + }); + this.btnPresetsTop.render( $('#printadv-dlg-presets-top')) ; + + this.txtRangeLeft = new Common.UI.InputField({ + el : $('#printadv-dlg-txt-left'), + style : 'width: 100%;', + allowBlank : true, + validateOnChange: true + }); + + this.btnPresetsLeft = new Common.UI.Button({ + cls: 'btn-text-menu-default', + caption: this.textRepeat, + style: 'width: 95px;', + menu: true + }); + this.btnPresetsLeft.render( $('#printadv-dlg-presets-left')) ; + this.btnHide = new Common.UI.Button({ el: $('#printadv-dlg-btn-hide') }); @@ -314,7 +345,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', } else { this.extended = false; this.panelDetails.css({'display': 'block'}); - this.setHeight(475); + this.setHeight(585); btn.setCaption(this.textHideDetails); Common.localStorage.setItem("sse-hide-print-settings", 0); } @@ -355,7 +386,11 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', textRange: 'Range', textIgnore: 'Ignore Print Area', textCustomOptions: 'Custom Options', - textCustom: 'Custom' + textCustom: 'Custom', + strPrintTitles: 'Print Titles', + textRepeatTop: 'Repeat rows at top', + textRepeatLeft: 'Repeat columns at left', + textRepeat: 'Repeat...' }, SSE.Views.PrintSettings || {})); }); \ No newline at end of file From 0ef9620d9b47116bd4d1c0418baf623180024b9e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Mar 2020 18:03:42 +0300 Subject: [PATCH 05/11] [SSE] Fix print titles --- apps/spreadsheeteditor/main/app/controller/Print.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 1 + apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index d4d40886a..3fd6012ca 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -497,9 +497,9 @@ define([ } else { var value = ''; if (item.value == 'frozen') - value = this.api.asc_getFrozen(type=='top'); + value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, type=='left', panel.cmbSheet.getValue()); else if (item.value == 'first') - value = this.api.asc_getFirst(type=='top'); + value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, type=='left', panel.cmbSheet.getValue()); txtRange.setValue(value); txtRange.checkValidate(); if (type=='top') diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index adc795ea5..d9233389d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3461,6 +3461,7 @@ define([ me = this; win = new SSE.Views.PrintTitlesDialog({ api: me.api, + sheet: me.api.asc_getActiveWorksheetIndex(), handler: function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index d1d0001c2..c9e61df6e 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -94,6 +94,7 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; + this.sheet = this.options.sheet; Common.UI.Window.prototype.initialize.call(this, this.options); this.dataRangeTop = ''; this.dataRangeLeft = ''; @@ -260,9 +261,9 @@ define([ } else { var value = ''; if (item.value == 'frozen') - value = this.api.asc_getFrozen(type=='top'); + value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, type=='left', this.sheet); else if (item.value == 'first') - value = this.api.asc_getFirst(type=='top'); + value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, type=='left', this.sheet); txtRange.setValue(value); txtRange.checkValidate(); if (type=='top') From e5c35c772e9fb6add0a449b313d8a3c607124757 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Mar 2020 10:08:47 +0300 Subject: [PATCH 06/11] [SSE] Fix print titles --- .../main/app/controller/Print.js | 6 ++--- .../main/app/controller/Toolbar.js | 1 - .../main/app/view/PrintTitlesDialog.js | 24 ++++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 3fd6012ca..3a3231343 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -428,14 +428,14 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; panel.txtRangeLeft.validation = function(value) { if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; var data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([ @@ -491,7 +491,7 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.None }); } } else { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index d9233389d..87b54ceb2 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3471,7 +3471,6 @@ define([ } }); win.show(); - win.setSettings(me.api.asc_getPageOptions(me.api.asc_getActiveWorksheetIndex())); Common.component.Analytics.trackEvent('ToolBar', 'Print Titles'); } diff --git a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js index c9e61df6e..ccc5034f9 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PrintTitlesDialog.js @@ -129,7 +129,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; } }); @@ -163,7 +163,7 @@ define([ if (_.isEmpty(value)) { return true; } - var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false); + var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, value, false); return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; } }); @@ -191,6 +191,8 @@ define([ var $window = this.getChild(); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); + + this.setSettings(); }, _handleInput: function(state) { @@ -211,14 +213,14 @@ define([ }, setSettings: function (props) { - if (props) { - // var value = props.asc_getPrintTitlesWidth(); - // this.txtRangeTop.setValue((value) ? value : ''); - // this.dataRangeTop = value; - // - // value = props.asc_getPrintTitlesHeight(); - // this.txtRangeLeft.setValue((value) ? value : ''); - // this.dataRangeLeft = value; + if (this.api) { + var value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.current, false, this.sheet); + this.txtRangeTop.setValue((value) ? value : ''); + this.dataRangeTop = value; + + value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.current, true, this.sheet); + this.txtRangeLeft.setValue((value) ? value : ''); + this.dataRangeLeft = value; } }, @@ -255,7 +257,7 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.Chart + type : Asc.c_oAscSelectionDialogType.None }); } } else { From d8e79bded782fc50b3eec8a24ccb498250a2948a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Mar 2020 13:06:18 +0300 Subject: [PATCH 07/11] [SSE] Print titles: check frozen areas, check print ranges --- .../main/app/controller/Print.js | 36 ++++++++++------ .../main/app/view/FileMenuPanels.js | 28 ++++++------- .../main/app/view/PrintSettings.js | 8 ++-- .../main/app/view/PrintTitlesDialog.js | 41 +++++++++++++------ 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 3a3231343..ac0876c32 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -111,10 +111,10 @@ define([ }, comboSheetsChange: function(panel, combo, record) { - this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value)); + this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value), record.value); }, - fillPageOptions: function(panel, props) { + fillPageOptions: function(panel, props, sheet) { var opt = props.asc_getPageSetup(); this._originalPageSettings = opt; @@ -159,13 +159,18 @@ define([ panel.chPrintGrid.setValue(props.asc_getGridLines(), true); panel.chPrintRows.setValue(props.asc_getHeadings(), true); - // var value = props.asc_getPrintTitlesWidth(); - // panel.txtRangeTop.setValue((value) ? value : ''); - // panel.dataRangeTop = value; - // - // value = props.asc_getPrintTitlesHeight(); - // panel.txtRangeLeft.setValue((value) ? value : ''); - // panel.dataRangeLeft = value; + var value = props.asc_getPrintTitlesWidth(); + panel.txtRangeTop.setValue((value) ? value : ''); + panel.txtRangeTop.checkValidate(); + panel.dataRangeTop = value; + + value = props.asc_getPrintTitlesHeight(); + panel.txtRangeLeft.setValue((value) ? value : ''); + panel.txtRangeLeft.checkValidate(); + panel.dataRangeLeft = value; + + panel.btnPresetsTop.menu.items[panel.btnPresetsTop.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, false, sheet)); + panel.btnPresetsLeft.menu.items[panel.btnPresetsLeft.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, sheet)); }, fillPrintOptions: function(props) { @@ -223,8 +228,11 @@ define([ props.asc_setPageMargins(opt); - props.asc_setPrintTitlesWidth(panel.txtRangeTop.getValue()); - props.asc_setPrintTitlesHeight(panel.txtRangeLeft.getValue()); + var check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeTop.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; + props.asc_setPrintTitlesWidth(check ? panel.txtRangeTop.getValue() : panel.dataRangeTop); + + check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeLeft.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError; + props.asc_setPrintTitlesHeight(check ? panel.txtRangeLeft.getValue() : panel.dataRangeLeft); return props; }, @@ -366,6 +374,8 @@ define([ panel.spnMarginRight.on('change', _.bind(this.propertyChange, this, panel)); panel.chPrintGrid.on('change', _.bind(this.propertyChange, this, panel)); panel.chPrintRows.on('change', _.bind(this.propertyChange, this, panel)); + panel.txtRangeTop.on('changing', _.bind(this.propertyChange, this, panel)); + panel.txtRangeLeft.on('changing', _.bind(this.propertyChange, this, panel)); panel.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'top')); panel.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'left')); }, @@ -425,6 +435,7 @@ define([ fillComponents: function(panel, selectdata) { var me = this; panel.txtRangeTop.validation = function(value) { + me.propertyChange(panel); if (_.isEmpty(value)) { return true; } @@ -432,6 +443,7 @@ define([ return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true; }; panel.txtRangeLeft.validation = function(value) { + me.propertyChange(panel); if (_.isEmpty(value)) { return true; } @@ -491,7 +503,7 @@ define([ win.setSettings({ api : me.api, range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft), - type : Asc.c_oAscSelectionDialogType.None + type : Asc.c_oAscSelectionDialogType.Chart }); } } else { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index f7cdbfcb9..6280bba42 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -275,21 +275,21 @@ define([ '
', + '
', '', '', '', - '', - '', - '', - '', '', '', - '', - '', - '', - '', - '', + '', + '', + '', + '', + '', + '', + '', + '', + '', '', '
', '