[SSE] Assign macro to shape
This commit is contained in:
parent
e591a4477a
commit
f80a1f7652
|
@ -73,7 +73,8 @@ define([
|
||||||
'spreadsheeteditor/main/app/view/AutoFilterDialog',
|
'spreadsheeteditor/main/app/view/AutoFilterDialog',
|
||||||
'spreadsheeteditor/main/app/view/SpecialPasteDialog',
|
'spreadsheeteditor/main/app/view/SpecialPasteDialog',
|
||||||
'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced',
|
'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced',
|
||||||
'spreadsheeteditor/main/app/view/PivotGroupDialog'
|
'spreadsheeteditor/main/app/view/PivotGroupDialog',
|
||||||
|
'spreadsheeteditor/main/app/view/MacroDialog'
|
||||||
], function () {
|
], function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -244,7 +245,7 @@ define([
|
||||||
view.pmiNumFormat.menu.on('show:after', _.bind(me.onNumberFormatOpenAfter, me));
|
view.pmiNumFormat.menu.on('show:after', _.bind(me.onNumberFormatOpenAfter, me));
|
||||||
view.pmiAdvancedNumFormat.on('click', _.bind(me.onCustomNumberFormat, me));
|
view.pmiAdvancedNumFormat.on('click', _.bind(me.onCustomNumberFormat, me));
|
||||||
view.tableTotalMenu.on('item:click', _.bind(me.onTotalMenuClick, me));
|
view.tableTotalMenu.on('item:click', _.bind(me.onTotalMenuClick, me));
|
||||||
|
view.menuImgMacro.on('click', _.bind(me.onImgMacro, me));
|
||||||
} else {
|
} else {
|
||||||
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
|
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
|
||||||
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
|
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
|
||||||
|
@ -987,6 +988,22 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onImgMacro: function(item) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
(new SSE.Views.MacroDialog({
|
||||||
|
props: {macroList: me.api.asc_getAllMacrosNames(), current: me.api.asc_getCurrentDrawingMacrosName()},
|
||||||
|
handler: function(result, value) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
if (me.api) {
|
||||||
|
me.api.asc_assignMacrosToCurrentDrawing(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
|
}
|
||||||
|
})).show();
|
||||||
|
},
|
||||||
|
|
||||||
onApiCoAuthoringDisconnect: function() {
|
onApiCoAuthoringDisconnect: function() {
|
||||||
this.permissions.isEdit = false;
|
this.permissions.isEdit = false;
|
||||||
},
|
},
|
||||||
|
@ -1807,6 +1824,8 @@ define([
|
||||||
documentHolder.menuSignatureEditSetup.setVisible(isInSign);
|
documentHolder.menuSignatureEditSetup.setVisible(isInSign);
|
||||||
documentHolder.menuEditSignSeparator.setVisible(isInSign);
|
documentHolder.menuEditSignSeparator.setVisible(isInSign);
|
||||||
|
|
||||||
|
documentHolder.menuImgMacro.setDisabled(isObjLocked);
|
||||||
|
|
||||||
if (showMenu) this.showPopupMenu(documentHolder.imgMenu, {}, event);
|
if (showMenu) this.showPopupMenu(documentHolder.imgMenu, {}, event);
|
||||||
documentHolder.mnuShapeSeparator.setVisible(documentHolder.mnuShapeAdvanced.isVisible() || documentHolder.mnuChartEdit.isVisible() || documentHolder.mnuImgAdvanced.isVisible());
|
documentHolder.mnuShapeSeparator.setVisible(documentHolder.mnuShapeAdvanced.isVisible() || documentHolder.mnuChartEdit.isVisible() || documentHolder.mnuImgAdvanced.isVisible());
|
||||||
documentHolder.mnuSlicerSeparator.setVisible(documentHolder.mnuSlicerAdvanced.isVisible());
|
documentHolder.mnuSlicerSeparator.setVisible(documentHolder.mnuSlicerAdvanced.isVisible());
|
||||||
|
|
|
@ -46,9 +46,6 @@ define([
|
||||||
'backbone',
|
'backbone',
|
||||||
'gateway',
|
'gateway',
|
||||||
'common/main/lib/component/Menu'
|
'common/main/lib/component/Menu'
|
||||||
// 'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog',
|
|
||||||
// 'spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced',
|
|
||||||
// 'spreadsheeteditor/main/app/view/TableSettingsAdvanced'
|
|
||||||
], function ($, _, Backbone, gateway) { 'use strict';
|
], function ($, _, Backbone, gateway) { 'use strict';
|
||||||
|
|
||||||
SSE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
SSE.Views.DocumentHolder = Backbone.View.extend(_.extend({
|
||||||
|
@ -820,6 +817,10 @@ define([
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.menuImgMacro = new Common.UI.MenuItem({
|
||||||
|
caption: me.textMacro
|
||||||
|
});
|
||||||
|
|
||||||
this.imgMenu = new Common.UI.Menu({
|
this.imgMenu = new Common.UI.Menu({
|
||||||
cls: 'shifted-right',
|
cls: 'shifted-right',
|
||||||
items: [
|
items: [
|
||||||
|
@ -833,6 +834,7 @@ define([
|
||||||
me.menuImageArrange,
|
me.menuImageArrange,
|
||||||
me.menuImageAlign,
|
me.menuImageAlign,
|
||||||
me.menuImgRotate,
|
me.menuImgRotate,
|
||||||
|
me.menuImgMacro,
|
||||||
me.mnuShapeSeparator,
|
me.mnuShapeSeparator,
|
||||||
me.menuImgCrop,
|
me.menuImgCrop,
|
||||||
me.mnuChartEdit,
|
me.mnuChartEdit,
|
||||||
|
@ -1247,7 +1249,8 @@ define([
|
||||||
txtCustomSort: 'Custom sort',
|
txtCustomSort: 'Custom sort',
|
||||||
txtCondFormat: 'Conditional Formatting',
|
txtCondFormat: 'Conditional Formatting',
|
||||||
textBullets: 'Bullets',
|
textBullets: 'Bullets',
|
||||||
textNumbering: 'Numbering'
|
textNumbering: 'Numbering',
|
||||||
|
textMacro: 'Assign Macro'
|
||||||
|
|
||||||
}, SSE.Views.DocumentHolder || {}));
|
}, SSE.Views.DocumentHolder || {}));
|
||||||
});
|
});
|
188
apps/spreadsheeteditor/main/app/view/MacroDialog.js
Normal file
188
apps/spreadsheeteditor/main/app/view/MacroDialog.js
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System Limited 2010-2021
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MacroDialog.js
|
||||||
|
*
|
||||||
|
* Created by Julia Radzhabova on 16.02.2021
|
||||||
|
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'common/main/lib/util/utils',
|
||||||
|
'common/main/lib/component/ListView',
|
||||||
|
'common/main/lib/component/InputField',
|
||||||
|
'common/main/lib/view/AdvancedSettingsWindow'
|
||||||
|
], function () { 'use strict';
|
||||||
|
|
||||||
|
SSE.Views.MacroDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||||
|
options: {
|
||||||
|
contentWidth: 250,
|
||||||
|
height: 312
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize : function(options) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
_.extend(this.options, {
|
||||||
|
title: this.textTitle,
|
||||||
|
template: [
|
||||||
|
'<div class="box" style="height:' + (me.options.height - 85) + 'px;">',
|
||||||
|
'<div class="content-panel" style="padding: 0 5px;"><div class="inner-content">',
|
||||||
|
'<div class="settings-panel active">',
|
||||||
|
'<table cols="1" style="width: 100%;">',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-extra-small">',
|
||||||
|
'<label class="input-label">', me.textMacro, '</label>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-small">',
|
||||||
|
'<div id="macro-dlg-txt-name"></div>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td>',
|
||||||
|
'<div id="macro-dlg-list" style="width:100%; height: 169px;"></div>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'</table>',
|
||||||
|
'</div></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>'
|
||||||
|
].join('')
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this.handler = options.handler;
|
||||||
|
this.props = options.props;
|
||||||
|
|
||||||
|
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
this.txtName = new Common.UI.InputField({
|
||||||
|
el : $('#macro-dlg-txt-name'),
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true,
|
||||||
|
validateOnBlur: true,
|
||||||
|
style : 'width: 100%;',
|
||||||
|
value : '',
|
||||||
|
maxLength: 40,
|
||||||
|
validation : function(value) { return true; }
|
||||||
|
}).on ('changing', function (input, value) {
|
||||||
|
me.findMacro(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.macroList = new Common.UI.ListView({
|
||||||
|
el: $('#macro-dlg-list', this.$window),
|
||||||
|
store: new Common.UI.DataViewStore(),
|
||||||
|
tabindex: 1,
|
||||||
|
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;overflow: hidden; text-overflow: ellipsis;"><%= value %></div>')
|
||||||
|
});
|
||||||
|
this.macroList.on('item:dblclick', _.bind(this.onDblClickMacro, this));
|
||||||
|
this.macroList.on('entervalue', _.bind(this.onPrimary, this));
|
||||||
|
this.macroList.on('item:select', _.bind(this.onSelectMacro, this));
|
||||||
|
|
||||||
|
this.afterRender();
|
||||||
|
},
|
||||||
|
|
||||||
|
getFocusedComponents: function() {
|
||||||
|
return [this.txtName, this.macroList];
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefaultFocusableComponent: function() {
|
||||||
|
return this.txtName;
|
||||||
|
},
|
||||||
|
|
||||||
|
afterRender: function() {
|
||||||
|
this._setDefaults(this.props);
|
||||||
|
},
|
||||||
|
|
||||||
|
_setDefaults: function (props) {
|
||||||
|
this.props = props;
|
||||||
|
this.refreshList();
|
||||||
|
},
|
||||||
|
|
||||||
|
getSettings: function () {
|
||||||
|
return this.txtName.getValue();
|
||||||
|
},
|
||||||
|
|
||||||
|
onDlgBtnClick: function(event) {
|
||||||
|
var state = event.currentTarget.attributes['result'].value;
|
||||||
|
this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
onPrimary: function() {
|
||||||
|
this.handler && this.handler.call(this, 'ok', this.getSettings());
|
||||||
|
this.close();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshList: function() {
|
||||||
|
if (this.props) {
|
||||||
|
this.props.macroList && this.macroList.store.reset(this.props.macroList);
|
||||||
|
if (this.props.current) {
|
||||||
|
this.txtName.setValue(this.props.current);
|
||||||
|
this.findMacro(this.props.current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onSelectMacro: function(listView, itemView, record) {
|
||||||
|
if (!record) return;
|
||||||
|
this.txtName.setValue(record.get('value'));
|
||||||
|
},
|
||||||
|
|
||||||
|
onDblClickMacro: function(listView, itemView, record) {
|
||||||
|
this.handler && this.handler.call(this, 'ok', this.getSettings());
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
findMacro: function(value) {
|
||||||
|
var rec = this.macroList.store.findWhere({value: value});
|
||||||
|
if (rec) {
|
||||||
|
this.macroList.selectRecord(rec);
|
||||||
|
this.macroList.scrollToRecord(rec);
|
||||||
|
} else
|
||||||
|
this.macroList.deselectAll();
|
||||||
|
},
|
||||||
|
|
||||||
|
textTitle: 'Assign Macro',
|
||||||
|
textMacro: 'Macro name'
|
||||||
|
}, SSE.Views.MacroDialog || {}))
|
||||||
|
});
|
|
@ -1910,6 +1910,7 @@
|
||||||
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||||
"SSE.Views.DocumentHolder.txtWidth": "Width",
|
"SSE.Views.DocumentHolder.txtWidth": "Width",
|
||||||
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
||||||
|
"SSE.Views.DocumentHolder.textMacro": "Assign Macro",
|
||||||
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
||||||
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
||||||
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",
|
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",
|
||||||
|
@ -2362,6 +2363,8 @@
|
||||||
"SSE.Views.LeftMenu.txtLimit": "Limit Access",
|
"SSE.Views.LeftMenu.txtLimit": "Limit Access",
|
||||||
"SSE.Views.LeftMenu.txtTrial": "TRIAL MODE",
|
"SSE.Views.LeftMenu.txtTrial": "TRIAL MODE",
|
||||||
"SSE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode",
|
"SSE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode",
|
||||||
|
"SSE.Views.MacroDialog.textTitle": "Assign Macro",
|
||||||
|
"SSE.Views.MacroDialog.textMacro": "Macro name",
|
||||||
"SSE.Views.MainSettingsPrint.okButtonText": "Save",
|
"SSE.Views.MainSettingsPrint.okButtonText": "Save",
|
||||||
"SSE.Views.MainSettingsPrint.strBottom": "Bottom",
|
"SSE.Views.MainSettingsPrint.strBottom": "Bottom",
|
||||||
"SSE.Views.MainSettingsPrint.strLandscape": "Landscape",
|
"SSE.Views.MainSettingsPrint.strLandscape": "Landscape",
|
||||||
|
|
Loading…
Reference in a new issue