Compare commits

...

68 commits

Author SHA1 Message Date
Lea 4eebaab5e6
Enable mobile editing 2023-01-12 14:28:17 +01:00
papacarlo ddec589b37 Merge branch hotfix/v7.2.2 into master 2022-12-20 08:00:10 +00:00
Maxim Kadushkin 7b03f08adc [desktop] for bug 60014 2022-12-07 16:54:48 +03:00
Maxim Kadushkin 3208a4bdf2 [desktop] hide panel before "print" command 2022-12-07 16:48:55 +03:00
Maxim Kadushkin 9e608f168d [desktop] for bug 60014 2022-12-06 21:43:43 +03:00
Maxim Kadushkin f91bc6e50e [desktop] for bug 60025 2022-12-06 20:24:15 +03:00
maxkadushkin b5c282872d
Merge pull request #2105 from ONLYOFFICE/fix/bug-59971
For Bug 59971
2022-12-04 22:50:14 +03:00
Julia Radzhabova 37b37425af For Bug 59971 2022-12-04 16:56:12 +03:00
Maxim Kadushkin f7eccb611f [DE] fix bug 59971 2022-12-03 23:27:22 +03:00
Julia Radzhabova f453f92a32
Merge pull request #2102 from ONLYOFFICE/fix/translation
Update translation. Fix Bug 59947
2022-12-02 14:24:26 +03:00
Julia Radzhabova b6d7e60624 Update translation. Fix Bug 59947 2022-12-02 14:18:13 +03:00
Maxim Kadushkin 6b269291ae [all] hide "quick print" button for macos 2022-12-02 00:14:31 +03:00
Julia Radzhabova 9e80367822
Merge pull request #2098 from ONLYOFFICE/fix/bugfix
Fix Bug 59959
2022-11-30 22:00:24 +03:00
Julia Radzhabova 2bcb91c15c Fix Bug 59959 2022-11-30 21:53:27 +03:00
Maxim Kadushkin 215f2bf28d [desktop] debug 2022-11-30 21:18:32 +03:00
Maxim Kadushkin 6543e5bb49 [SSE PE] fix bug 59951 2022-11-30 15:36:56 +03:00
Julia Radzhabova 9940b59d38
Merge pull request #2095 from ONLYOFFICE/fix/bugfix
[SSE] Try printing in internal spreadsheet editor
2022-11-30 01:37:54 +03:00
Julia Radzhabova 2c48d5c8cb [SSE] Try printing in internal spreadsheet editor 2022-11-30 01:31:59 +03:00
Julia Radzhabova 1ef412c1ee
Merge pull request #2091 from ONLYOFFICE/fix/bugfix
[DE][PE] Fix Bug 59911
2022-11-28 14:13:07 +03:00
Julia Radzhabova 70d6ecb6dc [DE][PE] Fix Bug 59911 2022-11-28 14:06:48 +03:00
Julia Radzhabova 43617a9729
Merge pull request #2087 from ONLYOFFICE/fix/translation
Update translation. Fix Bug 59887
2022-11-25 17:37:42 +03:00
Julia Radzhabova 30d35b42eb Update translation. Fix Bug 59887 2022-11-25 17:31:35 +03:00
Maxim Kadushkin 7e7f519caf [desktop] refactoring 2022-11-22 19:28:54 +03:00
Julia Radzhabova 62d74b444c
Merge pull request #2077 from ONLYOFFICE/fix/quick-preview-warning
Show warning before first click on Quick print button
2022-11-22 01:15:13 +03:00
Julia Radzhabova 7d0ac791aa Show warning before first click on Quick print button 2022-11-22 00:56:54 +03:00
Maxim Kadushkin 8e25f9c027 [desktop] event on show 'quick print' button 2022-11-22 00:28:55 +03:00
Maxim Kadushkin 4fa78dad3a [desktop] 'file locked' message didn't open 2022-11-21 13:04:25 +03:00
Julia Radzhabova 58203c0989
Merge pull request #2071 from ONLYOFFICE/fix/quick-print
Change button's order
2022-11-18 19:17:19 +03:00
Julia Radzhabova aec1b4464d Change button's order 2022-11-18 19:09:50 +03:00
Julia Radzhabova c7f4687a2f
Merge pull request #2067 from ONLYOFFICE/fix/print-preview
Fix/print preview
2022-11-18 15:11:10 +03:00
Julia Radzhabova 7455c536ac Add translation 2022-11-18 15:03:47 +03:00
Julia Radzhabova 033c44d473 [DE][PE] Show error when printing several pages 2022-11-18 14:47:58 +03:00
Julia Radzhabova 81fcfb05f0
Merge pull request #2065 from ONLYOFFICE/fix/print-preview
[DE][PE] Send paper size preset
2022-11-17 22:52:56 +03:00
Julia Radzhabova 8eb8226da2 [DE][PE] Send paper size preset 2022-11-17 22:47:18 +03:00
Julia Radzhabova 6f59e5771b
Merge pull request #2063 from ONLYOFFICE/fix/print-preview
[PE] Send paper size for print preview
2022-11-17 12:55:47 +03:00
Julia Radzhabova 640edd8a79 [PE] Send paper size for print preview 2022-11-17 12:49:11 +03:00
Maxim Kadushkin b825310d30 [desktop] changed "read only" file opening 2022-11-16 19:04:46 +03:00
Julia Radzhabova 4c4da4113f
Merge pull request #2059 from ONLYOFFICE/fix/print-preview
[DE] Send settings for first printing page
2022-11-16 15:45:52 +03:00
Julia Radzhabova db925cd1e8 [DE] Send settings for first printing page 2022-11-16 15:38:00 +03:00
Julia Radzhabova d535175dc1
Merge pull request #2058 from ONLYOFFICE/fix/quick-print
Fix/quick print
2022-11-16 14:52:39 +03:00
Julia Radzhabova 1401b51648 Merge branch 'hotfix/v7.2.2' into fix/quick-print 2022-11-16 14:46:00 +03:00
Julia Radzhabova 629af711e2 [PE][SSE] Add quick print button 2022-11-16 14:28:07 +03:00
Julia Radzhabova d4de267db2 Add icons for quick print/print preview 2022-11-16 14:25:12 +03:00
Julia Radzhabova 1ba9ddf351 [DE] Quick print 2022-11-16 12:46:49 +03:00
Maxim Kadushkin 2d2958e07b Merge branch 'hotfix/v7.2.2' of https://github.com/ONLYOFFICE/web-apps into hotfix/v7.2.2 2022-11-16 00:08:44 +03:00
Maxim Kadushkin 72fd49401f [desktop] get def printer name 2022-11-16 00:08:16 +03:00
Julia Radzhabova d2a87abfb5
Merge pull request #2055 from ONLYOFFICE/fix/print-preview
Fix/print preview
2022-11-15 23:40:14 +03:00
Julia Radzhabova 2a128bc539 [DE] Add quick print button 2022-11-15 21:45:25 +03:00
Julia Radzhabova c4536c0807 [PE] Add paper size. Send print settings to sdk. Enable print preview only for desktop. 2022-11-15 17:54:09 +03:00
Julia Radzhabova 53298b4aab [DE] Fix translation 2022-11-15 17:47:41 +03:00
Julia Radzhabova 24830cb70b [DE] Send print settings to sdk. Enable print preview only for desktop. 2022-11-15 16:45:28 +03:00
maxkadushkin 50bf470a63
Merge pull request #2051 from ONLYOFFICE/fix/refactoringLocks
Refactoring locks
2022-11-14 18:07:03 +03:00
Oleg Korshul a715c720ca Refactoring locks 2022-11-14 18:00:11 +03:00
Julia Radzhabova 6656f45b04
Merge pull request #2038 from ONLYOFFICE/fix/bugfix
[SSE] Fix bug 59466
2022-11-08 16:59:43 +03:00
JuliaSvinareva c0493d45ab [SSE] Fix bug 59466 2022-11-08 16:53:16 +03:00
Julia Radzhabova d499edb1f3
Merge pull request #2036 from ONLYOFFICE/feature/print-preview
Feature/print preview
2022-11-07 23:17:04 +03:00
Julia Radzhabova fcaeb143ba
Merge pull request #2032 from ONLYOFFICE/fix/bugfix
Fix Bug 59592
2022-11-01 16:29:54 +03:00
Julia Radzhabova 1ac0d04f2e Fix Bug 59592 2022-11-01 16:13:30 +03:00
Julia Radzhabova 42b75058c5 [PE] Show print preview 2022-10-27 15:40:52 +03:00
Julia Radzhabova d4aed51fdf [DE] Print preview refactoring 2022-10-27 15:29:06 +03:00
Julia Radzhabova 591cf88d5e [DE] Disable page settings in print preview 2022-10-26 22:13:10 +03:00
Julia Radzhabova 3dffb8a7ba [DE] Fix print preview 2022-10-26 00:22:23 +03:00
Julia Radzhabova e0c8c84c72 [DE] Refactoring custom margins 2022-10-25 23:56:46 +03:00
Julia Radzhabova 0020e55ea0 [DE] Fix pages numbers for printing 2022-10-25 21:40:16 +03:00
Julia Radzhabova d8600b8a2a [DE] Refactoring print preview, hide preview for mac os 2022-10-24 19:02:05 +03:00
Julia Radzhabova 229e55811e [DE] Init preview div 2022-10-24 14:16:34 +03:00
Julia Radzhabova c0fea1c230 [DE] Add print preview panel 2022-10-21 23:22:16 +03:00
papacarlo 645ff855aa Merge branch hotfix/v7.2.1 into master 2022-10-20 13:12:05 +00:00
52 changed files with 2369 additions and 73 deletions

View file

