From 2a128bc53986423a889b9b2044c91de8a0569165 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 15 Nov 2022 21:45:25 +0300 Subject: [PATCH 1/4] [DE] Add quick print button --- apps/common/main/lib/controller/Desktop.js | 4 +++ apps/common/main/lib/view/Header.js | 17 ++++++++++++- .../main/app/controller/Main.js | 9 +++++++ .../main/app/controller/Toolbar.js | 4 +++ .../main/app/controller/Viewport.js | 20 ++++++++++++++- .../main/app/view/FileMenuPanels.js | 25 +++++++++++++++++-- apps/documenteditor/main/locale/en.json | 3 +++ 7 files changed, 78 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index 356764bd4..11522753e 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -201,6 +201,7 @@ define([ if ( !!titlebuttons ) { info.hints = {}; !!titlebuttons['print'] && (info.hints['print'] = titlebuttons['print'].btn.btnEl.attr('data-hint-title')); + !!titlebuttons['printquick'] && (info.hints['printquick'] = titlebuttons['printquick'].btn.btnEl.attr('data-hint-title')); !!titlebuttons['undo'] && (info.hints['undo'] = titlebuttons['undo'].btn.btnEl.attr('data-hint-title')); !!titlebuttons['redo'] && (info.hints['redo'] = titlebuttons['redo'].btn.btnEl.attr('data-hint-title')); !!titlebuttons['save'] && (info.hints['save'] = titlebuttons['save'].btn.btnEl.attr('data-hint-title')); @@ -258,6 +259,9 @@ define([ if (!!header.btnPrint) titlebuttons['print'] = {btn: header.btnPrint}; + if (!!header.btnPrintQuick) + titlebuttons['printquick'] = {btn: header.btnPrintQuick}; + if (!!header.btnUndo) titlebuttons['undo'] = {btn: header.btnUndo}; diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index f433be058..fa3968008 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -80,6 +80,7 @@ define([ '
' + '
' + '
' + + '
' + '
' + '
' + '
' + @@ -127,6 +128,7 @@ define([ '
' + '
' + '
' + + '
' + '
' + '
' + '
' + @@ -332,6 +334,13 @@ define([ }); } + if ( me.btnPrintQuick ) { + me.btnPrintQuick.updateHint(me.tipPrintQuick); + me.btnPrintQuick.on('click', function (e) { + me.fireEvent('print-quick', me); + }); + } + if ( me.btnSave ) { me.btnSave.updateHint(me.tipSave + Common.Utils.String.platformKey('Ctrl+S')); me.btnSave.on('click', function (e) { @@ -572,6 +581,9 @@ define([ if ( config.canPrint ) this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P'); + if ( config.canQuickPrint ) + this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q'); + if ( config.canEdit && config.canRequestEditRights ) this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big'); } @@ -646,6 +658,8 @@ define([ if ( config.canPrint && config.isEdit ) { me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P'); } + if ( config.canQuickPrint && config.isEdit ) + me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q'); me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true, undefined, undefined, 'S'); me.btnUndo = createTitleButton('toolbar__icon icon--inverse btn-undo', $html.findById('#slot-btn-dt-undo'), true, undefined, undefined, 'Z'); @@ -910,7 +924,8 @@ define([ textAddFavorite: 'Mark as favorite', textHideNotes: 'Hide Notes', tipSearch: 'Search', - textShare: 'Share' + textShare: 'Share', + tipPrintQuick: 'Quick print' } }(), Common.Views.Header || {})) }); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 31b233d18..5db889425 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1495,6 +1495,8 @@ define([ this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; 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.buildVersion = params.asc_getBuildVersion(); this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); @@ -2652,6 +2654,13 @@ define([ if (url) this.iframePrint.src = url; }, + onPrintQuick: function() { + if (!this.appOptions.canPrint) return; + // call special quick print + this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)) + Common.component.Analytics.trackEvent('Print'); + }, + onClearDummyComment: function() { this.dontCloseDummyComment = false; }, diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 3edfc217d..1caab736f 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -129,6 +129,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/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 713133cde..aa640e891 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -71,7 +71,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) { @@ -79,6 +80,12 @@ 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("de-settings-quick-print-button"); + value = (value===null) ? 1 : parseInt(value); + Common.Utils.InternalSettings.set("de-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 ? @@ -100,6 +107,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 ) @@ -255,12 +264,21 @@ define([ me.header.lockHeaderBtns( 'users', _need_disable ); }, + applySettings: function () { + var value = parseInt(Common.localStorage.getItem("de-settings-quick-print-button")); + Common.Utils.InternalSettings.set("de-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) this.header.btnDownload.hide(); if (this.header.btnPrint && !enableDownload) this.header.btnPrint.hide(); + if (this.header.btnPrintQuick && !enableDownload) + this.header.btnPrintQuick.hide(); if (this.header.btnEdit) this.header.btnEdit.hide(); this.header.lockHeaderBtns( 'rename-user', true); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 881050d70..881d6ba91 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -341,6 +341,12 @@ define([ '', '
', '', + '', + '
', + '', + '
', + '', + '', '', '', '', @@ -698,6 +704,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'); @@ -762,9 +779,9 @@ define([ $('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide'](); $('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); - /** coauthoring end **/ + $('tr.quick-print', this.el)[mode.canQuickPrint ? 'show' : 'hide'](); $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show'](); if ( !Common.UI.Themes.available() ) { $('tr.themes, tr.themes + tr.divider', this.el).hide(); @@ -835,6 +852,7 @@ define([ this.cmbMacros.setValue(item ? item.get('value') : 0); this.chPaste.setValue(Common.Utils.InternalSettings.get("de-settings-paste-button")); + this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("de-settings-quick-print-button")); var data = []; for (var t in Common.UI.Themes.map()) { @@ -904,6 +922,7 @@ define([ } Common.localStorage.setItem("de-settings-paste-button", this.chPaste.isChecked() ? 1 : 0); + Common.localStorage.setItem("de-settings-quick-print-button", this.chQuickPrint.isChecked() ? 1 : 0); Common.localStorage.save(); @@ -1001,7 +1020,9 @@ 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' }, DE.Views.FileMenuPanels.Settings || {})); DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 303e6e092..1cc9793c0 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -319,6 +319,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", @@ -1840,6 +1841,8 @@ "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "DE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "DE.Views.FileMenuPanels.Settings.txtQuickPrint": "Show the Quick Print button in the editor header", + "DE.Views.FileMenuPanels.Settings.txtQuickPrintTip": "The document will be printed on the last selected or default printer", "DE.Views.FormSettings.textAlways": "Always", "DE.Views.FormSettings.textAspect": "Lock aspect ratio", "DE.Views.FormSettings.textAtLeast": "At least", From 1ba9ddf351d2bd2b7c02a2d448c6b36dcb123f0c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Nov 2022 12:46:49 +0300 Subject: [PATCH 2/4] [DE] Quick print --- apps/documenteditor/main/app/controller/Main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 5db889425..9ff4ae234 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2655,9 +2655,12 @@ define([ }, onPrintQuick: function() { - if (!this.appOptions.canPrint) return; - // call special quick print - this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)) + 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'); }, From d4de267db257aa691871f417f15b09da3780158c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 16 Nov 2022 14:25:12 +0300 Subject: [PATCH 3/4] Add icons for quick print/print preview --- apps/common/main/lib/view/Header.js | 8 ++++---- .../img/toolbar/1.25x/btn-print-preview.png | Bin 0 -> 254 bytes .../img/toolbar/1.25x/btn-quick-print.png | Bin 0 -> 392 bytes .../img/toolbar/1.5x/btn-print-preview.png | Bin 0 -> 286 bytes .../img/toolbar/1.5x/btn-quick-print.png | Bin 0 -> 439 bytes .../img/toolbar/1.75x/btn-print-preview.png | Bin 0 -> 314 bytes .../img/toolbar/1.75x/btn-quick-print.png | Bin 0 -> 525 bytes .../img/toolbar/1x/btn-print-preview.png | Bin 0 -> 238 bytes .../resources/img/toolbar/1x/btn-quick-print.png | Bin 0 -> 360 bytes .../img/toolbar/2x/btn-print-preview.png | Bin 0 -> 436 bytes .../resources/img/toolbar/2x/btn-quick-print.png | Bin 0 -> 754 bytes 11 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 apps/common/main/resources/img/toolbar/1.25x/btn-print-preview.png create mode 100644 apps/common/main/resources/img/toolbar/1.25x/btn-quick-print.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/btn-print-preview.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/btn-quick-print.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/btn-print-preview.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/btn-quick-print.png create mode 100644 apps/common/main/resources/img/toolbar/1x/btn-print-preview.png create mode 100644 apps/common/main/resources/img/toolbar/1x/btn-quick-print.png create mode 100644 apps/common/main/resources/img/toolbar/2x/btn-print-preview.png create mode 100644 apps/common/main/resources/img/toolbar/2x/btn-quick-print.png diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index fa3968008..554490f7a 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -579,10 +579,10 @@ define([ this.btnDownload = createTitleButton('toolbar__icon icon--inverse btn-download', $html.findById('#slot-hbtn-download'), undefined, 'bottom', 'big'); if ( config.canPrint ) - this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P'); + this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print-preview', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P'); if ( config.canQuickPrint ) - this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q'); + this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q'); if ( config.canEdit && config.canRequestEditRights ) this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big'); @@ -656,10 +656,10 @@ define([ me.setUserName(me.options.userName); if ( config.canPrint && config.isEdit ) { - me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P'); + me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print-preview', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P'); } if ( config.canQuickPrint && config.isEdit ) - me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q'); + me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q'); me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true, undefined, undefined, 'S'); me.btnUndo = createTitleButton('toolbar__icon icon--inverse btn-undo', $html.findById('#slot-btn-dt-undo'), true, undefined, undefined, 'Z'); diff --git a/apps/common/main/resources/img/toolbar/1.25x/btn-print-preview.png b/apps/common/main/resources/img/toolbar/1.25x/btn-print-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..f5bf7d1e33a3d3b6446006ff5bd1a74f9aae11aa GIT binary patch literal 254 zcmVX1^@s6b5wmq0002RNkl;$TL7p4WgVQz3K0YGqqx|Io%Wba{NWw5A!pxkXHmH~kpBx}FFs|a&yWh)Y%S`o;nBw1^L0C}4v zYpoIcF_1kFYMw-p!CQr%C*SBJQ}>Z{vM+eoyOn-GJ1bfdiyE%y!2kdN07*qoM6N<$ Eg2oGEKmY&$ literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.25x/btn-quick-print.png b/apps/common/main/resources/img/toolbar/1.25x/btn-quick-print.png new file mode 100644 index 0000000000000000000000000000000000000000..fba845c843fcb51d99458ce04d3277893512aa3e GIT binary patch literal 392 zcmV;30eAk1P)X1^@s6b5wmq0003`Nkl` z--j2mQvS>XnAx*F{8CJ@y~S5qB zKl4SjVMR_vnCohTNVyd`5ura^E{In)_8>BtGveM&1EOsFP&0@O=8U*^(}JX^7cAJk z$@R!t1qdgA7cAJk$@R$DQV@r?{|RD6O$kV_(3pT&Lyh(v$>}A7`8&p>IY)AODSREw z-!Z1r-G{K)O?1cj0jW2RFCc`)ZlXKJkD%O*yvN%&&;hu26=R7GLBe>b m`2cLg4p4+~)n~M5k%%WxlYNqBowAky00003%fB+xO35L)w zT;M1& literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.5x/btn-quick-print.png b/apps/common/main/resources/img/toolbar/1.5x/btn-quick-print.png new file mode 100644 index 0000000000000000000000000000000000000000..93752a11abc7e6b7a77ab5e7244f7088708641f6 GIT binary patch literal 439 zcmV;o0Z9IdP)FiAbAb~#82w=GAni?3cxW<6L0k~&oPtSDc%nq4pm|%QxRXg_lCQJZt z1|A8n1^zmP4cLHxhr^7RS-A5)8yGKjm=QA&Q+NZ?pzSU_jl=A=B$`e@+VrRnpo zap_LrA1=+VeAl}4nb*b4N;*-9AdG9)Up$$WbfOTU7}w1IzZ|!15(S7FWl!w1c2T6v h?LPIs78VxQ#~UvO1Gv7#kA46E002ovPDHLkV1oSo$VvbJ literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.75x/btn-print-preview.png b/apps/common/main/resources/img/toolbar/1.75x/btn-print-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..149f53961c60ba9228851c00edbb76796c47872f GIT binary patch literal 314 zcmV-A0mc4_P))Q990Fa+7is3-`L8@_Y&3t16C(y_e#~Bh{7&ObyjJlnu%TVH3JRM_>d-U<5|U8R;WM9F!z>Dk|BMMUadeUY+ld z%SBC1O-)Vhmuw_=OdlmC;+z{D-$p4g?j$*8FzyUF6pVsVFv&S2gjPh5g@jg2kj2W3 zTSby3FHuDbCSbDeEMRg&(uz?q=Lb`ex2tY9kayn(L+J|gcGc|$@-7t&r-e`Cmi+4F zD?Knx3>an$pU5rw)yr2dV91(SFe(3B1EA(Zj6uvJ0*p(jlm^>s|=BV?%mTEbAX0HQrz`V)t7`Hp39Nd98VCeQue#f}o z66KiRhy^oZc`Q~VM~~~ev`Z{4@goDgc;(&K;M?O`uHxtRJ>&wjC8iDX*hH~T1@li# z(Z1c5$cBhD2TZZETyD(Po&u)WSuQtDYv*k6>WB^AGw10WmQUyg?-{EZoRhk4r7M*u z!jA;a;8^GD3fgmfwCl}b24IHOk*3|+?PmUhHUKmDN1D)~ug*nHO-=0&NH@o|6S_X) P00000NkvXXu0mjfSWw`r literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1x/btn-print-preview.png b/apps/common/main/resources/img/toolbar/1x/btn-print-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..4231e64a9b69fbd746f6bc07ddb90adf1b01b9fd GIT binary patch literal 238 zcmVk_5wVXkGihsoaZAnxWsT@%00erC3?LT!5{0}d zwEY`?FadiM(g5rkNI0Lq3ix_@24M8e5-@t^bAXKr$TEo*Kf>t2M@hxSVZ~Q2PParL zxJ@PJ4;sPkQWD9YgcA_e-qirX1hhaifZHf2)3kuo#im;)1(z<4#FH4~%@sEquri}v oaYKn2R{T`{6D0|l4(jdd09&A_<)oo2#Q*>R07*qoM6N<$f+VS2+W-In literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1x/btn-quick-print.png b/apps/common/main/resources/img/toolbar/1x/btn-quick-print.png new file mode 100644 index 0000000000000000000000000000000000000000..63d65c6254b79d56970e2a7ed5267e86db1be75d GIT binary patch literal 360 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<{OJS~!q zypsea6lYK5J;By9MbO5{t)RDLqQIlM|5jXyu-d8+Rck4qH?``uf49pWfv#Q?c8VjqAM|dg1KshMnp+7$;w2%ZO$?V<|J|)6BoT7s^B?Jcx*4OW*!Q zt(<`^+;>y@gL~6NC3e_DeCiq%&NF0#4XU(ua;&%*Nb$zIfj4^}FgC+C+Y<}=? zhU0Ah9V^q@_Ou0ml-Xjsqt7y9vSmj4!+WQ$vR^S$%HzGg@Fy??89ZJ6T-G@yGywqN CotOXs literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/2x/btn-print-preview.png b/apps/common/main/resources/img/toolbar/2x/btn-print-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..0c2c4fe2fd6f653f0e7bb768a7edfe74017d4e12 GIT binary patch literal 436 zcmV;l0ZaagP)<0w(279Gdg2IkE9E e<~%VNL&pb6o`{bHkZ4%|0000YkXx~-Ty_Zz@-cIU)yE8@-~C6?;Gl6zFD`(}WN z0e%W-5Wr6X%>e&-30EfX%%D0LJ8WITX1U7bof%XIV}~sPYLl&F3-fV+W*Kd=b!=gx z0mk%)_PW~Sj;vS0n!Ifa0vOpJ+UshQJF;F0YyN4QVgQErhqg@B!u{<38Zuu80u1dB zZJDZt`zezRnXf|u`jj@pZagaL0oSyF0NoYxhTV9S`vb0Nr2!tuzNQ@KUtun85tS4` zYYJpvQ;zemphVmvDoKEMn0ItE8C2^9_DL*zDS&sFdUP}yRO3Qzf zkf>fMfE`RNJxYB9m>Si)blsZM`fdS=^m;UIWbWDZMXfn)KqIcO*JJZ;WZARNi#n}1 zt}noD!cZ>Er3(*$rzOV?0N8OufpQ(E$~C4Bbp?p7!x|v|_y>&J#Im5%@d! zyJn}4iZ#%R^@gu`k^s>}YBE;Os98^_f6+t|07Mh1$yhxjXg#6+RTGH?Sdr5QRae8{ zohKSbYbj4RI5V)uDP?z4@M Date: Wed, 16 Nov 2022 14:28:07 +0300 Subject: [PATCH 4/4] [PE][SSE] Add quick print button --- .../main/app/controller/Main.js | 12 +++++++++ .../main/app/controller/Toolbar.js | 4 +++ .../main/app/controller/Viewport.js | 19 +++++++++++++- .../main/app/view/FileMenuPanels.js | 26 +++++++++++++++++-- apps/presentationeditor/main/locale/en.json | 3 +++ .../main/app/controller/Main.js | 12 +++++++++ .../main/app/controller/Toolbar.js | 4 +++ .../main/app/controller/Viewport.js | 19 +++++++++++++- .../main/app/view/FileMenuPanels.js | 24 ++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 3 +++ 10 files changed, 121 insertions(+), 5 deletions(-) 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",