Merge pull request #113 from ONLYOFFICE/feature/sse-layout

Feature/sse layout
This commit is contained in:
Julia Radzhabova 2018-07-19 10:09:39 +03:00 committed by GitHub
commit db09848a3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 912 additions and 53 deletions

View file

@ -413,7 +413,8 @@ define([
Asc.c_oAscFileType.ODT,
Asc.c_oAscFileType.DOCX,
Asc.c_oAscFileType.HTML,
Asc.c_oAscFileType.PDF
Asc.c_oAscFileType.PDF,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )

View file

@ -142,7 +142,8 @@ define([
Asc.c_oAscFileType.RTF,
Asc.c_oAscFileType.ODT,
Asc.c_oAscFileType.DOCX,
Asc.c_oAscFileType.HTML
Asc.c_oAscFileType.HTML,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )

View file

@ -54,6 +54,7 @@ define([
formats: [[
{name: 'DOCX', imgCls: 'docx', type: Asc.c_oAscFileType.DOCX},
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF},
{name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA},
{name: 'TXT', imgCls: 'txt', type: Asc.c_oAscFileType.TXT}
],[
// {name: 'DOC', imgCls: 'doc-format btn-doc', type: Asc.c_oAscFileType.DOC},

View file

@ -2325,7 +2325,7 @@ define([
textTabFile: 'File',
textTabHome: 'Home',
textTabInsert: 'Insert',
textTabLayout: 'Page Layout',
textTabLayout: 'Layout',
textTabReview: 'Review',
capBtnInsShape: 'Shape',
capBtnInsTextbox: 'Text Box',
@ -2340,12 +2340,12 @@ define([
tipImgAlign: 'Align objects',
tipImgGroup: 'Group objects',
tipImgWrapping: 'Wrap text',
tipSendForward: 'Send forward',
tipSendForward: 'Bring forward',
tipSendBackward: 'Send backward',
capImgAlign: 'Align',
capImgGroup: 'Group',
capImgForward: 'Move forward',
capImgBackward: 'Move backward',
capImgForward: 'Bring Forward',
capImgBackward: 'Send Backward',
capImgWrapping: 'Wrapping',
capBtnComment: 'Comment',
textColumnsCustom: 'Custom Columns',

View file

@ -264,6 +264,7 @@
<img class="inline-svg" src="../../common/main/resources/img/header/buttons.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/docx.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdf.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdfa.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/txt.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/odt.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/rtf.svg">

View file

@ -285,6 +285,7 @@
<inline src="resources/img/header/buttons.svg" />
<inline src="resources/img/doc-formats/docx.svg" />
<inline src="resources/img/doc-formats/pdf.svg" />
<inline src="resources/img/doc-formats/pdfa.svg" />
<inline src="resources/img/doc-formats/txt.svg" />
<inline src="resources/img/doc-formats/odt.svg" />
<inline src="resources/img/doc-formats/rtf.svg" />

View file

@ -385,7 +385,8 @@ define([
_supported = [
Asc.c_oAscFileType.PPTX,
Asc.c_oAscFileType.ODP,
Asc.c_oAscFileType.PDF
Asc.c_oAscFileType.PDF,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )

View file

@ -149,7 +149,8 @@ define([
var _supported = [
Asc.c_oAscFileType.PPTX,
Asc.c_oAscFileType.ODP
Asc.c_oAscFileType.ODP,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )

View file

@ -55,6 +55,7 @@ define([
formats: [[
{name: 'PPTX', imgCls: 'pptx', type: Asc.c_oAscFileType.PPTX},
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF},
{name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA},
{name: 'ODP', imgCls: 'odp', type: Asc.c_oAscFileType.ODP}
]],

View file

@ -263,6 +263,7 @@
<img class="inline-svg" src="../../common/main/resources/img/header/buttons.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pptx.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdf.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdfa.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/odp.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/blank.svg">
<script>

View file

@ -285,6 +285,7 @@
<inline src="resources/img/header/buttons.svg" />
<inline src="resources/img/doc-formats/pptx.svg" />
<inline src="resources/img/doc-formats/pdf.svg" />
<inline src="resources/img/doc-formats/pdfa.svg" />
<inline src="resources/img/doc-formats/odp.svg" />
<inline src="resources/img/doc-formats/blank.svg" />

View file

@ -261,9 +261,9 @@ define([
}
}, this)
});
} else if (format == Asc.c_oAscFileType.PDF) {
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) {
menu.hide();
Common.NotificationCenter.trigger('download:settings', this.leftMenu);
Common.NotificationCenter.trigger('download:settings', this.leftMenu, format);
} else {
this.api.asc_DownloadAs(format);
menu.hide();

View file

@ -407,13 +407,14 @@ define([
Asc.c_oAscFileType.XLSX,
Asc.c_oAscFileType.ODS,
Asc.c_oAscFileType.CSV,
Asc.c_oAscFileType.PDF
Asc.c_oAscFileType.PDF,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.XLSX;
if (_format == Asc.c_oAscFileType.PDF)
Common.NotificationCenter.trigger('download:settings', this, true);
if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA)
Common.NotificationCenter.trigger('download:settings', this, _format, true);
else
this.api.asc_DownloadAs(_format, true);
},
@ -1810,6 +1811,7 @@ define([
Common.Utils.InternalSettings.set("sse-settings-unit", value);
this.getApplication().getController('RightMenu').updateMetricUnit();
this.getApplication().getController('Print').getView('MainSettingsPrint').updateMetricUnit();
this.getApplication().getController('Toolbar').getView('Toolbar').updateMetricUnit();
},
_compareActionStrong: function(obj1, obj2){

View file

@ -203,6 +203,7 @@ define([
if (this._changedProps[index])
this.api.asc_setPageOptions(this._changedProps[index], index);
}
Common.NotificationCenter.trigger('page:settings');
},
onShowMainSettingsPrint: function() {
@ -220,9 +221,10 @@ define([
}
},
openPrintSettings: function(type, cmp, asUrl) {
openPrintSettings: function(type, cmp, format, asUrl) {
if (this.api) {
this.asUrl = asUrl;
this.downloadFormat = format;
this.printSettingsDlg = (new SSE.Views.PrintSettings({
type: type,
handler: _.bind(this.resultPrintSettings,this),
@ -251,7 +253,7 @@ define([
if ( this.printSettingsDlg.type=='print' )
this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera);
else
this.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, this.asUrl, this.adjPrintParams);
this.api.asc_DownloadAs(this.downloadFormat, this.asUrl, this.adjPrintParams);
Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');
Common.component.Analytics.trackEvent('ToolBar', (this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');
Common.NotificationCenter.trigger('edit:complete', view);

View file

@ -52,7 +52,8 @@ define([
'spreadsheeteditor/main/app/view/NamedRangeEditDlg',
'spreadsheeteditor/main/app/view/NamedRangePasteDlg',
'spreadsheeteditor/main/app/view/NameManagerDlg',
'spreadsheeteditor/main/app/view/FormatSettingsDialog'
'spreadsheeteditor/main/app/view/FormatSettingsDialog',
'spreadsheeteditor/main/app/view/PageMarginsDialog'
], function () { 'use strict';
SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({
@ -101,14 +102,15 @@ define([
var _supported = [
Asc.c_oAscFileType.XLSX,
Asc.c_oAscFileType.ODS,
Asc.c_oAscFileType.CSV
Asc.c_oAscFileType.CSV,
Asc.c_oAscFileType.PDFA
];
if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.PDF;
if (_format == Asc.c_oAscFileType.PDF)
Common.NotificationCenter.trigger('download:settings', this.toolbar);
if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA)
Common.NotificationCenter.trigger('download:settings', this.toolbar, _format);
else
_main.api.asc_DownloadAs(_format);
},
@ -117,6 +119,8 @@ define([
}
}
});
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
this.editMode = true;
this._isAddingShape = false;
this._state = {
@ -155,7 +159,10 @@ define([
numformatinfo: undefined,
numformattype: undefined,
numformat: undefined,
langId: undefined
langId: undefined,
pgsize: [0, 0],
pgmargins: undefined,
pgorient: undefined
};
var checkInsertAutoshape = function(e, action) {
@ -343,6 +350,15 @@ define([
$('#id-toolbar-menu-new-fontcolor').on('click', _.bind(this.onNewTextColor, this));
$('#id-toolbar-menu-new-paracolor').on('click', _.bind(this.onNewBackColor, this));
$('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this));
toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this));
toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this));
toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this));
toolbar.btnImgGroup.menu.on('item:click', _.bind(this.onImgGroupSelect, this));
toolbar.btnImgBackward.menu.on('item:click', _.bind(this.onImgArrangeSelect, this));
toolbar.btnImgForward.menu.on('item:click', _.bind(this.onImgArrangeSelect, this));
toolbar.btnImgAlign.menu.on('item:click', _.bind(this.onImgAlignSelect, this));
toolbar.btnImgForward.on('click', this.onImgArrangeSelect.bind(this, 'forward'));
toolbar.btnImgBackward.on('click', this.onImgArrangeSelect.bind(this, 'backward'));
this.onSetupCopyStyleButton();
}
@ -1669,7 +1685,68 @@ define([
onApiZoomChange: function(zf, type){},
onApiSheetChanged: function() {},
onApiSheetChanged: function() {
if (!this.toolbar.mode.isEdit) return;
var props = this.api.asc_getPageOptions(this.api.asc_getActiveWorksheetIndex()),
opt = props.asc_getPageSetup();
this.onApiPageOrient(opt.asc_getOrientation());
this.onApiPageSize(opt.asc_getWidth(), opt.asc_getHeight());
this.onApiPageMargins(props.asc_getPageMargins());
},
onApiPageSize: function(w, h) {
if (this._state.pgorient===undefined) return;
if (Math.abs(this._state.pgsize[0] - w) > 0.01 ||
Math.abs(this._state.pgsize[1] - h) > 0.01) {
this._state.pgsize = [w, h];
if (this.toolbar.mnuPageSize) {
this.toolbar.mnuPageSize.clearAll();
_.each(this.toolbar.mnuPageSize.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
Math.abs(item.value[0] - w) < 0.01 && Math.abs(item.value[1] - h) < 0.01) {
item.setChecked(true);
return false;
}
}, this);
}
}
},
onApiPageMargins: function(props) {
if (props) {
var left = props.asc_getLeft(),
top = props.asc_getTop(),
right = props.asc_getRight(),
bottom = props.asc_getBottom();
if (!this._state.pgmargins || Math.abs(this._state.pgmargins[0] - top) > 0.01 ||
Math.abs(this._state.pgmargins[1] - left) > 0.01 || Math.abs(this._state.pgmargins[2] - bottom) > 0.01 ||
Math.abs(this._state.pgmargins[3] - right) > 0.01) {
this._state.pgmargins = [top, left, bottom, right];
if (this.toolbar.btnPageMargins.menu) {
this.toolbar.btnPageMargins.menu.clearAll();
_.each(this.toolbar.btnPageMargins.menu.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
Math.abs(item.value[0] - top) < 0.01 && Math.abs(item.value[1] - left) < 0.01 &&
Math.abs(item.value[2] - bottom) < 0.01 && Math.abs(item.value[3] - right) < 0.01) {
item.setChecked(true);
return false;
}
}, this);
}
}
}
},
onApiPageOrient: function(orient) {
if (this._state.pgorient !== orient) {
this.toolbar.btnPageOrient.menu.items[orient == Asc.c_oAscPageOrientation.PagePortrait ? 0 : 1].setChecked(true);
this._state.pgorient = orient;
}
},
onApiEditorSelectionChanged: function(fontobj) {
if (!this.editMode) return;
@ -1819,6 +1896,17 @@ define([
}
*/
need_disable = (selectionType == Asc.c_oAscSelectionType.RangeCells || selectionType == Asc.c_oAscSelectionType.RangeCol ||
selectionType == Asc.c_oAscSelectionType.RangeRow || selectionType == Asc.c_oAscSelectionType.RangeMax);
toolbar.lockToolbar(SSE.enumLock.selRange, need_disable, { array: [toolbar.btnImgAlign, toolbar.btnImgBackward, toolbar.btnImgForward, toolbar.btnImgGroup]});
var cangroup = this.api.asc_canGroupGraphicsObjects(),
canungroup = this.api.asc_canUnGroupGraphicsObjects();
toolbar.lockToolbar(SSE.enumLock.cantGroupUngroup, !cangroup && !canungroup, { array: [toolbar.btnImgGroup]});
toolbar.btnImgGroup.menu.items[0].setDisabled(!cangroup);
toolbar.btnImgGroup.menu.items[1].setDisabled(!canungroup);
toolbar.lockToolbar(SSE.enumLock.cantGroup, !cangroup, { array: [toolbar.btnImgAlign]});
if (editOptionsDisabled) return;
/* read font params */
@ -2901,7 +2989,7 @@ define([
this.onApiEditCell(this.api.isRangeSelection ? Asc.c_oAscCellEditorState.editStart : Asc.c_oAscCellEditorState.editEnd);
var toolbar = this.toolbar;
toolbar.lockToolbar(SSE.enumLock.selRange, this.api.isRangeSelection);
toolbar.lockToolbar(SSE.enumLock.selRangeEdit, this.api.isRangeSelection);
this.setDisabledComponents([toolbar.btnUndo], this.api.isRangeSelection || !this.api.asc_getCanUndo());
this.setDisabledComponents([toolbar.btnRedo], this.api.isRangeSelection || !this.api.asc_getCanRedo());
@ -2971,7 +3059,7 @@ define([
tab = {action: 'pivot', caption: me.textPivot};
$panel = me.getApplication().getController('PivotTable').createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 3);
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.setVisible('pivot', true);
}
}
@ -2979,7 +3067,7 @@ define([
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.addTab(tab, $panel, 5);
if ( config.isDesktopApp ) {
// hide 'print' and 'save' buttons group and next separator
@ -2996,7 +3084,7 @@ define([
tab = {action: 'protect', caption: me.toolbar.textTabProtect};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel)
me.toolbar.addTab(tab, $panel, 5);
me.toolbar.addTab(tab, $panel, 6);
}
}
}
@ -3056,6 +3144,94 @@ define([
}
},
onPageSizeClick: function(menu, item, state) {
if (this.api && state) {
this._state.pgsize = [0, 0];
this.api.asc_changeDocSize(item.value[0], item.value[1], this.api.asc_getActiveWorksheetIndex());
Common.NotificationCenter.trigger('page:settings');
Common.component.Analytics.trackEvent('ToolBar', 'Page Size');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onPageMarginsSelect: function(menu, item) {
if (this.api) {
this._state.pgmargins = undefined;
if (item.value !== 'advanced') {
this.api.asc_changePageMargins(item.value[1], item.value[3], item.value[0], item.value[2], this.api.asc_getActiveWorksheetIndex());
Common.NotificationCenter.trigger('page:settings');
} else {
var win, props,
me = this;
win = new SSE.Views.PageMarginsDialog({
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.asc_getTop(), props.asc_getLeft(), props.asc_getBottom(), props.asc_getRight()];
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
Common.localStorage.setItem("sse-pgmargins-top", props.asc_getTop());
Common.localStorage.setItem("sse-pgmargins-left", props.asc_getLeft());
Common.localStorage.setItem("sse-pgmargins-bottom", props.asc_getBottom());
Common.localStorage.setItem("sse-pgmargins-right", props.asc_getRight());
me.api.asc_changePageMargins( props.asc_getLeft(), props.asc_getRight(), props.asc_getTop(), props.asc_getBottom(), me.api.asc_getActiveWorksheetIndex());
Common.NotificationCenter.trigger('page:settings');
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
});
win.show();
win.setSettings(me.api.asc_getPageOptions(me.api.asc_getActiveWorksheetIndex()));
}
Common.component.Analytics.trackEvent('ToolBar', 'Page Margins');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onPageOrientSelect: function(menu, item) {
this._state.pgorient = undefined;
if (this.api && item.checked) {
this.api.asc_changePageOrient(item.value==Asc.c_oAscPageOrientation.PagePortrait, this.api.asc_getActiveWorksheetIndex());
Common.NotificationCenter.trigger('page:settings');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Orientation');
},
onImgGroupSelect: function(menu, item) {
if (this.api)
this.api[(item.value == 'grouping') ? 'asc_groupGraphicsObjects' : 'asc_unGroupGraphicsObjects']();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Objects Group');
},
onImgArrangeSelect: function(menu, item) {
if (this.api) {
if ( menu == 'forward' )
this.api.asc_setSelectedDrawingObjectLayer(Asc.c_oAscDrawingLayerType.BringForward);
else if ( menu == 'backward' )
this.api.asc_setSelectedDrawingObjectLayer(Asc.c_oAscDrawingLayerType.SendBackward);
else
this.api.asc_setSelectedDrawingObjectLayer(item.value);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Objects Arrange');
},
onImgAlignSelect: function(menu, item) {
if (this.api)
// this.api.asc_setSelectedDrawingObjectLayer(item.value);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Objects Align');
},
textEmptyImgUrl : 'You need to specify image URL.',
warnMergeLostData : 'Operation can destroy data in the selected cells.<br>Continue?',
textWarning : 'Warning',

View file

@ -136,6 +136,20 @@
<span class="btn-slot text x-huge" id="slot-btn-insequation"></span>
</div>
</section>
<section class="panel" data-tab="layout">
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-pagemargins"></span>
<span class="btn-slot text x-huge" id="slot-btn-pageorient"></span>
<span class="btn-slot text x-huge" id="slot-btn-pagesize"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-img-align"></span>
<span class="btn-slot text x-huge" id="slot-img-group"></span>
<span class="btn-slot text x-huge" id="slot-img-movefrwd"></span>
<span class="btn-slot text x-huge" id="slot-img-movebkwd"></span>
</div>
</section>
</section>
</section>
</section>

View file

@ -945,7 +945,13 @@ define([
txtPercentage: 'Percentage',
txtFraction: 'Fraction',
txtText: 'Text',
textMoreFormats: 'More formats'
textMoreFormats: 'More formats',
textShapeAlignLeft : 'Align Left',
textShapeAlignRight : 'Align Right',
textShapeAlignCenter : 'Align Center',
textShapeAlignTop : 'Align Top',
textShapeAlignBottom : 'Align Bottom',
textShapeAlignMiddle : 'Align Middle'
}, SSE.Views.DocumentHolder || {}));
});

View file

@ -44,6 +44,8 @@ define([
formats: [[
{name: 'XLSX', imgCls: 'xlsx', type: Asc.c_oAscFileType.XLSX},
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF},
{name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA}
],[
{name: 'ODS', imgCls: 'ods', type: Asc.c_oAscFileType.ODS},
{name: 'CSV', imgCls: 'csv', type: Asc.c_oAscFileType.CSV}
]

View file

@ -0,0 +1,209 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* 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 Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* 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
*
*/
/**
* PageMarginsDialog.js
*
* Created by Julia Radzhabova on 06/29/18
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window',
'common/main/lib/component/MetricSpinner'
], function () { 'use strict';
SSE.Views.PageMarginsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 215,
header: true,
style: 'min-width: 216px;',
cls: 'modal-dlg',
id: 'window-page-margins'
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box" style="height: 85px;">',
'<table cols="2" style="width: 100%;margin-bottom: 10px;">',
'<tr>',
'<td style="padding-right: 10px;padding-bottom: 8px;">',
'<label class="input-label">' + this.textTop + '</label>',
'<div id="page-margins-spin-top"></div>',
'</td>',
'<td style="padding-bottom: 8px;">',
'<label class="input-label">' + this.textBottom + '</label>',
'<div id="page-margins-spin-bottom"></div>',
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small" style="padding-right: 10px;">',
'<label class="input-label">' + this.textLeft + '</label>',
'<div id="page-margins-spin-left"></div>',
'</td>',
'<td class="padding-small">',
'<label class="input-label">' + this.textRight + '</label>',
'<div id="page-margins-spin-right"></div>',
'</td>',
'</tr>',
'</table>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.spinners = [];
this._noApply = false;
this.maxMarginsW = this.maxMarginsH = 0;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
this.spnTop = new Common.UI.MetricSpinner({
el: $('#page-margins-spin-top'),
step: .1,
width: 86,
defaultUnit : "cm",
value: '0',
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnTop);
this.spnBottom = new Common.UI.MetricSpinner({
el: $('#page-margins-spin-bottom'),
step: .1,
width: 86,
defaultUnit : "cm",
value: '0',
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnBottom);
this.spnLeft = new Common.UI.MetricSpinner({
el: $('#page-margins-spin-left'),
step: .1,
width: 86,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnLeft);
this.spnRight = new Common.UI.MetricSpinner({
el: $('#page-margins-spin-right'),
step: .1,
width: 86,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 48.25,
minValue: 0
});
this.spinners.push(this.spnRight);
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
this.updateMetricUnit();
},
_handleInput: function(state) {
if (this.options.handler)
this.options.handler.call(this, this, state);
this.close();
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
}
},
setSettings: function (props) {
if (props) {
var margins = props.asc_getPageMargins();
this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getTop()), true);
this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getBottom()), true);
this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getLeft()), true);
this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getRight()), true);
}
},
getSettings: function() {
var props = new Asc.asc_CPageMargins();
props.asc_setTop(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue()));
props.asc_setBottom(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue()));
props.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue()));
props.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue()));
return props;
},
updateMetricUnit: function() {
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
}
}
},
textTitle: 'Margins',
textTop: 'Top',
textLeft: 'Left',
textBottom: 'Bottom',
textRight: 'Right',
cancelButtonText: 'Cancel',
okButtonText: 'Ok'
}, SSE.Views.PageMarginsDialog || {}))
});

View file

@ -119,12 +119,12 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
{value:'215.9|279.4', displayValue:'US Letter (21,59cm x 27,94cm)', caption: 'US Letter'},
{value:'215.9|355.6', displayValue:'US Legal (21,59cm x 35,56cm)', caption: 'US Legal'},
{value:'210|297', displayValue:'A4 (21cm x 29,7cm)', caption: 'A4'},
{value:'148.1|209.9', displayValue:'A5 (14,81cm x 20,99cm)', caption: 'A5'},
{value:'176|250.1', displayValue:'B5 (17,6cm x 25,01cm)', caption: 'B5'},
{value:'148|210', displayValue:'A5 (14,8cm x 21cm)', caption: 'A5'},
{value:'176|250', displayValue:'B5 (17,6cm x 25cm)', caption: 'B5'},
{value:'104.8|241.3', displayValue:'Envelope #10 (10,48cm x 24,13cm)', caption: 'Envelope #10'},
{value:'110.1|220.1', displayValue:'Envelope DL (11,01cm x 22,01cm)', caption: 'Envelope DL'},
{value:'279.4|431.7', displayValue:'Tabloid (27,94cm x 43,17cm)', caption: 'Tabloid'},
{value:'297|420.1', displayValue:'A3 (29,7cm x 42,01cm)', caption: 'A3'},
{value:'110|220', displayValue:'Envelope DL (11cm x 22cm)', caption: 'Envelope DL'},
{value:'279.4|431.8', displayValue:'Tabloid (27,94cm x 43,18cm)', caption: 'Tabloid'},
{value:'297|420', displayValue:'A3 (29,7cm x 42cm)', caption: 'A3'},
{value:'304.8|457.1', displayValue:'Tabloid Oversize (30,48cm x 45,71cm)', caption: 'Tabloid Oversize'},
{value:'196.8|273', displayValue:'ROC 16K (19,68cm x 27,3cm)', caption: 'ROC 16K'},
{value:'119.9|234.9', displayValue:'Envelope Choukei 3 (11,99cm x 23,49cm)', caption: 'Envelope Choukei 3'},

View file

@ -69,6 +69,7 @@ define([
selChart: 'sel-chart',
selChartText: 'sel-chart-txt',
selRange: 'sel-range',
selRangeEdit: 'sel-range-edit',
lostConnect: 'disconnect',
coAuth: 'co-auth',
coAuthText: 'co-auth-text',
@ -80,7 +81,9 @@ define([
multiselect: 'is-multiselect',
cantHyperlink: 'cant-hyperlink',
commentLock: 'can-comment',
cantModifyFilter: 'cant-filter'
cantModifyFilter: 'cant-filter',
cantGroup: 'cant-group',
cantGroupUngroup: 'cant-group-ungroup',
};
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
@ -232,7 +235,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'btn-formula',
split : true,
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -279,7 +282,7 @@ define([
cls : 'input-group-nr',
menuStyle : 'min-width: 180px;',
hint : me.tipNumFormat,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
itemsTemplate: formatTemplate,
editable : false,
data : me.numFormatData
@ -338,7 +341,8 @@ define([
tabs: [
{ caption: me.textTabFile, action: 'file', extcls: 'canedit', haspanel:false},
{ caption: me.textTabHome, action: 'home', extcls: 'canedit'},
{ caption: me.textTabInsert, action: 'ins', extcls: 'canedit'}
{ caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'}
]}
);
@ -346,7 +350,7 @@ define([
cls : 'input-group-nr',
menuStyle : 'min-width: 55px;',
hint : me.tipFontSize,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
data : [
{ value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" },
@ -372,7 +376,7 @@ define([
menuCls : 'scrollable-menu',
menuStyle : 'min-width: 325px;',
hint : me.tipFontName,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
store : new Common.Collections.Fonts()
});
@ -395,21 +399,21 @@ define([
id : 'id-toolbar-btn-incfont',
cls : 'btn-toolbar',
iconCls : 'btn-incfont',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect]
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect]
});
me.btnDecFontSize = new Common.UI.Button({
id : 'id-toolbar-btn-decfont',
cls : 'btn-toolbar',
iconCls : 'btn-decfont',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect]
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect]
});
me.btnBold = new Common.UI.Button({
id : 'id-toolbar-btn-bold',
cls : 'btn-toolbar',
iconCls : 'btn-bold',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true
});
@ -417,7 +421,7 @@ define([
id : 'id-toolbar-btn-italic',
cls : 'btn-toolbar',
iconCls : 'btn-italic',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true
});
@ -425,7 +429,7 @@ define([
id : 'id-toolbar-btn-underline',
cls : 'btn-toolbar',
iconCls : 'btn-underline',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true
});
@ -433,7 +437,7 @@ define([
id: 'id-toolbar-btn-strikeout',
cls: 'btn-toolbar',
iconCls: 'btn-strikeout',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true
});
@ -444,7 +448,7 @@ define([
icls : 'btn-subscript',
split : true,
enableToggle: true,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu : new Common.UI.Menu({
items: [
{
@ -475,7 +479,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'btn-fontcolor',
split : true,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu : new Common.UI.Menu({
items: [
{ template: _.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>') },
@ -832,7 +836,7 @@ define([
cls : 'input-group-nr',
menuStyle : 'min-width: 180px;',
hint : me.tipNumFormat,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
itemsTemplate: formatTemplate,
editable : false,
data : me.numFormatData
@ -899,7 +903,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'btn-formula',
split : true,
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -920,7 +924,7 @@ define([
id : 'id-toolbar-btn-insertrange',
cls : 'btn-toolbar',
iconCls : 'btn-named-range',
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.selRange],
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.selRangeEdit],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -946,7 +950,7 @@ define([
id : 'id-toolbar-btn-clear',
cls : 'btn-toolbar',
iconCls : 'btn-clearstyle',
lock : [_set.lostConnect, _set.coAuth, _set.selRange],
lock : [_set.lostConnect, _set.coAuth, _set.selRangeEdit],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -1202,6 +1206,237 @@ define([
var hidetip = Common.localStorage.getItem("sse-hide-synch");
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
// me.needShowSynchTip = false;
me.btnPageOrient = new Common.UI.Button({
id: 'tlbtn-pageorient',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-pageorient',
caption: me.capBtnPageOrient,
lock : [_set.lostConnect, _set.coAuth],
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
items: [
{
caption: me.textPortrait,
iconCls: 'mnu-orient-portrait',
checkable: true,
toggleGroup: 'menuOrient',
value: Asc.c_oAscPageOrientation.PagePortrait
},
{
caption: me.textLandscape,
iconCls: 'mnu-orient-landscape',
checkable: true,
toggleGroup: 'menuOrient',
value: Asc.c_oAscPageOrientation.PageLandscape
}
]
})
});
var pageMarginsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
'<% if (options.value !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
'<label style="display: block;">' + this.textTop + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.textLeft + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">' + this.textBottom + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
'<label style="display: block;">' + this.textRight + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div>' +
'<% } %></a>');
me.btnPageMargins = new Common.UI.Button({
id: 'tlbtn-pagemargins',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-pagemargins',
caption: me.capBtnMargins,
lock : [_set.lostConnect, _set.coAuth],
menu: new Common.UI.Menu({
items: [
{
caption: me.textMarginsLast,
checkable: true,
template: pageMarginsTemplate,
toggleGroup: 'menuPageMargins'
}, //top,left,bottom,right
{
caption: me.textMarginsNormal,
checkable: true,
template: pageMarginsTemplate,
toggleGroup: 'menuPageMargins',
value: [19.1, 17.8, 19.1, 17.8]
},
{
caption: me.textMarginsNarrow,
checkable: true,
template: pageMarginsTemplate,
toggleGroup: 'menuPageMargins',
value: [19.1, 6.4, 19.1, 6.4]
},
{
caption: me.textMarginsWide,
checkable: true,
template: pageMarginsTemplate,
toggleGroup: 'menuPageMargins',
value: [25.4, 25.4, 25.4, 25.4]
},
{caption: '--'},
{caption: me.textPageMarginsCustom, value: 'advanced'}
]
})
});
var pageSizeTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
'<div><%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' +
'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></div></a>');
me.btnPageSize = new Common.UI.Button({
id: 'tlbtn-pagesize',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-pagesize',
caption: me.capBtnPageSize,
lock : [_set.lostConnect, _set.coAuth],
menu: new Common.UI.Menu({
items: [
{
caption: 'US Letter',
subtitle: '21,59cm x 27,94cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [215.9, 279.4]
},
{
caption: 'US Legal',
subtitle: '21,59cm x 35,56cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [215.9, 355.6]
},
{
caption: 'A4',
subtitle: '21cm x 29,7cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [210, 297],
checked: true
},
{
caption: 'A5',
subtitle: '14,81cm x 20,99cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [148, 210]
},
{
caption: 'B5',
subtitle: '17,6cm x 25,01cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [176, 250]
},
{
caption: 'Envelope #10',
subtitle: '10,48cm x 24,13cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [104.8, 241.3]
},
{
caption: 'Envelope DL',
subtitle: '11,01cm x 22,01cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [110, 220]
},
{
caption: 'Tabloid',
subtitle: '27,94cm x 43,17cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [279.4, 431.8]
},
{
caption: 'A3',
subtitle: '29,7cm x 42,01cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [297, 420]
},
{
caption: 'Tabloid Oversize',
subtitle: '30,48cm x 45,71cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [304.8, 457.1]
},
{
caption: 'ROC 16K',
subtitle: '19,68cm x 27,3cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [196.8, 273]
},
{
caption: 'Envelope Choukei 3',
subtitle: '11,99cm x 23,49cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [119.9, 234.9]
},
{
caption: 'Super B/A3',
subtitle: '33,02cm x 48,25cm',
template: pageSizeTemplate,
checkable: true,
toggleGroup: 'menuPageSize',
value: [330.2, 482.5]
}
]
})
});
me.mnuPageSize = me.btnPageSize.menu;
me.btnImgAlign = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-img-align',
caption: me.capImgAlign,
lock : [_set.selRange, _set.selRangeEdit, _set.cantGroup, _set.lostConnect, _set.coAuth],
menu: true
});
me.btnImgGroup = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-img-group',
caption: me.capImgGroup,
lock : [_set.selRange, _set.selRangeEdit, _set.cantGroupUngroup, _set.lostConnect, _set.coAuth],
menu: true
});
me.btnImgForward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-img-frwd',
caption: me.capImgForward,
split: true,
lock : [_set.selRange, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
menu: true
});
me.btnImgBackward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-img-bkwd',
caption: me.capImgBackward,
lock : [_set.selRange, _set.selRangeEdit, _set.lostConnect, _set.coAuth],
split: true,
menu: true
});
} else {
Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template_view),
@ -1240,7 +1475,8 @@ define([
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
me.btnInsertChart, me.btnColorSchemas,
me.btnAutofilter, me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle,
me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup
];
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,
@ -1300,8 +1536,21 @@ define([
}
});
if ( mode.isEdit )
if ( mode.isEdit ) {
var top = Common.localStorage.getItem("sse-pgmargins-top"),
left = Common.localStorage.getItem("sse-pgmargins-left"),
bottom = Common.localStorage.getItem("sse-pgmargins-bottom"),
right = Common.localStorage.getItem("sse-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.setTab('home');
}
if ( me.isCompactView )
me.setFolded(true);
@ -1391,6 +1640,14 @@ define([
_injectComponent('#slot-btn-inschart', this.btnInsertChart);
_injectComponent('#slot-field-styles', this.listStyles);
_injectComponent('#slot-btn-chart', this.btnEditChart);
_injectComponent('#slot-btn-pageorient', this.btnPageOrient);
_injectComponent('#slot-btn-pagemargins', this.btnPageMargins);
_injectComponent('#slot-btn-pagesize', this.btnPageSize);
_injectComponent('#slot-img-align', this.btnImgAlign);
_injectComponent('#slot-img-group', this.btnImgGroup);
_injectComponent('#slot-img-movefrwd', this.btnImgForward);
_injectComponent('#slot-img-movebkwd', this.btnImgBackward);
// replacePlacholder('#id-toolbar-short-placeholder-btn-halign', this.btnHorizontalAlign);
// replacePlacholder('#id-toolbar-short-placeholder-btn-valign', this.btnVerticalAlign);
// replacePlacholder('#id-toolbar-short-placeholder-btn-filter', this.btnAutofilter);
@ -1459,6 +1716,9 @@ define([
_updateHint(this.btnHorizontalAlign, this.tipHAligh);
_updateHint(this.btnVerticalAlign, this.tipVAligh);
_updateHint(this.btnAutofilter, this.tipAutofilter);
_updateHint(this.btnPageOrient, this.tipPageOrient);
_updateHint(this.btnPageSize, this.tipPageSize);
_updateHint(this.btnPageMargins, this.tipPageMargins);
// set menus
if (this.btnBorders && this.btnBorders.rendered) {
@ -1649,6 +1909,8 @@ define([
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
});
}
this.updateMetricUnit();
},
onToolbarAfterRender: function(toolbar) {
@ -1674,6 +1936,35 @@ define([
}
},
updateMetricUnit: function () {
var items = this.btnPageMargins.menu.items;
for (var i = 0; i < items.length; i++) {
var mnu = items[i];
if (mnu.checkable) {
var checked = mnu.checked;
$(mnu.el).html(mnu.template({
id: Common.UI.getId(),
caption: mnu.caption,
options: mnu.options
}));
if (checked) mnu.setChecked(checked);
}
}
items = this.btnPageSize.menu.items;
for (var i = 0; i < items.length; i++) {
var mnu = items[i];
if (mnu.checkable) {
var checked = mnu.checked;
$(mnu.el).html(mnu.template({
id: Common.UI.getId(),
caption: mnu.caption,
options: mnu.options
}));
if (checked) mnu.setChecked(checked);
}
}
},
setApi: function(api) {
this.api = api;
@ -1839,6 +2130,76 @@ define([
},
onAppReady: function (config) {
var me = this;
var _holder_view = SSE.getController('DocumentHolder').getView('DocumentHolder');
me.btnImgForward.updateHint(me.tipSendForward);
me.btnImgForward.setMenu(new Common.UI.Menu({
items: [{
caption : _holder_view.textArrangeFront,
iconCls : 'mnu-arrange-front',
value : Asc.c_oAscDrawingLayerType.BringToFront
}, {
caption : _holder_view.textArrangeForward,
iconCls : 'mnu-arrange-forward',
value : Asc.c_oAscDrawingLayerType.BringForward
}
]})
);
me.btnImgBackward.updateHint(me.tipSendBackward);
me.btnImgBackward.setMenu(new Common.UI.Menu({
items: [{
caption : _holder_view.textArrangeBack,
iconCls : 'mnu-arrange-back',
value : Asc.c_oAscDrawingLayerType.SendToBack
}, {
caption : _holder_view.textArrangeBackward,
iconCls : 'mnu-arrange-backward',
value : Asc.c_oAscDrawingLayerType.SendBackward
}]
}));
me.btnImgAlign.updateHint(me.tipImgAlign);
me.btnImgAlign.setMenu(new Common.UI.Menu({
items: [{
caption : _holder_view.textShapeAlignLeft,
iconCls : 'mnu-img-align-left',
// halign : Asc.c_oAscAlignH.Left
}, {
caption : _holder_view.textShapeAlignCenter,
iconCls : 'mnu-img-align-center',
// halign : Asc.c_oAscAlignH.Center
}, {
caption : _holder_view.textShapeAlignRight,
iconCls : 'mnu-img-align-right',
// halign : Asc.c_oAscAlignH.Right
}, {
caption : _holder_view.textShapeAlignTop,
iconCls : 'mnu-img-align-top',
// valign : Asc.c_oAscAlignV.Top
}, {
caption : _holder_view.textShapeAlignMiddle,
iconCls : 'mnu-img-align-middle',
// valign : Asc.c_oAscAlignV.Center
}, {
caption : _holder_view.textShapeAlignBottom,
iconCls : 'mnu-img-align-bottom',
// valign : Asc.c_oAscAlignV.Bottom
}]
}));
me.btnImgGroup.updateHint(me.tipImgGroup);
me.btnImgGroup.setMenu(new Common.UI.Menu({
items: [{
caption : _holder_view.txtGroup,
iconCls : 'mnu-group',
value: 'grouping'
}, {
caption : _holder_view.txtUngroup,
iconCls : 'mnu-ungroup',
value: 'ungrouping'
}]
}));
},
@ -2032,6 +2393,32 @@ define([
textSurface: 'Surface',
tipChangeChart: 'Change Chart Type',
textTabCollaboration: 'Collaboration',
textTabProtect: 'Protection'
textTabProtect: 'Protection',
textTabLayout: 'Layout',
capBtnPageOrient: 'Orientation',
capBtnMargins: 'Margins',
capBtnPageSize: 'Size',
tipImgAlign: 'Align objects',
tipImgGroup: 'Group objects',
tipSendForward: 'Bring forward',
tipSendBackward: 'Send backward',
capImgAlign: 'Align',
capImgGroup: 'Group',
capImgForward: 'Bring Forward',
capImgBackward: 'Send Backward',
tipPageSize: 'Page Size',
tipPageOrient: 'Page Orientation',
tipPageMargins: 'Page Margins',
textMarginsLast: 'Last Custom',
textMarginsNormal: 'Normal',
textMarginsNarrow: 'Narrow',
textMarginsWide: 'Wide',
textPageMarginsCustom: 'Custom margins',
textTop: 'Top: ',
textLeft: 'Left: ',
textBottom: 'Bottom: ',
textRight: 'Right: ',
textPortrait: 'Portrait',
textLandscape: 'Landscape'
}, SSE.Views.Toolbar || {}));
});

View file

@ -265,6 +265,7 @@
<img class="inline-svg" src="../../common/main/resources/img/header/buttons.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/xlsx.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdf.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/pdfa.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/ods.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/csv.svg">
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/blank.svg">

View file

@ -284,6 +284,7 @@
<inline src="resources/img/header/buttons.svg" />
<inline src="resources/img/doc-formats/xlsx.svg" />
<inline src="resources/img/doc-formats/pdf.svg" />
<inline src="resources/img/doc-formats/pdfa.svg" />
<inline src="resources/img/doc-formats/ods.svg" />
<inline src="resources/img/doc-formats/csv.svg" />
<inline src="resources/img/doc-formats/blank.svg" />

View file

@ -1244,6 +1244,12 @@
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
"SSE.Views.DocumentHolder.txtWidth": "Width",
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"SSE.Views.DocumentHolder.textShapeAlignBottom": "Align Bottom",
"SSE.Views.DocumentHolder.textShapeAlignCenter": "Align Center",
"SSE.Views.DocumentHolder.textShapeAlignLeft": "Align Left",
"SSE.Views.DocumentHolder.textShapeAlignMiddle": "Align Middle",
"SSE.Views.DocumentHolder.textShapeAlignRight": "Align Right",
"SSE.Views.DocumentHolder.textShapeAlignTop": "Align Top",
"SSE.Views.FileMenu.btnBackCaption": "Go to Documents",
"SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",
@ -1465,6 +1471,13 @@
"SSE.Views.NameManagerDlg.textWorkbook": "Workbook",
"SSE.Views.NameManagerDlg.tipIsLocked": "This element is being edited by another user.",
"SSE.Views.NameManagerDlg.txtTitle": "Name Manager",
"SSE.Views.PageMarginsDialog.cancelButtonText": "Cancel",
"SSE.Views.PageMarginsDialog.okButtonText": "Ok",
"SSE.Views.PageMarginsDialog.textBottom": "Bottom",
"SSE.Views.PageMarginsDialog.textLeft": "Left",
"SSE.Views.PageMarginsDialog.textRight": "Right",
"SSE.Views.PageMarginsDialog.textTitle": "Margins",
"SSE.Views.PageMarginsDialog.textTop": "Top",
"SSE.Views.ParagraphSettings.strLineHeight": "Line Spacing",
"SSE.Views.ParagraphSettings.strParagraphSpacing": "Paragraph Spacing",
"SSE.Views.ParagraphSettings.strSpacingAfter": "After",
@ -2017,5 +2030,31 @@
"SSE.Views.Top10FilterDialog.txtItems": "Item",
"SSE.Views.Top10FilterDialog.txtPercent": "Percent",
"SSE.Views.Top10FilterDialog.txtTitle": "Top 10 AutoFilter",
"SSE.Views.Top10FilterDialog.txtTop": "Top"
"SSE.Views.Top10FilterDialog.txtTop": "Top",
"SSE.Views.Toolbar.textTabLayout": "Layout",
"SSE.Views.Toolbar.capBtnMargins": "Margins",
"SSE.Views.Toolbar.capBtnPageOrient": "Orientation",
"SSE.Views.Toolbar.capBtnPageSize": "Size",
"SSE.Views.Toolbar.capImgAlign": "Align",
"SSE.Views.Toolbar.capImgBackward": "Send Backward",
"SSE.Views.Toolbar.capImgForward": "Bring Forward",
"SSE.Views.Toolbar.capImgGroup": "Group",
"SSE.Views.Toolbar.tipImgAlign": "Align objects",
"SSE.Views.Toolbar.tipImgGroup": "Group objects",
"SSE.Views.Toolbar.tipSendBackward": "Send backward",
"SSE.Views.Toolbar.tipSendForward": "Bring forward",
"SSE.Views.Toolbar.tipPageMargins": "Page margins",
"SSE.Views.Toolbar.tipPageOrient": "Page orientation",
"SSE.Views.Toolbar.tipPageSize": "Page size",
"SSE.Views.Toolbar.textMarginsLast": "Last Custom",
"SSE.Views.Toolbar.textMarginsNarrow": "Narrow",
"SSE.Views.Toolbar.textMarginsNormal": "Normal",
"SSE.Views.Toolbar.textMarginsWide": "Wide",
"SSE.Views.Toolbar.textPageMarginsCustom": "Custom margins",
"SSE.Views.Toolbar.textBottom": "Bottom: ",
"SSE.Views.Toolbar.textLeft": "Left: ",
"SSE.Views.Toolbar.textRight": "Right: ",
"SSE.Views.Toolbar.textTop": "Top: ",
"SSE.Views.Toolbar.textLandscape": "Landscape",
"SSE.Views.Toolbar.textPortrait": "Portrait"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -210,6 +210,16 @@
.menu-btn-icon(mnu-text-subscript, 38, @menu-icon-size);
.menu-btn-icon(mnu-text-superscript, 39, @menu-icon-size);
.menu-btn-icon(mnu-orient-portrait, 48, @menu-icon-size);
.menu-btn-icon(mnu-orient-landscape, 49, @menu-icon-size);
.menu-btn-icon(mnu-img-align-center, 41, @menu-icon-size);
.menu-btn-icon(mnu-img-align-left, 40, @menu-icon-size);
.menu-btn-icon(mnu-img-align-right, 42, @menu-icon-size);
.menu-btn-icon(mnu-img-align-bottom, 45, @menu-icon-size);
.menu-btn-icon(mnu-img-align-middle, 44, @menu-icon-size);
.menu-btn-icon(mnu-img-align-top, 43, @menu-icon-size);
.username-tip {
background-color: #ee3525;
border: none;