@ -45,7 +45,8 @@ define([
version: '{{PRODUCT_VERSION}}',
eventloading: true,
titlebuttons: true,
uithemes: true
uithemes: true,
quickprint: true,
};
var native = window.desktop || window.AscDesktopEditor;
@ -166,7 +167,8 @@ define([
action: action,
icon: config.icon || undefined,
hint: config.btn.options.hint,
disabled: config.btn.isDisabled()
disabled: config.btn.isDisabled(),
visible: config.visible,
};
};
@ -201,6 +203,7 @@ define([
if ( !!titlebuttons ) {
info.hints = {};
!!titlebuttons['print'] && (info.hints['print'] = titlebuttons['print'].btn.btnEl.attr('data-hint-title'));
!!titlebuttons['quickprint'] && (info.hints['quickprint'] = titlebuttons['quickprint'].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'));
@ -216,6 +219,24 @@ define([
}
}
const _onApplySettings = function (menu) {
if ( !!titlebuttons.quickprint ) {
const var_name = window.SSE ? 'sse-settings-quick-print-button' :
window.PE ? 'pe-settings-quick-print-button' : 'de-settings-quick-print-button';
const is_btn_visible = Common.localStorage.getBool(var_name, false);
if ( titlebuttons.quickprint.visible != is_btn_visible ) {
titlebuttons.quickprint.visible = is_btn_visible;
const obj = {
visible: {
quickprint: is_btn_visible,
}
};
native.execCommand('title:button', JSON.stringify(obj));
}
}
}
return {
init: function (opts) {
_.extend(config, opts);
@ -233,9 +254,45 @@ define([
Common.NotificationCenter.on('document:ready', function () {
if ( config.isEdit ) {
var maincontroller = webapp.getController('Main');
if (maincontroller.api.asc_isReadOnly && maincontroller.api.asc_isReadOnly()) {
maincontroller.warningDocumentIsLocked();
function get_locked_message (t) {
switch (t) {
// case Asc.c_oAscLocalRestrictionType.Nosafe:
case Asc.c_oAscLocalRestrictionType.ReadOnly:
return Common.Locale.get("tipFileReadOnly",{name:"Common.Translation", default: "Document is read only. You can make changes and save its local copy later."});
default: return Common.Locale.get("tipFileLocked",{name:"Common.Translation", default: "Document is locked for editing. You can make changes and save its local copy later."});
}
}
const header = webapp.getController('Viewport').getView('Common.Views.Header');
const api = webapp.getController('Main').api;
const locktype = api.asc_getLocalRestrictions ? api.asc_getLocalRestrictions() : Asc.c_oAscLocalRestrictionType.None;
if ( Asc.c_oAscLocalRestrictionType.None !== locktype ) {
features.readonly = true;
header.setDocumentReadOnly(true);
api.asc_setLocalRestrictions(Asc.c_oAscLocalRestrictionType.None);
(new Common.UI.SynchronizeTip({
extCls: 'no-arrow',
placement: 'bottom',
target: $('.toolbar'),
text: get_locked_message(locktype),
showLink: false,
})).on('closeclick', function () {
this.close();
}).show();
native.execCommand('webapps:features', JSON.stringify(features));
api.asc_registerCallback('asc_onDocumentName', function () {
if ( features.readonly ) {
if ( api.asc_getLocalRestrictions() == Asc.c_oAscLocalRestrictionType.None ) {
features.readonly = false;
header.setDocumentReadOnly(false);
native.execCommand('webapps:features', JSON.stringify(features));
}
}
});
}
}
});
@ -247,7 +304,7 @@ define([
titlebuttons = {};
if ( mode.isEdit ) {
var header = webapp.getController('Viewport').getView('Common.Views.Header');
const header = webapp.getController('Viewport').getView('Common.Views.Header');
if (!!header.btnSave) {
titlebuttons['save'] = {btn: header.btnSave};
@ -258,6 +315,13 @@ define([
if (!!header.btnPrint)
titlebuttons['print'] = {btn: header.btnPrint};
if (!!header.btnPrintQuick) {
titlebuttons['quickprint'] = {
btn: header.btnPrintQuick,
visible: header.btnPrintQuick.isVisible(),
};
}
if (!!header.btnUndo)
titlebuttons['undo'] = {btn: header.btnUndo};
@ -288,6 +352,7 @@ define([
Common.NotificationCenter.on({
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close'),
'modal:hide': _onModalDialog.bind(this, 'hide'),
'uitheme:changed' : function (name) {
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
native.execCommand("uitheme:changed", JSON.stringify({name:'theme-system'}));
@ -312,6 +377,7 @@ define([
menu.hide();
}
},
'settings:apply': _onApplySettings.bind(this),
},
}, {id: 'desktop'});
@ -369,7 +435,10 @@ define([
}
return undefined;
}
},
getDefaultPrinterName: function () {
return nativevars ? nativevars.defaultPrinterName : '';
},
};
};

View file

@ -979,7 +979,7 @@ Common.Utils.warningDocumentIsLocked = function (opts) {
callback: function(btn){
if (btn == 'edit') {
if ( opts.disablefunc ) opts.disablefunc(false);
app.getController('Main').api.asc_setIsReadOnly(false);
app.getController('Main').api.asc_setLocalRestrictions(Asc.c_oAscLocalRestrictionType.None);
}
}
});

View file

@ -81,6 +81,7 @@ define([
'<div class="hedset">' +
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
'<div class="btn-slot" id="slot-hbtn-print"></div>' +
'<div class="btn-slot" id="slot-hbtn-print-quick"></div>' +
'<div class="btn-slot" id="slot-hbtn-download"></div>' +
'</div>' +
'<div class="hedset" data-layout-name="header-users">' +
@ -128,6 +129,7 @@ define([
'<div class="hedset">' +
'<div class="btn-slot" id="slot-btn-dt-save" data-layout-name="header-save"></div>' +
'<div class="btn-slot" id="slot-btn-dt-print"></div>' +
'<div class="btn-slot" id="slot-btn-dt-print-quick"></div>' +
'<div class="btn-slot" id="slot-btn-dt-undo"></div>' +
'<div class="btn-slot" id="slot-btn-dt-redo"></div>' +
'</div>' +
@ -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-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');
}
@ -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-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');
@ -695,6 +709,7 @@ define([
if (idx>0)
this.fileExtention = this.documentCaption.substring(idx);
this.isModified && (value += '*');
this.readOnly && (value += ' (' + this.textReadOnly + ')');
if ( $labelDocName ) {
this.setDocTitle( value );
}
@ -887,6 +902,11 @@ define([
return initials;
},
setDocumentReadOnly: function (readonly) {
this.readOnly = readonly;
this.setDocumentCaption(this.documentCaption);
},
textBack: 'Go to Documents',
txtRename: 'Rename',
txtAccessRights: 'Change access rights',
@ -910,7 +930,9 @@ define([
textAddFavorite: 'Mark as favorite',
textHideNotes: 'Hide Notes',
tipSearch: 'Search',
textShare: 'Share'
textShare: 'Share',
tipPrintQuick: 'Quick print',
textReadOnly: 'Read only'
}
}(), Common.Views.Header || {}))
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

View file

@ -157,6 +157,7 @@ require([
'Main',
'ViewTab',
'Search',
'Print',
'Common.Controllers.Fonts',
'Common.Controllers.History'
/** coauthoring begin **/
@ -191,6 +192,7 @@ require([
'documenteditor/main/app/controller/Main',
'documenteditor/main/app/controller/ViewTab',
'documenteditor/main/app/controller/Search',
'documenteditor/main/app/controller/Print',
'documenteditor/main/app/view/FileMenuPanels',
'documenteditor/main/app/view/ParagraphSettings',
'documenteditor/main/app/view/HeaderFooterSettings',

View file

@ -1249,15 +1249,11 @@ define([
handler: function(dlg, result) {
if (result == 'ok') {
var props = dlg.getSettings();
var mnu = DE.getController('Toolbar').toolbar.btnPageMargins.menu.items[0];
mnu.setVisible(true);
mnu.setChecked(true);
mnu.options.value = mnu.value = [props.get_TopMargin(), props.get_LeftMargin(), props.get_BottomMargin(), props.get_RightMargin()];
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin());
Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin());
Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin());
Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin());
Common.NotificationCenter.trigger('margins:update', props);
me.api.asc_SetSectionProps(props);
me.editComplete();

View file

@ -113,6 +113,7 @@ define([
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem(null, 'history');
}, this));
Common.NotificationCenter.on('file:print', _.bind(this.clickToolbarPrint, this));
},
onLaunch: function() {
@ -549,6 +550,13 @@ define([
this.leftMenu.menuFile.hide();
},
clickToolbarPrint: function () {
if (this.mode.canPreviewPrint)
this.leftMenu.showMenu('file:printpreview');
else if (this.mode.canPrint)
this.clickMenuFileItem(null, 'print');
},
changeToolbarSaveState: function (state) {
var btnSave = this.leftMenu.menuFile.getButton('save');
btnSave && btnSave.setDisabled(state);

View file

@ -1494,6 +1494,9 @@ 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.isDesktopApp;
this.appOptions.canQuickPrint = this.appOptions.canPrint && !Common.Utils.isMac && 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);
@ -1663,6 +1666,9 @@ define([
toolbarController.setMode(this.appOptions);
documentHolder.setMode(this.appOptions);
var printController = app.getController('Print');
printController && this.api && printController.setApi(this.api).setMode(this.appOptions);
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
@ -2460,6 +2466,7 @@ define([
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
this.getApplication().getController('Toolbar').getView().updateMetricUnit();
this.appOptions.canPreviewPrint && this.getApplication().getController('Print').getView('PrintWithPreview').updateMetricUnit();
},
onAdvancedOptions: function(type, advOptions, mode, formatOptions) {
@ -2614,9 +2621,7 @@ define([
onPrint: function() {
if (!this.appOptions.canPrint || Common.Utils.ModalWindow.isVisible()) return;
if (this.api)
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)); // if isChrome or isOpera == true use asc_onPrintUrl event
Common.NotificationCenter.trigger('file:print');
Common.component.Analytics.trackEvent('Print');
},
@ -2649,6 +2654,39 @@ define([
if (url) this.iframePrint.src = url;
},
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var value = Common.localStorage.getBool("de-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("de-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
onClearDummyComment: function() {
this.dontCloseDummyComment = false;
},
@ -3275,7 +3313,8 @@ define([
errorTextFormWrongFormat: 'The value entered does not match the format of the field.',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -0,0 +1,574 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* 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
*
*/
define([
'core',
'documenteditor/main/app/view/FileMenuPanels'
], function () {
'use strict';
DE.Controllers.Print = Backbone.Controller.extend(_.extend({
views: [
'PrintWithPreview'
],
initialize: function() {
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this._state = {
lock_doc: false,
firstPrintPage: 0
};
this._navigationPreview = {
pageCount: false,
currentPage: 0,
currentPreviewPage: 0
};
this._isPreviewVisible = false;
this.addListeners({
'PrintWithPreview': {
'show': _.bind(this.onShowMainSettingsPrint, this),
'render:after': _.bind(this.onAfterRender, this)
}
});
},
onLaunch: function() {
this.printSettings = this.createView('PrintWithPreview');
},
onAfterRender: function(view) {
var me = this;
this.printSettings.menu.on('menu:hide', _.bind(this.onHidePrintMenu, this));
this.printSettings.btnPrint.on('click', _.bind(this.onBtnPrint, this, true));
this.printSettings.btnPrintPdf.on('click', _.bind(this.onBtnPrint, this, false));
this.printSettings.btnPrevPage.on('click', _.bind(this.onChangePreviewPage, this, false));
this.printSettings.btnNextPage.on('click', _.bind(this.onChangePreviewPage, this, true));
this.printSettings.txtNumberPage.on({
'keypress:after': _.bind(this.onKeypressPageNumber, this),
'keyup:after': _.bind(this.onKeyupPageNumber, this)
});
this.printSettings.txtNumberPage.cmpEl.find('input').on('blur', _.bind(this.onBlurPageNumber, this));
this.printSettings.cmbPaperSize.on('selected', _.bind(this.onPaperSizeSelect, this));
this.printSettings.cmbPaperOrientation.on('selected', _.bind(this.onPaperOrientSelect, this));
this.printSettings.cmbPaperMargins.on('selected', _.bind(this.onPaperMarginsSelect, this));
this.printSettings.cmbRange.on('selected', _.bind(this.comboRangeChange, this));
this.printSettings.inputPages.on('changing', _.bind(this.inputPagesChanging, this));
this.printSettings.inputPages.validation = function(value) {
if (!_.isEmpty(value) && /[0-9,\-]/.test(value)) {
var res = [],
arr = value.split(',');
if (me._isPrint && arr.length>1)
return me.txtPrintRangeSingleRange;
for (var i=0; i<arr.length; i++) {
var item = arr[i];
if (!item) // empty
return me.txtPrintRangeInvalid;
var str = item.match(/\-/g);
if (str && str.length>1) // more than 1 symbol '-'
return me.txtPrintRangeInvalid;
if (!str) {// one number
var num = parseInt(item)-1;
(num>=0) && res.push(num);
} else { // range
var pages = item.split('-'),
start = (pages[0] ? parseInt(pages[0])-1 : 0),
end = (pages[1] ? parseInt(pages[1])-1 : me._navigationPreview.pageCount-1);
if (start>end) {
var num = start;
start = end;
end = num;
}
for (var j=start; j<=end; j++) {
(j>=0) && res.push(j);
}
}
}
if (res.length>0) {
me._state.firstPrintPage = res[0];
return true;
}
}
return me.txtPrintRangeInvalid;
};
Common.NotificationCenter.on('window:resize', _.bind(function () {
if (this._isPreviewVisible) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage);
}
}, this));
Common.NotificationCenter.on('margins:update', _.bind(this.onUpdateLastCustomMargins, this));
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
},
setMode: function (mode) {
this.mode = mode;
this.printSettings && this.printSettings.setMode(mode);
},
setApi: function(o) {
this.api = o;
this.api.asc_registerCallback('asc_onDocSize', _.bind(this.onApiPageSize, this));
this.api.asc_registerCallback('asc_onPageOrient', _.bind(this.onApiPageOrient, this));
this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this));
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(this.onCurrentPage, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
return this;
},
findPagePreset: function(w, h) {
var width = (w<h) ? w : h,
height = (w<h) ? h : w;
var panel = this.printSettings;
var store = panel.cmbPaperSize.store,
item = null;
for (var i=0; i<store.length-1; i++) {
var rec = store.at(i),
size = rec.get('size'),
pagewidth = size[0],
pageheight = size[1];
if (Math.abs(pagewidth - width) < 0.1 && Math.abs(pageheight - height) < 0.1) {
item = rec;
break;
}
}
return item ? item.get('caption') : undefined;
},
onApiPageSize: function(w, h) {
this._state.pgsize = [w, h];
if (this.printSettings.isVisible()) {
var width = this._state.pgorient ? w : h,
height = this._state.pgorient ? h : w;
var panel = this.printSettings;
var store = panel.cmbPaperSize.store,
item = null;
for (var i=0; i<store.length-1; i++) {
var rec = store.at(i),
size = rec.get('size'),
pagewidth = size[0],
pageheight = size[1];
if (Math.abs(pagewidth - width) < 0.1 && Math.abs(pageheight - height) < 0.1) {
item = rec;
break;
}
}
if (item)
panel.cmbPaperSize.setValue(item.get('value'));
else
panel.cmbPaperSize.setValue(this.txtCustom + ' (' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(width).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ' x ' +
parseFloat(Common.Utils.Metric.fnRecalcFromMM(height).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ')');
} else {
this.isFillProps = false;
}
},
onApiPageOrient: function(isportrait) {
this._state.pgorient = !!isportrait;
if (this.printSettings.isVisible()) {
var item = this.printSettings.cmbPaperOrientation.store.findWhere({value: this._state.pgorient ? Asc.c_oAscPageOrientation.PagePortrait : Asc.c_oAscPageOrientation.PageLandscape});
if (item) this.printSettings.cmbPaperOrientation.setValue(item.get('value'));
}
},
onSectionProps: function(props) {
if (!props) return;
this._state.sectionprops = props;
if (this.printSettings.isVisible()) {
var left = props.get_LeftMargin(),
top = props.get_TopMargin(),
right = props.get_RightMargin(),
bottom = props.get_BottomMargin();
this._state.pgmargins = [top, left, bottom, right];
var store = this.printSettings.cmbPaperMargins.store,
item = null;
for (var i=0; i<store.length-1; i++) {
var rec = store.at(i),
size = rec.get('size');
if (typeof(size) == 'object' &&
Math.abs(size[0] - top) < 0.1 && Math.abs(size[1] - left) < 0.1 &&
Math.abs(size[2] - bottom) < 0.1 && Math.abs(size[3] - right) < 0.1) {
item = rec;
break;
}
}
if (item)
this.printSettings.cmbPaperMargins.setValue(item.get('value'));
else
this.printSettings.cmbPaperMargins.setValue(this.txtCustom);
}
},
comboRangeChange: function(combo, record) {
if (record.value === -1) {
var me = this;
setTimeout(function(){
me.printSettings.inputPages.focus();
}, 50);
} else {
this.printSettings.inputPages.setValue('');
}
this.printSettings.inputPages.showError();
},
onCountPages: function(count) {
this._navigationPreview.pageCount = count;
if (this._navigationPreview.currentPreviewPage > count - 1) {
this._navigationPreview.currentPreviewPage = Math.max(0, count - 1);
if (this.printSettings.isVisible()) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, count);
}
}
},
onCurrentPage: function(number) {
this._navigationPreview.currentPreviewPage = number;
if (this.printSettings.isVisible()) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, this._navigationPreview.pageCount);
}
},
onShowMainSettingsPrint: function() {
var me = this;
this.printSettings.$previewBox.removeClass('hidden');
this.onUpdateLastCustomMargins(this._state.lastmargins);
this._state.pgsize && this.onApiPageSize(this._state.pgsize[0], this._state.pgsize[1]);
this.onApiPageOrient(this._state.pgorient);
this._state.sectionprops && this.onSectionProps(this._state.sectionprops);
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);
this.api.asc_initPrintPreview('print-preview', opts);
this._navigationPreview.currentPreviewPage = this._navigationPreview.currentPage = this.api.getCurrentPage();
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, this._navigationPreview.pageCount);
this.SetDisabled();
this._isPreviewVisible = true;
},
onPaperSizeSelect: function(combo, record) {
this._state.pgsize = [0, 0];
if (record.value !== -1) {
if (this.checkPageSize(record.size[0], record.size[1])) {
var section = this.api.asc_GetSectionProps();
this.onApiPageSize(section.get_W(), section.get_H());
return;
} else
this.api.change_DocSize(record.size[0], record.size[1]);
} else {
var win, props,
me = this;
win = new DE.Views.PageSizeDialog({
checkPageSize: _.bind(this.checkPageSize, this),
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
me.api.change_DocSize(props[0], props[1]);
Common.NotificationCenter.trigger('edit:complete');
}
}
});
win.show();
win.setSettings(me.api.asc_GetSectionProps());
}
Common.NotificationCenter.trigger('edit:complete');
},
onPaperMarginsSelect: function(combo, record) {
this._state.pgmargins = undefined;
if (record.value !== -1) {
if (this.checkPageSize(undefined, undefined, record.size[1], record.size[3], record.size[0], record.size[2])) {
this.onSectionProps(this.api.asc_GetSectionProps());
return;
} else {
var props = new Asc.CDocumentSectionProps();
props.put_TopMargin(record.size[0]);
props.put_LeftMargin(record.size[1]);
props.put_BottomMargin(record.size[2]);
props.put_RightMargin(record.size[3]);
this.api.asc_SetSectionProps(props);
}
} else {
var win, props,
me = this;
win = new DE.Views.PageMarginsDialog({
api: me.api,
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin());
Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin());
Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin());
Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin());
Common.NotificationCenter.trigger('margins:update', props);
me.api.asc_SetSectionProps(props);
Common.NotificationCenter.trigger('edit:complete');
}
}
});
win.show();
win.setSettings(me.api.asc_GetSectionProps());
}
Common.NotificationCenter.trigger('edit:complete');
},
onUpdateLastCustomMargins: function(props) {
this._state.lastmargins = props;
if (this.printSettings.isVisible()) {
var top = props ? props.get_TopMargin() : Common.localStorage.getItem("de-pgmargins-top"),
left = props ? props.get_LeftMargin() : Common.localStorage.getItem("de-pgmargins-left"),
bottom = props ? props.get_BottomMargin() : Common.localStorage.getItem("de-pgmargins-bottom"),
right = props ? props.get_RightMargin() : Common.localStorage.getItem("de-pgmargins-right");
if ( top!==null && left!==null && bottom!==null && right!==null ) {
var rec = this.printSettings.cmbPaperMargins.store.at(0);
if (rec.get('value')===-2)
rec.set('size', [parseFloat(top), parseFloat(left), parseFloat(bottom), parseFloat(right)]);
else
this.printSettings.cmbPaperMargins.store.unshift({ value: -2, displayValue: this.textMarginsLast, size: [parseFloat(top), parseFloat(left), parseFloat(bottom), parseFloat(right)]});
this.printSettings.cmbPaperMargins.onResetItems();
}
}
},
onPaperOrientSelect: function(combo, record) {
this._state.pgorient = undefined;
if (this.api) {
this.api.change_PageOrient(record.value === Asc.c_oAscPageOrientation.PagePortrait);
}
Common.NotificationCenter.trigger('edit:complete');
},
checkPageSize: function(width, height, left, right, top, bottom) {
var section = this.api.asc_GetSectionProps();
(width===undefined) && (width = parseFloat(section.get_W().toFixed(4)));
(height===undefined) && (height = parseFloat(section.get_H().toFixed(4)));
(left===undefined) && (left = parseFloat(section.get_LeftMargin().toFixed(4)));
(right===undefined) && (right = parseFloat(section.get_RightMargin().toFixed(4)));
(top===undefined) && (top = parseFloat(section.get_TopMargin().toFixed(4)));
(bottom===undefined) && (bottom = parseFloat(section.get_BottomMargin().toFixed(4)));
var gutterLeft = section.get_GutterAtTop() ? 0 : parseFloat(section.get_Gutter().toFixed(4)),
gutterTop = section.get_GutterAtTop() ? parseFloat(section.get_Gutter().toFixed(4)) : 0;
var errmsg = null;
if (left + right + gutterLeft > width-12.7 )
errmsg = this.txtMarginsW;
else if (top + bottom + gutterTop > height-2.6 )
errmsg = this.txtMarginsH;
if (errmsg) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg : errmsg,
callback: function() {
Common.NotificationCenter.trigger('edit:complete');
}
});
return true;
}
},
getPrintParams: function() {
return this.adjPrintParams;
},
onHidePrintMenu: function () {
if (this._isPreviewVisible) {
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview();
this._isPreviewVisible = false;
}
},
onChangePreviewPage: function (next) {
var index = this._navigationPreview.currentPreviewPage;
if (next) {
index++;
index = Math.min(index, this._navigationPreview.pageCount - 1);
} else {
index--;
index = Math.max(index, 0);
}
this.api.goToPage(index);
},
onKeypressPageNumber: function (input, e) {
if (e.keyCode === Common.UI.Keys.RETURN) {
var box = this.printSettings.$el.find('#print-number-page'),
edit = box.find('input[type=text]'), page = parseInt(edit.val());
if (!page || page > this._navigationPreview.pageCount || page < 0) {
edit.select();
this.printSettings.txtNumberPage.setValue(this._navigationPreview.currentPreviewPage + 1);
this.printSettings.txtNumberPage.checkValidate();
return false;
}
box.focus(); // for IE
this.api.goToPage(page-1);
this.api.asc_enableKeyEvents(true);
return false;
}
},
onKeyupPageNumber: function (input, e) {
if (e.keyCode === Common.UI.Keys.ESC) {
var box = this.printSettings.$el.find('#print-number-page');
box.focus(); // for IE
this.api.asc_enableKeyEvents(true);
return false;
}
},
onBlurPageNumber: function () {
if (this.printSettings.txtNumberPage.getValue() != this._navigationPreview.currentPreviewPage + 1) {
this.printSettings.txtNumberPage.setValue(this._navigationPreview.currentPreviewPage + 1);
this.printSettings.txtNumberPage.checkValidate();
}
},
onPreviewWheel: function (e) {
if (e.ctrlKey) {
e.preventDefault();
e.stopImmediatePropagation();
}
var forward = (e.deltaY || (e.detail && -e.detail) || e.wheelDelta) < 0;
this.onChangePreviewPage(forward);
},
updateNavigationButtons: function (page, count) {
this._navigationPreview.currentPage = page;
this.printSettings.updateCurrentPage(page);
this._navigationPreview.pageCount = count;
this.printSettings.updateCountOfPages(count);
this.disableNavButtons();
},
disableNavButtons: function (force) {
if (force) {
this.printSettings.btnPrevPage.setDisabled(true);
this.printSettings.btnNextPage.setDisabled(true);
return;
}
var curPage = this._navigationPreview.currentPage,
pageCount = this._navigationPreview.pageCount;
this.printSettings.btnPrevPage.setDisabled(curPage < 1);
this.printSettings.btnNextPage.setDisabled(curPage > pageCount - 2);
},
onBtnPrint: function(print) {
this._isPrint = print;
if (this.printSettings.cmbRange.getValue()===-1 && this.printSettings.inputPages.checkValidate() !== true) {
this.printSettings.inputPages.focus();
this.isInputFirstChange = true;
return;
}
if (this.printSettings.cmbRange.getValue()==='all')
this._state.firstPrintPage = 0;
else if (this.printSettings.cmbRange.getValue()==='current')
this._state.firstPrintPage = this._navigationPreview.currentPage;
var size = this.api.asc_getPageSize(this._state.firstPrintPage);
this.adjPrintParams.asc_setNativeOptions({
pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(),
paperSize: {
w: size ? size['W'] : undefined,
h: size ? size['H'] : undefined,
preset: size ? this.findPagePreset(size['W'], size['H']) : undefined
},
paperOrientation: size ? (size['H'] > size['W'] ? 'portrait' : 'landscape') : null
});
this.printSettings.menu.hide();
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);
this.api.asc_Print(opts);
} else {
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_DownloadAs(opts);
}
},
inputPagesChanging: function (input, value) {
this.isInputFirstChange && this.printSettings.inputPages.showError();
this.isInputFirstChange = false;
if (value.length<1)
this.printSettings.cmbRange.setValue('all');
else if (this.printSettings.cmbRange.getValue()!==-1)
this.printSettings.cmbRange.setValue(-1);
},
onApiLockDocumentProps: function() {
this._state.lock_doc = true;
this.SetDisabled();
},
onApiUnLockDocumentProps: function() {
this._state.lock_doc = false;
this.SetDisabled();
},
SetDisabled: function() {
if (this.printSettings.isVisible()) {
var disable = !this.mode.isEdit || this._state.lock_doc;
this.printSettings.cmbPaperSize.setDisabled(disable);
this.printSettings.cmbPaperMargins.setDisabled(disable);
this.printSettings.cmbPaperOrientation.setDisabled(disable);
}
},
txtCustom: 'Custom',
txtPrintRangeInvalid: 'Invalid print range',
textMarginsLast: 'Last Custom',
txtPrintRangeSingleRange: 'Enter either a single page number or a single page range (for example, 5-12). Or you can Print to PDF.'
}, DE.Controllers.Print || {}));
});

View file

@ -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();
},
@ -1057,9 +1061,7 @@ define([
},
onPrint: function(e) {
if (this.api)
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)); // if isChrome or isOpera == true use asc_onPrintUrl event
Common.NotificationCenter.trigger('file:print', this.toolbar);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('Print');
@ -1748,15 +1750,11 @@ define([
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
var mnu = me.toolbar.btnPageMargins.menu.items[0];
mnu.setVisible(true);
mnu.setChecked(true);
mnu.options.value = mnu.value = [props.get_TopMargin(), props.get_LeftMargin(), props.get_BottomMargin(), props.get_RightMargin()];
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin());
Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin());
Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin());
Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin());
Common.NotificationCenter.trigger('margins:update', props);
me.api.asc_SetSectionProps(props);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);

View file

@ -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,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.getBool("de-settings-quick-print-button", true);
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 +106,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 +263,21 @@ define([
me.header.lockHeaderBtns( 'users', _need_disable );
},
applySettings: function () {
var value = Common.localStorage.getBool("de-settings-quick-print-button", true);
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);

View file

@ -8,6 +8,7 @@
<li id="fm-btn-save-copy" class="fm-btn"></li>
<li id="fm-btn-save-desktop" class="fm-btn"></li>
<li id="fm-btn-print" class="fm-btn"></li>
<li id="fm-btn-print-with-preview" class="fm-btn"></li>
<li id="fm-btn-rename" class="fm-btn"></li>
<li id="fm-btn-protect" class="fm-btn"></li>
<li class="devider"></li>
@ -34,4 +35,5 @@
<div id="panel-settings" class="content-box"></div>
<div id="panel-help" class="content-box"></div>
<div id="panel-protect" class="content-box"></div>
<div id="panel-print" class="content-box"></div>
</div>

View file

@ -732,9 +732,9 @@ define([
me.menuImgPrint.setDisabled(!cancopy);
var lockreview = Common.Utils.InternalSettings.get("de-accept-reject-lock");
me.menuImgAccept.setVisible(!lockreview);
me.menuImgReject.setVisible(!lockreview);
menuImgReviewSeparator.setVisible(!lockreview);
me.menuImgAccept.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
me.menuImgReject.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
menuImgReviewSeparator.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
var signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined,
isInSign = !!signGuid;
@ -1302,9 +1302,9 @@ define([
me.menuTablePrint.setDisabled(!cancopy);
var lockreview = Common.Utils.InternalSettings.get("de-accept-reject-lock");
me.menuTableAccept.setVisible(!lockreview);
me.menuTableReject.setVisible(!lockreview);
menuTableReviewSeparator.setVisible(!lockreview);
me.menuTableAccept.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
me.menuTableReject.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
menuTableReviewSeparator.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
// bullets & numbering
var listId = me.api.asc_GetCurrentNumberingId(),
@ -1914,9 +1914,9 @@ define([
me.menuParaPrint.setDisabled(!cancopy);
var lockreview = Common.Utils.InternalSettings.get("de-accept-reject-lock");
me.menuParaAccept.setVisible(!lockreview);
me.menuParaReject.setVisible(!lockreview);
menuParaReviewSeparator.setVisible(!lockreview);
me.menuParaAccept.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
me.menuParaReject.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
menuParaReviewSeparator.setVisible(me.mode.canReview && !me.mode.isReviewOnly && !lockreview);
// spellCheck
var spell = (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);

View file

@ -158,6 +158,17 @@ define([
dataHintOffset: [2, 14]
});
this.miPrintWithPreview = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-print-with-preview'),
action : 'printpreview',
caption : this.btnPrintCaption,
canFocused: false,
dataHint: 1,
dataHintDirection: 'left-top',
dataHintOffset: [2, 14],
dataHintTitle: 'P'
});
this.miPrint = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-print'),
action : 'print',
@ -292,6 +303,7 @@ define([
this.miSaveCopyAs,
this.miSaveAs,
this.miPrint,
this.miPrintWithPreview,
this.miRename,
this.miProtect,
this.miRecent,
@ -381,7 +393,8 @@ define([
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miPrint[this.mode.canPrint && !this.mode.canPreviewPrint ?'show':'hide']();
this.miPrintWithPreview[this.mode.canPreviewPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || this.mode.canProtect ||
@ -463,6 +476,12 @@ define([
this.panels['help'].setLangConfig(this.mode.lang);
}
if (this.mode.canPreviewPrint) {
var printPanel = DE.getController('Print').getView('PrintWithPreview');
printPanel.menu = this;
!this.panels['printpreview'] && (this.panels['printpreview'] = printPanel.render(this.$el.find('#panel-print')));
}
if ( Common.Controllers.Desktop.isActive() ) {
$('<li id="fm-btn-local-open" class="fm-btn"/>').insertAfter($('#fm-btn-recent', this.$el));
this.items.push(

View file

@ -341,6 +341,12 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr class="quick-print">',
'<td colspan="2"><div style="display: flex;"><div id="fms-chb-quick-print"></div>',
'<span style ="display: flex; flex-direction: column;"><label><%= scope.txtQuickPrint %></label>',
'<label class="comment-text"><%= scope.txtQuickPrintTip %></label></span></div>',
'</td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td>',
@ -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.setBool("de-settings-quick-print-button", this.chQuickPrint.isChecked());
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({
@ -2329,4 +2350,340 @@ define([
}, DE.Views.FileMenuPanels.ProtectDoc || {}));
DE.Views.PrintWithPreview = Common.UI.BaseView.extend(_.extend({
el: '#panel-print',
menu: undefined,
template: _.template([
'<div style="width:100%; height:100%; position: relative;">',
'<div id="id-print-settings" class="no-padding">',
'<div class="print-settings">',
'<div class="flex-settings ps-container oo settings-container">',
'<table style="width: 100%;">',
'<tbody>',
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>',
'<tr><td class="padding-small"><div id="print-combo-range" style="width: 248px;"></div></td></tr>',
'<tr><td class="padding-large">',
'<table style="width: 100%;"><tbody><tr>',
'<td><%= scope.txtPages %></td><td><div id="print-txt-pages" style="width: 100%;padding-left: 5px;"></div></td>',
'</tr></tbody></table>',
'</td></tr>',
'<tr><td><label class="header"><%= scope.txtPageSize %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-pages" style="width: 248px;"></div></td></tr>',
'<tr><td><label class="header"><%= scope.txtPageOrientation %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-orient" style="width: 150px;"></div></td></tr>',
'<tr><td><label class="header"><%= scope.txtMargins %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-margins" style="width: 248px;"></div></td></tr>',
'<tr class="fms-btn-apply"><td>',
'<div class="footer justify">',
'<button id="print-btn-print" class="btn normal dlg-btn primary" result="print" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button>',
'<button id="print-btn-print-pdf" class="btn normal dlg-btn" result="pdf" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrintPdf %></button>',
'</div>',
'</td></tr>',
'</tbody>',
'</table>',
'</div>',
'</div>',
'</div>',
'<div id="print-preview-box" style="position: absolute; left: 280px; top: 0; right: 0; bottom: 0;" class="no-padding">',
'<div id="print-preview"></div>',
'<div id="print-navigation">',
'<div id="print-prev-page" style="display: inline-block; margin-right: 4px;"></div>',
'<div id="print-next-page" style="display: inline-block;"></div>',
'<div class="page-number">',
'<label><%= scope.txtPage %></label>',
'<div id="print-number-page"></div>',
'<label id="print-count-page"><%= scope.txtOf %></label>',
'</div>',
'</div>',
'</div>',
'</div>'
].join('')),
initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.menu = options.menu;
this._initSettings = true;
},
render: function(node) {
var me = this;
var $markup = $(this.template({scope: this}));
this.cmbRange = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-range'),
menuStyle: 'min-width: 248px;max-height: 280px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ 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'),
allowBlank: true,
validateOnChange: true,
validateOnBlur: false,
maskExp: /[0-9,\-]/,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.cmbPaperSize = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-pages'),
menuStyle: 'max-height: 280px; min-width: 248px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: 0, displayValue:'US Letter (21,59cm x 27,94cm)', caption: 'US Letter', size: [215.9, 279.4]},
{ value: 1, displayValue:'US Legal (21,59cm x 35,56cm)', caption: 'US Legal', size: [215.9, 355.6]},
{ value: 2, displayValue:'A4 (21cm x 29,7cm)', caption: 'A4', size: [210, 297]},
{ value: 3, displayValue:'A5 (14,8cm x 21cm)', caption: 'A5', size: [148, 210]},
{ value: 4, displayValue:'B5 (17,6cm x 25cm)', caption: 'B5', size: [176, 250]},
{ value: 5, displayValue:'Envelope #10 (10,48cm x 24,13cm)', caption: 'Envelope #10', size: [104.8, 241.3]},
{ value: 6, displayValue:'Envelope DL (11cm x 22cm)', caption: 'Envelope DL', size: [110, 220]},
{ value: 7, displayValue:'Tabloid (27,94cm x 43,18cm)', caption: 'Tabloid', size: [279.4, 431.8]},
{ value: 8, displayValue:'A3 (29,7cm x 42cm)', caption: 'A3', size: [297, 420]},
{ value: 9, displayValue:'Tabloid Oversize (30,48cm x 45,71cm)', caption: 'Tabloid Oversize', size: [304.8, 457.1]},
{ value: 10, displayValue:'ROC 16K (19,68cm x 27,3cm)', caption: 'ROC 16K', size: [196.8, 273]},
{ value: 11, displayValue:'Envelope Choukei 3 (11,99cm x 23,49cm)', caption: 'Envelope Choukei 3', size: [119.9, 234.9]},
{ value: 12, displayValue:'Super B/A3 (33,02cm x 48,25cm)', caption: 'Super B/A3', size: [330.2, 482.5]},
{ value: 13, displayValue:'A4 (84,1cm x 118,9cm)', caption: 'A0', size: [841, 1189]},
{ value: 14, displayValue:'A4 (59,4cm x 84,1cm)', caption: 'A1', size: [594, 841]},
{ value: 16, displayValue:'A4 (42cm x 59,4cm)', caption: 'A2', size: [420, 594]},
{ value: 17, displayValue:'A4 (10,5cm x 14,8cm)', caption: 'A6', size: [105, 148]},
{ value: -1, displayValue: this.txtCustom, caption: this.txtCustom, size: []}
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbPaperOrientation = new Common.UI.ComboBox({
el : $markup.findById('#print-combo-orient'),
menuStyle : 'min-width: 150px;',
editable : false,
takeFocusOnClose: true,
cls : 'input-group-nr',
data : [
{ value: Asc.c_oAscPageOrientation.PagePortrait, displayValue: this.txtPortrait },
{ value: Asc.c_oAscPageOrientation.PageLandscape, displayValue: this.txtLandscape }
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbPaperMargins = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-margins'),
menuStyle: 'max-height: 280px; min-width: 248px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: 0, displayValue: this.textMarginsNormal, size: [20, 30, 20, 15]},
{ value: 1, displayValue: this.textMarginsUsNormal, size: [25.4, 25.4, 25.4, 25.4]},
{ value: 2, displayValue: this.textMarginsNarrow, size: [12.7, 12.7, 12.7, 12.7]},
{ value: 3, displayValue: this.textMarginsModerate, size: [25.4, 19.1, 25.4, 19.1]},
{ value: 4, displayValue: this.textMarginsWide, size: [25.4, 50.8, 25.4, 50.8]},
{ value: -1, displayValue: this.txtCustom, size: null}
],
itemsTemplate: _.template([
'<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%- item.value %>"><a tabindex="-1" type="menuitem">',
'<div><b><%= scope.getDisplayValue(item) %></b></div>',
'<% if (item.size !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
'<label style="display: block;">' + this.txtTop + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtLeft + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">' + this.txtBottom + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.txtRight + ': <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.size[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div>' +
'<% } %>',
'<% }); %>'
].join('')),
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
this.pnlTable = $(this.pnlSettings.find('table')[0]);
this.trApply = $markup.find('.fms-btn-apply');
this.btnPrint = new Common.UI.Button({
el: $markup.findById('#print-btn-print')
});
this.btnPrintPdf = new Common.UI.Button({
el: $markup.findById('#print-btn-print-pdf')
});
this.btnPrevPage = new Common.UI.Button({
parentEl: $markup.findById('#print-prev-page'),
cls: 'btn-prev-page',
iconCls: 'arrow',
dataHint: '2',
dataHintDirection: 'top'
});
this.btnNextPage = new Common.UI.Button({
parentEl: $markup.findById('#print-next-page'),
cls: 'btn-next-page',
iconCls: 'arrow',
dataHint: '2',
dataHintDirection: 'top'
});
this.countOfPages = $markup.findById('#print-count-page');
this.txtNumberPage = new Common.UI.InputField({
el: $markup.findById('#print-number-page'),
allowBlank: true,
validateOnChange: true,
style: 'width: 50px;',
maskExp: /[0-9]/,
validation: function(value) {
if (/(^[0-9]+$)/.test(value)) {
value = parseInt(value);
if (undefined !== value && value > 0 && value <= me.pageCount)
return true;
}
return me.txtPageNumInvalid;
},
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.$el = $(node).html($markup);
this.$previewBox = $('#print-preview-box');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: this.pnlSettings,
suppressScrollX: true,
alwaysVisibleY: true
});
}
Common.NotificationCenter.on({
'window:resize': function() {
me.isVisible() && me.updateScroller();
}
});
this.updateMetricUnit();
this.fireEvent('render:after', this);
return this;
},
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
if (this._initSettings) {
this.updateMetricUnit();
this._initSettings = false;
}
this.updateScroller();
this.fireEvent('show', this);
},
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height();
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
this.scroller.update();
}
},
setMode: function(mode) {
this.mode = mode;
},
setApi: function(api) {
},
updateMetricUnit: function() {
if (!this.cmbPaperSize) return;
var store = this.cmbPaperSize.store;
for (var i=0; i<store.length-1; i++) {
var item = store.at(i),
size = item.get('size'),
pagewidth = size[0],
pageheight = size[1];
item.set('displayValue', item.get('caption') + ' (' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(pagewidth).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ' x ' +
parseFloat(Common.Utils.Metric.fnRecalcFromMM(pageheight).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ')');
}
this.cmbPaperSize.onResetItems();
this.cmbPaperMargins.onResetItems();
},
isVisible: function() {
return (this.$el || $(this.el)).is(":visible");
},
setRange: function(value) {
this.cmbRange.setValue(value);
},
getRange: function() {
return this.cmbRange.getValue();
},
updateCountOfPages: function (count) {
this.countOfPages.text(
Common.Utils.String.format(this.txtOf, count)
);
this.pageCount = count;
},
updateCurrentPage: function (index) {
this.txtNumberPage.setValue(index + 1);
},
txtPrint: 'Print',
txtPrintPdf: 'Print to PDF',
txtPrintRange: 'Print range',
txtCurrentPage: 'Current page',
txtAllPages: 'All pages',
txtSelection: 'Selection',
txtCustomPages: 'Custom print',
txtPageSize: 'Page size',
txtPageOrientation: 'Page orientation',
txtPortrait: 'Portrait',
txtLandscape: 'Landscape',
txtCustom: 'Custom',
txtMargins: 'Margins',
txtTop: 'Top',
txtBottom: 'Bottom',
txtLeft: 'Left',
txtRight: 'Right',
txtPage: 'Page',
txtOf: 'of {0}',
txtPageNumInvalid: 'Page number invalid',
txtPages: 'Pages',
textMarginsLast: 'Last Custom',
textMarginsNormal: 'Normal',
textMarginsUsNormal: 'US Normal',
textMarginsNarrow: 'Narrow',
textMarginsModerate: 'Moderate',
textMarginsWide: 'Wide'
}, DE.Views.PrintWithPreview || {}));
});

View file

@ -1628,17 +1628,8 @@ define([
me.setTab('home');
var top = Common.localStorage.getItem("de-pgmargins-top"),
left = Common.localStorage.getItem("de-pgmargins-left"),
bottom = Common.localStorage.getItem("de-pgmargins-bottom"),
right = Common.localStorage.getItem("de-pgmargins-right");
if ( top!==null && left!==null && bottom!==null && right!==null ) {
var mnu = this.btnPageMargins.menu.items[0];
mnu.options.value = mnu.value = [parseFloat(top), parseFloat(left), parseFloat(bottom), parseFloat(right)];
mnu.setVisible(true);
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
} else
this.btnPageMargins.menu.items[0].setVisible(false);
me.onUpdateLastCustomMargins();
Common.NotificationCenter.on('margins:update', _.bind(me.onUpdateLastCustomMargins, me));
}
if ( me.isCompactView )
@ -2643,6 +2634,22 @@ define([
this.api.asc_RemoveAllCustomStyles();
},
onUpdateLastCustomMargins: function(props) {
if (!this.btnPageMargins) return;
var top = props ? props.get_TopMargin() : Common.localStorage.getItem("de-pgmargins-top"),
left = props ? props.get_LeftMargin() : Common.localStorage.getItem("de-pgmargins-left"),
bottom = props ? props.get_BottomMargin() : Common.localStorage.getItem("de-pgmargins-bottom"),
right = props ? props.get_RightMargin() : Common.localStorage.getItem("de-pgmargins-right");
if ( top!==null && left!==null && bottom!==null && right!==null ) {
var mnu = this.btnPageMargins.menu.items[0];
mnu.options.value = mnu.value = [parseFloat(top), parseFloat(left), parseFloat(bottom), parseFloat(right)];
mnu.setVisible(true);
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
} else
this.btnPageMargins.menu.items[0].setVisible(false);
},
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.lockControls);
},

View file

@ -147,6 +147,7 @@ require([
'Main',
'ViewTab',
'Search',
'Print',
'Common.Controllers.Fonts',
'Common.Controllers.History'
/** coauthoring begin **/
@ -181,6 +182,7 @@ require([
'documenteditor/main/app/controller/Main',
'documenteditor/main/app/controller/ViewTab',
'documenteditor/main/app/controller/Search',
'documenteditor/main/app/controller/Print',
'documenteditor/main/app/view/FileMenuPanels',
'documenteditor/main/app/view/ParagraphSettings',
'documenteditor/main/app/view/HeaderFooterSettings',

View file

@ -126,6 +126,8 @@
"Common.define.chartData.textStock": "Stock",
"Common.define.chartData.textSurface": "Surface",
"Common.Translation.textMoreButton": "More",
"Common.Translation.tipFileLocked": "Document is locked for editing. You can make changes and save it as local copy later.",
"Common.Translation.tipFileReadOnly": "The file is read-only. To keep your changes, save the file with a new name or in a different location.",
"Common.Translation.warnFileLocked": "You can't edit this file because it's being edited in another app.",
"Common.Translation.warnFileLockedBtnEdit": "Create a copy",
"Common.Translation.warnFileLockedBtnView": "Open for viewing",
@ -319,6 +321,8 @@
"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.Header.textReadOnly": "Read only",
"Common.Views.History.textCloseHistory": "Close History",
"Common.Views.History.textHide": "Collapse",
"Common.Views.History.textHideAll": "Hide detailed changes",
@ -938,6 +942,7 @@
"DE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"DE.Controllers.Main.textUndo": "Undo",
"DE.Controllers.Main.textContinue": "Continue",
"DE.Controllers.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"DE.Controllers.Navigation.txtBeginning": "Beginning of document",
"DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document",
"DE.Controllers.Search.notcriticalErrorTitle": "Warning",
@ -951,6 +956,10 @@
"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.Print.txtPrintRangeSingleRange": "Enter either a single page number or a single page range (for example, 5-12). Or you can Print to PDF.",
"DE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
"DE.Controllers.Toolbar.dataUrl": "Paste a data URL",
"DE.Controllers.Toolbar.notcriticalErrorTitle": "Warning",
@ -1840,6 +1849,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",
@ -2384,6 +2395,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",

View file

@ -126,6 +126,8 @@
"Common.define.chartData.textStock": "Биржевая",
"Common.define.chartData.textSurface": "Поверхность",
"Common.Translation.textMoreButton": "Ещё",
"Common.Translation.tipFileLocked": "Документ заблокирован на редактирование. Вы можете внести изменения и сохранить его как локальную копию позже.",
"Common.Translation.tipFileReadOnly": "Файл доступен только для чтения. Чтобы сохранить изменения, сохраните файл с новым названием или в другом месте.",
"Common.Translation.warnFileLocked": "Вы не можете редактировать этот файл, потому что он уже редактируется в другом приложении.",
"Common.Translation.warnFileLockedBtnEdit": "Создать копию",
"Common.Translation.warnFileLockedBtnView": "Открыть на просмотр",
@ -303,6 +305,7 @@
"Common.Views.Header.textCompactView": "Скрыть панель инструментов",
"Common.Views.Header.textHideLines": "Скрыть линейки",
"Common.Views.Header.textHideStatusBar": "Скрыть строку состояния",
"Common.Views.Header.textReadOnly": "Только чтение",
"Common.Views.Header.textRemoveFavorite": "Удалить из избранного",
"Common.Views.Header.textShare": "Доступ",
"Common.Views.Header.textZoom": "Масштаб",
@ -310,6 +313,7 @@
"Common.Views.Header.tipDownload": "Скачать файл",
"Common.Views.Header.tipGoEdit": "Редактировать текущий файл",
"Common.Views.Header.tipPrint": "Напечатать файл",
"Common.Views.Header.tipPrintQuick": "Быстрая печать",
"Common.Views.Header.tipRedo": "Повторить",
"Common.Views.Header.tipSave": "Сохранить",
"Common.Views.Header.tipSearch": "Поиск",
@ -647,6 +651,7 @@
"DE.Controllers.Main.textClose": "Закрыть",
"DE.Controllers.Main.textCloseTip": "Щелкните, чтобы закрыть эту подсказку",
"DE.Controllers.Main.textContactUs": "Связаться с отделом продаж",
"DE.Controllers.Main.textContinue": "Продолжить",
"DE.Controllers.Main.textConvertEquation": "Это уравнение создано в старой версии редактора уравнений, которая больше не поддерживается. Чтобы изменить это уравнение, его необходимо преобразовать в формат Office Math ML.<br>Преобразовать сейчас?",
"DE.Controllers.Main.textCustomLoader": "Обратите внимание, что по условиям лицензии у вас нет прав изменять экран, отображаемый при загрузке.<br>Пожалуйста, обратитесь в наш отдел продаж, чтобы сделать запрос.",
"DE.Controllers.Main.textDisconnect": "Соединение потеряно",
@ -665,8 +670,10 @@
"DE.Controllers.Main.textRequestMacros": "Макрос делает запрос на URL. Вы хотите разрешить запрос на %1?",
"DE.Controllers.Main.textShape": "Фигура",
"DE.Controllers.Main.textStrict": "Строгий режим",
"DE.Controllers.Main.textTryQuickPrint": "Вы выбрали быструю печать: весь документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию.<br>Вы хотите продолжить?",
"DE.Controllers.Main.textTryUndoRedo": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.<br>Нажмите на кнопку 'Строгий режим' для переключения в Строгий режим совместного редактирования, чтобы редактировать файл без вмешательства других пользователей и отправлять изменения только после того, как вы их сохраните. Переключаться между режимами совместного редактирования можно с помощью Дополнительных параметров редактора.",
"DE.Controllers.Main.textTryUndoRedoWarn": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.",
"DE.Controllers.Main.textUndo": "Отменить",
"DE.Controllers.Main.titleLicenseExp": "Истек срок действия лицензии",
"DE.Controllers.Main.titleServerVersion": "Редактор обновлен",
"DE.Controllers.Main.titleUpdateVersion": "Версия изменилась",
@ -937,6 +944,10 @@
"DE.Controllers.Main.warnProcessRightsChange": "Вам было отказано в праве на редактирование этого файла.",
"DE.Controllers.Navigation.txtBeginning": "Начало документа",
"DE.Controllers.Navigation.txtGotoBeginning": "Перейти в начало документа",
"DE.Controllers.Print.textMarginsLast": "Последние настраиваемые",
"DE.Controllers.Print.txtCustom": "Пользовательское",
"DE.Controllers.Print.txtPrintRangeInvalid": "Неправильный диапазон печати",
"DE.Controllers.Print.txtPrintRangeSingleRange": "Введите или один номер страницы, или один диапазон страниц (например, 5-12). Или вы можете выбрать печать в PDF.",
"DE.Controllers.Search.notcriticalErrorTitle": "Внимание",
"DE.Controllers.Search.textNoTextFound": "Искомые данные не найдены. Пожалуйста, измените параметры поиска.",
"DE.Controllers.Search.textReplaceSkipped": "Замена выполнена. Пропущено вхождений - {0}.",
@ -1824,6 +1835,8 @@
"DE.Views.FileMenuPanels.Settings.txtNone": "Никакие",
"DE.Views.FileMenuPanels.Settings.txtProofing": "Правописание",
"DE.Views.FileMenuPanels.Settings.txtPt": "Пункт",
"DE.Views.FileMenuPanels.Settings.txtQuickPrint": "Показывать кнопку Быстрая печать в шапке редактора",
"DE.Views.FileMenuPanels.Settings.txtQuickPrintTip": "Документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию",
"DE.Views.FileMenuPanels.Settings.txtRunMacros": "Включить все",
"DE.Views.FileMenuPanels.Settings.txtRunMacrosDesc": "Включить все макросы без уведомления",
"DE.Views.FileMenuPanels.Settings.txtShowTrackChanges": "Показывать изменения при рецензировании",
@ -2073,6 +2086,7 @@
"DE.Views.LeftMenu.tipComments": "Комментарии",
"DE.Views.LeftMenu.tipNavigation": "Навигация",
"DE.Views.LeftMenu.tipOutline": "Заголовки",
"DE.Views.LeftMenu.tipPageThumbnails": "Эскизы страниц",
"DE.Views.LeftMenu.tipPlugins": "Плагины",
"DE.Views.LeftMenu.tipSearch": "Поиск",
"DE.Views.LeftMenu.tipSupport": "Обратная связь и поддержка",
@ -2380,6 +2394,33 @@
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Задать только верхнюю границу",
"DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Авто",
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "Без границ",
"DE.Views.PrintWithPreview.textMarginsLast": "Последние настраиваемые",
"DE.Views.PrintWithPreview.textMarginsModerate": "Средние",
"DE.Views.PrintWithPreview.textMarginsNarrow": "Узкие",
"DE.Views.PrintWithPreview.textMarginsNormal": "Обычные",
"DE.Views.PrintWithPreview.textMarginsUsNormal": "Обычные (американский стандарт)",
"DE.Views.PrintWithPreview.textMarginsWide": "Широкие",
"DE.Views.PrintWithPreview.txtAllPages": "Все страницы",
"DE.Views.PrintWithPreview.txtBottom": "Нижнее",
"DE.Views.PrintWithPreview.txtCurrentPage": "Текущая страница",
"DE.Views.PrintWithPreview.txtCustom": "Пользовательское",
"DE.Views.PrintWithPreview.txtCustomPages": "Настраиваемая печать",
"DE.Views.PrintWithPreview.txtLandscape": "Альбомная",
"DE.Views.PrintWithPreview.txtLeft": "Левое",
"DE.Views.PrintWithPreview.txtMargins": "Поля",
"DE.Views.PrintWithPreview.txtOf": "из {0}",
"DE.Views.PrintWithPreview.txtPage": "Страница",
"DE.Views.PrintWithPreview.txtPageNumInvalid": "Неправильный номер страницы",
"DE.Views.PrintWithPreview.txtPageOrientation": "Ориентация страницы",
"DE.Views.PrintWithPreview.txtPages": "Страницы",
"DE.Views.PrintWithPreview.txtPageSize": "Размер страницы",
"DE.Views.PrintWithPreview.txtPortrait": "Книжная",
"DE.Views.PrintWithPreview.txtPrint": "Печать",
"DE.Views.PrintWithPreview.txtPrintPdf": "Печать в PDF",
"DE.Views.PrintWithPreview.txtPrintRange": "Диапазон печати",
"DE.Views.PrintWithPreview.txtRight": "Правое",
"DE.Views.PrintWithPreview.txtSelection": "Выделенный фрагмент",
"DE.Views.PrintWithPreview.txtTop": "Верхнее",
"DE.Views.RightMenu.txtChartSettings": "Параметры диаграммы",
"DE.Views.RightMenu.txtFormSettings": "Параметры формы",
"DE.Views.RightMenu.txtHeaderFooterSettings": "Параметры верхнего и нижнего колонтитулов",

View file

@ -524,3 +524,110 @@ table {
}
}
}
#file-menu-panel {
#panel-print {
padding: 0;
#id-print-settings {
position: absolute;
width:280px;
top: 0;
bottom: 0;
}
.print-settings {
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
border-right: @scaled-one-px-value-ie solid @border-toolbar-ie;
border-right: @scaled-one-px-value solid @border-toolbar;
label.header {
font-weight: 700;
}
.footer {
.btn.primary {
margin-right: 8px;
}
}
.settings-container {
width: 100%;
height: 100%;
overflow: hidden;
padding: 12px 16px;
.padding-small {
padding-bottom: 8px;
}
.padding-large {
padding-bottom: 16px;
}
#print-apply-all {
margin-top: 5px;
}
.link {
margin-top: 9px;
}
.footer {
margin-top: 24px;
}
}
}
#print-navigation {
height: 50px;
padding-left: 20px;
padding-top: 10px;
display: flex;
.btn-prev-page, .btn-next-page {
background-color: transparent;
padding: 0;
height: 20px;
width: 20px;
i.arrow {
display: inline-block;
width: 10px;
height: 10px;
border: solid @scaled-one-px-value-ie @icon-normal-ie;
border: solid @scaled-one-px-value @icon-normal;
border-bottom: none;
border-right: none;
}
&.disabled {
opacity: @component-disabled-opacity;
}
&:hover:not(:disabled):not(.disabled) {
background-color: @highlight-button-hover-ie;
background-color: @highlight-button-hover;
}
}
.btn-prev-page {
i {
transform: rotate(-45deg) translate(-1px, 3px);
}
}
.btn-next-page {
i {
transform: rotate(135deg) translate(4px, 0px);
}
}
.page-number {
display: flex;
align-items: center;
height: 20px;
margin-left: 10px;
label {
.font-weight-bold();
}
#print-count-page, #print-number-page {
margin-left: 4px;
}
}
}
#print-preview {
height: calc(100% - 50px);
}
}
}

View file

@ -4,7 +4,7 @@ const EditorUIController = () => {
};
EditorUIController.isSupportEditFeature = () => {
return false
return true
};
EditorUIController.getToolbarOptions = () => {

View file

@ -152,6 +152,7 @@ require([
'Main',
'ViewTab',
'Search',
'Print',
'Common.Controllers.Fonts',
'Common.Controllers.History'
/** coauthoring begin **/
@ -182,6 +183,7 @@ require([
'presentationeditor/main/app/controller/Main',
'presentationeditor/main/app/controller/ViewTab',
'presentationeditor/main/app/controller/Search',
'presentationeditor/main/app/controller/Print',
'presentationeditor/main/app/view/FileMenuPanels',
'presentationeditor/main/app/view/ParagraphSettings',
'presentationeditor/main/app/view/ImageSettings',

View file

@ -107,6 +107,7 @@ define([
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem(null, 'history');
}, this));
Common.NotificationCenter.on('file:print', _.bind(this.clickToolbarPrint, this));
},
onLaunch: function() {
@ -765,6 +766,13 @@ define([
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
},
clickToolbarPrint: function () {
if (this.mode.canPreviewPrint)
this.leftMenu.showMenu('file:printpreview');
else if (this.mode.canPrint)
this.clickMenuFileItem(null, 'print');
},
textNoTextFound : 'Text not found',
newDocumentTitle : 'Unnamed document',
requestEditRightsText : 'Requesting editing rights...',

View file

@ -1165,6 +1165,9 @@ 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.isDesktopApp;
this.appOptions.canQuickPrint = this.appOptions.canPrint && !Common.Utils.isMac && 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;
@ -1297,6 +1300,9 @@ define([
toolbarController.setMode(this.appOptions);
documentHolder.setMode(this.appOptions);
var printController = app.getController('Print');
printController && this.api && printController.setApi(this.api).setMode(this.appOptions);
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(this.onDocumentModifiedChanged, this));
@ -1922,6 +1928,7 @@ define([
Common.Utils.InternalSettings.set("pe-settings-unit", value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
this.appOptions.canPreviewPrint && this.getApplication().getController('Print').getView('PrintWithPreview').updateMetricUnit();
},
updateThemeColors: function() {
@ -2175,9 +2182,7 @@ define([
onPrint: function() {
if (!this.appOptions.canPrint || Common.Utils.ModalWindow.isVisible()) return;
if (this.api)
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)); // if isChrome or isOpera == true use asc_onPrintUrl event
Common.NotificationCenter.trigger('file:print');
Common.component.Analytics.trackEvent('Print');
},
@ -2210,6 +2215,39 @@ define([
if (url) this.iframePrint.src = url;
},
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var value = Common.localStorage.getBool("pe-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("pe-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
onAdvancedOptions: function(type, advOptions) {
if (this._state.openDlg) return;
@ -3001,7 +3039,8 @@ define([
textRememberMacros: 'Remember my choice for all macros',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), PE.Controllers.Main || {}))
});

View file

@ -0,0 +1,348 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* 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
*
*/
define([
'core',
'presentationeditor/main/app/view/FileMenuPanels'
], function () {
'use strict';
PE.Controllers.Print = Backbone.Controller.extend(_.extend({
views: [
'PrintWithPreview'
],
initialize: function() {
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this._state = {};
this._paperSize = undefined;
this._navigationPreview = {
pageCount: false,
currentPage: 0,
currentPreviewPage: 0
};
this._isPreviewVisible = false;
this.addListeners({
'PrintWithPreview': {
'show': _.bind(this.onShowMainSettingsPrint, this),
'render:after': _.bind(this.onAfterRender, this)
}
});
},
onLaunch: function() {
this.printSettings = this.createView('PrintWithPreview');
},
onAfterRender: function(view) {
var me = this;
this.printSettings.menu.on('menu:hide', _.bind(this.onHidePrintMenu, this));
this.printSettings.btnPrint.on('click', _.bind(this.onBtnPrint, this, true));
this.printSettings.btnPrintPdf.on('click', _.bind(this.onBtnPrint, this, false));
this.printSettings.btnPrevPage.on('click', _.bind(this.onChangePreviewPage, this, false));
this.printSettings.btnNextPage.on('click', _.bind(this.onChangePreviewPage, this, true));
this.printSettings.txtNumberPage.on({
'keypress:after': _.bind(this.onKeypressPageNumber, this),
'keyup:after': _.bind(this.onKeyupPageNumber, this)
});
this.printSettings.txtNumberPage.cmpEl.find('input').on('blur', _.bind(this.onBlurPageNumber, this));
this.printSettings.cmbRange.on('selected', _.bind(this.comboRangeChange, this));
this.printSettings.inputPages.on('changing', _.bind(this.inputPagesChanging, this));
this.printSettings.inputPages.validation = function(value) {
if (!_.isEmpty(value) && /[0-9,\-]/.test(value)) {
var res = [],
arr = value.split(',');
if (me._isPrint && arr.length>1)
return me.txtPrintRangeSingleRange;
for (var i=0; i<arr.length; i++) {
var item = arr[i];
if (!item) // empty
return me.txtPrintRangeInvalid;
var str = item.match(/\-/g);
if (str && str.length>1) // more than 1 symbol '-'
return me.txtPrintRangeInvalid;
if (!str) {// one number
var num = parseInt(item)-1;
(num>=0) && res.push(num);
} else { // range
var pages = item.split('-'),
start = (pages[0] ? parseInt(pages[0])-1 : 0),
end = (pages[1] ? parseInt(pages[1])-1 : me._navigationPreview.pageCount-1);
if (start>end) {
var num = start;
start = end;
end = num;
}
for (var j=start; j<=end; j++) {
(j>=0) && res.push(j);
}
}
}
if (res.length>0) {
return true;
}
}
return me.txtPrintRangeInvalid;
};
this.printSettings.cmbPaperSize.on('selected', _.bind(this.onPaperSizeSelect, this));
this._paperSize = this.printSettings.cmbPaperSize.getSelectedRecord().size;
Common.NotificationCenter.on('window:resize', _.bind(function () {
if (this._isPreviewVisible) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage, this._paperSize);
}
}, this));
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
},
setMode: function (mode) {
this.mode = mode;
this.printSettings && this.printSettings.setMode(mode);
},
setApi: function(o) {
this.api = o;
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(this.onCurrentPage, this));
return this;
},
comboRangeChange: function(combo, record) {
if (record.value === -1) {
var me = this;
setTimeout(function(){
me.printSettings.inputPages.focus();
}, 50);
} else {
this.printSettings.inputPages.setValue('');
}
this.printSettings.inputPages.showError();
},
onCountPages: function(count) {
this._navigationPreview.pageCount = count;
if (this.printSettings.isVisible()) {
this.printSettings.$previewBox.toggleClass('hidden', !this._navigationPreview.pageCount);
this.printSettings.$previewEmpty.toggleClass('hidden', !!this._navigationPreview.pageCount);
}
if (!!this._navigationPreview.pageCount) {
if (this._navigationPreview.currentPreviewPage > count - 1)
this._navigationPreview.currentPreviewPage = Math.max(0, count - 1);
if (this.printSettings.isVisible()) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage, this._paperSize);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, count);
}
}
},
onCurrentPage: function(number) {
this._navigationPreview.currentPreviewPage = number;
if (this.printSettings.isVisible()) {
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage, this._paperSize);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, this._navigationPreview.pageCount);
}
},
onShowMainSettingsPrint: function() {
var me = this;
this.printSettings.$previewBox.removeClass('hidden');
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);
this.api.asc_initPrintPreview('print-preview', opts);
this.printSettings.$previewBox.toggleClass('hidden', !this._navigationPreview.pageCount);
this.printSettings.$previewEmpty.toggleClass('hidden', !!this._navigationPreview.pageCount);
if (!!this._navigationPreview.pageCount) {
this._navigationPreview.currentPreviewPage = this._navigationPreview.currentPage = this.api.getCurrentPage();
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage, this._paperSize);
this.updateNavigationButtons(this._navigationPreview.currentPreviewPage, this._navigationPreview.pageCount);
this.SetDisabled();
}
this._isPreviewVisible = true;
},
getPrintParams: function() {
return this.adjPrintParams;
},
onHidePrintMenu: function () {
if (this._isPreviewVisible) {
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview();
this._isPreviewVisible = false;
}
},
onChangePreviewPage: function (next) {
var index = this._navigationPreview.currentPreviewPage;
if (next) {
index++;
index = Math.min(index, this._navigationPreview.pageCount - 1);
} else {
index--;
index = Math.max(index, 0);
}
this.api.goToPage(index);
},
onKeypressPageNumber: function (input, e) {
if (e.keyCode === Common.UI.Keys.RETURN) {
var box = this.printSettings.$el.find('#print-number-page'),
edit = box.find('input[type=text]'), page = parseInt(edit.val());
if (!page || page > this._navigationPreview.pageCount || page < 0) {
edit.select();
this.printSettings.txtNumberPage.setValue(this._navigationPreview.currentPreviewPage + 1);
this.printSettings.txtNumberPage.checkValidate();
return false;
}
box.focus(); // for IE
this.api.goToPage(page-1);
this.api.asc_enableKeyEvents(true);
return false;
}
},
onKeyupPageNumber: function (input, e) {
if (e.keyCode === Common.UI.Keys.ESC) {
var box = this.printSettings.$el.find('#print-number-page');
box.focus(); // for IE
this.api.asc_enableKeyEvents(true);
return false;
}
},
onBlurPageNumber: function () {
if (this.printSettings.txtNumberPage.getValue() != this._navigationPreview.currentPreviewPage + 1) {
this.printSettings.txtNumberPage.setValue(this._navigationPreview.currentPreviewPage + 1);
this.printSettings.txtNumberPage.checkValidate();
}
},
onPreviewWheel: function (e) {
if (e.ctrlKey) {
e.preventDefault();
e.stopImmediatePropagation();
}
var forward = (e.deltaY || (e.detail && -e.detail) || e.wheelDelta) < 0;
this.onChangePreviewPage(forward);
},
updateNavigationButtons: function (page, count) {
this._navigationPreview.currentPage = page;
this.printSettings.updateCurrentPage(page);
this._navigationPreview.pageCount = count;
this.printSettings.updateCountOfPages(count);
this.disableNavButtons();
},
disableNavButtons: function (force) {
if (force) {
this.printSettings.btnPrevPage.setDisabled(true);
this.printSettings.btnNextPage.setDisabled(true);
return;
}
var curPage = this._navigationPreview.currentPage,
pageCount = this._navigationPreview.pageCount;
this.printSettings.btnPrevPage.setDisabled(curPage < 1);
this.printSettings.btnNextPage.setDisabled(curPage > pageCount - 2);
},
onBtnPrint: function(print) {
this._isPrint = print;
if (this.printSettings.cmbRange.getValue()===-1 && this.printSettings.inputPages.checkValidate() !== true) {
this.printSettings.inputPages.focus();
this.isInputFirstChange = true;
return;
}
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: {
w: rec ? rec.size[0] : undefined,
h: rec ? rec.size[1] : undefined,
preset: rec ? rec.caption : undefined
}
});
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);
this.api.asc_Print(opts);
} else {
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_DownloadAs(opts);
}
this.printSettings.menu.hide();
},
inputPagesChanging: function (input, value) {
this.isInputFirstChange && this.printSettings.inputPages.showError();
this.isInputFirstChange = false;
if (value.length<1)
this.printSettings.cmbRange.setValue('all');
else if (this.printSettings.cmbRange.getValue()!==-1)
this.printSettings.cmbRange.setValue(-1);
},
onPaperSizeSelect: function(combo, record) {
if (record) {
this._paperSize = record.size;
this.api.asc_drawPrintPreview(this._navigationPreview.currentPreviewPage, this._paperSize);
}
},
SetDisabled: function() {
if (this.printSettings.isVisible()) {
var disable = !this.mode.isEdit;
}
},
txtPrintRangeInvalid: 'Invalid print range',
txtPrintRangeSingleRange: 'Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.'
}, PE.Controllers.Print || {}));
});

View file

@ -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();
},
@ -1061,9 +1065,7 @@ define([
},
onPrint: function(e) {
if (this.api)
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86)); // if isChrome or isOpera == true use asc_onPrintUrl event
Common.NotificationCenter.trigger('file:print', this.toolbar);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('Print');

View file

@ -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,10 @@ 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.getBool("pe-settings-quick-print-button", true);
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 +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 )
@ -312,6 +319,13 @@ define([
me.header.lockHeaderBtns( 'users', _need_disable );
},
applySettings: function () {
var value = Common.localStorage.getBool("pe-settings-quick-print-button", true);
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 +334,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);
}
},

View file

@ -8,6 +8,7 @@
<li id="fm-btn-save-copy" class="fm-btn"></li>
<li id="fm-btn-save-desktop" class="fm-btn"></li>
<li id="fm-btn-print" class="fm-btn"></li>
<li id="fm-btn-print-with-preview" class="fm-btn"></li>
<li id="fm-btn-rename" class="fm-btn"></li>
<li id="fm-btn-protect" class="fm-btn"></li>
<li class="devider"></li>
@ -34,4 +35,5 @@
<div id="panel-settings" class="content-box"></div>
<div id="panel-help" class="content-box"></div>
<div id="panel-protect" class="content-box"></div>
<div id="panel-print" class="content-box"></div>
</div>

View file

@ -171,6 +171,17 @@ define([
dataHintTitle: 'P'
});
this.miPrintWithPreview = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-print-with-preview'),
action : 'printpreview',
caption : this.btnPrintCaption,
canFocused: false,
dataHint: 1,
dataHintDirection: 'left-top',
dataHintOffset: [2, 14],
dataHintTitle: 'P'
});
this.miRename = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-rename'),
action : 'rename',
@ -292,6 +303,7 @@ define([
this.miSaveCopyAs,
this.miSaveAs,
this.miPrint,
this.miPrintWithPreview,
this.miRename,
this.miProtect,
this.miRecent,
@ -381,7 +393,8 @@ define([
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miPrint[this.mode.canPrint && !this.mode.canPreviewPrint ?'show':'hide']();
this.miPrintWithPreview[this.mode.canPreviewPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
separatorVisible = (this.mode.canDownload || this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') || this.mode.canPrint || this.mode.canProtect ||
@ -462,6 +475,12 @@ define([
this.panels['help'].setLangConfig(this.mode.lang);
}
if (this.mode.canPreviewPrint) {
var printPanel = PE.getController('Print').getView('PrintWithPreview');
printPanel.menu = this;
!this.panels['printpreview'] && (this.panels['printpreview'] = printPanel.render(this.$el.find('#panel-print')));
}
if ( Common.Controllers.Desktop.isActive() ) {
$('<li id="fm-btn-local-open" class="fm-btn"/>').insertAfter($('#fm-btn-recent', this.$el));
this.items.push(

View file

@ -266,7 +266,12 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr class="quick-print">',
'<td colspan="2"><div style="display: flex;"><div id="fms-chb-quick-print"></div>',
'<span style ="display: flex; flex-direction: column;"><label><%= scope.txtQuickPrint %></label>',
'<label class="comment-text"><%= scope.txtQuickPrintTip %></label></span></div>',
'</td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td><span id="fms-cmb-theme"></span></td>',
@ -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.setBool("pe-settings-quick-print-button", this.chQuickPrint.isChecked());
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({
@ -1821,4 +1843,280 @@ define([
}, PE.Views.FileMenuPanels.ProtectDoc || {}));
PE.Views.PrintWithPreview = Common.UI.BaseView.extend(_.extend({
el: '#panel-print',
menu: undefined,
template: _.template([
'<div style="width:100%; height:100%; position: relative;">',
'<div id="id-print-settings" class="no-padding">',
'<div class="print-settings">',
'<div class="flex-settings ps-container oo settings-container">',
'<table style="width: 100%;">',
'<tbody>',
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>',
'<tr><td class="padding-small"><div id="print-combo-range" style="width: 248px;"></div></td></tr>',
'<tr><td class="padding-large">',
'<table style="width: 100%;"><tbody><tr>',
'<td><%= scope.txtPages %></td><td><div id="print-txt-pages" style="width: 100%;padding-left: 5px;"></div></td>',
'</tr></tbody></table>',
'</td></tr>',
'<tr><td><label class="header"><%= scope.txtPaperSize %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-pages" style="width: 248px;"></div></td></tr>',
'<tr class="fms-btn-apply"><td>',
'<div class="footer justify">',
'<button id="print-btn-print" class="btn normal dlg-btn primary" result="print" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button>',
'<button id="print-btn-print-pdf" class="btn normal dlg-btn" result="pdf" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrintPdf %></button>',
'</div>',
'</td></tr>',
'</tbody>',
'</table>',
'</div>',
'</div>',
'</div>',
'<div id="print-preview-box" style="position: absolute; left: 280px; top: 0; right: 0; bottom: 0;" class="no-padding">',
'<div id="print-preview"></div>',
'<div id="print-navigation">',
'<div id="print-prev-page" style="display: inline-block; margin-right: 4px;"></div>',
'<div id="print-next-page" style="display: inline-block;"></div>',
'<div class="page-number">',
'<label><%= scope.txtPage %></label>',
'<div id="print-number-page"></div>',
'<label id="print-count-page"><%= scope.txtOf %></label>',
'</div>',
'</div>',
'</div>',
'<div id="print-preview-empty" class="hidden">',
'<div><%= scope.txtEmptyTable %></div>',
'</div>',
'</div>'
].join('')),
initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.menu = options.menu;
this._initSettings = true;
},
render: function(node) {
var me = this;
var $markup = $(this.template({scope: this}));
this.cmbRange = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-range'),
menuStyle: 'min-width: 248px;max-height: 280px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ 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'),
allowBlank: true,
validateOnChange: true,
validateOnBlur: false,
maskExp: /[0-9,\-]/,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.cmbPaperSize = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-pages'),
menuStyle: 'max-height: 280px; min-width: 248px;',
editable: false,
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: 0, displayValue:'US Letter (21,59cm x 27,94cm)', caption: 'US Letter', size: [215.9, 279.4]},
{ value: 1, displayValue:'US Legal (21,59cm x 35,56cm)', caption: 'US Legal', size: [215.9, 355.6]},
{ value: 2, displayValue:'A4 (21cm x 29,7cm)', caption: 'A4', size: [210, 297]},
{ value: 3, displayValue:'A5 (14,8cm x 21cm)', caption: 'A5', size: [148, 210]},
{ value: 4, displayValue:'B5 (17,6cm x 25cm)', caption: 'B5', size: [176, 250]},
{ value: 5, displayValue:'Envelope #10 (10,48cm x 24,13cm)', caption: 'Envelope #10', size: [104.8, 241.3]},
{ value: 6, displayValue:'Envelope DL (11cm x 22cm)', caption: 'Envelope DL', size: [110, 220]},
{ value: 7, displayValue:'Tabloid (27,94cm x 43,18cm)', caption: 'Tabloid', size: [279.4, 431.8]},
{ value: 8, displayValue:'A3 (29,7cm x 42cm)', caption: 'A3', size: [297, 420]},
{ value: 9, displayValue:'Tabloid Oversize (30,48cm x 45,71cm)', caption: 'Tabloid Oversize', size: [304.8, 457.1]},
{ value: 10, displayValue:'ROC 16K (19,68cm x 27,3cm)', caption: 'ROC 16K', size: [196.8, 273]},
{ value: 11, displayValue:'Envelope Choukei 3 (11,99cm x 23,49cm)', caption: 'Envelope Choukei 3', size: [119.9, 234.9]},
{ value: 12, displayValue:'Super B/A3 (33,02cm x 48,25cm)', caption: 'Super B/A3', size: [330.2, 482.5]},
{ value: 13, displayValue:'A4 (84,1cm x 118,9cm)', caption: 'A0', size: [841, 1189]},
{ value: 14, displayValue:'A4 (59,4cm x 84,1cm)', caption: 'A1', size: [594, 841]},
{ value: 16, displayValue:'A4 (42cm x 59,4cm)', caption: 'A2', size: [420, 594]},
{ value: 17, displayValue:'A4 (10,5cm x 14,8cm)', caption: 'A6', size: [105, 148]}
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbPaperSize.setValue(2);
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
this.pnlTable = $(this.pnlSettings.find('table')[0]);
this.trApply = $markup.find('.fms-btn-apply');
this.btnPrint = new Common.UI.Button({
el: $markup.findById('#print-btn-print')
});
this.btnPrintPdf = new Common.UI.Button({
el: $markup.findById('#print-btn-print-pdf')
});
this.btnPrevPage = new Common.UI.Button({
parentEl: $markup.findById('#print-prev-page'),
cls: 'btn-prev-page',
iconCls: 'arrow',
dataHint: '2',
dataHintDirection: 'top'
});
this.btnNextPage = new Common.UI.Button({
parentEl: $markup.findById('#print-next-page'),
cls: 'btn-next-page',
iconCls: 'arrow',
dataHint: '2',
dataHintDirection: 'top'
});
this.countOfPages = $markup.findById('#print-count-page');
this.txtNumberPage = new Common.UI.InputField({
el: $markup.findById('#print-number-page'),
allowBlank: true,
validateOnChange: true,
style: 'width: 50px;',
maskExp: /[0-9]/,
validation: function(value) {
if (/(^[0-9]+$)/.test(value)) {
value = parseInt(value);
if (undefined !== value && value > 0 && value <= me.pageCount)
return true;
}
return me.txtPageNumInvalid;
},
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.$el = $(node).html($markup);
this.$previewBox = $('#print-preview-box');
this.$previewEmpty = $('#print-preview-empty');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: this.pnlSettings,
suppressScrollX: true,
alwaysVisibleY: true
});
}
Common.NotificationCenter.on({
'window:resize': function() {
me.isVisible() && me.updateScroller();
}
});
this.updateMetricUnit();
this.fireEvent('render:after', this);
return this;
},
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
if (this._initSettings) {
this.updateMetricUnit();
this._initSettings = false;
}
this.updateScroller();
this.fireEvent('show', this);
},
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height();
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
this.scroller.update();
}
},
setMode: function(mode) {
this.mode = mode;
},
setApi: function(api) {
},
isVisible: function() {
return (this.$el || $(this.el)).is(":visible");
},
setRange: function(value) {
this.cmbRange.setValue(value);
},
getRange: function() {
return this.cmbRange.getValue();
},
updateCountOfPages: function (count) {
this.countOfPages.text(
Common.Utils.String.format(this.txtOf, count)
);
this.pageCount = count;
},
updateCurrentPage: function (index) {
this.txtNumberPage.setValue(index + 1);
},
updateMetricUnit: function() {
if (!this.cmbPaperSize) return;
var store = this.cmbPaperSize.store;
for (var i=0; i<store.length; i++) {
var item = store.at(i),
size = item.get('size'),
pagewidth = size[0],
pageheight = size[1];
item.set('displayValue', item.get('caption') + ' (' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(pagewidth).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ' x ' +
parseFloat(Common.Utils.Metric.fnRecalcFromMM(pageheight).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ')');
}
var value = this.cmbPaperSize.getValue();
this.cmbPaperSize.onResetItems();
this.cmbPaperSize.setValue(value);
},
txtPrint: 'Print',
txtPrintPdf: 'Print to PDF',
txtPrintRange: 'Print range',
txtCurrentPage: 'Current slide',
txtAllPages: 'All slides',
txtCustomPages: 'Custom print',
txtPage: 'Slide',
txtOf: 'of {0}',
txtPageNumInvalid: 'Slide number invalid',
txtEmptyTable: 'There is nothing to print because the presentation is empty',
txtPages: 'Slides',
txtPaperSize: 'Paper size'
}, PE.Views.PrintWithPreview || {}));
});

View file

@ -143,6 +143,7 @@ require([
'Main',
'ViewTab',
'Search',
'Print',
'Common.Controllers.Fonts',
'Common.Controllers.History'
/** coauthoring begin **/
@ -173,6 +174,7 @@ require([
'presentationeditor/main/app/controller/Main',
'presentationeditor/main/app/controller/ViewTab',
'presentationeditor/main/app/controller/Search',
'presentationeditor/main/app/controller/Print',
'presentationeditor/main/app/view/FileMenuPanels',
'presentationeditor/main/app/view/ParagraphSettings',
'presentationeditor/main/app/view/ImageSettings',

View file

@ -249,6 +249,8 @@
"Common.define.effectData.textZigzag": "Zigzag",
"Common.define.effectData.textZoom": "Zoom",
"Common.Translation.textMoreButton": "More",
"Common.Translation.tipFileLocked": "Document is locked for editing. You can make changes and save it as local copy later.",
"Common.Translation.tipFileReadOnly": "The file is read-only. To keep your changes, save the file with a new name or in a different location.",
"Common.Translation.warnFileLocked": "The file is being edited in another app. You can continue editing and save it as a copy.",
"Common.Translation.warnFileLockedBtnEdit": "Create a copy",
"Common.Translation.warnFileLockedBtnView": "Open for viewing",
@ -412,6 +414,8 @@
"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.Header.textReadOnly": "Read only",
"Common.Views.History.textCloseHistory": "Close History",
"Common.Views.History.textHide": "Collapse",
"Common.Views.History.textHideAll": "Hide detailed changes",
@ -1010,6 +1014,9 @@
"PE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"PE.Controllers.Main.textUndo": "Undo",
"PE.Controllers.Main.textContinue": "Continue",
"PE.Controllers.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"PE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.",
"PE.Controllers.Search.notcriticalErrorTitle": "Warning",
"PE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
"PE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
@ -1710,6 +1717,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 cant use a date format in a different language than the slide master.<br>To change the master, click 'Apply to all' instead of 'Apply'",
@ -1849,6 +1858,18 @@
"PE.Views.ParagraphSettingsAdvanced.textTabRight": "Right",
"PE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings",
"PE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"PE.Views.PrintWithPreview.txtPrint": "Print",
"PE.Views.PrintWithPreview.txtPrintPdf": "Print to PDF",
"PE.Views.PrintWithPreview.txtPrintRange": "Print range",
"PE.Views.PrintWithPreview.txtCurrentPage": "Current slide",
"PE.Views.PrintWithPreview.txtAllPages": "All slides",
"PE.Views.PrintWithPreview.txtCustomPages": "Custom print",
"PE.Views.PrintWithPreview.txtPage": "Slide",
"PE.Views.PrintWithPreview.txtOf": "of {0}",
"PE.Views.PrintWithPreview.txtPageNumInvalid": "Slide number invalid",
"PE.Views.PrintWithPreview.txtEmptyTable": "There is nothing to print because the presentation is empty",
"PE.Views.PrintWithPreview.txtPages": "Slides",
"PE.Views.PrintWithPreview.txtPaperSize": "Paper size",
"PE.Views.RightMenu.txtChartSettings": "Chart settings",
"PE.Views.RightMenu.txtImageSettings": "Image settings",
"PE.Views.RightMenu.txtParagraphSettings": "Paragraph settings",

View file

@ -249,6 +249,8 @@
"Common.define.effectData.textZigzag": "Зигзаг",
"Common.define.effectData.textZoom": "Масштабирование",
"Common.Translation.textMoreButton": "Ещё",
"Common.Translation.tipFileLocked": "Документ заблокирован на редактирование. Вы можете внести изменения и сохранить его как локальную копию позже.",
"Common.Translation.tipFileReadOnly": "Файл доступен только для чтения. Чтобы сохранить изменения, сохраните файл с новым названием или в другом месте.",
"Common.Translation.warnFileLocked": "Файл редактируется в другом приложении. Вы можете продолжить редактирование и сохранить его как копию.",
"Common.Translation.warnFileLockedBtnEdit": "Создать копию",
"Common.Translation.warnFileLockedBtnView": "Открыть на просмотр",
@ -391,6 +393,7 @@
"Common.Views.Header.textHideLines": "Скрыть линейки",
"Common.Views.Header.textHideNotes": "Скрыть заметки",
"Common.Views.Header.textHideStatusBar": "Скрыть строку состояния",
"Common.Views.Header.textReadOnly": "Только чтение",
"Common.Views.Header.textRemoveFavorite": "Удалить из избранного",
"Common.Views.Header.textSaveBegin": "Сохранение...",
"Common.Views.Header.textSaveChanged": "Изменен",
@ -402,6 +405,7 @@
"Common.Views.Header.tipDownload": "Скачать файл",
"Common.Views.Header.tipGoEdit": "Редактировать текущий файл",
"Common.Views.Header.tipPrint": "Напечатать файл",
"Common.Views.Header.tipPrintQuick": "Быстрая печать",
"Common.Views.Header.tipRedo": "Повторить",
"Common.Views.Header.tipSave": "Сохранить",
"Common.Views.Header.tipSearch": "Поиск",
@ -713,6 +717,7 @@
"PE.Controllers.Main.textClose": "Закрыть",
"PE.Controllers.Main.textCloseTip": "Щелкните, чтобы закрыть эту подсказку",
"PE.Controllers.Main.textContactUs": "Связаться с отделом продаж",
"PE.Controllers.Main.textContinue": "Продолжить",
"PE.Controllers.Main.textConvertEquation": "Это уравнение создано в старой версии редактора уравнений, которая больше не поддерживается. Чтобы изменить это уравнение, его необходимо преобразовать в формат Office Math ML.<br>Преобразовать сейчас?",
"PE.Controllers.Main.textCustomLoader": "Обратите внимание, что по условиям лицензии у вас нет прав изменять экран, отображаемый при загрузке.<br>Пожалуйста, обратитесь в наш отдел продаж, чтобы сделать запрос.",
"PE.Controllers.Main.textDisconnect": "Соединение потеряно",
@ -731,8 +736,10 @@
"PE.Controllers.Main.textRequestMacros": "Макрос делает запрос на URL. Вы хотите разрешить запрос на %1?",
"PE.Controllers.Main.textShape": "Фигура",
"PE.Controllers.Main.textStrict": "Строгий режим",
"PE.Controllers.Main.textTryQuickPrint": "Вы выбрали быструю печать: весь документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию.<br>Вы хотите продолжить?",
"PE.Controllers.Main.textTryUndoRedo": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.<br>Нажмите на кнопку 'Строгий режим' для переключения в Строгий режим совместного редактирования, чтобы редактировать файл без вмешательства других пользователей и отправлять изменения только после того, как вы их сохраните. Переключаться между режимами совместного редактирования можно с помощью Дополнительных параметров редактора.",
"PE.Controllers.Main.textTryUndoRedoWarn": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.",
"PE.Controllers.Main.textUndo": "Отменить",
"PE.Controllers.Main.titleLicenseExp": "Истек срок действия лицензии",
"PE.Controllers.Main.titleServerVersion": "Редактор обновлен",
"PE.Controllers.Main.txtAddFirstSlide": "Нажмите, чтобы добавить первый слайд",
@ -1007,6 +1014,8 @@
"PE.Controllers.Main.warnNoLicense": "Вы достигли лимита на одновременные подключения к редакторам %1. Этот документ будет открыт на просмотр.<br>Напишите в отдел продаж %1, чтобы обсудить индивидуальные условия лицензирования.",
"PE.Controllers.Main.warnNoLicenseUsers": "Вы достигли лимита на одновременные подключения к редакторам %1.<br>Напишите в отдел продаж %1, чтобы обсудить индивидуальные условия лицензирования.",
"PE.Controllers.Main.warnProcessRightsChange": "Вам было отказано в праве на редактирование этого файла.",
"PE.Controllers.Print.txtPrintRangeInvalid": "Неправильный диапазон печати",
"PE.Controllers.Print.txtPrintRangeSingleRange": "Введите или один номер слайда, или один диапазон слайдов (например, 5-12). Или вы можете выбрать печать в PDF.",
"PE.Controllers.Search.notcriticalErrorTitle": "Внимание",
"PE.Controllers.Search.textNoTextFound": "Искомые данные не найдены. Пожалуйста, измените параметры поиска.",
"PE.Controllers.Search.textReplaceSkipped": "Замена выполнена. Пропущено вхождений - {0}.",
@ -1695,6 +1704,8 @@
"PE.Views.FileMenuPanels.Settings.txtNative": "Собственный",
"PE.Views.FileMenuPanels.Settings.txtProofing": "Правописание",
"PE.Views.FileMenuPanels.Settings.txtPt": "Пункт",
"PE.Views.FileMenuPanels.Settings.txtQuickPrint": "Показывать кнопку Быстрая печать в шапке редактора",
"PE.Views.FileMenuPanels.Settings.txtQuickPrintTip": "Документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию",
"PE.Views.FileMenuPanels.Settings.txtRunMacros": "Включить все",
"PE.Views.FileMenuPanels.Settings.txtRunMacrosDesc": "Включить все макросы без уведомления",
"PE.Views.FileMenuPanels.Settings.txtSpellCheck": "Проверка орфографии",
@ -1846,6 +1857,18 @@
"PE.Views.ParagraphSettingsAdvanced.textTabRight": "По правому краю",
"PE.Views.ParagraphSettingsAdvanced.textTitle": "Абзац - дополнительные параметры",
"PE.Views.ParagraphSettingsAdvanced.txtAutoText": "Авто",
"PE.Views.PrintWithPreview.txtAllPages": "Все слайды",
"PE.Views.PrintWithPreview.txtCurrentPage": "Текущий слайд",
"PE.Views.PrintWithPreview.txtCustomPages": "Настраиваемая печать",
"PE.Views.PrintWithPreview.txtEmptyTable": "Нечего печатать, так как презентация пустая",
"PE.Views.PrintWithPreview.txtOf": "из {0}",
"PE.Views.PrintWithPreview.txtPage": "Слайд",
"PE.Views.PrintWithPreview.txtPageNumInvalid": "Неправильный номер слайда",
"PE.Views.PrintWithPreview.txtPages": "Слайды",
"PE.Views.PrintWithPreview.txtPaperSize": "Размер бумаги",
"PE.Views.PrintWithPreview.txtPrint": "Печать",
"PE.Views.PrintWithPreview.txtPrintPdf": "Печать в PDF",
"PE.Views.PrintWithPreview.txtPrintRange": "Диапазон печати",
"PE.Views.RightMenu.txtChartSettings": "Параметры диаграммы",
"PE.Views.RightMenu.txtImageSettings": "Параметры изображения",
"PE.Views.RightMenu.txtParagraphSettings": "Параметры абзаца",

View file

@ -519,6 +519,128 @@
}
}
}
#panel-print {
padding: 0;
#print-preview-empty {
padding: 14px;
color: @text-tertiary-ie;
color: @text-tertiary;
position: absolute;
left: 280px;
top: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
div {
text-align: center;
}
}
#id-print-settings {
position: absolute;
width:280px;
top: 0;
bottom: 0;
}
.print-settings {
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
border-right: @scaled-one-px-value-ie solid @border-toolbar-ie;
border-right: @scaled-one-px-value solid @border-toolbar;
label.header {
font-weight: 700;
}
.footer {
.btn.primary {
margin-right: 8px;
}
}
.settings-container {
width: 100%;
height: 100%;
overflow: hidden;
padding: 12px 16px;
.padding-small {
padding-bottom: 8px;
}
.padding-large {
padding-bottom: 16px;
}
#print-apply-all {
margin-top: 5px;
}
.link {
margin-top: 9px;
}
.footer {
margin-top: 24px;
}
}
}
#print-navigation {
height: 50px;
padding-left: 20px;
padding-top: 10px;
display: flex;
.btn-prev-page, .btn-next-page {
background-color: transparent;
padding: 0;
height: 20px;
width: 20px;
i.arrow {
display: inline-block;
width: 10px;
height: 10px;
border: solid @scaled-one-px-value-ie @icon-normal-ie;
border: solid @scaled-one-px-value @icon-normal;
border-bottom: none;
border-right: none;
}
&.disabled {
opacity: @component-disabled-opacity;
}
&:hover:not(:disabled):not(.disabled) {
background-color: @highlight-button-hover-ie;
background-color: @highlight-button-hover;
}
}
.btn-prev-page {
i {
transform: rotate(-45deg) translate(-1px, 3px);
}
}
.btn-next-page {
i {
transform: rotate(135deg) translate(4px, 0px);
}
}
.page-number {
display: flex;
align-items: center;
height: 20px;
margin-left: 10px;
label {
.font-weight-bold();
}
#print-count-page, #print-number-page {
margin-left: 4px;
}
}
}
#print-preview {
height: calc(100% - 50px);
}
}
}
}

