diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 31b233d18..813a2089f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1494,7 +1494,7 @@ 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.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac && this.appOptions.isDesktopApp; 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); diff --git a/apps/documenteditor/main/app/controller/Print.js b/apps/documenteditor/main/app/controller/Print.js index d92d4e893..d6acb6ee5 100644 --- a/apps/documenteditor/main/app/controller/Print.js +++ b/apps/documenteditor/main/app/controller/Print.js @@ -42,14 +42,10 @@ define([ ], initialize: function() { - var value = Common.localStorage.getItem("de-print-settings-range"); - value = (value!==null) ? parseInt(value) : Asc.c_oAscPrintType.ActiveSheets; - this.adjPrintParams = new Asc.asc_CAdjustPrint(); - this.adjPrintParams.asc_setPrintType(value); - this._state = { - lock_doc: false + lock_doc: false, + firstPrintPage: 0 }; this._navigationPreview = { @@ -118,7 +114,7 @@ define([ } } if (res.length>0) { - // me.adjPrintParams.asc_setPages(res); + me._state.firstPrintPage = res[0]; return true; } } @@ -135,8 +131,6 @@ define([ var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel'; this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this)); - - this.fillPrintOptions(); }, setMode: function (mode) { @@ -224,23 +218,14 @@ define([ } }, - fillPrintOptions: function(props) { - // fill page numbers, copies, collated - var panel = this.printSettings; - panel.cmbRange.setValue(this.adjPrintParams.asc_getPrintType()); - panel.inputPages.setValue(''); // pages numbers - }, - comboRangeChange: function(combo, record) { if (record.value === -1) { var me = this; setTimeout(function(){ me.printSettings.inputPages.focus(); }, 50); - // this.adjPrintParams.asc_setPrintType(record.value) } else { this.printSettings.inputPages.setValue(''); - this.adjPrintParams.asc_setPrintType(record.value) } this.printSettings.inputPages.showError(); }, @@ -501,8 +486,18 @@ define([ this.isInputFirstChange = true; return; } - this._isPrint = print; + if (this.printSettings.cmbRange.getValue()==='all') + this._state.firstPrintPage = 0; + else if (this.printSettings.cmbRange.getValue()==='current') + this._state.firstPrintPage = this._navigationPreview.currentPage; + this.adjPrintParams.asc_setNativeOptions({ + pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(), + paperSize: this._state.pgsize, //this.api.asc_getPageSize(this._state.firstPrintPage), + paperOrientation: this._state.pgorient ? 'portrait' : 'landscape' // this.api.asc_getPageOrient(this._state.firstPrintPage) ? 'portrait' : 'landscape' + }); + + this._isPrint = print; if ( print ) { var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86); opts.asc_setAdvancedOptions(this.adjPrintParams); @@ -521,7 +516,7 @@ define([ this.isInputFirstChange = false; if (value.length<1) - this.printSettings.cmbRange.setValue(Asc.c_oAscPrintType.EntireWorkbook); + this.printSettings.cmbRange.setValue('all'); else if (this.printSettings.cmbRange.getValue()!==-1) this.printSettings.cmbRange.setValue(-1); }, diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 881050d70..92fc8b1ed 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -2399,14 +2399,15 @@ define([ takeFocusOnClose: true, cls: 'input-group-nr', data: [ - { value: Asc.c_oAscPrintType.EntireWorkbook, displayValue: this.txtAllPages }, - { value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtCurrentPage }, + { value: 'all', displayValue: this.txtAllPages }, + { value: 'current', displayValue: this.txtCurrentPage }, { value: -1, displayValue: this.txtCustomPages } ], dataHint: '2', dataHintDirection: 'bottom', dataHintOffset: 'big' }); + this.cmbRange.setValue('all'); this.inputPages = new Common.UI.InputField({ el: $markup.findById('#print-txt-pages'), @@ -2484,10 +2485,10 @@ define([ '
  • ', '
    <%= scope.getDisplayValue(item) %>
    ', '<% if (item.size !== null) { %>
    ' + - '' + - '
    ' + - '' + - '
    ' + + '' + + '
    ' + + '' + + '
    ' + '<% } %>', '<% }); %>' ].join('')), @@ -2647,10 +2648,10 @@ define([ txtLandscape: 'Landscape', txtCustom: 'Custom', txtMargins: 'Margins', - txtTop: 'Top:', - txtBottom: 'Bottom:', - txtLeft: 'Left:', - txtRight: 'Right:', + txtTop: 'Top', + txtBottom: 'Bottom', + txtLeft: 'Left', + txtRight: 'Right', txtPage: 'Page', txtOf: 'of {0}', txtPageNumInvalid: 'Page number invalid', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 303e6e092..e27028544 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -951,6 +951,9 @@ "DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled", "DE.Controllers.Statusbar.tipReview": "Track changes", "DE.Controllers.Statusbar.zoomText": "Zoom {0}%", + "DE.Controllers.Print.txtCustom": "Custom", + "DE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range", + "DE.Controllers.Print.textMarginsLast": "Last Custom", "DE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
    The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
    Do you want to continue?", "DE.Controllers.Toolbar.dataUrl": "Paste a data URL", "DE.Controllers.Toolbar.notcriticalErrorTitle": "Warning", @@ -2384,6 +2387,33 @@ "DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only", "DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto", "DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders", + "DE.Views.PrintWithPreview.txtPrint": "Print", + "DE.Views.PrintWithPreview.txtPrintPdf": "Print to PDF", + "DE.Views.PrintWithPreview.txtPrintRange": "Print range", + "DE.Views.PrintWithPreview.txtCurrentPage": "Current page", + "DE.Views.PrintWithPreview.txtAllPages": "All pages", + "DE.Views.PrintWithPreview.txtSelection": "Selection", + "DE.Views.PrintWithPreview.txtCustomPages": "Custom print", + "DE.Views.PrintWithPreview.txtPageSize": "Page size", + "DE.Views.PrintWithPreview.txtPageOrientation": "Page orientation", + "DE.Views.PrintWithPreview.txtPortrait": "Portrait", + "DE.Views.PrintWithPreview.txtLandscape": "Landscape", + "DE.Views.PrintWithPreview.txtCustom": "Custom", + "DE.Views.PrintWithPreview.txtMargins": "Margins", + "DE.Views.PrintWithPreview.txtTop": "Top", + "DE.Views.PrintWithPreview.txtBottom": "Bottom", + "DE.Views.PrintWithPreview.txtLeft": "Left", + "DE.Views.PrintWithPreview.txtRight": "Right", + "DE.Views.PrintWithPreview.txtPage": "Page", + "DE.Views.PrintWithPreview.txtOf": "of {0}", + "DE.Views.PrintWithPreview.txtPageNumInvalid": "Page number invalid", + "DE.Views.PrintWithPreview.txtPages": "Pages", + "DE.Views.PrintWithPreview.textMarginsLast": "Last Custom", + "DE.Views.PrintWithPreview.textMarginsNormal": "Normal", + "DE.Views.PrintWithPreview.textMarginsUsNormal": "US Normal", + "DE.Views.PrintWithPreview.textMarginsNarrow": "Narrow", + "DE.Views.PrintWithPreview.textMarginsModerate": "Moderate", + "DE.Views.PrintWithPreview.textMarginsWide": "Wide", "DE.Views.RightMenu.txtChartSettings": "Chart settings", "DE.Views.RightMenu.txtFormSettings": "Form Settings", "DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index a967c5918..595901701 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1165,7 +1165,7 @@ define([ console.log("Obsolete: The 'chat' parameter of the 'customization' section is deprecated. Please use 'chat' parameter in the permissions instead."); } this.appOptions.canPrint = (this.permissions.print !== false); - this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac; + this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac && this.appOptions.isDesktopApp; 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; diff --git a/apps/presentationeditor/main/app/controller/Print.js b/apps/presentationeditor/main/app/controller/Print.js index 3f3938aa4..fb2e54e80 100644 --- a/apps/presentationeditor/main/app/controller/Print.js +++ b/apps/presentationeditor/main/app/controller/Print.js @@ -42,11 +42,7 @@ define([ ], initialize: function() { - var value = Common.localStorage.getItem("pe-print-settings-range"); - value = (value!==null) ? parseInt(value) : Asc.c_oAscPrintType.ActiveSheets; - this.adjPrintParams = new Asc.asc_CAdjustPrint(); - this.adjPrintParams.asc_setPrintType(value); this._state = {}; @@ -113,7 +109,6 @@ define([ } } if (res.length>0) { - // me.adjPrintParams.asc_setPages(res); return true; } } @@ -129,8 +124,6 @@ define([ var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel'; this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this)); - - this.fillPrintOptions(); }, setMode: function (mode) { @@ -146,23 +139,14 @@ define([ return this; }, - fillPrintOptions: function(props) { - // fill page numbers, copies, collated - var panel = this.printSettings; - panel.cmbRange.setValue(this.adjPrintParams.asc_getPrintType()); - panel.inputPages.setValue(''); // pages numbers - }, - comboRangeChange: function(combo, record) { if (record.value === -1) { var me = this; setTimeout(function(){ me.printSettings.inputPages.focus(); }, 50); - // this.adjPrintParams.asc_setPrintType(record.value) } else { this.printSettings.inputPages.setValue(''); - this.adjPrintParams.asc_setPrintType(record.value) } this.printSettings.inputPages.showError(); }, @@ -307,6 +291,12 @@ define([ if (this._navigationPreview.pageCount<1) return; + var rec = this.printSettings.cmbPaperSize.getSelectedRecord(); + this.adjPrintParams.asc_setNativeOptions({ + pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(), + paperSize: rec ? rec.size : null + }); + this._isPrint = print; if ( print ) { var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86); @@ -326,7 +316,7 @@ define([ this.isInputFirstChange = false; if (value.length<1) - this.printSettings.cmbRange.setValue(Asc.c_oAscPrintType.EntireWorkbook); + this.printSettings.cmbRange.setValue('all'); else if (this.printSettings.cmbRange.getValue()!==-1) this.printSettings.cmbRange.setValue(-1); }, diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index f02b56ff3..9e727858e 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -1839,6 +1839,8 @@ define([ '<%= scope.txtPages %>', '', '', + '', + '', '', '