diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index a967c5918..ec9a863ac 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1166,6 +1166,8 @@ define([ } this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac; + this.appOptions.canQuickPrint = this.appOptions.canPrint && this.appOptions.isDesktopApp && + !(this.editorConfig.customization && this.editorConfig.customization.compactHeader); this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; @@ -2213,6 +2215,16 @@ define([ if (url) this.iframePrint.src = url; }, + onPrintQuick: function() { + if (!this.appOptions.canQuickPrint) return; + var printopt = new Asc.asc_CAdjustPrint(); + printopt.asc_setNativeOptions({quickPrint: true}); + var opts = new Asc.asc_CDownloadOptions(); + opts.asc_setAdvancedOptions(printopt); + this.api.asc_Print(opts); + Common.component.Analytics.trackEvent('Print'); + }, + onAdvancedOptions: function(type, advOptions) { if (this._state.openDlg) return; diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 121084f53..4ab653747 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -146,6 +146,10 @@ define([ var _main = this.getApplication().getController('Main'); _main.onPrint(); }, + 'print-quick': function (opts) { + var _main = this.getApplication().getController('Main'); + _main.onPrintQuick(); + }, 'save': function (opts) { this.api.asc_Save(); }, diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 50500ed56..46e87a5e2 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -72,7 +72,8 @@ define([ this.addListeners({ 'FileMenu': { 'menu:hide': me.onFileMenu.bind(me, 'hide'), - 'menu:show': me.onFileMenu.bind(me, 'show') + 'menu:show': me.onFileMenu.bind(me, 'show'), + 'settings:apply': me.applySettings.bind(me) }, 'Toolbar': { 'render:before' : function (toolbar) { @@ -80,6 +81,11 @@ define([ toolbar.setExtra('right', me.header.getPanel('right', config)); if (!config.isEdit || config.customization && !!config.customization.compactHeader) toolbar.setExtra('left', me.header.getPanel('left', config)); + var value = Common.localStorage.getItem("pe-settings-quick-print-button"); + value = (value===null) ? 1 : parseInt(value); + Common.Utils.InternalSettings.set("pe-settings-quick-print-button", value); + if (me.header && me.header.btnPrintQuick) + me.header.btnPrintQuick[value ? 'show' : 'hide'](); }, 'view:compact' : function (toolbar, state) { me.viewport.vlayout.getItem('toolbar').height = state ? @@ -102,6 +108,8 @@ define([ 'print:disabled' : function (state) { if ( me.header.btnPrint ) me.header.btnPrint.setDisabled(state); + if ( me.header.btnPrintQuick ) + me.header.btnPrintQuick.setDisabled(state); }, 'save:disabled' : function (state) { if ( me.header.btnSave ) @@ -312,6 +320,13 @@ define([ me.header.lockHeaderBtns( 'users', _need_disable ); }, + applySettings: function () { + var value = parseInt(Common.localStorage.getItem("pe-settings-quick-print-button")); + Common.Utils.InternalSettings.set("pe-settings-quick-print-button", value); + if (this.header && this.header.btnPrintQuick) + this.header.btnPrintQuick[value ? 'show' : 'hide'](); + }, + onApiCoAuthoringDisconnect: function(enableDownload) { if (this.header) { if (this.header.btnDownload && !enableDownload) @@ -320,6 +335,8 @@ define([ this.header.btnPrint.hide(); if (this.header.btnEdit) this.header.btnEdit.hide(); + if (this.header.btnPrintQuick && !enableDownload) + this.header.btnPrintQuick.hide(); this.header.lockHeaderBtns( 'rename-user', true); } }, diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index f02b56ff3..0e6cbd4bd 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -266,7 +266,12 @@ define([ '', '
', '', - + '', + '
', + '', + '
', + '', + '', '', '', '', @@ -535,6 +540,17 @@ define([ })).on('click', _.bind(me.applySettings, me)); }); + this.chQuickPrint = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-quick-print'), + labelText: '', + dataHint: '2', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.chQuickPrint.$el.parent().on('click', function (){ + me.chQuickPrint.setValue(!me.chQuickPrint.isChecked()); + }); + this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings'); this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply'); this.pnlTable = this.pnlSettings.find('table'); @@ -596,6 +612,7 @@ define([ $('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); $('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide'](); + $('tr.quick-print', this.el)[mode.canQuickPrint ? 'show' : 'hide'](); if ( !Common.UI.Themes.available() ) { $('tr.themes, tr.themes + tr.divider', this.el).hide(); @@ -657,6 +674,7 @@ define([ this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); this.chPaste.setValue(Common.Utils.InternalSettings.get("pe-settings-paste-button")); + this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("pe-settings-quick-print-button")); var data = []; for (var t in Common.UI.Themes.map()) { @@ -702,6 +720,7 @@ define([ Common.Utils.InternalSettings.set("pe-macros-mode", this.cmbMacros.getValue()); Common.localStorage.setItem("pe-settings-paste-button", this.chPaste.isChecked() ? 1 : 0); + Common.localStorage.setItem("pe-settings-quick-print-button", this.chQuickPrint.isChecked() ? 1 : 0); Common.localStorage.save(); @@ -777,7 +796,10 @@ define([ txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make', strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE', strIgnoreWordsWithNumbers: 'Ignore words with numbers', - strShowOthersChanges: 'Show changes from other users' + strShowOthersChanges: 'Show changes from other users', + txtQuickPrint: 'Show the Quick Print button in the editor header', + txtQuickPrintTip: 'The document will be printed on the last selected or default printer' + }, PE.Views.FileMenuPanels.Settings || {})); PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index a1ebc4f86..dcdcedad3 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -412,6 +412,7 @@ "Common.Views.Header.tipViewUsers": "View users and manage document access rights", "Common.Views.Header.txtAccessRights": "Change access rights", "Common.Views.Header.txtRename": "Rename", + "Common.Views.Header.tipPrintQuick": "Quick print", "Common.Views.History.textCloseHistory": "Close History", "Common.Views.History.textHide": "Collapse", "Common.Views.History.textHideAll": "Hide detailed changes", @@ -1710,6 +1711,8 @@ "PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "PE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "PE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "PE.Views.FileMenuPanels.Settings.txtQuickPrint": "Show the Quick Print button in the editor header", + "PE.Views.FileMenuPanels.Settings.txtQuickPrintTip": "The document will be printed on the last selected or default printer", "PE.Views.HeaderFooterDialog.applyAllText": "Apply to all", "PE.Views.HeaderFooterDialog.applyText": "Apply", "PE.Views.HeaderFooterDialog.diffLanguage": "You can’t use a date format in a different language than the slide master.
To change the master, click 'Apply to all' instead of 'Apply'", diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d291c1b65..a086e907a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1291,6 +1291,8 @@ define([ this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; this.appOptions.canDownload = (this.permissions.download !== false); this.appOptions.canPrint = (this.permissions.print !== false); + this.appOptions.canQuickPrint = this.appOptions.canPrint && this.appOptions.isDesktopApp && + !(this.editorConfig.customization && this.editorConfig.customization.compactHeader); this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; @@ -2873,6 +2875,16 @@ define([ if (url) this.iframePrint.src = url; }, + onPrintQuick: function() { + if (!this.appOptions.canQuickPrint) return; + var printopt = new Asc.asc_CAdjustPrint(); + printopt.asc_setNativeOptions({quickPrint: true}); + var opts = new Asc.asc_CDownloadOptions(); + opts.asc_setAdvancedOptions(printopt); + this.api.asc_Print(opts); + Common.component.Analytics.trackEvent('Print'); + }, + warningDocumentIsLocked: function() { var me = this; Common.Utils.warningDocumentIsLocked({ diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index eb82d6b5d..7285f80de 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -99,6 +99,10 @@ define([ var _main = this.getApplication().getController('Main'); _main.onPrint(); }, + 'print-quick': function (opts) { + var _main = this.getApplication().getController('Main'); + _main.onPrintQuick(); + }, 'save': function (opts) { this.api.asc_Save(); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index 90b38270e..9f48df44d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -70,7 +70,8 @@ define([ this.addListeners({ 'FileMenu': { 'menu:hide': me.onFileMenu.bind(me, 'hide'), - 'menu:show': me.onFileMenu.bind(me, 'show') + 'menu:show': me.onFileMenu.bind(me, 'show'), + 'settings:apply': me.applySettings.bind(me) }, 'Statusbar': { 'view:compact': function (statusbar, state) { @@ -89,6 +90,11 @@ define([ if ( me.appConfig && me.appConfig.isEdit && !(config.customization && config.customization.compactHeader) && toolbar.btnCollabChanges ) toolbar.btnCollabChanges = me.header.btnSave; + var value = Common.localStorage.getItem("sse-settings-quick-print-button"); + value = (value===null) ? 1 : parseInt(value); + Common.Utils.InternalSettings.set("sse-settings-quick-print-button", value); + if (me.header && me.header.btnPrintQuick) + me.header.btnPrintQuick[value ? 'show' : 'hide'](); }, 'view:compact' : function (toolbar, state) { me.viewport.vlayout.getItem('toolbar').height = state ? @@ -111,6 +117,8 @@ define([ 'print:disabled' : function (state) { if ( me.header.btnPrint ) me.header.btnPrint.setDisabled(state); + if ( me.header.btnPrintQuick ) + me.header.btnPrintQuick.setDisabled(state); }, 'save:disabled' : function (state) { if ( me.header.btnSave ) @@ -285,6 +293,13 @@ define([ me.header.lockHeaderBtns( 'users', _need_disable ); }, + applySettings: function () { + var value = parseInt(Common.localStorage.getItem("sse-settings-quick-print-button")); + Common.Utils.InternalSettings.set("sse-settings-quick-print-button", value); + if (this.header && this.header.btnPrintQuick) + this.header.btnPrintQuick[value ? 'show' : 'hide'](); + }, + onApiCoAuthoringDisconnect: function(enableDownload) { if (this.header) { if (this.header.btnDownload && !enableDownload) @@ -293,6 +308,8 @@ define([ this.header.btnPrint.hide(); if (this.header.btnEdit) this.header.btnEdit.hide(); + if (this.header.btnPrintQuick && !enableDownload) + this.header.btnPrintQuick.hide(); } }, diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index aae0402bf..0a42ae9bf 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -244,6 +244,12 @@ define([ '', '
', '', + '', + '
', + '', + '
', + '', + '', '', '', '', @@ -718,6 +724,17 @@ define([ })).on('click', _.bind(me.applySettings, me)); }); + this.chQuickPrint = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-quick-print'), + labelText: '', + dataHint: '2', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.chQuickPrint.$el.parent().on('click', function (){ + me.chQuickPrint.setValue(!me.chQuickPrint.isChecked()); + }); + this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings'); this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply'); this.pnlTable = this.pnlSettings.find('table'); @@ -782,6 +799,7 @@ define([ $('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); + $('tr.quick-print', this.el)[mode.canQuickPrint ? 'show' : 'hide'](); if ( !Common.UI.Themes.available() ) { $('tr.themes, tr.themes + tr.divider', this.el).hide(); @@ -877,6 +895,7 @@ define([ this.cmbMacros.setValue(item ? item.get('value') : 0); this.chPaste.setValue(Common.Utils.InternalSettings.get("sse-settings-paste-button")); + this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("sse-settings-quick-print-button")); var data = []; for (var t in Common.UI.Themes.map()) { @@ -977,6 +996,7 @@ define([ Common.Utils.InternalSettings.set("sse-macros-mode", this.cmbMacros.getValue()); Common.localStorage.setItem("sse-settings-paste-button", this.chPaste.isChecked() ? 1 : 0); + Common.localStorage.setItem("sse-settings-quick-print-button", this.chQuickPrint.isChecked() ? 1 : 0); Common.localStorage.save(); if (this.menu) { @@ -1169,7 +1189,9 @@ define([ txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make', strShowOthersChanges: 'Show changes from other users', txtCalculating: 'Calculating', - strDateFormat1904: 'Use 1904 date system' + strDateFormat1904: 'Use 1904 date system', + txtQuickPrint: 'Show the Quick Print button in the editor header', + txtQuickPrintTip: 'The document will be printed on the last selected or default printer' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index d617ac4d5..6b297ba29 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -253,6 +253,7 @@ "Common.Views.Header.tipViewUsers": "View users and manage document access rights", "Common.Views.Header.txtAccessRights": "Change access rights", "Common.Views.Header.txtRename": "Rename", + "Common.Views.Header.tipPrintQuick": "Quick print", "Common.Views.History.textCloseHistory": "Close History", "Common.Views.History.textHide": "Collapse", "Common.Views.History.textHideAll": "Hide detailed changes", @@ -2229,6 +2230,8 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWorkspace": "Workspace", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtZh": "Chinese", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtQuickPrint": "Show the Quick Print button in the editor header", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtQuickPrintTip": "The document will be printed on the last selected or default printer", "SSE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning", "SSE.Views.FileMenuPanels.ProtectDoc.strEncrypt": "With password", "SSE.Views.FileMenuPanels.ProtectDoc.strProtect": "Protect Spreadsheet",