[SSE] Show slicer settings in the right menu
This commit is contained in:
parent
15b036daf8
commit
c3eb5132da
|
@ -105,7 +105,8 @@ Common.Utils = _.extend(new(function() {
|
|||
MailMerge : 8,
|
||||
Signature : 9,
|
||||
Pivot : 10,
|
||||
Cell : 11
|
||||
Cell : 11,
|
||||
Slicer : 12
|
||||
},
|
||||
importTextType = {
|
||||
DRM: 0,
|
||||
|
|
|
@ -884,12 +884,12 @@ define([
|
|||
var me = this;
|
||||
|
||||
(new SSE.Views.SlicerSettingsAdvanced({
|
||||
props : item.imageInfo,
|
||||
imageProps : item.imageInfo,
|
||||
api : me.api,
|
||||
handler : function(result, value) {
|
||||
if (result == 'ok') {
|
||||
if (me.api) {
|
||||
me.api.asc_setGraphicObjectProps(value);
|
||||
me.api.asc_setGraphicObjectProps(value.imageProps);
|
||||
|
||||
Common.component.Analytics.trackEvent('DocumentHolder', 'Apply slicer settings');
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ define([
|
|||
this._settings[Common.Utils.documentSettingsType.Pivot] = {panelId: "id-pivot-settings", panel: rightMenu.pivotSettings, btn: rightMenu.btnPivot, hidden: 1, locked: false};
|
||||
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false};
|
||||
this._settings[Common.Utils.documentSettingsType.Cell] = {panelId: "id-cell-settings", panel: rightMenu.cellSettings, btn: rightMenu.btnCell, hidden: 1, locked: false};
|
||||
this._settings[Common.Utils.documentSettingsType.Slicer] = {panelId: "id-slicer-settings", panel: rightMenu.slicerSettings, btn: rightMenu.btnSlicer, hidden: 1, locked: false};
|
||||
},
|
||||
|
||||
setApi: function(api) {
|
||||
|
@ -190,6 +191,8 @@ define([
|
|||
this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 0;
|
||||
this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.asc_getLocked();
|
||||
}
|
||||
} else if (value.asc_getSlicerProperties() !== null) {
|
||||
settingsType = Common.Utils.documentSettingsType.Slicer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,6 +329,7 @@ define([
|
|||
this.rightmenu.paragraphSettings.updateMetricUnit();
|
||||
this.rightmenu.chartSettings.updateMetricUnit();
|
||||
this.rightmenu.imageSettings.updateMetricUnit();
|
||||
this.rightmenu.slicerSettings.updateMetricUnit();
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
|
@ -392,6 +396,7 @@ define([
|
|||
this.rightmenu.tableSettings.disableControls(disabled);
|
||||
this.rightmenu.pivotSettings.disableControls(disabled);
|
||||
this.rightmenu.cellSettings.disableControls(disabled);
|
||||
this.rightmenu.slicerSettings.disableControls(disabled);
|
||||
|
||||
if (!allowSignature && this.rightmenu.signatureSettings) {
|
||||
this.rightmenu.btnSignature.setDisabled(disabled);
|
||||
|
@ -410,6 +415,7 @@ define([
|
|||
this.rightmenu.btnChart.setDisabled(disabled);
|
||||
this.rightmenu.btnPivot.setDisabled(disabled);
|
||||
this.rightmenu.btnCell.setDisabled(disabled);
|
||||
this.rightmenu.btnSlicer.setDisabled(disabled);
|
||||
} else {
|
||||
this.onSelectionChanged(this.api.asc_getCellInfo());
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
</div>
|
||||
<div id="id-cell-settings" class="settings-panel">
|
||||
</div>
|
||||
<div id="id-slicer-settings" class="settings-panel">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tool-menu-btns">
|
||||
<div class="ct-btn-category arrow-left" />
|
||||
|
@ -29,6 +31,7 @@
|
|||
<button id="id-right-menu-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><i class="icon toolbar__icon btn-paragraph"> </i></button>
|
||||
<button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon toolbar__icon btn-menu-textart"> </i></button>
|
||||
<button id="id-right-menu-pivot" class="btn btn-category arrow-left" content-target="id-pivot-settings"><i class="icon toolbar__icon btn-menu-pivot"> </i></button>
|
||||
<button id="id-right-menu-slicer" class="btn btn-category arrow-left" content-target="id-slicer-settings"><i class="icon toolbar__icon btn-menu-pivot"> </i></button>
|
||||
<button id="id-right-menu-signature" class="btn btn-category arrow-left hidden" content-target="id-signature-settings"><i class="icon toolbar__icon btn-menu-signature"> </i></button>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,89 @@
|
|||
<table cols="3">
|
||||
<tr>
|
||||
<td class="padding-large" width="88px">
|
||||
<label class="input-label"><%= scope.textWidth %></label>
|
||||
<div id="slicer-spin-width"></div>
|
||||
</td>
|
||||
<td class="padding-large" width="28px" style="vertical-align: bottom;">
|
||||
<div id="slicer-button-ratio"></div>
|
||||
</td>
|
||||
<td class="padding-large" width="88px">
|
||||
<label class="input-label"><%= scope.textHeight %></label>
|
||||
<div id="slicer-spin-height"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cols="2">
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<label class="header"><%= scope.textPosition %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="" width="50%">
|
||||
<label class="input-label"><%= scope.textHor %></label>
|
||||
<div id="slicer-spin-hor"></div>
|
||||
</td>
|
||||
<td class="" width="50%">
|
||||
<label class="input-label"><%= scope.textVert %></label>
|
||||
<div id="slicer-spin-vert"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div id="slicer-checkbox-disable-resize"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<label class="header"><%= scope.textButtons %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<label class="input-label"><%= scope.textColumns %></label>
|
||||
<div id="slicer-spin-cols" style="display: inline-block;margin-left:5px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" width="50%">
|
||||
<label class="input-label"><%= scope.textWidth %></label>
|
||||
<div id="slicer-spin-col-width"></div>
|
||||
</td>
|
||||
<td class="padding-small" width="50%">
|
||||
<label class="input-label"><%= scope.textHeight %></label>
|
||||
<div id="slicer-spin-col-height"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<label class="header"><%= scope.textStyle %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div id="slicer-btn-style" style="width: 100%;height: 52px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-small" colspan=2>
|
||||
<div class="separator horizontal"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" colspan=2>
|
||||
<label class="link" id="slicer-advanced-link"><%= scope.textAdvanced %></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="finish-cell"></tr>
|
||||
</table>
|
|
@ -58,6 +58,7 @@ define([
|
|||
'spreadsheeteditor/main/app/view/PivotSettings',
|
||||
'spreadsheeteditor/main/app/view/SignatureSettings',
|
||||
'spreadsheeteditor/main/app/view/CellSettings',
|
||||
'spreadsheeteditor/main/app/view/SlicerSettings',
|
||||
'common/main/lib/component/Scroller'
|
||||
], function (menuTemplate, $, _, Backbone) {
|
||||
'use strict';
|
||||
|
@ -143,6 +144,14 @@ define([
|
|||
toggleGroup: 'tabpanelbtnsGroup',
|
||||
allowMouseEventsOnDisabled: true
|
||||
});
|
||||
this.btnSlicer = new Common.UI.Button({
|
||||
hint: this.txtSlicerSettings,
|
||||
asctype: Common.Utils.documentSettingsType.Slicer,
|
||||
enableToggle: true,
|
||||
disabled: true,
|
||||
toggleGroup: 'tabpanelbtnsGroup',
|
||||
allowMouseEventsOnDisabled: true
|
||||
});
|
||||
|
||||
this._settings = [];
|
||||
this._settings[Common.Utils.documentSettingsType.Paragraph] = {panel: "id-paragraph-settings", btn: this.btnText};
|
||||
|
@ -153,6 +162,7 @@ define([
|
|||
this._settings[Common.Utils.documentSettingsType.Table] = {panel: "id-table-settings", btn: this.btnTable};
|
||||
this._settings[Common.Utils.documentSettingsType.Pivot] = {panel: "id-pivot-settings", btn: this.btnPivot};
|
||||
this._settings[Common.Utils.documentSettingsType.Cell] = {panel: "id-cell-settings", btn: this.btnCell};
|
||||
this._settings[Common.Utils.documentSettingsType.Slicer] = {panel: "id-slicer-settings", btn: this.btnSlicer};
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -178,6 +188,7 @@ define([
|
|||
this.btnTable.setElement($('#id-right-menu-table'), false); this.btnTable.render();
|
||||
this.btnPivot.setElement($('#id-right-menu-pivot'), false); this.btnPivot.render();
|
||||
this.btnCell.setElement($('#id-right-menu-cell'), false); this.btnCell.render();
|
||||
this.btnSlicer.setElement($('#id-right-menu-slicer'), false); this.btnSlicer.render();
|
||||
|
||||
this.btnText.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
this.btnImage.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
|
@ -187,6 +198,7 @@ define([
|
|||
this.btnTable.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
this.btnPivot.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
this.btnCell.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
this.btnSlicer.on('click', _.bind(this.onBtnMenuClick, this));
|
||||
|
||||
this.paragraphSettings = new SSE.Views.ParagraphSettings();
|
||||
this.imageSettings = new SSE.Views.ImageSettings();
|
||||
|
@ -196,6 +208,7 @@ define([
|
|||
this.tableSettings = new SSE.Views.TableSettings();
|
||||
this.pivotSettings = new SSE.Views.PivotSettings();
|
||||
this.cellSettings = new SSE.Views.CellSettings();
|
||||
this.slicerSettings = new SSE.Views.SlicerSettings();
|
||||
|
||||
if (mode && mode.isSignatureSupport) {
|
||||
this.btnSignature = new Common.UI.Button({
|
||||
|
@ -244,6 +257,7 @@ define([
|
|||
this.tableSettings.setApi(api);
|
||||
this.pivotSettings.setApi(api);
|
||||
this.cellSettings.setApi(api);
|
||||
this.slicerSettings.setApi(api);
|
||||
if (this.signatureSettings) this.signatureSettings.setApi(api);
|
||||
return this;
|
||||
},
|
||||
|
@ -329,6 +343,7 @@ define([
|
|||
txtTableSettings: 'Table Settings',
|
||||
txtPivotSettings: 'Pivot Table Settings',
|
||||
txtSignatureSettings: 'Signature Settings',
|
||||
txtCellSettings: 'Cell Settings'
|
||||
txtCellSettings: 'Cell Settings',
|
||||
txtSlicerSettings: 'Slicer Settings'
|
||||
}, SSE.Views.RightMenu || {}));
|
||||
});
|
493
apps/spreadsheeteditor/main/app/view/SlicerSettings.js
Normal file
493
apps/spreadsheeteditor/main/app/view/SlicerSettings.js
Normal file
|
@ -0,0 +1,493 @@
|
|||
/*
|
||||
*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* SlicerSettings.js
|
||||
*
|
||||
* Created by Julia Radzhabova on 5/26/20
|
||||
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
define([
|
||||
'text!spreadsheeteditor/main/app/template/SlicerSettings.template',
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/MetricSpinner',
|
||||
'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced'
|
||||
], function (menuTemplate, $, _, Backbone) {
|
||||
'use strict';
|
||||
|
||||
SSE.Views.SlicerSettings = Backbone.View.extend(_.extend({
|
||||
el: '#id-slicer-settings',
|
||||
|
||||
// Compile our stats template
|
||||
template: _.template(menuTemplate),
|
||||
|
||||
// Delegated events for creating new items, and clearing completed ones.
|
||||
events: {
|
||||
},
|
||||
|
||||
options: {
|
||||
alias: 'SlicerSettings'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this._initSettings = true;
|
||||
|
||||
this._nRatio = 1;
|
||||
this._state = {
|
||||
Width: 0,
|
||||
Height: 0,
|
||||
DisabledControls: false,
|
||||
keepRatio: false,
|
||||
ColCount: 0,
|
||||
ColWidth: 0,
|
||||
ColHeight: 0,
|
||||
PosVert: 0,
|
||||
PosHor: 0
|
||||
};
|
||||
this.spinners = [];
|
||||
this.lockedControls = [];
|
||||
this._locked = false;
|
||||
|
||||
this._noApply = false;
|
||||
this._originalProps = null;
|
||||
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var el = $(this.el);
|
||||
el.html(this.template({
|
||||
scope: this
|
||||
}));
|
||||
|
||||
this.linkAdvanced = $('#image-advanced-link');
|
||||
},
|
||||
|
||||
setApi: function(api) {
|
||||
if ( api == undefined ) return;
|
||||
this.api = api;
|
||||
if (this.api) {
|
||||
// this.api.asc_registerCallback('asc_InitSlicerStyles', _.bind(this.onInitStyles, this));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
this.mode = mode;
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
createDelayedControls: function() {
|
||||
var me = this;
|
||||
this.spnWidth = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-width'),
|
||||
step: .1,
|
||||
width: 78,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnWidth);
|
||||
this.lockedControls.push(this.spnWidth);
|
||||
|
||||
this.spnHeight = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-height'),
|
||||
step: .1,
|
||||
width: 78,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnHeight);
|
||||
this.lockedControls.push(this.spnHeight);
|
||||
|
||||
this.btnRatio = new Common.UI.Button({
|
||||
parentEl: $('#slicer-button-ratio'),
|
||||
cls: 'btn-toolbar',
|
||||
iconCls: 'toolbar__icon advanced-btn-ratio',
|
||||
style: 'margin-bottom: 1px;',
|
||||
enableToggle: true,
|
||||
hint: this.textKeepRatio
|
||||
});
|
||||
this.lockedControls.push(this.btnRatio);
|
||||
|
||||
this.btnRatio.on('click', _.bind(function(btn, e) {
|
||||
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
|
||||
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
|
||||
}
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.asc_putLockAspect(btn.pressed);
|
||||
this.api.asc_setGraphicObjectProps(props);
|
||||
}
|
||||
}, this));
|
||||
|
||||
this.spnWidth.on('change', _.bind(this.onWidthChange, this));
|
||||
this.spnHeight.on('change', _.bind(this.onHeightChange, this));
|
||||
this.spnWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
|
||||
this.spnHor = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-hor'),
|
||||
step: .1,
|
||||
width: 85,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnHor);
|
||||
this.lockedControls.push(this.spnVert);
|
||||
|
||||
this.spnVert = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-vert'),
|
||||
step: .1,
|
||||
width: 85,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnVert);
|
||||
this.lockedControls.push(this.spnVert);
|
||||
|
||||
// this.spnHor.on('change', _.bind(this.onHorChange, this));
|
||||
// this.spnVert.on('change', _.bind(this.onVertChange, this));
|
||||
this.spnHor.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
this.spnVert.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
|
||||
this.spnColWidth = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-col-width'),
|
||||
step: .1,
|
||||
width: 85,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnColWidth);
|
||||
this.lockedControls.push(this.spnColWidth);
|
||||
|
||||
this.spnColHeight = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-col-height'),
|
||||
step: .1,
|
||||
width: 85,
|
||||
defaultUnit : "cm",
|
||||
value: '0 cm',
|
||||
maxValue: 5963.9,
|
||||
minValue: 0
|
||||
});
|
||||
this.spinners.push(this.spnColHeight);
|
||||
this.lockedControls.push(this.spnColHeight);
|
||||
|
||||
this.numCols = new Common.UI.MetricSpinner({
|
||||
el: $('#slicer-spin-cols'),
|
||||
step: 1,
|
||||
width: 50,
|
||||
defaultUnit : "",
|
||||
defaultValue : 1,
|
||||
value: '1',
|
||||
allowDecimal: false,
|
||||
maxValue: 20000,
|
||||
minValue: 0
|
||||
});
|
||||
this.lockedControls.push(this.numCols);
|
||||
|
||||
// this.spnColWidth.on('change', _.bind(this.onColWidthChange, this));
|
||||
// this.spnColHeight.on('change', _.bind(this.onColHeightChange, this));
|
||||
// this.numCols.on('change', _.bind(this.onColChange, this));
|
||||
this.spnColWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
this.spnColHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
this.numCols.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
|
||||
|
||||
$(this.el).on('click', '#slicer-advanced-link', _.bind(this.openAdvancedSettings, this));
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
this.createDelayedControls();
|
||||
this.updateMetricUnit();
|
||||
this._initSettings = false;
|
||||
},
|
||||
|
||||
openAdvancedSettings: function(e) {
|
||||
if (this.linkAdvanced.hasClass('disabled')) return;
|
||||
|
||||
var me = this;
|
||||
var win;
|
||||
if (me.api && !this._locked){
|
||||
var selectedElements = me.api.asc_getGraphicObjectProps();
|
||||
if (selectedElements && selectedElements.length>0){
|
||||
var elType, elValue;
|
||||
for (var i = selectedElements.length - 1; i >= 0; i--) {
|
||||
elType = selectedElements[i].asc_getObjectType();
|
||||
elValue = selectedElements[i].asc_getObjectValue();
|
||||
if (Asc.c_oAscTypeSelectElement.Image == elType) {
|
||||
(new SSE.Views.SlicerSettingsAdvanced(
|
||||
{
|
||||
imageProps: elValue,
|
||||
api: me.api,
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
if (me.api) {
|
||||
me.api.asc_setGraphicObjectProps(value.imageProps);
|
||||
}
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', me);
|
||||
}
|
||||
})).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
ChangeSettings: function(props) {
|
||||
if (this._initSettings)
|
||||
this.createDelayedElements();
|
||||
|
||||
this.disableControls(this._locked);
|
||||
|
||||
if (props ){
|
||||
this._originalProps = new Asc.asc_CImgProperty(props);
|
||||
|
||||
var value = props.asc_getWidth();
|
||||
if ( Math.abs(this._state.Width-value)>0.001 ||
|
||||
(this._state.Width===null || value===null)&&(this._state.Width!==value)) {
|
||||
this.spnWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true);
|
||||
this._state.Width = value;
|
||||
}
|
||||
|
||||
value = props.asc_getHeight();
|
||||
if ( Math.abs(this._state.Height-value)>0.001 ||
|
||||
(this._state.Height===null || value===null)&&(this._state.Height!==value)) {
|
||||
this.spnHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true);
|
||||
this._state.Height = value;
|
||||
}
|
||||
|
||||
if (props.asc_getHeight()>0)
|
||||
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
|
||||
|
||||
value = props.asc_getLockAspect();
|
||||
if (this._state.keepRatio!==value) {
|
||||
this.btnRatio.toggle(value);
|
||||
this._state.keepRatio=value;
|
||||
}
|
||||
|
||||
var slicerprops = props.asc_getSlicerProperties();
|
||||
if (slicerprops) {
|
||||
value = slicerprops.asc_getColumnCount();
|
||||
if ( Math.abs(this._state.ColCount-value)>0.1 ||
|
||||
(this._state.ColCount===null || value===null)&&(this._state.ColCount!==value)) {
|
||||
this.numCols.setValue((value!==null) ? value : '', true);
|
||||
this._state.ColCount = value;
|
||||
}
|
||||
|
||||
// value = props.asc_getColWidth()/36000;
|
||||
// if ( Math.abs(this._state.ColWidth-value)>0.001 ||
|
||||
// (this._state.ColWidth===null || value===null)&&(this._state.ColWidth!==value)) {
|
||||
// this.spnColWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true);
|
||||
// this._state.ColWidth = value;
|
||||
// }
|
||||
|
||||
value = slicerprops.asc_getRowHeight()/36000;
|
||||
if ( Math.abs(this._state.ColHeight-value)>0.001 ||
|
||||
(this._state.ColHeight===null || value===null)&&(this._state.ColHeight!==value)) {
|
||||
this.spnColHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true);
|
||||
this._state.ColHeight = value;
|
||||
}
|
||||
|
||||
value = slicerprops.asc_getStyle();
|
||||
if (!this.btnSlicerStyle)
|
||||
this.onInitStyles();
|
||||
// var rec = this.mnuSlicerPicker.store.findWhere({type: value});
|
||||
// if (!rec) {
|
||||
// rec = this.mnuSlicerPicker.store.at(0);
|
||||
// }
|
||||
// this.btnSlicerStyle.suspendEvents();
|
||||
// this.mnuSlicerPicker.selectRecord(rec, true);
|
||||
// this.btnSlicerStyle.resumeEvents();
|
||||
// this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'});
|
||||
this.$el.find('.icon-template-table').css({'height': '48px', 'width': '63px', 'background-position': 'center', 'background-size': 'cover'});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onWidthChange: function(field, newValue, oldValue, eOpts){
|
||||
var w = field.getNumberValue();
|
||||
var h = this.spnHeight.getNumberValue();
|
||||
if (this.btnRatio.pressed) {
|
||||
h = w/this._nRatio;
|
||||
if (h>this.spnHeight.options.maxValue) {
|
||||
h = this.spnHeight.options.maxValue;
|
||||
w = h * this._nRatio;
|
||||
this.spnWidth.setValue(w, true);
|
||||
}
|
||||
this.spnHeight.setValue(h, true);
|
||||
}
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
|
||||
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
|
||||
this.api.asc_setGraphicObjectProps(props);
|
||||
}
|
||||
},
|
||||
|
||||
onHeightChange: function(field, newValue, oldValue, eOpts){
|
||||
var h = field.getNumberValue(), w = this.spnWidth.getNumberValue();
|
||||
if (this.btnRatio.pressed) {
|
||||
w = h * this._nRatio;
|
||||
if (w>this.spnWidth.options.maxValue) {
|
||||
w = this.spnWidth.options.maxValue;
|
||||
h = w/this._nRatio;
|
||||
this.spnHeight.setValue(h, true);
|
||||
}
|
||||
this.spnWidth.setValue(w, true);
|
||||
}
|
||||
if (this.api) {
|
||||
var props = new Asc.asc_CImgProperty();
|
||||
props.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(w));
|
||||
props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h));
|
||||
this.api.asc_setGraphicObjectProps(props);
|
||||
}
|
||||
},
|
||||
|
||||
onInitStyles: function(Templates){
|
||||
var self = this;
|
||||
this._isTemplatesChanged = true;
|
||||
|
||||
if (!this.btnSlicerStyle) {
|
||||
this.btnSlicerStyle = new Common.UI.Button({
|
||||
cls : 'btn-large-dataview sheet-template-table',
|
||||
iconCls : 'icon-template-table',
|
||||
menu : new Common.UI.Menu({
|
||||
style: 'width: 400px;',
|
||||
items: [
|
||||
{ template: _.template('<div id="id-slicer-menu-style" class="menu-table-template" style="margin: 5px 5px 5px 10px;"></div>') }
|
||||
]
|
||||
})
|
||||
});
|
||||
this.btnSlicerStyle.on('render:after', function(btn) {
|
||||
self.mnuSlicerPicker = new Common.UI.DataView({
|
||||
el: $('#id-slicer-menu-style'),
|
||||
parentMenu: btn.menu,
|
||||
restoreHeight: 325,
|
||||
groups: new Common.UI.DataViewGroupStore(),
|
||||
store: new Common.UI.DataViewStore(),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item"><img src="<%= imageUrl %>" height="46" width="61"></div>'),
|
||||
style: 'max-height: 325px;'
|
||||
});
|
||||
});
|
||||
this.btnSlicerStyle.render($('#slicer-btn-style'));
|
||||
this.lockedControls.push(this.btnSlicerStyle);
|
||||
this.mnuSlicerPicker.on('item:click', _.bind(this.onSelectSlicerStyle, this, this.btnSlicerStyle));
|
||||
if (this._locked) this.btnSlicerStyle.setDisabled(this._locked);
|
||||
}
|
||||
|
||||
if (Templates) {
|
||||
var count = self.mnuSlicerPicker.store.length;
|
||||
if (count>0 && count==Templates.length) {
|
||||
var data = self.mnuSlicerPicker.store.models;
|
||||
_.each(Templates, function(template, index){
|
||||
data[index].set('imageUrl', template.asc_getImage());
|
||||
});
|
||||
} else {
|
||||
var arr = [];
|
||||
_.each(Templates, function(template){
|
||||
arr.push({
|
||||
id : Common.UI.getId(),
|
||||
type : template.asc_getType(),
|
||||
imageUrl : template.asc_getImage(),
|
||||
allowSelected : true,
|
||||
selected : false
|
||||
});
|
||||
});
|
||||
self.mnuSlicerPicker.store.reset(arr);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onSelectSlicerStyle: function(combo, record) {
|
||||
if (this._noApply) return;
|
||||
|
||||
// if (this._originalProps) {
|
||||
// this._originalProps..asc_getSlicerProperties().asc_setStyle(record.get('type'));
|
||||
// }
|
||||
},
|
||||
|
||||
setLocked: function (locked) {
|
||||
this._locked = locked;
|
||||
},
|
||||
|
||||
disableControls: function(disable) {
|
||||
if (this._initSettings) return;
|
||||
|
||||
if (this._state.DisabledControls!==disable) {
|
||||
this._state.DisabledControls = disable;
|
||||
_.each(this.lockedControls, function(item) {
|
||||
item.setDisabled(disable);
|
||||
});
|
||||
this.linkAdvanced.toggleClass('disabled', disable);
|
||||
}
|
||||
},
|
||||
|
||||
textKeepRatio: 'Constant Proportions',
|
||||
textSize: 'Size',
|
||||
textWidth: 'Width',
|
||||
textHeight: 'Height',
|
||||
textAdvanced: 'Show advanced settings',
|
||||
textPosition: 'Position',
|
||||
textHor: 'Horizontal',
|
||||
textVert: 'Vertical',
|
||||
textButtons: 'Buttons',
|
||||
textColumns: 'Columns',
|
||||
textStyle: 'Style'
|
||||
|
||||
}, SSE.Views.SlicerSettings || {}));
|
||||
});
|
||||
|
|
@ -75,7 +75,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
|
|||
this._noApply = true;
|
||||
this.spinners = [];
|
||||
|
||||
this._originalProps = this.options.props;
|
||||
this._originalProps = this.options.imageProps;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -344,7 +344,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
|
|||
if (this.isAltDescChanged)
|
||||
this._originalProps.asc_putDescription(this.textareaAltDescription.val());
|
||||
|
||||
return this._originalProps;
|
||||
return {imageProps: this._originalProps};
|
||||
},
|
||||
|
||||
_setDefaults: function(props) {
|
||||
|
|
|
@ -2113,6 +2113,7 @@
|
|||
"SSE.Views.RightMenu.txtSparklineSettings": "Sparkline Settings",
|
||||
"SSE.Views.RightMenu.txtTableSettings": "Table settings",
|
||||
"SSE.Views.RightMenu.txtTextArtSettings": "Text Art settings",
|
||||
"SSE.Views.RightMenu.txtSlicerSettings": "Slicer Settings",
|
||||
"SSE.Views.ScaleDialog.textAuto": "Auto",
|
||||
"SSE.Views.ScaleDialog.textError": "The entered value is incorrect.",
|
||||
"SSE.Views.ScaleDialog.textFewPages": "pages",
|
||||
|
|
Loading…
Reference in a new issue