View file

@ -1,6 +1,6 @@
const EditorUIController = () => null;
EditorUIController.isSupportEditFeature = () => false;
EditorUIController.isSupportEditFeature = () => true;
export default EditorUIController;

View file

@ -1290,7 +1290,9 @@ define([
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined
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.canPrint = (this.permissions.print !== false) && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.canQuickPrint = this.appOptions.canPrint && !Common.Utils.isMac && 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,39 @@ define([
if (url) this.iframePrint.src = url;
},
onPrintQuick: function() {
if (!this.appOptions.canQuickPrint) return;
var value = Common.localStorage.getBool("sse-hide-quick-print-warning"),
me = this,
handler = function () {
var printopt = new Asc.asc_CAdjustPrint();
printopt.asc_setNativeOptions({quickPrint: true});
var opts = new Asc.asc_CDownloadOptions();
opts.asc_setAdvancedOptions(printopt);
me.api.asc_Print(opts);
Common.component.Analytics.trackEvent('Print');
};
if (value) {
handler.call(this);
} else {
Common.UI.warning({
msg: this.textTryQuickPrint,
buttons: ['yes', 'no'],
primary: 'yes',
dontshow: true,
maxwidth: 500,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setBool("sse-hide-quick-print-warning", true);
if (btn === 'yes') {
setTimeout(handler, 1);
}
}
});
}
},
warningDocumentIsLocked: function() {
var me = this;
Common.Utils.warningDocumentIsLocked({
@ -3653,7 +3688,8 @@ define([
textRememberMacros: 'Remember my choice for all macros',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
textContinue: 'Continue',
textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -424,6 +424,7 @@ define([
this.printSettings.applySettings();
if (print) {
var view = SSE.getController('Toolbar').getView('Toolbar');
var printType = this.printSettings.getRange();
this.adjPrintParams.asc_setPrintType(printType);
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);

View file

@ -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();
},

View file

@ -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,10 @@ define([
if ( me.appConfig && me.appConfig.isEdit && !(config.customization && config.customization.compactHeader) && toolbar.btnCollabChanges )
toolbar.btnCollabChanges = me.header.btnSave;
var value = Common.localStorage.getBool("sse-settings-quick-print-button", true);
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 +116,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 +292,13 @@ define([
me.header.lockHeaderBtns( 'users', _need_disable );
},
applySettings: function () {
var value = Common.localStorage.getBool("sse-settings-quick-print-button", true);
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 +307,8 @@ define([
this.header.btnPrint.hide();
if (this.header.btnEdit)
this.header.btnEdit.hide();
if (this.header.btnPrintQuick && !enableDownload)
this.header.btnPrintQuick.hide();
}
},

View file

@ -244,6 +244,12 @@ define([
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
'<tr class="quick-print">',
'<td colspan="2"><div style="display: flex;"><div id="fms-chb-quick-print"></div>',
'<span style ="display: flex; flex-direction: column;"><label><%= scope.txtQuickPrint %></label>',
'<label class="comment-text"><%= scope.txtQuickPrintTip %></label></span></div>',
'</td>',
'</tr>',
'<tr class="themes">',
'<td><label><%= scope.strTheme %></label></td>',
'<td><span id="fms-cmb-theme"></span></td>',
@ -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.setBool("sse-settings-quick-print-button", this.chQuickPrint.isChecked());
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 || {}));
@ -2714,7 +2736,8 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
applySettings: function() {
if (this.menu) {
this.menu.fireEvent('settings:apply', [this.menu]);
this.menu.hide();
// this.menu.fireEvent('settings:apply', [this.menu]);
}
},

View file

@ -101,6 +101,8 @@
"Common.define.conditionalData.textValue": "Value is",
"Common.define.conditionalData.textYesterday": "Yesterday",
"Common.Translation.textMoreButton": "More",
"Common.Translation.tipFileLocked": "Document is locked for editing. You can make changes and save it as local copy later.",
"Common.Translation.tipFileReadOnly": "The file is read-only. To keep your changes, save the file with a new name or in a different location.",
"Common.Translation.warnFileLocked": "The file is being edited in another app. You can continue editing and save it as a copy.",
"Common.Translation.warnFileLockedBtnEdit": "Create a copy",
"Common.Translation.warnFileLockedBtnView": "Open for viewing",
@ -253,6 +255,8 @@
"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.Header.textReadOnly": "Read only",
"Common.Views.History.textCloseHistory": "Close History",
"Common.Views.History.textHide": "Collapse",
"Common.Views.History.textHideAll": "Hide detailed changes",
@ -1123,6 +1127,7 @@
"SSE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"SSE.Controllers.Main.textUndo": "Undo",
"SSE.Controllers.Main.textContinue": "Continue",
"SSE.Controllers.Main.textTryQuickPrint": "You have selected Quick print: the entire document will be printed on the last selected or default printer.<br>Do you want to continue?",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row",
@ -2229,6 +2234,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",

View file

@ -101,6 +101,8 @@
"Common.define.conditionalData.textValue": "Значение равно",
"Common.define.conditionalData.textYesterday": "Вчера",
"Common.Translation.textMoreButton": "Ещё",
"Common.Translation.tipFileLocked": "Документ заблокирован на редактирование. Вы можете внести изменения и сохранить его как локальную копию позже.",
"Common.Translation.tipFileReadOnly": "Файл доступен только для чтения. Чтобы сохранить изменения, сохраните файл с новым названием или в другом месте.",
"Common.Translation.warnFileLocked": "Файл редактируется в другом приложении. Вы можете продолжить редактирование и сохранить его как копию.",
"Common.Translation.warnFileLockedBtnEdit": "Создать копию",
"Common.Translation.warnFileLockedBtnView": "Открыть на просмотр",
@ -232,6 +234,7 @@
"Common.Views.Header.textCompactView": "Скрыть панель инструментов",
"Common.Views.Header.textHideLines": "Скрыть линейки",
"Common.Views.Header.textHideStatusBar": "Объединить строки листов и состояния",
"Common.Views.Header.textReadOnly": "Только чтение",
"Common.Views.Header.textRemoveFavorite": "Удалить из избранного",
"Common.Views.Header.textSaveBegin": "Сохранение...",
"Common.Views.Header.textSaveChanged": "Изменен",
@ -243,6 +246,7 @@
"Common.Views.Header.tipDownload": "Скачать файл",
"Common.Views.Header.tipGoEdit": "Редактировать текущий файл",
"Common.Views.Header.tipPrint": "Напечатать файл",
"Common.Views.Header.tipPrintQuick": "Быстрая печать",
"Common.Views.Header.tipRedo": "Повторить",
"Common.Views.Header.tipSave": "Сохранить",
"Common.Views.Header.tipSearch": "Поиск",
@ -521,8 +525,8 @@
"SSE.Controllers.DocumentHolder.textChangeColumnWidth": "Ширина столбца {0} символов ({1} пикселей)",
"SSE.Controllers.DocumentHolder.textChangeRowHeight": "Высота строки {0} пунктов ({1} пикселей)",
"SSE.Controllers.DocumentHolder.textCtrlClick": "Щелкните по ссылке, чтобы открыть ее, или щелкните и удерживайте кнопку мыши, чтобы выделить ячейку.",
"SSE.Controllers.DocumentHolder.textInsertLeft": "Добавить слева",
"SSE.Controllers.DocumentHolder.textInsertTop": "Добавить сверху",
"SSE.Controllers.DocumentHolder.textInsertLeft": "Добавить столбец слева",
"SSE.Controllers.DocumentHolder.textInsertTop": "Добавить строку сверху",
"SSE.Controllers.DocumentHolder.textPasteSpecial": "Специальная вставка",
"SSE.Controllers.DocumentHolder.textStopExpand": "Не развертывать таблицы автоматически",
"SSE.Controllers.DocumentHolder.textSym": "симв",
@ -823,6 +827,7 @@
"SSE.Controllers.Main.textCloseTip": "Щелкните, чтобы закрыть эту подсказку",
"SSE.Controllers.Main.textConfirm": "Подтверждение",
"SSE.Controllers.Main.textContactUs": "Связаться с отделом продаж",
"SSE.Controllers.Main.textContinue": "Продолжить",
"SSE.Controllers.Main.textConvertEquation": "Это уравнение создано в старой версии редактора уравнений, которая больше не поддерживается. Чтобы изменить это уравнение, его необходимо преобразовать в формат Office Math ML.<br>Преобразовать сейчас?",
"SSE.Controllers.Main.textCustomLoader": "Обратите внимание, что по условиям лицензии у вас нет прав изменять экран, отображаемый при загрузке.<br>Пожалуйста, обратитесь в наш отдел продаж, чтобы сделать запрос.",
"SSE.Controllers.Main.textDisconnect": "Соединение потеряно",
@ -849,8 +854,10 @@
"SSE.Controllers.Main.textRequestMacros": "Макрос делает запрос на URL. Вы хотите разрешить запрос на %1?",
"SSE.Controllers.Main.textShape": "Фигура",
"SSE.Controllers.Main.textStrict": "Строгий режим",
"SSE.Controllers.Main.textTryQuickPrint": "Вы выбрали быструю печать: весь документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию.<br>Вы хотите продолжить?",
"SSE.Controllers.Main.textTryUndoRedo": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.<br>Нажмите на кнопку 'Строгий режим' для переключения в Строгий режим совместного редактирования, чтобы редактировать файл без вмешательства других пользователей и отправлять изменения только после того, как вы их сохраните. Переключаться между режимами совместного редактирования можно с помощью Дополнительных параметров редактора.",
"SSE.Controllers.Main.textTryUndoRedoWarn": "Функции отмены и повтора действий отключены в Быстром режиме совместного редактирования.",
"SSE.Controllers.Main.textUndo": "Отменить",
"SSE.Controllers.Main.textYes": "Да",
"SSE.Controllers.Main.titleLicenseExp": "Истек срок действия лицензии",
"SSE.Controllers.Main.titleServerVersion": "Редактор обновлен",
@ -2205,6 +2212,8 @@
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPt": "Пункт",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPtbr": "Португальский (Бразилия)",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPtlang": "Португальский (Португалия)",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtQuickPrint": "Показывать кнопку Быстрая печать в шапке редактора",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtQuickPrintTip": "Документ будет напечатан на последнем выбранном принтере или на принтере по умолчанию",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRegion": "Регион",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRo": "Румынский",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRu": "Русский",

View file

@ -1,6 +1,6 @@
const EditorUIController = () => null;
EditorUIController.isSupportEditFeature = () => false;
EditorUIController.isSupportEditFeature = () => true;
export default EditorUIController;