Merge branch 'develop' into feature/Bug_45361
|
@ -96,11 +96,13 @@ define([
|
|||
'<a class="scroll left"></a>' +
|
||||
'<ul>' +
|
||||
'<% for(var i in items) { %>' +
|
||||
'<% if (typeof items[i] == "object") { %>' +
|
||||
'<li class="ribtab' +
|
||||
'<% if (items[i].haspanel===false) print(" x-lone") %>' +
|
||||
'<% if (items[i].extcls) print(\' \' + items[i].extcls) %>">' +
|
||||
'<a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>"><%= items[i].caption %></a>' +
|
||||
'</li>' +
|
||||
'<% } %>' +
|
||||
'<% } %>' +
|
||||
'</ul>' +
|
||||
'<a class="scroll right"></a>' +
|
||||
|
|
|
@ -111,7 +111,9 @@ define([
|
|||
} else
|
||||
if (this.placement == 'top')
|
||||
this.cmpEl.css({bottom : innerHeight - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
|
||||
else {// left or right
|
||||
else if (this.placement == 'target') {
|
||||
this.cmpEl.css({top : (showxy.top+5) + 'px', left: (showxy.left+5) + 'px'});
|
||||
} else {// left or right
|
||||
var top = showxy.top + this.target.height()/2,
|
||||
height = this.cmpEl.height();
|
||||
if (top+height>innerHeight)
|
||||
|
|
|
@ -51,9 +51,15 @@ define([
|
|||
this.active = false;
|
||||
this.label = 'Tab';
|
||||
this.cls = '';
|
||||
this.iconCls = '';
|
||||
this.iconVisible = false;
|
||||
this.iconTitle = '';
|
||||
this.index = -1;
|
||||
this.template = _.template(['<li class="list-item <% if(active){ %>active selected<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%- label %>">',
|
||||
'<span title="<%- label %>" draggable="true" oo_editor_input="true" tabindex="-1" data-index="<%= index %>"><%- label %></span>',
|
||||
this.template = _.template(['<li class="list-item <% if(active){ %>active selected<% } %> <% if(cls.length){%><%= cls %><%}%><% if(iconVisible){%> icon-visible <%}%>" data-label="<%- label %>">',
|
||||
'<span title="<%- label %>" draggable="true" oo_editor_input="true" tabindex="-1" data-index="<%= index %>">',
|
||||
'<div class="toolbar__icon <% if(iconCls.length){%><%= iconCls %><%}%>" title="<% if(iconTitle.length){%><%=iconTitle%><%}%>"></div>',
|
||||
'<%- label %>',
|
||||
'</span>',
|
||||
'</li>'].join(''));
|
||||
|
||||
this.initialize.call(this, opts);
|
||||
|
@ -126,6 +132,16 @@ define([
|
|||
|
||||
setCaption: function(text) {
|
||||
this.$el.find('> span').text(text);
|
||||
},
|
||||
|
||||
changeIconState: function(visible, title) {
|
||||
if (this.iconCls.length) {
|
||||
this.iconVisible = visible;
|
||||
this.iconTitle = title || '';
|
||||
this[visible ? 'addClass' : 'removeClass']('icon-visible');
|
||||
if (title)
|
||||
this.$el.find('.' + this.iconCls).attr('title', title);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
127
apps/common/main/lib/view/EditNameDialog.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* EditNameDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 10.07.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/component/Window',
|
||||
'common/main/lib/component/InputField'
|
||||
], function () { 'use strict';
|
||||
|
||||
Common.Views.EditNameDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 330,
|
||||
header: false,
|
||||
cls: 'modal-dlg',
|
||||
buttons: ['ok', 'cancel']
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<div class="input-row">',
|
||||
'<label>' + (this.options.label ? this.options.label : this.textLabel) + '</label>',
|
||||
'</div>',
|
||||
'<div id="id-dlg-label-caption" class="input-row"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this;
|
||||
me.inputLabel = new Common.UI.InputField({
|
||||
el : $('#id-dlg-label-caption'),
|
||||
allowBlank : false,
|
||||
blankError : me.options.error ? me.options.error : me.textLabelError,
|
||||
style : 'width: 100%;',
|
||||
validateOnBlur: false,
|
||||
validation : function(value) {
|
||||
return value ? true : '';
|
||||
}
|
||||
});
|
||||
me.inputLabel.setValue(this.options.value || '' );
|
||||
|
||||
var $window = this.getChild();
|
||||
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
||||
},
|
||||
|
||||
show: function() {
|
||||
Common.UI.Window.prototype.show.apply(this, arguments);
|
||||
|
||||
var me = this;
|
||||
_.delay(function(){
|
||||
me.getChild('input').focus();
|
||||
},50);
|
||||
},
|
||||
|
||||
onPrimary: function(event) {
|
||||
this._handleInput('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
this._handleInput(event.currentTarget.attributes['result'].value);
|
||||
},
|
||||
|
||||
_handleInput: function(state) {
|
||||
if (this.options.handler) {
|
||||
if (state == 'ok') {
|
||||
if (this.inputLabel.checkValidate() !== true) {
|
||||
this.inputLabel.cmpEl.find('input').focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.options.handler.call(this, state, this.inputLabel.getValue());
|
||||
}
|
||||
|
||||
this.close();
|
||||
},
|
||||
|
||||
textLabel: 'Label:',
|
||||
textLabelError: 'Label must not be empty.'
|
||||
}, Common.Views.EditNameDialog || {}));
|
||||
});
|
|
@ -664,9 +664,11 @@ define([
|
|||
|
||||
fakeMenuItem: function() {
|
||||
return {
|
||||
conf: {checked: false},
|
||||
conf: {checked: false, disabled: false},
|
||||
setChecked: function (val) { this.conf.checked = val; },
|
||||
isChecked: function () { return this.conf.checked; }
|
||||
isChecked: function () { return this.conf.checked; },
|
||||
setDisabled: function (val) { this.conf.disabled = val; },
|
||||
isDisabled: function () { return this.conf.disabled; }
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -489,9 +489,18 @@ define([
|
|||
var init = (aFontSelects.length<1);
|
||||
init && this.initFonts();
|
||||
|
||||
//fill recents
|
||||
this.fillRecentSymbols();
|
||||
|
||||
var lastfont;
|
||||
if (options.font) {
|
||||
lastfont = options.font;
|
||||
} else if (aRecents.length>0) {
|
||||
lastfont = aRecents[0].font;
|
||||
}
|
||||
if (lastfont) {
|
||||
for(var i = 0; i < aFontSelects.length; ++i){
|
||||
if(aFontSelects[i].displayValue === options.font){
|
||||
if(aFontSelects[i].displayValue === lastfont){
|
||||
nCurrentFont = i;
|
||||
break;
|
||||
}
|
||||
|
@ -526,6 +535,8 @@ define([
|
|||
nCurrentSymbol = options.code;
|
||||
} else if (options.symbol) {
|
||||
nCurrentSymbol = this.fixedCharCodeAt(options.symbol, 0);
|
||||
} else if (aRecents.length>0) {
|
||||
nCurrentSymbol = aRecents[0].symbol;
|
||||
}
|
||||
|
||||
if (init && this.options.lang && this.options.lang != 'en') {
|
||||
|
@ -539,6 +550,8 @@ define([
|
|||
|
||||
this.on('resizing', _.bind(this.onWindowResizing, this));
|
||||
this.on('resize', _.bind(this.onWindowResize, this));
|
||||
|
||||
bMainFocus = true;
|
||||
},
|
||||
|
||||
initFonts: function() {
|
||||
|
@ -705,9 +718,6 @@ define([
|
|||
me.updateInput();
|
||||
});
|
||||
|
||||
//fill recents
|
||||
this.fillRecentSymbols();
|
||||
|
||||
this.symbolTablePanel = $window.find('#symbol-table-scrollable-div');
|
||||
this.previewPanel = $window.find('#id-preview-data');
|
||||
this.previewParent = this.previewPanel.parent();
|
||||
|
@ -822,7 +832,7 @@ define([
|
|||
this.options.handler.call(this, this, state, settings);
|
||||
}
|
||||
if (state=='ok') {
|
||||
!special && settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
||||
!special && this.checkRecent(nCurrentSymbol, settings.font);
|
||||
!special && settings.updateRecents && this.updateRecents();
|
||||
if (this.type)
|
||||
return;
|
||||
|
@ -1050,7 +1060,7 @@ define([
|
|||
this._handleInput('ok');
|
||||
else {
|
||||
var settings = this.getPasteSymbol($(e.target).attr('id'));
|
||||
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
||||
this.checkRecent(nCurrentSymbol, settings.font);
|
||||
settings.updateRecents && this.updateView(false, undefined, undefined, true);
|
||||
this.fireEvent('symbol:dblclick', this, 'ok', settings);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.no-arrow {
|
||||
.tip-arrow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.asc-synchronizetip {
|
||||
padding-right: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
&.inc-index {
|
||||
z-index: @zindex-navbar + 4;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ define([
|
|||
'documenteditor/main/app/view/TableOfContentsSettings',
|
||||
'documenteditor/main/app/view/BookmarksDialog',
|
||||
'documenteditor/main/app/view/CaptionDialog',
|
||||
'documenteditor/main/app/view/NotesRemoveDialog'
|
||||
'documenteditor/main/app/view/NotesRemoveDialog',
|
||||
'documenteditor/main/app/view/CrossReferenceDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -69,7 +70,8 @@ define([
|
|||
'links:notes': this.onNotesClick,
|
||||
'links:hyperlink': this.onHyperlinkClick,
|
||||
'links:bookmarks': this.onBookmarksClick,
|
||||
'links:caption': this.onCaptionClick
|
||||
'links:caption': this.onCaptionClick,
|
||||
'links:crossref': this.onCrossRefClick
|
||||
},
|
||||
'DocumentHolder': {
|
||||
'links:contents': this.onTableContents,
|
||||
|
@ -154,12 +156,15 @@ define([
|
|||
this._state.in_object = in_image || in_table || in_equation;
|
||||
|
||||
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
|
||||
control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
|
||||
control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false,
|
||||
lock_type = control_props ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked,
|
||||
content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
|
||||
var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : false,
|
||||
rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : false,
|
||||
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
|
||||
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
|
||||
|
||||
|
||||
var need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain || rich_edit_lock || plain_edit_lock;
|
||||
this.view.btnsNotes.setDisabled(need_disable);
|
||||
|
||||
|
@ -171,6 +176,10 @@ define([
|
|||
|
||||
need_disable = in_header;
|
||||
this.view.btnCaption.setDisabled(need_disable);
|
||||
|
||||
need_disable = paragraph_locked || header_locked || control_plain || rich_edit_lock || plain_edit_lock || content_locked;
|
||||
this.view.btnCrossRef.setDisabled(need_disable);
|
||||
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(need_disable);
|
||||
},
|
||||
|
||||
onApiCanAddHyperlink: function(value) {
|
||||
|
@ -443,6 +452,24 @@ define([
|
|||
|
||||
onShowContentControlsActions: function(obj, x, y) {
|
||||
(obj.type == Asc.c_oAscContentControlSpecificType.TOC) && this.onShowTOCActions(obj, x, y);
|
||||
},
|
||||
|
||||
onCrossRefClick: function(btn) {
|
||||
if (this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible()) return;
|
||||
|
||||
var me = this;
|
||||
me.dlgCrossRefDialog = new DE.Views.CrossReferenceDialog({
|
||||
api: me.api,
|
||||
crossRefProps: me.crossRefProps,
|
||||
handler: function (result, settings) {
|
||||
if (result != 'ok')
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
}
|
||||
});
|
||||
me.dlgCrossRefDialog.on('close', function(obj){
|
||||
me.crossRefProps = me.dlgCrossRefDialog.getSettings();
|
||||
});
|
||||
me.dlgCrossRefDialog.show();
|
||||
}
|
||||
|
||||
}, DE.Controllers.Links || {}));
|
||||
|
|
|
@ -60,7 +60,8 @@ define([
|
|||
'documenteditor/main/app/view/WatermarkSettingsDialog',
|
||||
'documenteditor/main/app/view/CompareSettingsDialog',
|
||||
'documenteditor/main/app/view/ListSettingsDialog',
|
||||
'documenteditor/main/app/view/DateTimeDialog'
|
||||
'documenteditor/main/app/view/DateTimeDialog',
|
||||
'documenteditor/main/app/view/LineNumbersDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -101,7 +102,9 @@ define([
|
|||
pgmargins: undefined,
|
||||
fontsize: undefined,
|
||||
in_equation: false,
|
||||
in_chart: false
|
||||
in_chart: false,
|
||||
linenum_apply: Asc.c_oAscSectionApplyType.All,
|
||||
suppress_num: undefined
|
||||
};
|
||||
this.flg = {};
|
||||
this.diagramEditor = null;
|
||||
|
@ -334,6 +337,8 @@ define([
|
|||
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
|
||||
toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this));
|
||||
toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this));
|
||||
toolbar.btnLineNumbers.menu.on('item:click', _.bind(this.onLineNumbersSelect, this));
|
||||
toolbar.btnLineNumbers.menu.on('show:after', _.bind(this.onLineNumbersShow, this));
|
||||
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
|
||||
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
|
||||
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
|
||||
|
@ -385,6 +390,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
|
||||
this.api.asc_registerCallback('asc_onColumnsProps', _.bind(this.onColumnsProps, this));
|
||||
this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this));
|
||||
this.api.asc_registerCallback('asc_onLineNumbersProps', _.bind(this.onLineNumbersProps, this));
|
||||
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
|
||||
this.api.asc_registerCallback('asc_onShowParaMarks', _.bind(this.onShowParaMarks, this));
|
||||
this.api.asc_registerCallback('asc_onChangeSdtGlobalSettings', _.bind(this.onChangeSdtGlobalSettings, this));
|
||||
|
@ -886,6 +892,10 @@ define([
|
|||
|
||||
toolbar.btnWatermark.setDisabled(header_locked);
|
||||
|
||||
if (frame_pr) {
|
||||
this._state.suppress_num = !!frame_pr.get_SuppressLineNumbers();
|
||||
}
|
||||
|
||||
this._state.in_equation = in_equation;
|
||||
},
|
||||
|
||||
|
@ -1674,6 +1684,67 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onLineNumbersSelect: function(menu, item) {
|
||||
if (_.isUndefined(item.value))
|
||||
return;
|
||||
|
||||
switch (item.value) {
|
||||
case 0:
|
||||
this.api.asc_SetLineNumbersProps(this._state.linenum_apply, null);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
this._state.linenum = undefined;
|
||||
if (this.api && item.checked) {
|
||||
var props = new Asc.CSectionLnNumType();
|
||||
props.put_Restart(item.value==1 ? Asc.c_oAscLineNumberRestartType.Continuous : (item.value==2 ? Asc.c_oAscLineNumberRestartType.NewPage : Asc.c_oAscLineNumberRestartType.NewSection));
|
||||
this.api.asc_SetLineNumbersProps(this._state.linenum_apply, props);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
this.api && this.api.asc_SetParagraphSuppressLineNumbers(item.checked);
|
||||
break;
|
||||
case 5:
|
||||
var win,
|
||||
me = this;
|
||||
win = new DE.Views.LineNumbersDialog({
|
||||
applyTo: me._state.linenum_apply,
|
||||
handler: function(dlg, result) {
|
||||
if (result == 'ok') {
|
||||
var settings = dlg.getSettings();
|
||||
me.api.asc_SetLineNumbersProps(settings.type, settings.props);
|
||||
me._state.linenum_apply = settings.type;
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
}
|
||||
}
|
||||
});
|
||||
win.show();
|
||||
win.setSettings(me.api.asc_GetLineNumbersProps());
|
||||
break;
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onLineNumbersProps: function(props) {
|
||||
var index = 0;
|
||||
if (props) {
|
||||
switch (props.get_Restart()) {
|
||||
case Asc.c_oAscLineNumberRestartType.Continuous: index = 1; break;
|
||||
case Asc.c_oAscLineNumberRestartType.NewPage: index = 2; break;
|
||||
case Asc.c_oAscLineNumberRestartType.NewSection: index = 3; break;
|
||||
}
|
||||
}
|
||||
if (this._state.linenum === index)
|
||||
return;
|
||||
this.toolbar.btnLineNumbers.menu.items[index].setChecked(true);
|
||||
this._state.linenum = index;
|
||||
},
|
||||
|
||||
onLineNumbersShow: function(menu) {
|
||||
menu.items[4].setChecked(this._state.suppress_num);
|
||||
},
|
||||
|
||||
onColorSchemaClick: function(menu, item) {
|
||||
if (this.api) {
|
||||
this.api.asc_ChangeColorSchemeByIdx(item.value);
|
||||
|
@ -2589,7 +2660,8 @@ define([
|
|||
if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return;
|
||||
|
||||
if (this.api) {
|
||||
var me = this;
|
||||
var me = this,
|
||||
selected = me.api.asc_GetSelectedText();
|
||||
me.dlgSymbolTable = new Common.Views.SymbolTableDialog({
|
||||
api: me.api,
|
||||
lang: me.mode.lang,
|
||||
|
@ -2597,6 +2669,8 @@ define([
|
|||
type: 1,
|
||||
special: true,
|
||||
showShortcutKey: true,
|
||||
font: selected && selected.length>0 ? this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined,
|
||||
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
|
||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
||||
handler: function(dlg, result, settings) {
|
||||
if (result == 'ok') {
|
||||
|
|
|
@ -79,6 +79,11 @@
|
|||
<div id="paragraphadv-checkbox-keep-next"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan="2">
|
||||
<div id="paragraphadv-checkbox-suppress-line-numbers"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
<span class="btn-slot text x-huge" id="slot-btn-pagesize"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-columns"></span>
|
||||
<span class="btn-slot text x-huge btn-pagebreak"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-line-numbers"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
|
@ -158,6 +159,7 @@
|
|||
<span class="btn-slot text x-huge slot-inshyperlink"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-bookmarks"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-caption"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-crossref"></span>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
|
459
apps/documenteditor/main/app/view/CrossReferenceDialog.js
Normal file
|
@ -0,0 +1,459 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* CrossReferenceDialog.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 22.09.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
define([
|
||||
'common/main/lib/component/Window',
|
||||
'common/main/lib/component/ComboBox'
|
||||
], function () { 'use strict';
|
||||
|
||||
DE.Views.CrossReferenceDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 400,
|
||||
height: 407,
|
||||
style: 'min-width: 240px;',
|
||||
cls: 'modal-dlg',
|
||||
modal: false
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, {
|
||||
title: this.txtTitle,
|
||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close']
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<table cols="2" style="width: 100%;">',
|
||||
'<tr>',
|
||||
'<td style="padding-right: 5px;">',
|
||||
'<label class="input-label">' + this.txtType + '</label>',
|
||||
'<div id="id-dlg-cross-type" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
||||
'</td>',
|
||||
'<td style="padding-left: 5px;">',
|
||||
'<label class="input-label">' + this.txtReference + '</label>',
|
||||
'<div id="id-dlg-cross-ref" class="input-group-nr" style="width: 100%;margin-bottom: 10px;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td colspan="2" style="padding-bottom: 10px;">',
|
||||
'<div id="id-dlg-cross-insert-as" style="width:100%;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td colspan="2" style="padding-bottom: 7px;">',
|
||||
'<div id="id-dlg-cross-below-above" style="width:100%;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td colspan="2" style="padding-bottom: 10px;">',
|
||||
'<div id="id-dlg-cross-separate" style="display: inline-block;vertical-align: middle;margin-right: 10px;"></div>',
|
||||
'<div id="id-dlg-cross-separator" style="display: inline-block;vertical-align: middle;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td colspan="2" style="width: 100%;">',
|
||||
'<label id="id-dlg-cross-which">' + this.textWhich + '</label>',
|
||||
'<div id="id-dlg-cross-list" class="no-borders" style="width:368px; height:161px;margin-top: 2px; "></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'</table>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.crossRefProps = options.crossRefProps;
|
||||
this.api = options.api;
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
this._locked = false;
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this,
|
||||
$window = this.getChild();
|
||||
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
||||
var arr = Common.Utils.InternalSettings.get("de-settings-captions");
|
||||
if (arr==null || arr==undefined) {
|
||||
arr = Common.localStorage.getItem("de-settings-captions") || '';
|
||||
Common.Utils.InternalSettings.set("de-settings-captions", arr);
|
||||
}
|
||||
arr = arr ? JSON.parse(arr) : [];
|
||||
|
||||
// 0 - not removable
|
||||
arr = arr.concat([{ value: 5, displayValue: this.textEquation },
|
||||
{ value: 6, displayValue: this.textFigure },
|
||||
{ value: 7, displayValue: this.textTable }
|
||||
]);
|
||||
arr.sort(function(a,b){
|
||||
var sa = a.displayValue.toLowerCase(),
|
||||
sb = b.displayValue.toLowerCase();
|
||||
return sa>sb ? 1 : (sa<sb ? -1 : 0);
|
||||
});
|
||||
|
||||
this.cmbType = new Common.UI.ComboBox({
|
||||
el : $window.find('#id-dlg-cross-type'),
|
||||
menuStyle : 'min-width: 100%;max-height: 233px;',
|
||||
editable : false,
|
||||
cls : 'input-group-nr',
|
||||
data : [
|
||||
{ value: 0, displayValue: this.textParagraph },
|
||||
{ value: 1, displayValue: this.textHeading },
|
||||
{ value: 2, displayValue: this.textBookmark },
|
||||
{ value: 3, displayValue: this.textFootnote },
|
||||
{ value: 4, displayValue: this.textEndnote }
|
||||
].concat(arr)
|
||||
});
|
||||
this.cmbType.on('selected', _.bind(this.onTypeSelected, this));
|
||||
|
||||
this.cmbReference = new Common.UI.ComboBox({
|
||||
el : $window.find('#id-dlg-cross-ref'),
|
||||
menuStyle : 'min-width: 100%;max-height: 233px;',
|
||||
editable : false,
|
||||
cls : 'input-group-nr',
|
||||
data : []
|
||||
});
|
||||
this.cmbReference.on('selected', _.bind(this.onReferenceSelected, this));
|
||||
|
||||
this.chInsertAs = new Common.UI.CheckBox({
|
||||
el: $window.find('#id-dlg-cross-insert-as'),
|
||||
labelText: this.textInsertAs,
|
||||
value: true
|
||||
});
|
||||
|
||||
this.chBelowAbove = new Common.UI.CheckBox({
|
||||
el: $window.find('#id-dlg-cross-below-above'),
|
||||
labelText: this.textIncludeAbove
|
||||
});
|
||||
|
||||
this.chSeparator = new Common.UI.CheckBox({
|
||||
el: $window.find('#id-dlg-cross-separate'),
|
||||
labelText: this.textSeparate
|
||||
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||
var checked = field.getValue() === 'checked';
|
||||
this.inputSeparator.setDisabled(!checked);
|
||||
}, this));
|
||||
|
||||
this.inputSeparator = new Common.UI.InputField({
|
||||
el: $window.findById('#id-dlg-cross-separator'),
|
||||
style: 'width: 35px;',
|
||||
validateOnBlur: false,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.refList = new Common.UI.ListView({
|
||||
el: $window.find('#id-dlg-cross-list'),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;overflow: hidden; text-overflow: ellipsis;white-space: pre;"><%= value %></div>')
|
||||
});
|
||||
this.refList.on('entervalue', _.bind(this.onPrimary, this))
|
||||
.on('item:dblclick', _.bind(this.onPrimary, this));
|
||||
|
||||
this.lblWhich = $window.find('#id-dlg-cross-which');
|
||||
|
||||
this.btnInsert = new Common.UI.Button({
|
||||
el: $window.find('.primary'),
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.afterRender();
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
this._setDefaults();
|
||||
},
|
||||
|
||||
_handleInput: function(state, fromButton) {
|
||||
if (this.options.handler) {
|
||||
this.options.handler.call(this, state);
|
||||
}
|
||||
if (state=='ok') {
|
||||
if(!fromButton && document.activeElement && document.activeElement.localName == 'textarea' && /area_id/.test(document.activeElement.id)){
|
||||
return;
|
||||
}
|
||||
!this.btnInsert.isDisabled() && this.insertReference();
|
||||
return;
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
|
||||
onBtnClick: function(event) {
|
||||
this._handleInput(event.currentTarget.attributes['result'].value, true);
|
||||
},
|
||||
|
||||
onPrimary: function(event) {
|
||||
this._handleInput('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
getSettings: function() {
|
||||
return {type: this.cmbType.getValue(), refType: this.cmbReference.getValue()};
|
||||
},
|
||||
|
||||
_setDefaults: function () {
|
||||
var rec,
|
||||
currentRef;
|
||||
if (this.crossRefProps) {
|
||||
rec = this.cmbType.store.findWhere({value: this.crossRefProps.type});
|
||||
rec && (currentRef = this.crossRefProps.refType);
|
||||
}
|
||||
rec ? this.cmbType.selectRecord(rec) : this.cmbType.setValue(0);
|
||||
this.refreshReferenceTypes(this.cmbType.getSelectedRecord(), currentRef);
|
||||
},
|
||||
|
||||
insertReference: function() {
|
||||
var record = this.refList.getSelectedRec(),
|
||||
typeRec = this.cmbType.getSelectedRecord(),
|
||||
type = (typeRec.type==1 || typeRec.value>4) ? 5 : typeRec.value,
|
||||
reftype = this.cmbReference.getValue(),
|
||||
link = this.chInsertAs.getValue()=='checked',
|
||||
below = this.chBelowAbove.getValue()=='checked',
|
||||
separator = (this.chSeparator.getValue()=='checked') ? this.inputSeparator.getValue() : undefined;
|
||||
|
||||
switch (type) {
|
||||
case 0: // paragraph
|
||||
case 1: // heading
|
||||
this.api.asc_AddCrossRefToParagraph(record.get('para'), reftype, link, below, separator);
|
||||
break;
|
||||
case 2: // bookmark
|
||||
this.api.asc_AddCrossRefToBookmark(record.get('value'), reftype, link, below, separator);
|
||||
break;
|
||||
case 3: // footnote
|
||||
case 4: // endnote
|
||||
this.api.asc_AddCrossRefToNote(record.get('para'), reftype, link, below);
|
||||
break;
|
||||
case 5: // caption
|
||||
if (reftype==Asc.c_oAscDocumentRefenceToType.OnlyCaptionText && record.get('para').asc_canAddRefToCaptionText(typeRec.displayValue)===false) {
|
||||
Common.UI.warning({
|
||||
msg : this.textEmpty
|
||||
});
|
||||
} else
|
||||
this.api.asc_AddCrossRefToCaption(typeRec.displayValue, record.get('para'), reftype, link, below);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onTypeSelected: function (combo, record) {
|
||||
this.refreshReferenceTypes(record);
|
||||
},
|
||||
|
||||
refreshReferenceTypes: function(record, currentRef) {
|
||||
var arr = [],
|
||||
str = this.textWhich, type = 5;
|
||||
if (record.type==1 || record.value > 4) {
|
||||
// custom labels from caption dialog and Equation, Figure, Table
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textCaption },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber, displayValue: this.textLabelNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.OnlyCaptionText, displayValue: this.textOnlyCaption },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
|
||||
];
|
||||
} else {
|
||||
type = record.value;
|
||||
switch (record.value) {
|
||||
case 0: // paragraph
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textText },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
|
||||
];
|
||||
str = this.textWhichPara;
|
||||
break;
|
||||
case 1: // heading
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textHeadingText },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textHeadingNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textHeadingNumNo },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textHeadingNumFull },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
|
||||
];
|
||||
str = this.textWhichHeading;
|
||||
break;
|
||||
case 2: // bookmark
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.Text, displayValue: this.textBookmarkText },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNum, displayValue: this.textParaNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumNoContext, displayValue: this.textParaNumNo },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.ParaNumFullContex, displayValue: this.textParaNumFull },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow }
|
||||
];
|
||||
str = this.textWhichBookmark;
|
||||
break;
|
||||
case 3: // note
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textNoteNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textNoteNumForm }
|
||||
];
|
||||
str = this.textWhichNote;
|
||||
break;
|
||||
case 4: // end note
|
||||
arr = [
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.NoteNumber, displayValue: this.textEndNoteNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.PageNum, displayValue: this.textPageNum },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.AboveBelow, displayValue: this.textAboveBelow },
|
||||
{ value: Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted, displayValue: this.textEndNoteNumForm }
|
||||
];
|
||||
str = this.textWhichEndnote;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.cmbReference.setData(arr);
|
||||
this.cmbReference.setValue(currentRef ? currentRef : arr[0].value);
|
||||
this.onReferenceSelected(this.cmbReference, this.cmbReference.getSelectedRecord());
|
||||
this.lblWhich.text(str);
|
||||
this.refreshReferences(type);
|
||||
},
|
||||
|
||||
refreshReferences: function(type) {
|
||||
var store = this.refList.store,
|
||||
arr = [],
|
||||
props;
|
||||
switch (type) {
|
||||
case 0: // paragraph
|
||||
props = this.api.asc_GetAllNumberedParagraphs();
|
||||
break;
|
||||
case 1: // heading
|
||||
props = this.api.asc_GetAllHeadingParagraphs();
|
||||
break;
|
||||
case 2: // bookmark
|
||||
props = this.api.asc_GetBookmarksManager();
|
||||
break;
|
||||
case 3: // footnote
|
||||
props = this.api.asc_GetAllFootNoteParagraphs();
|
||||
break;
|
||||
case 4: // endnote
|
||||
props = this.api.asc_GetAllEndNoteParagraphs();
|
||||
break;
|
||||
case 5: // caption
|
||||
props = this.api.asc_GetAllCaptionParagraphs(this.cmbType.getSelectedRecord().displayValue);
|
||||
break;
|
||||
}
|
||||
if (type==2) { // bookmark
|
||||
var count = props.asc_GetCount();
|
||||
for (var i=0; i<count; i++) {
|
||||
var name = props.asc_GetName(i);
|
||||
if (!props.asc_IsInternalUseBookmark(name) && !props.asc_IsHiddenBookmark(name)) {
|
||||
arr.push({value: name});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var i=0; i<props.length; i++) {
|
||||
arr.push({value: props[i].asc_getText(), para: props[i]});
|
||||
}
|
||||
}
|
||||
|
||||
store.reset(arr);
|
||||
if (store.length>0) {
|
||||
var rec = store.at(0);
|
||||
this.refList.selectRecord(rec);
|
||||
this.refList.scrollToRecord(rec);
|
||||
}
|
||||
this.btnInsert.setDisabled(arr.length<1 || this._locked);
|
||||
},
|
||||
|
||||
onReferenceSelected: function(combo, record) {
|
||||
var refType = record.value,
|
||||
typeRec = this.cmbType.getSelectedRecord(),
|
||||
type = (typeRec.type==1 || typeRec.value>4) ? 5 : typeRec.value;
|
||||
var disable = (type==5 && refType!==Asc.c_oAscDocumentRefenceToType.PageNum) || (type<5) && (refType==Asc.c_oAscDocumentRefenceToType.Text || refType==Asc.c_oAscDocumentRefenceToType.AboveBelow);
|
||||
this.chBelowAbove.setDisabled(disable);
|
||||
disable = !(type==0 || type==2) || (refType!==Asc.c_oAscDocumentRefenceToType.ParaNumFullContex);
|
||||
this.chSeparator.setDisabled(disable);
|
||||
this.inputSeparator.setDisabled(disable || this.chSeparator.getValue()!=='checked');
|
||||
},
|
||||
|
||||
setLocked: function(locked){
|
||||
this._locked = locked;
|
||||
this.btnInsert.setDisabled(this.refList.store.length<1 || this._locked);
|
||||
},
|
||||
|
||||
txtTitle: 'Cross-reference',
|
||||
txtType: 'Reference type',
|
||||
txtReference: 'Insert reference to',
|
||||
textInsertAs: 'Insert as hyperlink',
|
||||
textSeparate: 'Separate numbers with',
|
||||
textIncludeAbove: 'Include above/below',
|
||||
textPageNum: 'Page number',
|
||||
textParaNum: 'Paragraph number',
|
||||
textParaNumNo: 'Paragraph number (no context)',
|
||||
textParaNumFull: 'Paragraph number (full context)',
|
||||
textText: 'Paragraph text',
|
||||
textAboveBelow: 'Above/below',
|
||||
textHeadingText: 'Heading text',
|
||||
textHeadingNum: 'Heading number',
|
||||
textHeadingNumNo: 'Heading number (no context)',
|
||||
textHeadingNumFull: 'Heading number (full context)',
|
||||
textBookmarkText: 'Bookmark text',
|
||||
textNoteNum: 'Footnote number',
|
||||
textNoteNumForm: 'Footnote number (formatted)',
|
||||
textEndNoteNum: 'Endnote number',
|
||||
textEndNoteNumForm: 'Endnote number (formatted)',
|
||||
textCaption: 'Entire caption',
|
||||
textLabelNum: 'Only label and number',
|
||||
textOnlyCaption: 'Only caption text',
|
||||
textParagraph: 'Numbered item',
|
||||
textHeading: 'Heading',
|
||||
textBookmark: 'Bookmark',
|
||||
textFootnote: 'Footnote',
|
||||
textEndnote: 'Endnote',
|
||||
textEquation: 'Equation',
|
||||
textFigure: 'Figure',
|
||||
textTable: 'Table',
|
||||
textInsert: 'Insert',
|
||||
textWhich: 'For which caption',
|
||||
textWhichHeading: 'For which heading',
|
||||
textWhichBookmark: 'For which bookmark',
|
||||
textWhichNote: 'For which footnote',
|
||||
textWhichEndnote: 'For which endnote',
|
||||
textWhichPara: 'For which numbered item',
|
||||
textEmpty: 'The request reference is empty.'
|
||||
|
||||
}, DE.Views.CrossReferenceDialog || {}))
|
||||
});
|
258
apps/documenteditor/main/app/view/LineNumbersDialog.js
Normal file
|
@ -0,0 +1,258 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* LineNumbersDialog.js
|
||||
*
|
||||
* Created by Julia Svinareva on 18/09/19
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/component/Window',
|
||||
'common/main/lib/component/CheckBox',
|
||||
'common/main/lib/component/MetricSpinner'
|
||||
], function () { 'use strict';
|
||||
|
||||
DE.Views.LineNumbersDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 290,
|
||||
height: 308,
|
||||
header: true,
|
||||
style: 'min-width: 290px;',
|
||||
cls: 'modal-dlg',
|
||||
buttons: ['ok', 'cancel']
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, {
|
||||
title: this.textTitle
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box" style="">',
|
||||
'<div id="line-numbers-add-line-numbering" style="margin-bottom: 15px;"></div>',
|
||||
'<div style="margin-bottom: 15px;">',
|
||||
'<div style="display: inline-block; margin-right: 9px;"><label>' + this.textStartAt + '</label><div id="line-numbers-start-at"></div></div>',
|
||||
'<div style="display: inline-block; margin-right: 9px;"><label>' + this.textFromText + '</label><div id="line-numbers-from-text"></div></div>',
|
||||
'<div style="display: inline-block;"><label>' + this.textCountBy + '</label><div id="line-numbers-count-by"></div></div>',
|
||||
'</div>',
|
||||
'<div style="margin-bottom: 8px;"><label>' + this.textNumbering + '</label></div>',
|
||||
'<div id="line-numbers-restart-each-page" style="margin-bottom: 8px;"></div>',
|
||||
'<div id="line-numbers-restart-each-section" style="margin-bottom: 8px;"></div>',
|
||||
'<div id="line-numbers-continuous" style="margin-bottom: 15px;"></div>',
|
||||
'<div style="margin-bottom: 5px;">',
|
||||
'<label style="margin-top: 4px;">' + this.textApplyTo + '</label><div id="line-numbers-combo-apply" class="input-group-nr" style="display: inline-block; width:125px;float:right;"></div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.options.tpl = _.template(this.template)(this.options);
|
||||
|
||||
this.spinners = [];
|
||||
this._noApply = false;
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
this.chAddLineNumbering = new Common.UI.CheckBox({
|
||||
el: $('#line-numbers-add-line-numbering'),
|
||||
labelText: this.textAddLineNumbering
|
||||
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||
var checked = field.getValue()!=='checked';
|
||||
this.spnStartAt.setDisabled(checked);
|
||||
this.spnFromText.setDisabled(checked);
|
||||
this.spnCountBy.setDisabled(checked);
|
||||
this.rbRestartEachPage.setDisabled(checked);
|
||||
this.rbRestartEachSection.setDisabled(checked);
|
||||
this.rbContinuous.setDisabled(checked);
|
||||
}, this));
|
||||
|
||||
this.spnStartAt = new Common.UI.MetricSpinner({
|
||||
el: $('#line-numbers-start-at'),
|
||||
step: 1,
|
||||
width: 80,
|
||||
defaultUnit : '',
|
||||
value: 1,
|
||||
maxValue: 32767,
|
||||
minValue: 1,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.spnFromText = new Common.UI.MetricSpinner({
|
||||
el: $('#line-numbers-from-text'),
|
||||
step: 0.1,
|
||||
width: 80,
|
||||
defaultUnit : 'cm',
|
||||
value: 'Auto',
|
||||
maxValue: 55.87,
|
||||
minValue: 0.1,
|
||||
allowAuto: true,
|
||||
disabled: true
|
||||
});
|
||||
this.spinners.push(this.spnFromText);
|
||||
|
||||
this.spnCountBy = new Common.UI.MetricSpinner({
|
||||
el: $('#line-numbers-count-by'),
|
||||
step: 1,
|
||||
width: 80,
|
||||
defaultUnit : '',
|
||||
value: 1,
|
||||
maxValue: 100,
|
||||
minValue: 1,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.rbRestartEachPage = new Common.UI.RadioBox({
|
||||
el: $('#line-numbers-restart-each-page'),
|
||||
labelText: this.textRestartEachPage,
|
||||
name: 'asc-radio-line-numbers',
|
||||
disabled: true,
|
||||
checked: true
|
||||
});
|
||||
|
||||
this.rbRestartEachSection = new Common.UI.RadioBox({
|
||||
el: $('#line-numbers-restart-each-section'),
|
||||
labelText: this.textRestartEachSection,
|
||||
name: 'asc-radio-line-numbers',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.rbContinuous = new Common.UI.RadioBox({
|
||||
el: $('#line-numbers-continuous'),
|
||||
labelText: this.textContinuous,
|
||||
name: 'asc-radio-line-numbers',
|
||||
disabled: true
|
||||
});
|
||||
|
||||
this.cmbApply = new Common.UI.ComboBox({
|
||||
el: $('#line-numbers-combo-apply'),
|
||||
cls: 'input-group-nr',
|
||||
menuStyle: 'min-width: 125px;',
|
||||
editable: false,
|
||||
data: [
|
||||
{ displayValue: this.textSection, value: Asc.c_oAscSectionApplyType.Current },
|
||||
{ displayValue: this.textForward, value: Asc.c_oAscSectionApplyType.ToEnd },
|
||||
{ displayValue: this.textDocument, value: Asc.c_oAscSectionApplyType.All }
|
||||
]
|
||||
});
|
||||
this.cmbApply.setValue(this.options.applyTo);
|
||||
|
||||
this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||
|
||||
this.updateMetricUnit();
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
},
|
||||
|
||||
setSettings: function (props) {
|
||||
if (props) {
|
||||
var type = props.get_Restart();
|
||||
this.chAddLineNumbering.setValue(true);
|
||||
switch (type) {
|
||||
case Asc.c_oAscLineNumberRestartType.Continuous: this.rbContinuous.setValue(true, true); break;
|
||||
case Asc.c_oAscLineNumberRestartType.NewPage: this.rbRestartEachPage.setValue(true, true); break;
|
||||
case Asc.c_oAscLineNumberRestartType.NewSection: this.rbRestartEachSection.setValue(true, true); break;
|
||||
}
|
||||
this.spnStartAt.setValue(props.get_Start()!==null && props.get_Start()!==undefined ? props.get_Start() : '', true);
|
||||
this.spnFromText.setValue(props.get_Distance()!==null && props.get_Distance()!==undefined ? Common.Utils.Metric.fnRecalcFromMM(props.get_Distance() * 25.4 / 20 / 72.0) : -1, true);
|
||||
this.spnCountBy.setValue(props.get_CountBy()!==null && props.get_CountBy()!==undefined ? props.get_CountBy() : '', true);
|
||||
} else
|
||||
this.chAddLineNumbering.setValue(false);
|
||||
},
|
||||
|
||||
_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);
|
||||
},
|
||||
|
||||
onPrimary: function() {
|
||||
this._handleInput('ok');
|
||||
return false;
|
||||
},
|
||||
|
||||
getSettings: function() {
|
||||
var props;
|
||||
if (this.chAddLineNumbering.getValue()==='checked') {
|
||||
props = new Asc.CSectionLnNumType();
|
||||
if (this.rbContinuous.getValue())
|
||||
props.put_Restart(Asc.c_oAscLineNumberRestartType.Continuous);
|
||||
else if (this.rbRestartEachPage.getValue())
|
||||
props.put_Restart(Asc.c_oAscLineNumberRestartType.NewPage);
|
||||
else if (this.rbRestartEachSection.getValue())
|
||||
props.put_Restart(Asc.c_oAscLineNumberRestartType.NewSection);
|
||||
props.put_Start(this.spnStartAt.getValue()!=='' ? this.spnStartAt.getNumberValue() : undefined);
|
||||
var value = this.spnFromText.getNumberValue();
|
||||
props.put_Distance(value<0 ? null : parseInt(Common.Utils.Metric.fnRecalcToMM(value) * 72 * 20 / 25.4));
|
||||
props.put_CountBy(this.spnCountBy.getValue()!=='' ? this.spnCountBy.getNumberValue() : undefined);
|
||||
}
|
||||
return {props: props, type: this.cmbApply.getValue()};
|
||||
},
|
||||
|
||||
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());
|
||||
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
textTitle: 'Line Numbers',
|
||||
textAddLineNumbering: 'Add line numbering',
|
||||
textStartAt: 'Start at',
|
||||
textFromText: 'From text',
|
||||
textCountBy: 'Count by',
|
||||
textNumbering: 'Numbering',
|
||||
textRestartEachPage: 'Restart Each Page',
|
||||
textRestartEachSection: 'Restart Each Section',
|
||||
textContinuous: 'Continuous',
|
||||
textApplyTo: 'Apply changes to',
|
||||
textDocument: 'Whole document',
|
||||
textSection: 'Current section',
|
||||
textForward: 'This point forward'
|
||||
}, DE.Views.LineNumbersDialog || {}))
|
||||
});
|
|
@ -124,6 +124,10 @@ define([
|
|||
this.btnCaption.on('click', function (b, e) {
|
||||
me.fireEvent('links:caption');
|
||||
});
|
||||
|
||||
this.btnCrossRef.on('click', function (b, e) {
|
||||
me.fireEvent('links:crossref');
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -177,6 +181,15 @@ define([
|
|||
});
|
||||
this.paragraphControls.push(this.btnCaption);
|
||||
|
||||
this.btnCrossRef = new Common.UI.Button({
|
||||
parentEl: $host.find('#slot-btn-crossref'),
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-cross-reference',
|
||||
caption: this.capBtnCrossRef,
|
||||
disabled: true
|
||||
});
|
||||
this.paragraphControls.push(this.btnCrossRef);
|
||||
|
||||
this._state = {disabled: false};
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
@ -308,6 +321,7 @@ define([
|
|||
|
||||
me.btnBookmarks.updateHint(me.tipBookmarks);
|
||||
me.btnCaption.updateHint(me.tipCaption);
|
||||
me.btnCrossRef.updateHint(me.tipCrossRef);
|
||||
|
||||
setEvents.call(me);
|
||||
});
|
||||
|
@ -357,7 +371,9 @@ define([
|
|||
mniInsEndnote: 'Insert Endnote',
|
||||
textConvertToEndnotes: 'Convert All Footnotes to Endnotes',
|
||||
textConvertToFootnotes: 'Convert All Endnotes to Footnotes',
|
||||
textSwapNotes: 'Swap Footnotes and Endnotes'
|
||||
textSwapNotes: 'Swap Footnotes and Endnotes',
|
||||
capBtnCrossRef: 'Cross-reference',
|
||||
tipCrossRef: 'Insert cross-reference'
|
||||
}
|
||||
}()), DE.Views.Links || {}));
|
||||
});
|
|
@ -160,13 +160,15 @@ define([
|
|||
id: 'id-dlg-bullet-text-color',
|
||||
caption: this.txtLikeText,
|
||||
checkable: true,
|
||||
toggleGroup: 'list-settings-color'
|
||||
toggleGroup: 'list-settings-color',
|
||||
style: 'padding-left: 20px;'
|
||||
},
|
||||
{
|
||||
id: 'id-dlg-bullet-auto-color',
|
||||
caption: this.textAuto,
|
||||
checkable: true,
|
||||
toggleGroup: 'list-settings-color'
|
||||
toggleGroup: 'list-settings-color',
|
||||
style: 'padding-left: 20px;'
|
||||
},
|
||||
{caption: '--'}],
|
||||
additionalAlign: this.menuAddAlign
|
||||
|
|
|
@ -346,6 +346,16 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
|
|||
}
|
||||
}, this));
|
||||
|
||||
this.chLineNumbers = new Common.UI.CheckBox({
|
||||
el: $('#paragraphadv-checkbox-suppress-line-numbers'),
|
||||
labelText: this.strSuppressLineNumbers
|
||||
});
|
||||
this.chLineNumbers.on('change', _.bind(function(field, newValue, oldValue, eOpts){
|
||||
if (this._changedProps) {
|
||||
this._changedProps.put_SuppressLineNumbers(field.getValue()=='checked');
|
||||
}
|
||||
}, this));
|
||||
|
||||
// Borders
|
||||
|
||||
this.cmbBorderSize = new Common.UI.ComboBorderSize({
|
||||
|
@ -774,6 +784,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
|
|||
this.chKeepNext.setValue((props.get_KeepNext() !== null && props.get_KeepNext() !== undefined) ? props.get_KeepNext() : 'indeterminate', true);
|
||||
this.chOrphan.setValue((props.get_WidowControl() !== null && props.get_WidowControl() !== undefined) ? props.get_WidowControl() : 'indeterminate', true);
|
||||
|
||||
this.chLineNumbers.setValue((props.get_SuppressLineNumbers() !== null && props.get_SuppressLineNumbers() !== undefined) ? props.get_SuppressLineNumbers() : 'indeterminate', true);
|
||||
|
||||
this.Borders = new Asc.asc_CParagraphBorders(props.get_Borders());
|
||||
|
||||
// Margins
|
||||
|
@ -1471,7 +1483,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
|
|||
textLevel: 'Level',
|
||||
strIndentsOutlinelevel: 'Outline level',
|
||||
strIndent: 'Indents',
|
||||
strSpacing: 'Spacing'
|
||||
strSpacing: 'Spacing',
|
||||
strSuppressLineNumbers: 'Suppress line numbers'
|
||||
|
||||
}, DE.Views.ParagraphSettingsAdvanced || {}));
|
||||
});
|
|
@ -974,6 +974,54 @@ define([
|
|||
});
|
||||
this.toolbarControls.push(this.btnPageSize);
|
||||
|
||||
this.btnLineNumbers = new Common.UI.Button({
|
||||
id: 'tlbtn-line-numbers',
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-line-numbering',
|
||||
caption: me.capBtnLineNumbers,
|
||||
menu: new Common.UI.Menu({
|
||||
cls: 'ppm-toolbar',
|
||||
items: [
|
||||
{
|
||||
caption: this.textNone,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuLineNumbers',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
caption: this.textContinuous,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuLineNumbers',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
caption: this.textRestartEachPage,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuLineNumbers',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
caption: this.textRestartEachSection,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuLineNumbers',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
caption: this.textSuppressForCurrentParagraph,
|
||||
checkable: true,
|
||||
allowDepress: true,
|
||||
value: 4
|
||||
},
|
||||
{caption: '--'},
|
||||
{
|
||||
caption: this.textCustomLineNumbers,
|
||||
value: 5
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
this.btnClearStyle = new Common.UI.Button({
|
||||
id: 'id-toolbar-btn-clearstyle',
|
||||
cls: 'btn-toolbar',
|
||||
|
@ -1346,6 +1394,7 @@ define([
|
|||
_injectComponent('#slot-btn-dropcap', this.btnDropCap);
|
||||
_injectComponent('#slot-btn-controls', this.btnContentControls);
|
||||
_injectComponent('#slot-btn-columns', this.btnColumns);
|
||||
_injectComponent('#slot-btn-line-numbers', this.btnLineNumbers);
|
||||
_injectComponent('#slot-btn-editheader', this.btnEditHeader);
|
||||
_injectComponent('#slot-btn-datetime', this.btnInsDateTime);
|
||||
_injectComponent('#slot-btn-blankpage', this.btnBlankPage);
|
||||
|
@ -1640,6 +1689,7 @@ define([
|
|||
this.btnPageOrient.updateHint(this.tipPageOrient);
|
||||
this.btnPageSize.updateHint(this.tipPageSize);
|
||||
this.btnPageMargins.updateHint(this.tipPageMargins);
|
||||
this.btnLineNumbers.updateHint(this.tipLineNumbers);
|
||||
this.btnClearStyle.updateHint(this.tipClearStyle);
|
||||
this.btnCopyStyle.updateHint(this.tipCopyStyle + Common.Utils.String.platformKey('Ctrl+Shift+C'));
|
||||
this.btnColorSchemas.updateHint(this.tipColorSchemas);
|
||||
|
@ -2364,7 +2414,14 @@ define([
|
|||
textNewComboboxControl: 'New combo box',
|
||||
textNewCheckboxControl: 'New check box',
|
||||
textNewRadioboxControl: 'New radio box',
|
||||
textNewDropdownControl: 'New drop-down list'
|
||||
textNewDropdownControl: 'New drop-down list',
|
||||
capBtnLineNumbers: 'Line Numbers',
|
||||
textContinuous: 'Continuous',
|
||||
textRestartEachPage: 'Restart Each Page',
|
||||
textRestartEachSection: 'Restart Each Section',
|
||||
textSuppressForCurrentParagraph: 'Suppress for Current Paragraph',
|
||||
textCustomLineNumbers: 'Line Numbering Options',
|
||||
tipLineNumbers: 'Show line numbers'
|
||||
}
|
||||
})(), DE.Views.Toolbar || {}));
|
||||
});
|
||||
|
|
|
@ -1222,6 +1222,46 @@
|
|||
"DE.Views.ControlSettingsDialog.tipChange": "Change symbol",
|
||||
"DE.Views.ControlSettingsDialog.txtLockDelete": "Content control cannot be deleted",
|
||||
"DE.Views.ControlSettingsDialog.txtLockEdit": "Contents cannot be edited",
|
||||
"DE.Views.CrossReferenceDialog.txtTitle": "Cross-reference",
|
||||
"DE.Views.CrossReferenceDialog.txtType": "Reference type",
|
||||
"DE.Views.CrossReferenceDialog.txtReference": "Insert reference to",
|
||||
"DE.Views.CrossReferenceDialog.textInsertAs": "Insert as hyperlink",
|
||||
"DE.Views.CrossReferenceDialog.textSeparate": "Separate numbers with",
|
||||
"DE.Views.CrossReferenceDialog.textIncludeAbove": "Include above/below",
|
||||
"DE.Views.CrossReferenceDialog.textPageNum": "Page number",
|
||||
"DE.Views.CrossReferenceDialog.textParaNum": "Paragraph number",
|
||||
"DE.Views.CrossReferenceDialog.textParaNumNo": "Paragraph number (no context)",
|
||||
"DE.Views.CrossReferenceDialog.textParaNumFull": "Paragraph number (full context)",
|
||||
"DE.Views.CrossReferenceDialog.textText": "Paragraph text",
|
||||
"DE.Views.CrossReferenceDialog.textAboveBelow": "Above/below",
|
||||
"DE.Views.CrossReferenceDialog.textHeadingText": "Heading text",
|
||||
"DE.Views.CrossReferenceDialog.textHeadingNum": "Heading number",
|
||||
"DE.Views.CrossReferenceDialog.textHeadingNumNo": "Heading number (no context)",
|
||||
"DE.Views.CrossReferenceDialog.textHeadingNumFull": "Heading number (full context)",
|
||||
"DE.Views.CrossReferenceDialog.textBookmarkText": "Bookmark text",
|
||||
"DE.Views.CrossReferenceDialog.textNoteNum": "Footnote number",
|
||||
"DE.Views.CrossReferenceDialog.textNoteNumForm": "Footnote number (formatted)",
|
||||
"DE.Views.CrossReferenceDialog.textEndNoteNum": "Endnote number",
|
||||
"DE.Views.CrossReferenceDialog.textEndNoteNumForm": "Endnote number (formatted)",
|
||||
"DE.Views.CrossReferenceDialog.textCaption": "Entire caption",
|
||||
"DE.Views.CrossReferenceDialog.textLabelNum": "Only label and number",
|
||||
"DE.Views.CrossReferenceDialog.textOnlyCaption": "Only caption text",
|
||||
"DE.Views.CrossReferenceDialog.textParagraph": "Numbered item",
|
||||
"DE.Views.CrossReferenceDialog.textHeading": "Heading",
|
||||
"DE.Views.CrossReferenceDialog.textBookmark": "Bookmark",
|
||||
"DE.Views.CrossReferenceDialog.textFootnote": "Footnote",
|
||||
"DE.Views.CrossReferenceDialog.textEndnote": "Endnote",
|
||||
"DE.Views.CrossReferenceDialog.textEquation": "Equation",
|
||||
"DE.Views.CrossReferenceDialog.textFigure": "Figure",
|
||||
"DE.Views.CrossReferenceDialog.textTable": "Table",
|
||||
"DE.Views.CrossReferenceDialog.textInsert": "Insert",
|
||||
"DE.Views.CrossReferenceDialog.textWhich": "For which caption",
|
||||
"DE.Views.CrossReferenceDialog.textWhichHeading": "For which heading",
|
||||
"DE.Views.CrossReferenceDialog.textWhichBookmark": "For which bookmark",
|
||||
"DE.Views.CrossReferenceDialog.textWhichNote": "For which footnote",
|
||||
"DE.Views.CrossReferenceDialog.textWhichEndnote": "For which endnote",
|
||||
"DE.Views.CrossReferenceDialog.textWhichPara": "For which numbered item",
|
||||
"DE.Views.CrossReferenceDialog.textEmpty": "The request reference is empty.",
|
||||
"DE.Views.CustomColumnsDialog.textColumns": "Number of columns",
|
||||
"DE.Views.CustomColumnsDialog.textSeparator": "Column divider",
|
||||
"DE.Views.CustomColumnsDialog.textSpacing": "Spacing between columns",
|
||||
|
@ -1755,6 +1795,19 @@
|
|||
"DE.Views.LeftMenu.tipTitles": "Titles",
|
||||
"DE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE",
|
||||
"DE.Views.LeftMenu.txtTrial": "TRIAL MODE",
|
||||
"DE.Views.LineNumbersDialog.textTitle": "Line Numbers",
|
||||
"DE.Views.LineNumbersDialog.textAddLineNumbering": "Add line numbering",
|
||||
"DE.Views.LineNumbersDialog.textStartAt": "Start at",
|
||||
"DE.Views.LineNumbersDialog.textFromText": "From text",
|
||||
"DE.Views.LineNumbersDialog.textCountBy": "Count by",
|
||||
"DE.Views.LineNumbersDialog.textNumbering": "Numbering",
|
||||
"DE.Views.LineNumbersDialog.textRestartEachPage": "Restart Each Page",
|
||||
"DE.Views.LineNumbersDialog.textRestartEachSection": "Restart Each Section",
|
||||
"DE.Views.LineNumbersDialog.textContinuous": "Continuous",
|
||||
"DE.Views.LineNumbersDialog.textApplyTo": "Apply changes to",
|
||||
"DE.Views.LineNumbersDialog.textDocument": "Whole document",
|
||||
"DE.Views.LineNumbersDialog.textSection": "Current section",
|
||||
"DE.Views.LineNumbersDialog.textForward": "This point forward",
|
||||
"DE.Views.Links.capBtnBookmarks": "Bookmark",
|
||||
"DE.Views.Links.capBtnCaption": "Caption",
|
||||
"DE.Views.Links.capBtnContentsUpdate": "Refresh",
|
||||
|
@ -1782,6 +1835,8 @@
|
|||
"DE.Views.Links.textConvertToEndnotes": "Convert All Footnotes to Endnotes",
|
||||
"DE.Views.Links.textConvertToFootnotes": "Convert All Endnotes to Footnotes",
|
||||
"DE.Views.Links.textSwapNotes": "Swap Footnotes and Endnotes",
|
||||
"DE.Views.Links.capBtnCrossRef": "Cross-reference",
|
||||
"DE.Views.Links.tipCrossRef": "Insert cross-reference",
|
||||
"DE.Views.ListSettingsDialog.textAuto": "Automatic",
|
||||
"DE.Views.ListSettingsDialog.textCenter": "Center",
|
||||
"DE.Views.ListSettingsDialog.textLeft": "Left",
|
||||
|
@ -1988,6 +2043,7 @@
|
|||
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only",
|
||||
"DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
|
||||
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders",
|
||||
"DE.Views.ParagraphSettingsAdvanced.strSuppressLineNumbers": "Suppress line numbers",
|
||||
"DE.Views.RightMenu.txtChartSettings": "Chart settings",
|
||||
"DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings",
|
||||
"DE.Views.RightMenu.txtImageSettings": "Image settings",
|
||||
|
@ -2456,6 +2512,13 @@
|
|||
"DE.Views.Toolbar.txtScheme7": "Equity",
|
||||
"DE.Views.Toolbar.txtScheme8": "Flow",
|
||||
"DE.Views.Toolbar.txtScheme9": "Foundry",
|
||||
"DE.Views.Toolbar.capBtnLineNumbers": "Line Numbers",
|
||||
"DE.Views.Toolbar.textContinuous": "Continuous",
|
||||
"DE.Views.Toolbar.textRestartEachPage": "Restart Each Page",
|
||||
"DE.Views.Toolbar.textRestartEachSection": "Restart Each Section",
|
||||
"DE.Views.Toolbar.textSuppressForCurrentParagraph": "Suppress for Current Paragraph",
|
||||
"DE.Views.Toolbar.textCustomLineNumbers": "Line Numbering Options",
|
||||
"DE.Views.Toolbar.tipLineNumbers": "Show line numbers",
|
||||
"DE.Views.WatermarkSettingsDialog.textAuto": "Auto",
|
||||
"DE.Views.WatermarkSettingsDialog.textBold": "Bold",
|
||||
"DE.Views.WatermarkSettingsDialog.textColor": "Text color",
|
||||
|
|
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 311 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 554 B |
After Width: | Height: | Size: 375 B |
|
@ -1866,12 +1866,15 @@ define([
|
|||
onInsertSymbolClick: function() {
|
||||
if (this.api) {
|
||||
var me = this,
|
||||
selected = me.api.asc_GetSelectedText(),
|
||||
win = new Common.Views.SymbolTableDialog({
|
||||
api: me.api,
|
||||
lang: me.toolbar.mode.lang,
|
||||
type: 1,
|
||||
special: true,
|
||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
||||
font: selected && selected.length>0 ? me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined,
|
||||
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
|
||||
handler: function(dlg, result, settings) {
|
||||
if (result == 'ok') {
|
||||
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
|
||||
|
|
|
@ -158,6 +158,7 @@ require([
|
|||
'Main',
|
||||
'PivotTable',
|
||||
'DataTab',
|
||||
'ViewTab',
|
||||
'Common.Controllers.Fonts',
|
||||
'Common.Controllers.Chat',
|
||||
'Common.Controllers.Comments',
|
||||
|
@ -181,6 +182,7 @@ require([
|
|||
'spreadsheeteditor/main/app/controller/Print',
|
||||
'spreadsheeteditor/main/app/controller/PivotTable',
|
||||
'spreadsheeteditor/main/app/controller/DataTab',
|
||||
'spreadsheeteditor/main/app/controller/ViewTab',
|
||||
'spreadsheeteditor/main/app/view/FileMenuPanels',
|
||||
'spreadsheeteditor/main/app/view/ParagraphSettings',
|
||||
'spreadsheeteditor/main/app/view/ImageSettings',
|
||||
|
|
|
@ -309,6 +309,11 @@ define([
|
|||
|
||||
onLockDefNameManager: function(state) {
|
||||
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
|
||||
},
|
||||
|
||||
disableEditing: function(disabled) {
|
||||
this.editor.$btnfunc[!disabled?'removeClass':'addClass']('disabled');
|
||||
this.editor.btnNamedRanges.setVisible(!disabled);
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1959,6 +1959,7 @@ define([
|
|||
documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot);
|
||||
documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot);
|
||||
documentHolder.pmiInsFunction.setDisabled(isCellLocked || inPivot);
|
||||
documentHolder.pmiFreezePanes.setDisabled(this.api.asc_isWorksheetLockedOrDeleted(this.api.asc_getActiveWorksheetIndex()));
|
||||
|
||||
if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event);
|
||||
} else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) {
|
||||
|
|
|
@ -188,6 +188,15 @@ define([
|
|||
return this;
|
||||
},
|
||||
|
||||
disableEditing: function(disabled) {
|
||||
this.leftMenu.btnComments.setDisabled(disabled);
|
||||
this.leftMenu.btnChat.setDisabled(disabled);
|
||||
this.leftMenu.btnPlugins.setDisabled(disabled);
|
||||
this.leftMenu.btnSpellcheck.setDisabled(disabled);
|
||||
|
||||
this.leftMenu.getMenu('file').disableEditing(disabled);
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
/** coauthoring begin **/
|
||||
if ( this.mode.canCoAuthoring ) {
|
||||
|
|
|
@ -358,6 +358,7 @@ define([
|
|||
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
|
||||
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
||||
this.appOptions.canFeaturePivot = true;
|
||||
this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views");
|
||||
|
||||
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '');
|
||||
|
@ -1149,7 +1150,7 @@ define([
|
|||
}
|
||||
|
||||
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && me.appOptions.canFeaturePivot)
|
||||
application.getController('PivotTable').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||
application.getController('PivotTable').setMode(me.appOptions);
|
||||
|
||||
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
|
||||
viewport.applyEditorMode();
|
||||
|
@ -1533,6 +1534,10 @@ define([
|
|||
config.msg = this.errorMoveSlicerError;
|
||||
break;
|
||||
|
||||
case Asc.c_oAscError.ID.LockedEditView:
|
||||
config.msg = this.errorEditView;
|
||||
break;
|
||||
|
||||
default:
|
||||
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
|
||||
break;
|
||||
|
@ -2220,13 +2225,16 @@ define([
|
|||
disablefunc: function (disable) {
|
||||
me.disableEditing(disable);
|
||||
var app = me.getApplication();
|
||||
app.getController('Toolbar').DisableToolbar(disable,disable);
|
||||
app.getController('RightMenu').SetDisabled(disable, true);
|
||||
app.getController('Statusbar').SetDisabled(disable);
|
||||
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||
app.getController('DocumentHolder').SetDisabled(disable, true);
|
||||
var leftMenu = app.getController('LeftMenu');
|
||||
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
||||
leftMenu.setPreviewMode(disable);
|
||||
leftMenu.disableEditing(disable);
|
||||
app.getController('CellEditor').disableEditing(disable);
|
||||
app.getController('Viewport').disableEditing(disable);
|
||||
var comments = app.getController('Common.Controllers.Comments');
|
||||
if (comments) comments.setPreviewMode(disable);
|
||||
}});
|
||||
|
@ -2662,7 +2670,8 @@ define([
|
|||
errorPasteSlicerError: 'Table slicers cannot be copied from one workbook to another.',
|
||||
errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.',
|
||||
errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,<br>cell references, and/or names.',
|
||||
errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another.<br>Try again by selecting the entire table and the slicers.'
|
||||
errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another.<br>Try again by selecting the entire table and the slicers.',
|
||||
errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.'
|
||||
}
|
||||
})(), SSE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
|
@ -89,12 +89,10 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||
},
|
||||
|
||||
setConfig: function (data, api) {
|
||||
this.view = this.createView('PivotTable');
|
||||
this.setApi(api);
|
||||
if (data) {
|
||||
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
||||
}
|
||||
setConfig: function (config) {
|
||||
this.view = this.createView('PivotTable', {
|
||||
toolbar: config.toolbar.toolbar
|
||||
});
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
|
@ -106,6 +104,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
|
@ -400,7 +399,7 @@ define([
|
|||
|
||||
Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
|
||||
Common.Utils.lockControls(SSE.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls});
|
||||
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: [this.view.btnAddPivot]});
|
||||
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot});
|
||||
|
||||
if (pivotInfo)
|
||||
this.ChangeSettings(pivotInfo);
|
||||
|
|
|
@ -413,7 +413,7 @@ define([
|
|||
|
||||
SetDisabled: function(disabled, allowSignature) {
|
||||
this.setMode({isEdit: !disabled});
|
||||
if (this.rightmenu) {
|
||||
if (this.rightmenu && this.rightmenu.paragraphSettings) {
|
||||
this.rightmenu.paragraphSettings.disableControls(disabled);
|
||||
this.rightmenu.shapeSettings.disableControls(disabled);
|
||||
this.rightmenu.imageSettings.disableControls(disabled);
|
||||
|
|
|
@ -104,6 +104,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
||||
this.api.asc_registerCallback('asc_onFilterInfo', _.bind(this.onApiFilterInfo , this));
|
||||
this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this));
|
||||
this.api.asc_registerCallback('asc_onRefreshNamedSheetViewList', _.bind(this.onRefreshNamedSheetViewList, this));
|
||||
|
||||
this.statusbar.setApi(api);
|
||||
},
|
||||
|
@ -711,12 +712,61 @@ define([
|
|||
|
||||
onApiActiveSheetChanged: function (index) {
|
||||
this.statusbar.tabMenu.hide();
|
||||
if (this._sheetViewTip && this._sheetViewTip.isVisible() && this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(index)) { // hide tip when sheet in the default mode
|
||||
this._sheetViewTip.hide();
|
||||
}
|
||||
},
|
||||
|
||||
onRefreshNamedSheetViewList: function() {
|
||||
var views = this.api.asc_getNamedSheetViews(),
|
||||
active = false,
|
||||
name="",
|
||||
me = this;
|
||||
for (var i=0; i<views.length; i++) {
|
||||
if (views[i].asc_getIsActive()) {
|
||||
active = true;
|
||||
name = views[i].asc_getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
var tab = this.statusbar.tabbar.getAt(this.statusbar.tabbar.getActive());
|
||||
if (tab) {
|
||||
tab.changeIconState(active, name);
|
||||
}
|
||||
|
||||
if (active && !Common.localStorage.getBool("sse-hide-sheet-view-tip") && !Common.Utils.InternalSettings.get("sse-hide-sheet-view-tip")) {
|
||||
if (!this._sheetViewTip) {
|
||||
this._sheetViewTip = new Common.UI.SynchronizeTip({
|
||||
target : $('#editor_sdk'),
|
||||
extCls : 'no-arrow',
|
||||
text : this.textSheetViewTip,
|
||||
placement : 'target'
|
||||
});
|
||||
this._sheetViewTip.on({
|
||||
'dontshowclick': function() {
|
||||
Common.localStorage.setBool("sse-hide-sheet-view-tip", true);
|
||||
Common.Utils.InternalSettings.set("sse-hide-sheet-view-tip", true);
|
||||
this.close();
|
||||
me._sheetViewTip = undefined;
|
||||
},
|
||||
'closeclick': function() {
|
||||
Common.Utils.InternalSettings.set("sse-hide-sheet-view-tip", true);
|
||||
this.close();
|
||||
me._sheetViewTip = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!this._sheetViewTip.isVisible())
|
||||
this._sheetViewTip.show();
|
||||
} else if (!active && this._sheetViewTip && this._sheetViewTip.isVisible())
|
||||
this._sheetViewTip.hide();
|
||||
},
|
||||
|
||||
zoomText : 'Zoom {0}%',
|
||||
errorLastSheet : 'Workbook must have at least one visible worksheet.',
|
||||
errorRemoveSheet: 'Can\'t delete the worksheet.',
|
||||
warnDeleteSheet : 'The worksheet maybe has data. Proceed operation?',
|
||||
strSheet : 'Sheet'
|
||||
strSheet : 'Sheet',
|
||||
textSheetViewTip: 'You are in Sheet View mode. Filters and sorting are visible only to you and those who are still in this view.'
|
||||
}, SSE.Controllers.Statusbar || {}));
|
||||
});
|
|
@ -2846,12 +2846,15 @@ define([
|
|||
onInsertSymbolClick: function() {
|
||||
if (this.api) {
|
||||
var me = this,
|
||||
selected = me.api.asc_GetSelectedText(),
|
||||
win = new Common.Views.SymbolTableDialog({
|
||||
api: me.api,
|
||||
lang: me.toolbar.mode.lang,
|
||||
type: 1,
|
||||
special: true,
|
||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
||||
font: selected && selected.length>0 ? me.api.asc_getCellInfo().asc_getXfs().asc_getFontName() : undefined,
|
||||
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
|
||||
handler: function(dlg, result, settings) {
|
||||
if (result == 'ok') {
|
||||
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
|
||||
|
@ -3314,6 +3317,7 @@ define([
|
|||
if ( config.canFeaturePivot ) {
|
||||
tab = {action: 'pivot', caption: me.textPivot};
|
||||
var pivottab = me.getApplication().getController('PivotTable');
|
||||
pivottab.setApi(me.api).setConfig({toolbar: me});
|
||||
$panel = pivottab.createToolbarPanel();
|
||||
if ($panel) {
|
||||
me.toolbar.addTab(tab, $panel, 5);
|
||||
|
@ -3342,6 +3346,10 @@ define([
|
|||
me.toolbar.addTab(tab, $panel, 7);
|
||||
}
|
||||
}
|
||||
|
||||
var viewtab = me.getApplication().getController('ViewTab');
|
||||
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
|
||||
Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
218
apps/spreadsheeteditor/main/app/controller/ViewTab.js
Normal file
|
@ -0,0 +1,218 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* ViewTab.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 08.07.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'core',
|
||||
'spreadsheeteditor/main/app/view/ViewTab',
|
||||
'spreadsheeteditor/main/app/view/ViewManagerDlg'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
SSE.Controllers.ViewTab = Backbone.Controller.extend(_.extend({
|
||||
models : [],
|
||||
collections : [
|
||||
],
|
||||
views : [
|
||||
'ViewTab'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
|
||||
initialize: function () {
|
||||
},
|
||||
onLaunch: function () {
|
||||
this._state = {};
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
if (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback('asc_onZoomChanged', this.onApiZoomChange.bind(this));
|
||||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this));
|
||||
this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onWorksheetLocked, this));
|
||||
this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
|
||||
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setConfig: function(config) {
|
||||
this.toolbar = config.toolbar;
|
||||
this.view = this.createView('ViewTab', {
|
||||
toolbar: this.toolbar.toolbar,
|
||||
mode: config.mode
|
||||
});
|
||||
this.addListeners({
|
||||
'ViewTab': {
|
||||
'viewtab:freeze': this.onFreeze,
|
||||
'viewtab:formula': this.onViewSettings,
|
||||
'viewtab:headings': this.onViewSettings,
|
||||
'viewtab:gridlines': this.onViewSettings,
|
||||
'viewtab:zoom': this.onZoom,
|
||||
'viewtab:showview': this.onShowView,
|
||||
'viewtab:openview': this.onOpenView,
|
||||
'viewtab:createview': this.onCreateView,
|
||||
'viewtab:manager': this.onOpenManager
|
||||
},
|
||||
'Statusbar': {
|
||||
'sheet:changed': this.onApiSheetChanged.bind(this)
|
||||
}
|
||||
});
|
||||
Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));
|
||||
},
|
||||
|
||||
SetDisabled: function(state) {
|
||||
this.view && this.view.SetDisabled(state);
|
||||
},
|
||||
|
||||
getView: function(name) {
|
||||
return !name && this.view ?
|
||||
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
onSelectionChanged: function(info) {
|
||||
if (!this.toolbar.editMode || !this.view) return;
|
||||
},
|
||||
|
||||
onFreeze: function(state) {
|
||||
if (this.api) {
|
||||
this.api.asc_freezePane();
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onZoom: function(zoom) {
|
||||
if (this.api) {
|
||||
this.api.asc_setZoom(zoom/100);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onViewSettings: function(type, value){
|
||||
if (this.api) {
|
||||
switch (type) {
|
||||
case 0: this.getApplication().getController('Viewport').header.fireEvent('formulabar:hide', [ value!=='checked']); break;
|
||||
case 1: this.api.asc_setDisplayHeadings(value=='checked'); break;
|
||||
case 2: this.api.asc_setDisplayGridlines( value=='checked'); break;
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onShowView: function() {
|
||||
var views = this.api.asc_getNamedSheetViews(),
|
||||
menu = this.view.btnSheetView.menu._innerMenu,
|
||||
active = false;
|
||||
|
||||
menu.removeItems(1, menu.items.length-1);
|
||||
_.each(views, function(item, index) {
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
caption : item.asc_getName(),
|
||||
checkable: true,
|
||||
allowDepress: false,
|
||||
checked : item.asc_getIsActive()
|
||||
}));
|
||||
if (item.asc_getIsActive())
|
||||
active = true;
|
||||
});
|
||||
menu.items[0].setChecked(!active, true);
|
||||
},
|
||||
|
||||
onOpenView: function(item) {
|
||||
this.api && this.api.asc_setActiveNamedSheetView((item.value == 'default') ? null : item.name);
|
||||
},
|
||||
|
||||
onCreateView: function(item) {
|
||||
this.api && this.api.asc_addNamedSheetView(null, true);
|
||||
},
|
||||
|
||||
onOpenManager: function(item) {
|
||||
var me = this;
|
||||
(new SSE.Views.ViewManagerDlg({
|
||||
api: this.api,
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok' && value) {
|
||||
if (me.api) {
|
||||
me.api.asc_setActiveNamedSheetView(value);
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.view);
|
||||
},
|
||||
views: this.api.asc_getNamedSheetViews()
|
||||
})).on('close', function(win){
|
||||
}).show();
|
||||
},
|
||||
|
||||
onWorksheetLocked: function(index,locked) {
|
||||
if (index == this.api.asc_getActiveWorksheetIndex()) {
|
||||
Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes]});
|
||||
}
|
||||
},
|
||||
|
||||
onApiSheetChanged: function() {
|
||||
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
|
||||
|
||||
var params = this.api.asc_getSheetViewSettings();
|
||||
this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true);
|
||||
this.view.chGridlines.setValue(!!params.asc_getShowGridLines(), true);
|
||||
this.view.btnFreezePanes.toggle(!!params.asc_getIsFreezePane(), true);
|
||||
|
||||
var currentSheet = this.api.asc_getActiveWorksheetIndex();
|
||||
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
|
||||
},
|
||||
|
||||
onLayoutChanged: function(area) {
|
||||
if (area=='celleditor' && arguments[1]) {
|
||||
this.view.chFormula.setValue(arguments[1]=='showed', true);
|
||||
}
|
||||
},
|
||||
|
||||
onApiZoomChange: function(zf, type){
|
||||
var value = Math.floor((zf + .005) * 100);
|
||||
this.view.cmbZoom.setValue(value, value + '%');
|
||||
}
|
||||
}, SSE.Controllers.ViewTab || {}));
|
||||
});
|
|
@ -127,6 +127,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onZoomChanged', this.onApiZoomChange.bind(this));
|
||||
this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this));
|
||||
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this));
|
||||
this.api.asc_registerCallback('asc_onWorksheetLocked', this.onWorksheetLocked.bind(this));
|
||||
this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',this.onApiCoAuthoringDisconnect.bind(this));
|
||||
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
|
||||
|
@ -209,7 +210,7 @@ define([
|
|||
}, this));
|
||||
}
|
||||
|
||||
var mnuitemHideFormulaBar = new Common.UI.MenuItem({
|
||||
me.header.mnuitemHideFormulaBar = new Common.UI.MenuItem({
|
||||
caption : me.textHideFBar,
|
||||
checked : Common.localStorage.getBool('sse-hidden-formula'),
|
||||
checkable : true,
|
||||
|
@ -220,6 +221,7 @@ define([
|
|||
caption : me.textHideHeadings,
|
||||
checkable : true,
|
||||
checked : me.header.mnuitemHideHeadings.isChecked(),
|
||||
disabled : me.header.mnuitemHideHeadings.isDisabled(),
|
||||
value : 'headings'
|
||||
});
|
||||
|
||||
|
@ -227,6 +229,7 @@ define([
|
|||
caption : me.textHideGridlines,
|
||||
checkable : true,
|
||||
checked : me.header.mnuitemHideGridlines.isChecked(),
|
||||
disabled : me.header.mnuitemHideGridlines.isDisabled(),
|
||||
value : 'gridlines'
|
||||
});
|
||||
|
||||
|
@ -234,6 +237,7 @@ define([
|
|||
caption : me.textFreezePanes,
|
||||
checkable : true,
|
||||
checked : me.header.mnuitemFreezePanes.isChecked(),
|
||||
disabled : me.header.mnuitemFreezePanes.isDisabled(),
|
||||
value : 'freezepanes'
|
||||
});
|
||||
|
||||
|
@ -270,7 +274,7 @@ define([
|
|||
style: 'min-width: 180px;',
|
||||
items: [
|
||||
me.header.mnuitemCompactToolbar,
|
||||
mnuitemHideFormulaBar,
|
||||
me.header.mnuitemHideFormulaBar,
|
||||
{caption:'--'},
|
||||
me.header.mnuitemHideHeadings,
|
||||
me.header.mnuitemHideGridlines,
|
||||
|
@ -400,6 +404,7 @@ define([
|
|||
case 'celleditor':
|
||||
if (arguments[1]) {
|
||||
this.boxSdk.css('border-top', arguments[1]=='hidden'?'none':'');
|
||||
this.header.mnuitemHideFormulaBar && this.header.mnuitemHideFormulaBar.setChecked(arguments[1]=='hidden', true);
|
||||
}
|
||||
this.viewport.celayout.doLayout();
|
||||
break;
|
||||
|
@ -442,6 +447,21 @@ define([
|
|||
me.header.mnuitemHideHeadings.setChecked(!params.asc_getShowRowColHeaders());
|
||||
me.header.mnuitemHideGridlines.setChecked(!params.asc_getShowGridLines());
|
||||
me.header.mnuitemFreezePanes.setChecked(params.asc_getIsFreezePane());
|
||||
|
||||
var currentSheet = me.api.asc_getActiveWorksheetIndex();
|
||||
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));
|
||||
}
|
||||
},
|
||||
|
||||
onWorksheetLocked: function(index,locked) {
|
||||
var me = this;
|
||||
var appConfig = me.viewport.mode;
|
||||
if ( !!appConfig && !appConfig.isEditDiagram && !appConfig.isEditMailMerge ) {
|
||||
if (index == this.api.asc_getActiveWorksheetIndex()) {
|
||||
me.header.mnuitemHideHeadings.setDisabled(locked);
|
||||
me.header.mnuitemHideGridlines.setDisabled(locked);
|
||||
me.header.mnuitemFreezePanes.setDisabled(locked);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -484,6 +504,10 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
disableEditing: function (disabled) {
|
||||
this.header.btnOptions.menu.items[6].setDisabled(disabled);
|
||||
},
|
||||
|
||||
textHideFBar: 'Hide Formula Bar',
|
||||
textHideHeadings: 'Hide Headings',
|
||||
textHideGridlines: 'Hide Gridlines',
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
</section>
|
||||
<section class="panel" data-tab="ins">
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge slot-add-pivot"></span>
|
||||
<span class="btn-slot text x-huge" id="slot-btn-instable"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
|
@ -225,6 +226,48 @@
|
|||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</section>
|
||||
<section class="panel" data-tab="view">
|
||||
<div class="group sheet-views">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-sheet-view"></span>
|
||||
</div>
|
||||
<div class="group sheet-views" style="padding-left: 5px;">
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-createview"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-closeview"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator long sheet-views"></div>
|
||||
<div class="group">
|
||||
<div class="elset" style="display: flex;">
|
||||
<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>
|
||||
</div>
|
||||
<div class="elset" style="text-align: center;">
|
||||
<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-freeze"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-chk-formula"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-chk-heading"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-chk-gridlines"></span>
|
||||
</div>
|
||||
<div class="elset">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
|
@ -322,6 +322,12 @@ define([
|
|||
this.panels['help'] = ((new SSE.Views.FileMenuPanels.Help({menu: this})).render());
|
||||
this.panels['help'].setLangConfig(this.mode.lang);
|
||||
}
|
||||
|
||||
if ( this.mode.disableEditing != undefined ) {
|
||||
this.panels['opts'].disableEditing(this.mode.disableEditing);
|
||||
this.miProtect.setDisabled(this.mode.disableEditing);
|
||||
delete this.mode.disableEditing;
|
||||
}
|
||||
},
|
||||
|
||||
setMode: function(mode, delay) {
|
||||
|
@ -410,6 +416,15 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
disableEditing: function(disabled) {
|
||||
if ( !this.panels ) {
|
||||
this.mode.disableEditing = disabled;
|
||||
} else {
|
||||
this.panels['opts'].disableEditing(disabled);
|
||||
this.miProtect.setDisabled(disabled);
|
||||
}
|
||||
},
|
||||
|
||||
btnSaveCaption : 'Save',
|
||||
btnDownloadCaption : 'Download as...',
|
||||
btnInfoCaption : 'Document Info...',
|
||||
|
|
|
@ -261,6 +261,20 @@ define([
|
|||
this.spellcheckSettings && this.spellcheckSettings.setApi(api);
|
||||
},
|
||||
|
||||
disableEditing: function(disabled) {
|
||||
if ( disabled ) {
|
||||
$(this.viewSettingsPicker.dataViewItems[1].el).hide();
|
||||
$(this.viewSettingsPicker.dataViewItems[2].el).hide();
|
||||
} else {
|
||||
if ( this.mode.canPrint )
|
||||
$(this.viewSettingsPicker.dataViewItems[1].el).show();
|
||||
|
||||
if ( this.mode.isEdit ) {
|
||||
$(this.viewSettingsPicker.dataViewItems[2].el).show();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
txtGeneral: 'General',
|
||||
txtPageSettings: 'Page Settings',
|
||||
txtSpellChecking: 'Spell checking'
|
||||
|
|
|
@ -53,7 +53,7 @@ define([
|
|||
var template =
|
||||
'<section id="pivot-table-panel" class="panel" data-tab="pivot">' +
|
||||
'<div class="group">' +
|
||||
'<span id="slot-btn-add-pivot" class="btn-slot text x-huge"></span>' +
|
||||
'<span class="btn-slot text x-huge slot-add-pivot"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long"></div>' +
|
||||
'<div class="group">' +
|
||||
|
@ -94,8 +94,10 @@ define([
|
|||
function setEvents() {
|
||||
var me = this;
|
||||
|
||||
this.btnAddPivot.on('click', function (e) {
|
||||
me.fireEvent('pivottable:create');
|
||||
this.btnsAddPivot.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('pivottable:create');
|
||||
});
|
||||
});
|
||||
|
||||
this.btnPivotLayout.menu.on('item:click', function (menu, item, e) {
|
||||
|
@ -149,11 +151,14 @@ define([
|
|||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
this.appConfig = options.mode;
|
||||
this.toolbar = options.toolbar;
|
||||
this.lockedControls = [];
|
||||
|
||||
var _set = SSE.enumLock;
|
||||
|
||||
this.btnsAddPivot = Common.Utils.injectButtons(this.toolbar.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtPivotTable,
|
||||
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]);
|
||||
|
||||
this.chRowHeader = new Common.UI.CheckBox({
|
||||
labelText: this.textRowHeader,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock]
|
||||
|
@ -178,14 +183,6 @@ define([
|
|||
});
|
||||
this.lockedControls.push(this.chColBanded);
|
||||
|
||||
this.btnAddPivot = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-pivot-sum',
|
||||
caption: this.txtCreate,
|
||||
disabled : false,
|
||||
lock : [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]
|
||||
});
|
||||
|
||||
this.btnPivotLayout = new Common.UI.Button({
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-pivot-layout',
|
||||
|
@ -277,7 +274,9 @@ define([
|
|||
(new Promise(function (accept, reject) {
|
||||
accept();
|
||||
})).then(function(){
|
||||
me.btnAddPivot.updateHint(me.tipCreatePivot);
|
||||
me.btnsAddPivot.forEach( function(btn) {
|
||||
btn.updateHint(me.tipCreatePivot);
|
||||
});
|
||||
me.btnRefreshPivot.updateHint(me.tipRefresh);
|
||||
me.btnSelectPivot.updateHint(me.tipSelect);
|
||||
me.btnPivotLayout.updateHint(me.capLayout);
|
||||
|
@ -326,12 +325,15 @@ define([
|
|||
getPanel: function () {
|
||||
this.$el = $(_.template(template)( {} ));
|
||||
|
||||
var _set = SSE.enumLock;
|
||||
this.btnsAddPivot = this.btnsAddPivot.concat(Common.Utils.injectButtons(this.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtCreate,
|
||||
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]));
|
||||
|
||||
this.chRowHeader.render(this.$el.find('#slot-chk-header-row'));
|
||||
this.chColHeader.render(this.$el.find('#slot-chk-header-column'));
|
||||
this.chRowBanded.render(this.$el.find('#slot-chk-banded-row'));
|
||||
this.chColBanded.render(this.$el.find('#slot-chk-banded-column'));
|
||||
|
||||
this.btnAddPivot.render(this.$el.find('#slot-btn-add-pivot'));
|
||||
this.btnRefreshPivot.render(this.$el.find('#slot-btn-refresh-pivot'));
|
||||
this.btnSelectPivot.render(this.$el.find('#slot-btn-select-pivot'));
|
||||
this.btnPivotLayout.render(this.$el.find('#slot-btn-pivot-report-layout'));
|
||||
|
@ -353,11 +355,11 @@ define([
|
|||
},
|
||||
|
||||
getButtons: function(type) {
|
||||
return this.lockedControls.concat(this.btnAddPivot);
|
||||
return this.btnsAddPivot.concat(this.lockedControls);
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
this.lockedControls.concat(this.btnAddPivot).forEach(function(button) {
|
||||
this.btnsAddPivot.concat(this.lockedControls).forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
|
@ -393,7 +395,8 @@ define([
|
|||
tipGrandTotals: 'Show or hide grand totals',
|
||||
tipSubtotals: 'Show or hide subtotals',
|
||||
txtSelect: 'Select',
|
||||
tipSelect: 'Select entire pivot table'
|
||||
tipSelect: 'Select entire pivot table',
|
||||
txtPivotTable: 'Pivot Table'
|
||||
}
|
||||
}()), SSE.Views.PivotTable || {}));
|
||||
});
|
|
@ -489,11 +489,12 @@ define([
|
|||
|
||||
if (this.api) {
|
||||
var wc = this.api.asc_getWorksheetsCount(), i = -1;
|
||||
var hidentems = [], items = [], tab, locked;
|
||||
var hidentems = [], items = [], tab, locked, name;
|
||||
var sindex = this.api.asc_getActiveWorksheetIndex();
|
||||
|
||||
while (++i < wc) {
|
||||
locked = me.api.asc_isWorksheetLockedOrDeleted(i);
|
||||
name = me.api.asc_getActiveNamedSheetView ? me.api.asc_getActiveNamedSheetView(i) || '' : '';
|
||||
tab = {
|
||||
sheetindex : i,
|
||||
index : items.length,
|
||||
|
@ -501,7 +502,10 @@ define([
|
|||
label : me.api.asc_getWorksheetName(i),
|
||||
// reorderable : !locked,
|
||||
cls : locked ? 'coauth-locked':'',
|
||||
isLockTheDrag : locked
|
||||
isLockTheDrag : locked,
|
||||
iconCls : 'btn-sheet-view',
|
||||
iconTitle : name,
|
||||
iconVisible : name!==''
|
||||
};
|
||||
|
||||
this.api.asc_isWorksheetHidden(i)? hidentems.push(tab) : items.push(tab);
|
||||
|
@ -765,7 +769,7 @@ define([
|
|||
showCustomizeStatusBar: function (e) {
|
||||
var el = $(e.target);
|
||||
if ($('#status-zoom-box').find(el).length > 0
|
||||
|| $(e.target).parent().hasClass('list-item')
|
||||
|| $(e.target).closest('.statusbar .list-item').length>0
|
||||
|| $('#status-tabs-scroll').find(el).length > 0
|
||||
|| $('#status-addtabs-box').find(el).length > 0) return;
|
||||
this.customizeStatusBarMenu.hide();
|
||||
|
|
|
@ -325,7 +325,9 @@ define([
|
|||
{ caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
|
||||
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'},
|
||||
{caption: me.textTabFormula, action: 'formula', extcls: 'canedit'},
|
||||
{caption: me.textTabData, action: 'data', extcls: 'canedit'}
|
||||
{caption: me.textTabData, action: 'data', extcls: 'canedit'},
|
||||
undefined, undefined, undefined,
|
||||
{caption: me.textTabView, action: 'view', extcls: 'canedit'}
|
||||
]}
|
||||
);
|
||||
|
||||
|
@ -2435,6 +2437,7 @@ define([
|
|||
tipPrintTitles: 'Print titles',
|
||||
capBtnInsSlicer: 'Slicer',
|
||||
tipInsertSlicer: 'Insert slicer',
|
||||
textVertical: 'Vertical Text'
|
||||
textVertical: 'Vertical Text',
|
||||
textTabView: 'View'
|
||||
}, SSE.Views.Toolbar || {}));
|
||||
});
|
346
apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js
Normal file
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* ViewManagerDlg.js
|
||||
*
|
||||
* Created by Julia.Radzhabova on 09.07.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/view/EditNameDialog',
|
||||
'common/main/lib/view/AdvancedSettingsWindow',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/component/ListView',
|
||||
'common/main/lib/component/InputField'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
SSE.Views = SSE.Views || {};
|
||||
|
||||
SSE.Views.ViewManagerDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||
options: {
|
||||
alias: 'ViewManagerDlg',
|
||||
contentWidth: 460,
|
||||
height: 330,
|
||||
buttons: null
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
var me = this;
|
||||
_.extend(this.options, {
|
||||
title: this.txtTitle,
|
||||
template: [
|
||||
'<div class="box" style="height:' + (this.options.height-85) + 'px;">',
|
||||
'<div class="content-panel" style="padding: 0;">',
|
||||
'<div class="settings-panel active">',
|
||||
'<div class="inner-content">',
|
||||
'<table cols="1" style="width: 100%;">',
|
||||
'<tr>',
|
||||
'<td class="padding-small">',
|
||||
'<label class="header">' + this.textViews + '</label>',
|
||||
'<div id="view-manager-list" class="range-tableview" style="width:100%; height: 166px;"></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr>',
|
||||
'<td class="padding-large">',
|
||||
'<button type="button" class="btn btn-text-default auto" id="view-manager-btn-new" style="min-width: 80px;margin-right:5px;">' + this.textNew + '</button>',
|
||||
'<button type="button" class="btn btn-text-default auto" id="view-manager-btn-rename" style="min-width: 80px;margin-right:5px;">' + this.textRename + '</button>',
|
||||
'<button type="button" class="btn btn-text-default auto" id="view-manager-btn-duplicate" style="min-width: 80px;">' + this.textDuplicate + '</button>',
|
||||
'<button type="button" class="btn btn-text-default auto" id="view-manager-btn-delete" style="min-width: 80px;float: right;">' + this.textDelete + '</button>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'</table>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'<div class="separator horizontal"></div>',
|
||||
'<div class="footer center">',
|
||||
'<button class="btn normal dlg-btn primary" result="ok" style="width: 86px;">' + this.textGoTo + '</button>',
|
||||
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.closeButtonText + '</button>',
|
||||
'</div>'
|
||||
].join('')
|
||||
}, options);
|
||||
|
||||
this.api = options.api;
|
||||
this.views = options.views || [];
|
||||
this.userTooltip = true;
|
||||
this.currentView = undefined;
|
||||
|
||||
this.wrapEvents = {
|
||||
onRefreshNamedSheetViewList: _.bind(this.onRefreshNamedSheetViewList, this)
|
||||
};
|
||||
|
||||
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||
},
|
||||
render: function () {
|
||||
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
|
||||
var me = this;
|
||||
|
||||
this.viewList = new Common.UI.ListView({
|
||||
el: $('#view-manager-list', this.$window),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
simpleAddMode: true,
|
||||
emptyText: this.textEmpty,
|
||||
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
|
||||
itemTemplate: _.template([
|
||||
'<div id="<%= id %>" class="list-item" style="width: 100%;height: 20px;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">',
|
||||
'<div style="width:100%;"><%= name %></div>',
|
||||
'<% if (lock) { %>',
|
||||
'<div class="lock-user"><%=lockuser%></div>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join(''))
|
||||
});
|
||||
this.viewList.on('item:select', _.bind(this.onSelectItem, this))
|
||||
.on('item:keydown', _.bind(this.onKeyDown, this))
|
||||
.on('item:dblclick', _.bind(this.onDblClickItem, this))
|
||||
.on('entervalue', _.bind(this.onDblClickItem, this));
|
||||
|
||||
this.btnNew = new Common.UI.Button({
|
||||
el: $('#view-manager-btn-new')
|
||||
});
|
||||
this.btnNew.on('click', _.bind(this.onNew, this, false));
|
||||
|
||||
this.btnRename = new Common.UI.Button({
|
||||
el: $('#view-manager-btn-rename')
|
||||
});
|
||||
this.btnRename.on('click', _.bind(this.onRename, this));
|
||||
|
||||
this.btnDuplicate = new Common.UI.Button({
|
||||
el: $('#view-manager-btn-duplicate')
|
||||
});
|
||||
this.btnDuplicate.on('click', _.bind(this.onNew, this, true));
|
||||
|
||||
this.btnDelete = new Common.UI.Button({
|
||||
el: $('#view-manager-btn-delete')
|
||||
});
|
||||
this.btnDelete.on('click', _.bind(this.onDelete, this));
|
||||
|
||||
this.afterRender();
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
this._setDefaults();
|
||||
},
|
||||
|
||||
_setDefaults: function (props) {
|
||||
this.refreshList(this.views, 0);
|
||||
this.api.asc_registerCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
||||
},
|
||||
|
||||
onRefreshNamedSheetViewList: function() {
|
||||
this.refreshList(this.api.asc_getNamedSheetViews(), this.currentView);
|
||||
},
|
||||
|
||||
refreshList: function(views, selectedItem) {
|
||||
if (views) {
|
||||
this.views = views;
|
||||
var arr = [];
|
||||
for (var i=0; i<this.views.length; i++) {
|
||||
var view = this.views[i],
|
||||
id = view.asc_getIsLock();
|
||||
arr.push({
|
||||
name: view.asc_getName(true),
|
||||
active: view.asc_getIsActive(),
|
||||
view: view,
|
||||
lock: (id!==null && id!==undefined),
|
||||
lockuser: (id) ? this.getUserName(id) : this.guestText
|
||||
});
|
||||
}
|
||||
this.viewList.store.reset(arr);
|
||||
}
|
||||
|
||||
var val = this.viewList.store.length;
|
||||
this.btnRename.setDisabled(!val);
|
||||
this.btnDuplicate.setDisabled(!val);
|
||||
this.btnDelete.setDisabled(!val);
|
||||
if (val>0) {
|
||||
if (selectedItem===undefined || selectedItem===null) selectedItem = 0;
|
||||
if (_.isNumber(selectedItem)) {
|
||||
if (selectedItem>val-1) selectedItem = val-1;
|
||||
this.viewList.selectByIndex(selectedItem);
|
||||
setTimeout(function() {
|
||||
me.viewList.scrollToRecord(me.viewList.store.at(selectedItem));
|
||||
}, 50);
|
||||
|
||||
}
|
||||
if (this.userTooltip===true && this.viewList.cmpEl.find('.lock-user').length>0)
|
||||
this.viewList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
|
||||
}
|
||||
|
||||
var me = this;
|
||||
_.delay(function () {
|
||||
me.viewList.cmpEl.find('.listview').focus();
|
||||
me.viewList.scroller.update({alwaysVisibleY: true});
|
||||
}, 100, this);
|
||||
},
|
||||
|
||||
onMouseOverLock: function (evt, el, opt) {
|
||||
if (this.userTooltip===true && $(evt.target).hasClass('lock-user')) {
|
||||
var me = this,
|
||||
tipdata = $(evt.target).tooltip({title: this.tipIsLocked,trigger:'manual'}).data('bs.tooltip');
|
||||
|
||||
this.userTooltip = tipdata.tip();
|
||||
this.userTooltip.css('z-index', parseInt(this.$window.css('z-index')) + 10);
|
||||
tipdata.show();
|
||||
|
||||
setTimeout(function() { me.userTipHide(); }, 5000);
|
||||
}
|
||||
},
|
||||
|
||||
userTipHide: function () {
|
||||
if (typeof this.userTooltip == 'object') {
|
||||
this.userTooltip.remove();
|
||||
this.userTooltip = undefined;
|
||||
this.viewList.cmpEl.off('mouseover').off('mouseout');
|
||||
}
|
||||
},
|
||||
|
||||
onMouseOutLock: function (evt, el, opt) {
|
||||
if (typeof this.userTooltip == 'object') this.userTipHide();
|
||||
},
|
||||
|
||||
onNew: function (duplicate) {
|
||||
var rec = duplicate ? this.viewList.getSelectedRec().get('view') : undefined;
|
||||
this.currentView = this.viewList.store.length;
|
||||
this.api.asc_addNamedSheetView(rec);
|
||||
},
|
||||
|
||||
onDelete: function () {
|
||||
var me = this,
|
||||
rec = this.viewList.getSelectedRec(),
|
||||
res;
|
||||
if (rec) {
|
||||
if (rec.get('active')) {
|
||||
Common.UI.warning({
|
||||
msg: this.warnDeleteView.replace('%1', rec.get('name')),
|
||||
buttons: ['yes', 'no'],
|
||||
primary: 'yes',
|
||||
callback: function(btn) {
|
||||
if (btn == 'yes') {
|
||||
me.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.api.asc_deleteNamedSheetViews([rec.get('view')]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onRename: function () {
|
||||
var rec = this.viewList.getSelectedRec();
|
||||
if (rec) {
|
||||
var me = this;
|
||||
(new Common.Views.EditNameDialog({
|
||||
label: this.textRenameLabel,
|
||||
error: this.textRenameError,
|
||||
value: rec.get('name'),
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
rec.get('view').asc_setName(value);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
},
|
||||
|
||||
getSettings: function() {
|
||||
var rec = this.viewList.getSelectedRec();
|
||||
return rec ? rec.get('name') : null;
|
||||
},
|
||||
|
||||
getUserName: function(id){
|
||||
var usersStore = SSE.getCollection('Common.Collections.Users');
|
||||
if (usersStore){
|
||||
var rec = usersStore.findUser(id);
|
||||
if (rec)
|
||||
return Common.Utils.UserInfoParser.getParsedName(rec.get('username'));
|
||||
}
|
||||
return this.guestText;
|
||||
},
|
||||
|
||||
onSelectItem: function(lisvView, itemView, record) {
|
||||
this.userTipHide();
|
||||
var rawData = {},
|
||||
isViewSelect = _.isFunction(record.toJSON);
|
||||
|
||||
if (isViewSelect){
|
||||
if (record.get('selected')) {
|
||||
rawData = record.toJSON();
|
||||
} else {// record deselected
|
||||
return;
|
||||
}
|
||||
this.currentView = _.indexOf(this.viewList.store.models, record);
|
||||
this.btnRename.setDisabled(rawData.lock);
|
||||
this.btnDelete.setDisabled(rawData.lock);
|
||||
}
|
||||
},
|
||||
|
||||
close: function () {
|
||||
this.userTipHide();
|
||||
this.api.asc_unregisterCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList);
|
||||
|
||||
Common.Views.AdvancedSettingsWindow.prototype.close.call(this);
|
||||
},
|
||||
|
||||
onKeyDown: function (lisvView, record, e) {
|
||||
if (e.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled())
|
||||
this.onDelete();
|
||||
},
|
||||
|
||||
onDblClickItem: function (lisvView, record, e) {
|
||||
this.onPrimary();
|
||||
},
|
||||
|
||||
txtTitle: 'Sheet View Manager',
|
||||
textViews: 'Sheet views',
|
||||
closeButtonText : 'Close',
|
||||
textNew: 'New',
|
||||
textRename: 'Rename',
|
||||
textDuplicate: 'Duplicate',
|
||||
textDelete: 'Delete',
|
||||
textGoTo: 'Go to view',
|
||||
textEmpty: 'No views have been created yet.',
|
||||
guestText: 'Guest',
|
||||
tipIsLocked: 'This element is being edited by another user.',
|
||||
textRenameLabel: 'Rename view',
|
||||
textRenameError: 'View name must not be empty.',
|
||||
warnDeleteView: "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?"
|
||||
|
||||
}, SSE.Views.ViewManagerDlg || {}));
|
||||
});
|
321
apps/spreadsheeteditor/main/app/view/ViewTab.js
Normal file
|
@ -0,0 +1,321 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2010-2020
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* ViewTab.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 08.07.2020
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/BaseView',
|
||||
'common/main/lib/component/Layout'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
SSE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
|
||||
function setEvents() {
|
||||
var me = this;
|
||||
if ( me.appConfig.canFeatureViews ) {
|
||||
me.btnCloseView.on('click', function (btn, e) {
|
||||
me.fireEvent('viewtab:openview', [{name: 'default', value: 'default'}]);
|
||||
});
|
||||
me.btnCreateView.on('click', function (btn, e) {
|
||||
me.fireEvent('viewtab:createview');
|
||||
});
|
||||
}
|
||||
|
||||
me.btnFreezePanes.on('click', function (btn, e) {
|
||||
me.fireEvent('viewtab:freeze', [btn.pressed]);
|
||||
});
|
||||
this.chFormula.on('change', function (field, value) {
|
||||
me.fireEvent('viewtab:formula', [0, value]);
|
||||
});
|
||||
this.chHeadings.on('change', function (field, value) {
|
||||
me.fireEvent('viewtab:headings', [1, value]);
|
||||
});
|
||||
this.chGridlines.on('change', function (field, value) {
|
||||
me.fireEvent('viewtab:gridlines', [2, value]);
|
||||
});
|
||||
this.cmbZoom.on('selected', function(combo, record) {
|
||||
me.fireEvent('viewtab:zoom', [record.value]);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
options: {},
|
||||
|
||||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this);
|
||||
this.toolbar = options.toolbar;
|
||||
this.appConfig = options.mode;
|
||||
|
||||
this.lockedControls = [];
|
||||
|
||||
var me = this,
|
||||
$host = me.toolbar.$el,
|
||||
_set = SSE.enumLock;
|
||||
|
||||
if ( me.appConfig.canFeatureViews ) {
|
||||
this.btnSheetView = new Common.UI.Button({
|
||||
parentEl: $host.find('#slot-btn-sheet-view'),
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-sheet-view',
|
||||
caption: me.capBtnSheetView,
|
||||
lock : [_set.lostConnect, _set.coAuth],
|
||||
menu: true
|
||||
});
|
||||
this.lockedControls.push(this.btnSheetView);
|
||||
|
||||
this.btnCreateView = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-createview',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-sheet-view-new',
|
||||
caption : this.textCreate,
|
||||
lock : [_set.coAuth, _set.lostConnect]
|
||||
});
|
||||
this.lockedControls.push(this.btnCreateView);
|
||||
Common.Utils.injectComponent($host.find('#slot-createview'), this.btnCreateView);
|
||||
|
||||
this.btnCloseView = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-closeview',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-sheet-view-close',
|
||||
caption : this.textClose,
|
||||
lock : [_set.coAuth, _set.lostConnect]
|
||||
});
|
||||
this.lockedControls.push(this.btnCloseView);
|
||||
Common.Utils.injectComponent($host.find('#slot-closeview'), this.btnCloseView);
|
||||
}
|
||||
|
||||
this.btnFreezePanes = new Common.UI.Button({
|
||||
parentEl: $host.find('#slot-btn-freeze'),
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-freeze-panes',
|
||||
caption: this.capBtnFreeze,
|
||||
split: false,
|
||||
enableToggle: true,
|
||||
lock: [_set.sheetLock, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
this.lockedControls.push(this.btnFreezePanes);
|
||||
|
||||
this.cmbZoom = new Common.UI.ComboBox({
|
||||
el : $host.find('#slot-field-zoom'),
|
||||
cls : 'input-group-nr',
|
||||
menuStyle : 'min-width: 55px;',
|
||||
hint : me.tipFontSize,
|
||||
editable : false,
|
||||
lock : [_set.coAuth, _set.lostConnect],
|
||||
data : [
|
||||
{ displayValue: "50%", value: 50 },
|
||||
{ displayValue: "75%", value: 75 },
|
||||
{ displayValue: "100%", value: 100 },
|
||||
{ displayValue: "125%", value: 125 },
|
||||
{ displayValue: "150%", value: 150 },
|
||||
{ displayValue: "175%", value: 175 },
|
||||
{ displayValue: "200%", value: 200 }
|
||||
]
|
||||
});
|
||||
this.cmbZoom.setValue(100);
|
||||
|
||||
this.chFormula = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-formula'),
|
||||
labelText: this.textFormula,
|
||||
value: !Common.localStorage.getBool('sse-hidden-formula'),
|
||||
lock : [_set.lostConnect, _set.coAuth]
|
||||
});
|
||||
this.lockedControls.push(this.chFormula);
|
||||
|
||||
this.chHeadings = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-heading'),
|
||||
labelText: this.textHeadings,
|
||||
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
this.lockedControls.push(this.chHeadings);
|
||||
|
||||
this.chGridlines = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-gridlines'),
|
||||
labelText: this.textGridlines,
|
||||
lock : [_set.sheetLock, _set.lostConnect, _set.coAuth]
|
||||
});
|
||||
this.lockedControls.push(this.chGridlines);
|
||||
|
||||
$host.find('#slot-lbl-zoom').text(this.textZoom);
|
||||
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
||||
render: function (el) {
|
||||
return this;
|
||||
},
|
||||
|
||||
onAppReady: function (config) {
|
||||
var me = this;
|
||||
(new Promise(function (accept, reject) {
|
||||
accept();
|
||||
})).then(function(){
|
||||
if (!config.canFeatureViews) {
|
||||
me.toolbar && me.toolbar.$el.find('.group.sheet-views').hide();
|
||||
me.toolbar && me.toolbar.$el.find('.separator.sheet-views').hide();
|
||||
} else {
|
||||
me.btnSheetView.updateHint( me.tipSheetView );
|
||||
me.setButtonMenu(me.btnSheetView);
|
||||
|
||||
me.btnCreateView.updateHint(me.tipCreate);
|
||||
me.btnCloseView.updateHint(me.tipClose);
|
||||
}
|
||||
me.btnFreezePanes.updateHint(me.tipFreeze);
|
||||
|
||||
setEvents.call(me);
|
||||
});
|
||||
},
|
||||
|
||||
focusInner: function(menu, e) {
|
||||
if (e.keyCode == Common.UI.Keys.UP)
|
||||
menu.items[menu.items.length-1].cmpEl.find('> a').focus();
|
||||
else
|
||||
menu.items[0].cmpEl.find('> a').focus();
|
||||
},
|
||||
|
||||
focusOuter: function(menu, e) {
|
||||
menu.items[2].cmpEl.find('> a').focus();
|
||||
},
|
||||
|
||||
onBeforeKeyDown: function(menu, e) {
|
||||
if (e.keyCode == Common.UI.Keys.RETURN) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var li = $(e.target).closest('li');
|
||||
(li.length>0) && li.click();
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
} else if (e.namespace!=="after.bs.dropdown" && (e.keyCode == Common.UI.Keys.DOWN || e.keyCode == Common.UI.Keys.UP)) {
|
||||
var $items = $('> [role=menu] > li:not(.divider):not(.disabled):visible', menu.$el).find('> a');
|
||||
if (!$items.length) return;
|
||||
var index = $items.index($items.filter(':focus')),
|
||||
me = this;
|
||||
if (menu._outerMenu && (e.keyCode == Common.UI.Keys.UP && index==0 || e.keyCode == Common.UI.Keys.DOWN && index==$items.length - 1) ||
|
||||
menu._innerMenu && (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) && index!==-1) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
_.delay(function() {
|
||||
menu._outerMenu ? me.focusOuter(menu._outerMenu, e) : me.focusInner(menu._innerMenu, e);
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setButtonMenu: function(btn) {
|
||||
var me = this,
|
||||
arr = [{caption: me.textDefault, value: 'default', checkable: true, allowDepress: false}];
|
||||
btn.setMenu(new Common.UI.Menu({
|
||||
items: [
|
||||
{template: _.template('<div id="id-toolbar-sheet-view-menu-" style="display: flex;" class="open"></div>')},
|
||||
{ caption: '--' },
|
||||
{
|
||||
caption: me.textManager,
|
||||
value: 'manager'
|
||||
}
|
||||
]
|
||||
}));
|
||||
btn.menu.items[2].on('click', function (item, e) {
|
||||
me.fireEvent('viewtab:manager');
|
||||
});
|
||||
btn.menu.on('show:after', function (menu, e) {
|
||||
var internalMenu = menu._innerMenu;
|
||||
internalMenu.scroller.update({alwaysVisibleY: true});
|
||||
_.delay(function() {
|
||||
menu._innerMenu && menu._innerMenu.cmpEl.focus();
|
||||
}, 10);
|
||||
}).on('show:before', function (menu, e) {
|
||||
me.fireEvent('viewtab:showview');
|
||||
}).on('keydown:before', _.bind(me.onBeforeKeyDown, this));
|
||||
|
||||
var menu = new Common.UI.Menu({
|
||||
maxHeight: 300,
|
||||
cls: 'internal-menu',
|
||||
items: arr
|
||||
});
|
||||
menu.render(btn.menu.items[0].cmpEl.children(':first'));
|
||||
menu.cmpEl.css({
|
||||
display : 'block',
|
||||
position : 'relative',
|
||||
left : 0,
|
||||
top : 0
|
||||
});
|
||||
menu.cmpEl.attr({tabindex: "-1"});
|
||||
menu.on('item:toggle', function (menu, item, state, e) {
|
||||
if (!!state)
|
||||
me.fireEvent('viewtab:openview', [{name: item.caption, value: item.value}]);
|
||||
}).on('keydown:before', _.bind(me.onBeforeKeyDown, this));
|
||||
btn.menu._innerMenu = menu;
|
||||
menu._outerMenu = btn.menu;
|
||||
},
|
||||
|
||||
show: function () {
|
||||
Common.UI.BaseView.prototype.show.call(this);
|
||||
this.fireEvent('show', this);
|
||||
},
|
||||
|
||||
getButtons: function(type) {
|
||||
if (type===undefined)
|
||||
return this.lockedControls;
|
||||
return [];
|
||||
},
|
||||
|
||||
SetDisabled: function (state) {
|
||||
this.lockedControls && this.lockedControls.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
capBtnSheetView: 'Sheet View',
|
||||
capBtnFreeze: 'Freeze Panes',
|
||||
textZoom: 'Zoom',
|
||||
tipSheetView: 'Sheet view',
|
||||
textDefault: 'Default',
|
||||
textManager: 'View manager',
|
||||
tipFreeze: 'Freeze panes',
|
||||
tipCreate: 'Create sheet view',
|
||||
tipClose: 'Close sheet view',
|
||||
textCreate: 'New',
|
||||
textClose: 'Close',
|
||||
textFormula: 'Formula bar',
|
||||
textHeadings: 'Headings',
|
||||
textGridlines: 'Gridlines'
|
||||
}
|
||||
}()), SSE.Views.ViewTab || {}));
|
||||
});
|
|
@ -151,6 +151,7 @@ require([
|
|||
'Main',
|
||||
'PivotTable',
|
||||
'DataTab',
|
||||
'ViewTab',
|
||||
'Common.Controllers.Fonts',
|
||||
'Common.Controllers.Chat',
|
||||
'Common.Controllers.Comments',
|
||||
|
@ -174,6 +175,7 @@ require([
|
|||
'spreadsheeteditor/main/app/controller/Print',
|
||||
'spreadsheeteditor/main/app/controller/PivotTable',
|
||||
'spreadsheeteditor/main/app/controller/DataTab',
|
||||
'spreadsheeteditor/main/app/controller/ViewTab',
|
||||
'spreadsheeteditor/main/app/view/FileMenuPanels',
|
||||
'spreadsheeteditor/main/app/view/ParagraphSettings',
|
||||
'spreadsheeteditor/main/app/view/ImageSettings',
|
||||
|
|
|
@ -103,6 +103,8 @@
|
|||
"Common.Views.CopyWarningDialog.textToPaste": "for Paste",
|
||||
"Common.Views.DocumentAccessDialog.textLoading": "Loading...",
|
||||
"Common.Views.DocumentAccessDialog.textTitle": "Sharing Settings",
|
||||
"Common.Views.EditNameDialog.textLabel": "Label:",
|
||||
"Common.Views.EditNameDialog.textLabelError": "Label must not be empty.",
|
||||
"Common.Views.Header.labelCoUsersDescr": "Users who are editing the file:",
|
||||
"Common.Views.Header.textAdvSettings": "Advanced settings",
|
||||
"Common.Views.Header.textBack": "Open file location",
|
||||
|
@ -850,6 +852,7 @@
|
|||
"SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
|
||||
"SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
|
||||
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
|
||||
"SSE.Controllers.Main.errorEditView": "The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.",
|
||||
"SSE.Controllers.Print.strAllSheets": "All Sheets",
|
||||
"SSE.Controllers.Print.textFirstCol": "First column",
|
||||
"SSE.Controllers.Print.textFirstRow": "First row",
|
||||
|
@ -867,6 +870,7 @@
|
|||
"SSE.Controllers.Statusbar.strSheet": "Sheet",
|
||||
"SSE.Controllers.Statusbar.warnDeleteSheet": "The selected worksheets might contain data. Are you sure you want to proceed?",
|
||||
"SSE.Controllers.Statusbar.zoomText": "Zoom {0}%",
|
||||
"SSE.Controllers.Statusbar.textSheetViewTip": "You are in Sheet View mode. Filters and sorting are visible only to you and those who are still in this view.",
|
||||
"SSE.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?",
|
||||
"SSE.Controllers.Toolbar.errorMaxRows": "ERROR! The maximum number of data series per chart is 255",
|
||||
"SSE.Controllers.Toolbar.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",
|
||||
|
@ -2183,6 +2187,7 @@
|
|||
"SSE.Views.PivotTable.txtCreate": "Insert Table",
|
||||
"SSE.Views.PivotTable.txtRefresh": "Refresh",
|
||||
"SSE.Views.PivotTable.txtSelect": "Select",
|
||||
"SSE.Views.PivotTable.txtPivotTable": "Pivot Table",
|
||||
"SSE.Views.PrintSettings.btnDownload": "Save & Download",
|
||||
"SSE.Views.PrintSettings.btnPrint": "Save & Print",
|
||||
"SSE.Views.PrintSettings.strBottom": "Bottom",
|
||||
|
@ -2890,6 +2895,7 @@
|
|||
"SSE.Views.Toolbar.txtTime": "Time",
|
||||
"SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells",
|
||||
"SSE.Views.Toolbar.txtYen": "¥ Yen",
|
||||
"SSE.Views.Toolbar.textTabView": "View",
|
||||
"SSE.Views.Top10FilterDialog.textType": "Show",
|
||||
"SSE.Views.Top10FilterDialog.txtBottom": "Bottom",
|
||||
"SSE.Views.Top10FilterDialog.txtBy": "by",
|
||||
|
@ -2926,5 +2932,33 @@
|
|||
"SSE.Views.ValueFieldSettingsDialog.txtSum": "Sum",
|
||||
"SSE.Views.ValueFieldSettingsDialog.txtSummarize": "Summarize value field by",
|
||||
"SSE.Views.ValueFieldSettingsDialog.txtVar": "Var",
|
||||
"SSE.Views.ValueFieldSettingsDialog.txtVarp": "Varp"
|
||||
"SSE.Views.ValueFieldSettingsDialog.txtVarp": "Varp",
|
||||
"SSE.Views.ViewManagerDlg.txtTitle": "Sheet View Manager",
|
||||
"SSE.Views.ViewManagerDlg.textViews": "Sheet views",
|
||||
"SSE.Views.ViewManagerDlg.closeButtonText": "Close",
|
||||
"SSE.Views.ViewManagerDlg.textNew": "New",
|
||||
"SSE.Views.ViewManagerDlg.textRename": "Rename",
|
||||
"SSE.Views.ViewManagerDlg.textDuplicate": "Duplicate",
|
||||
"SSE.Views.ViewManagerDlg.textDelete": "Delete",
|
||||
"SSE.Views.ViewManagerDlg.textGoTo": "Go to view",
|
||||
"SSE.Views.ViewManagerDlg.textEmpty": "No views have been created yet.",
|
||||
"SSE.Views.ViewManagerDlg.guestText": "Guest",
|
||||
"SSE.Views.ViewManagerDlg.tipIsLocked": "This element is being edited by another user.",
|
||||
"SSE.Views.ViewManagerDlg.textRenameLabel": "Rename view",
|
||||
"SSE.Views.ViewManagerDlg.textRenameError": "View name must not be empty.",
|
||||
"SSE.Views.ViewManagerDlg.warnDeleteView": "You are trying to delete the currently enabled view '%1'.<br>Close this view and delete it?",
|
||||
"SSE.Views.ViewTab.capBtnSheetView": "Sheet View",
|
||||
"SSE.Views.ViewTab.capBtnFreeze": "Freeze Panes",
|
||||
"SSE.Views.ViewTab.textZoom": "Zoom",
|
||||
"SSE.Views.ViewTab.tipSheetView": "Sheet view",
|
||||
"SSE.Views.ViewTab.textDefault": "Default",
|
||||
"SSE.Views.ViewTab.textManager": "View manager",
|
||||
"SSE.Views.ViewTab.tipFreeze": "Freeze panes",
|
||||
"SSE.Views.ViewTab.tipCreate": "Create sheet view",
|
||||
"SSE.Views.ViewTab.tipClose": "Close sheet view",
|
||||
"SSE.Views.ViewTab.textCreate": "New",
|
||||
"SSE.Views.ViewTab.textClose": "Close",
|
||||
"SSE.Views.ViewTab.textFormula": "Formula bar",
|
||||
"SSE.Views.ViewTab.textHeadings": "Headings",
|
||||
"SSE.Views.ViewTab.textGridlines": "Gridlines"
|
||||
}
|
|
@ -288,7 +288,7 @@
|
|||
"DISC": "DISAGIO",
|
||||
"DOLLARDE": "NOTIERUNGDEZ",
|
||||
"DOLLARFR": "NOTIERUNGBRU",
|
||||
"DURATION": "DURATIONТ",
|
||||
"DURATION": "DURATIONT",
|
||||
"EFFECT": "EFFEKTIV",
|
||||
"FV": "ZW",
|
||||
"FVSCHEDULE": "ZW2",
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
"SEARCH": "SEARCH",
|
||||
"SEARCHB": "SEARCHB",
|
||||
"SUBSTITUTE": "SUBSTITUTE",
|
||||
"T": "Т",
|
||||
"T": "T",
|
||||
"T.TEST": "T.TEST",
|
||||
"TEXT": "TEXT",
|
||||
"TEXTJOIN": "TEXTJOIN",
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
"SEARCH": "CHERCHE",
|
||||
"SEARCHB": "CHERCHERB",
|
||||
"SUBSTITUTE": "SUBSTITUE",
|
||||
"T": "Т",
|
||||
"T": "T",
|
||||
"T.TEST": "T.TEST",
|
||||
"TEXT": "TEXTE",
|
||||
"TEXTJOIN": "JOINDRE.TEXTE",
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
"SEARCH": "RICERCA",
|
||||
"SEARCHB": "SEARCHB",
|
||||
"SUBSTITUTE": "SOSTITUISCI",
|
||||
"T": "Т",
|
||||
"T": "T",
|
||||
"T.TEST": "TESTT",
|
||||
"TEXT": "TESTO",
|
||||
"TEXTJOIN": "TEXTJOIN",
|
||||
|
|
After Width: | Height: | Size: 342 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 473 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 588 B |
|
@ -236,6 +236,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.icon-visible {
|
||||
> span {
|
||||
padding-left: 25px;
|
||||
> .toolbar__icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.5;
|
||||
|
||||
|
@ -271,6 +285,16 @@
|
|||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
&.icon-visible {
|
||||
> span {
|
||||
padding-left: 24px;
|
||||
}
|
||||
&.right {
|
||||
> span {
|
||||
padding-left: 25px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.separator-item {
|
||||
margin-left: 20px;
|
||||
|
|
|
@ -161,3 +161,8 @@
|
|||
width: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
#slot-field-zoom {
|
||||
float: left;
|
||||
min-width: 46px;
|
||||
}
|