From 24b226872b800295ee730ade94bee211ecbc9233 Mon Sep 17 00:00:00 2001 From: nikita_bartoshuk Date: Tue, 13 Jan 2026 13:23:42 +0300 Subject: [PATCH] moved chart 3d settings to common --- .../main/app/controller/ChartTab.js | 2 +- .../main/app/view/Charts3DDlg.js | 358 ------------------ apps/spreadsheeteditor/main/app_dev.js | 2 +- apps/spreadsheeteditor/main/app_pack.js | 2 +- apps/spreadsheeteditor/main/locale/en.json | 40 +- 5 files changed, 23 insertions(+), 381 deletions(-) delete mode 100644 apps/spreadsheeteditor/main/app/view/Charts3DDlg.js diff --git a/apps/spreadsheeteditor/main/app/controller/ChartTab.js b/apps/spreadsheeteditor/main/app/controller/ChartTab.js index 2cf5596cb6..9b4becef7f 100644 --- a/apps/spreadsheeteditor/main/app/controller/ChartTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ChartTab.js @@ -99,7 +99,7 @@ define([ props = (me.isChart) ? me.api.asc_getChartSettings() : me._originalProps; if (props) { var oView3D = props.getView3d(); - (new SSE.Views.Charts3DDlg( + (new Common.Views.Charts3DDlg( { oView3D: oView3D, chartProps: props, diff --git a/apps/spreadsheeteditor/main/app/view/Charts3DDlg.js b/apps/spreadsheeteditor/main/app/view/Charts3DDlg.js deleted file mode 100644 index ee5ca9a24e..0000000000 --- a/apps/spreadsheeteditor/main/app/view/Charts3DDlg.js +++ /dev/null @@ -1,358 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2024 - * - * 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-6 Ernesta Birznieka-Upish - * 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 - * - */ -/** - * Charts3DDlg.js - * - * Created on 12.11.2025 - * - */ -define([], function () { - 'use strict'; - var nMaxRecent = 5; - SSE.Views.Charts3DDlg = Common.UI.Window.extend(_.extend({ - initialize : function (options) { - var t = this, - _options = {}; - _.extend(_options, { - title: options.title ? options.title : this.capRotation, - cls: 'modal-dlg', - width: 250, - height: 'auto', - buttons: options.buttons ? options.buttons : [{ - value: 'ok', - caption: 'Ok' - }, 'cancel'] - }, options); - this.recentNumTypes = []; - this.handler = options.handler; - this.props = options.props; - this.numbering = options.numbering; - this.numFormat = options.numFormat; - this.mode = options.mode; - this.X = options.X; - this.Y = options.Y; - this.RightAngle = options.RightAngle; - this.Perspective = options.Perspective; - this.Depth = options.Depth; - this.Height3d = options.Height3d; - this.oView3D = options.oView3D; - this.chartProps = options.chartProps; - this.api = options.api; - this.template = options.template || [ - '
', - '' + - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
' - ].join(''); - _options.tpl = _.template(this.template)(_options); - Common.UI.Window.prototype.initialize.call(this, _options); - }, - render: function () { - Common.UI.Window.prototype.render.call(this); - var me = this; - this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); - - this.btnLeft = new Common.UI.Button({ - parentEl: $('#id-chart-btn-x-left'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-270', - hint: this.textLeft, - }); - this.btnLeft.on('click', _.bind(function() { - this.spnX.setValue(Math.ceil((this.spnX.getNumberValue() - 10)/10)*10); - }, this)); - - this.btnRight= new Common.UI.Button({ - parentEl: $('#id-chart-btn-x-right'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-90', - hint: this.textRight, - }); - this.btnRight.on('click', _.bind(function() { - this.spnX.setValue(Math.floor((this.spnX.getNumberValue() + 10)/10)*10); - }, this)); - - this.spnX = new Common.UI.MetricSpinner({ - el: $('#id-chart-spin-x'), - step: 10, - width: 57, - defaultUnit : "°", - value: '20 °', - maxValue: 359.9, - minValue: 0, - ariaLabel: this.textX - }); - this.spnX.on('change', _.bind(this.onXRotation, this)); - - this.spnY = new Common.UI.MetricSpinner({ - el: $('#id-chart-spin-y'), - step: 10, - width: 57, - defaultUnit : "°", - value: '15 °', - maxValue: 90, - minValue: -90, - ariaLabel: this.textY - }); - this.spnY.on('change', _.bind(this.onYRotation, this)); - - this.btnUp = new Common.UI.Button({ - parentEl: $('#id-chart-btn-y-up'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-y-clockwise', - hint: this.textUp, - }); - this.btnUp.on('click', _.bind(function() { - this.spnY.setValue(Math.ceil((this.spnY.getNumberValue() - 10)/10)*10); - }, this)); - - this.btnDown= new Common.UI.Button({ - parentEl: $('#id-chart-btn-y-down'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-y-counterclockwise', - hint: this.textDown, - }); - this.btnDown.on('click', _.bind(function() { - this.spnY.setValue(Math.floor((this.spnY.getNumberValue() + 10)/10)*10); - }, this)); - - this.spnPerspective = new Common.UI.MetricSpinner({ - el: $('#id-chart-spin-persp'), - step: 5, - width: 57, - defaultUnit : "°", - value: '0 °', - maxValue: 100, - minValue: 0.1, - ariaLabel: this.textPerspective - }); - this.spnPerspective.on('change', _.bind(this.onPerspective, this)); - - this.btnNarrow = new Common.UI.Button({ - parentEl: $('#id-chart-btn-narrow'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-up', - hint: this.textNarrow, - }); - this.btnNarrow.on('click', _.bind(function() { - this.spnPerspective.setValue(Math.ceil((this.spnPerspective.getNumberValue() - 5)/5)*5); - }, this)); - - this.btnWiden= new Common.UI.Button({ - parentEl: $('#id-chart-btn-widen'), - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-rotate-down', - hint: this.textWiden, - }); - this.btnWiden.on('click', _.bind(function() { - this.spnPerspective.setValue(Math.floor((this.spnPerspective.getNumberValue() + 5)/5)*5); - }, this)); - - this.chRightAngle = new Common.UI.CheckBox({ - el: $('#id-chart-checkbox-right-angle'), - labelText: this.capRightAngleAxes - }); - this.chRightAngle.on('change', _.bind(function(field, newValue, oldValue, eOpts) { - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setRightAngleAxes(field.getValue()=='checked'); - this.spnPerspective.setDisabled(field.getValue()=='checked'); - this.btnNarrow.setDisabled(field.getValue()=='checked'); - this.btnWiden.setDisabled(field.getValue()=='checked'); - } - }, this)); - - this.chAutoscale = new Common.UI.CheckBox({ - el: $('#id-chart-checkbox-autoscale'), - labelText: this.capAutoscale - }); - this.chAutoscale.on('change', _.bind(function(field, newValue, oldValue, eOpts) { - if (this.api && this.chartProps && this.oView3D){ - this.oView3D.asc_setHeight(field.getValue()=='checked' ? null : this.spn3DHeight.getNumberValue()); - this.spn3DHeight.setDisabled(field.getValue()=='checked'); - } - }, this)); - - this.spn3DDepth = new Common.UI.MetricSpinner({ - el: $('#id-chart-spin-3d-depth'), - step: 10, - width: 70, - defaultUnit : "%", - value: '0 %', - maxValue: 2000, - minValue: 0, - ariaLabel: this.text3dDepth - }); - this.spn3DDepth.on('change', _.bind(this.on3DDepth, this)); - - this.spn3DHeight = new Common.UI.MetricSpinner({ - el: $('#id-chart-spin-3d-height'), - step: 10, - width: 70, - defaultUnit : "%", - value: '50 %', - maxValue: 500, - minValue: 5, - ariaLabel: this.text3dHeight - }); - this.spn3DHeight.on('change', _.bind(this.on3DHeight, this)); - - this.linkDefRotation = $('#id-chart-def-rotate-link'); - this.linkDefRotation.on('click', _.bind(this.onDefRotation, this)); - - this.spnX.setValue((me.X!==null && me.X !== undefined) ? me.X : '', true); - this.spnY.setValue((me.Y!==null && me.Y !== undefined) ? me.Y : '', true); - this.chRightAngle.setValue((me.RightAngle !== null && me.RightAngle !== undefined) ? me.RightAngle : 'indeterminate', true); - this.spnPerspective.setMinValue((me.Perspective!==null && me.Perspective !== undefined) ? 0.1 : 0); - this.spnPerspective.setValue((me.Perspective!==null && me.Perspective !== undefined) ? me.Perspective : 0, true); - this.spnPerspective.setDisabled(!!me.RightAngle); - this.btnNarrow.setDisabled(!!me.RightAngle); - this.btnWiden.setDisabled(!!me.RightAngle); - this.spn3DDepth.setValue((me.Depth!==null && me.Depth !== undefined) ? me.Depth : '', true); - this.chAutoscale.setValue(me.Height3d===null, true); - (me.Height3d!==null) && this.spn3DHeight.setValue(me.Height3d, true); - this.spn3DHeight.setDisabled(me.Height3d===null); - }, - - onXRotation: function(field, newValue, oldValue, eOpts){ - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setRotX(field.getNumberValue()); - } - }, - - onYRotation: function(field, newValue, oldValue, eOpts){ - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setRotY(field.getNumberValue()); - } - }, - - onPerspective: function(field, newValue, oldValue, eOpts){ - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setPerspective(field.getNumberValue()); - } - }, - - on3DDepth: function(field, newValue, oldValue, eOpts){ - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setDepth(field.getNumberValue()); - } - }, - - on3DHeight: function(field, newValue, oldValue, eOpts){ - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setHeight(field.getNumberValue()); - } - }, - - onDefRotation: function() { - var me = this; - if (this.api && this.chartProps && this.oView3D) { - this.oView3D.asc_setRotX(20); - this.oView3D.asc_setRotY(15); - me.spnX.setValue(20); - me.spnY.setValue(15); - } - }, - - getFocusedComponents: function() { - return [this.spnX, this.btnRight, this.btnLeft, this.spnY, this.btnUp, this.btnDown, this.spnPerspective, - this.btnNarrow, this.btnWiden, this.chRightAngle, this.chAutoscale, this.spn3DDepth, this.spn3DHeight].concat(this.getFooterButtons()); - }, - getDefaultFocusableComponent: function () { - return this.spnX; - }, - onPrimary: function(event) { - this._handleInput('ok'); - return false; - }, - onBtnClick: function(event) { - this._handleInput(event.currentTarget.attributes['result'].value); - }, - _handleInput: function(state) { - var me = this; - if (this.handler) { - this.handler.call(this, state, me.oView3D, me.chartProps); - } - this.close(); - }, - }, SSE.Views.Charts3DDlg || {})); -}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app_dev.js b/apps/spreadsheeteditor/main/app_dev.js index 87f0a3e454..d73fab28a9 100644 --- a/apps/spreadsheeteditor/main/app_dev.js +++ b/apps/spreadsheeteditor/main/app_dev.js @@ -208,6 +208,7 @@ require([ 'common/main/lib/component/ComboBoxDataView', 'common/main/lib/view/AdvancedSettingsWindow', 'common/main/lib/view/OptionsDialog', + 'common/main/lib/view/Charts3DDlg', 'common/main/lib/view/AutoCorrectDialog', 'common/main/lib/view/DocumentAccessDialog', 'common/main/lib/view/SaveAsDlg', @@ -282,7 +283,6 @@ require([ 'spreadsheeteditor/main/app/view/ShapeSettingsAdvanced', 'spreadsheeteditor/main/app/view/ProtectDialog', 'spreadsheeteditor/main/app/view/ProtectedRangesEditDlg', - 'spreadsheeteditor/main/app/view/Charts3DDlg', 'spreadsheeteditor/main/app/view/CreatePivotDialog', 'spreadsheeteditor/main/app/view/SortOptionsDialog', 'spreadsheeteditor/main/app/view/SetValueDialog', diff --git a/apps/spreadsheeteditor/main/app_pack.js b/apps/spreadsheeteditor/main/app_pack.js index d6b57de761..f57694e73b 100644 --- a/apps/spreadsheeteditor/main/app_pack.js +++ b/apps/spreadsheeteditor/main/app_pack.js @@ -5,6 +5,7 @@ require([ 'common/main/lib/component/ComboBoxDataView', 'common/main/lib/view/AdvancedSettingsWindow', 'common/main/lib/view/OptionsDialog', + 'common/main/lib/view/Charts3DDlg', 'common/main/lib/view/AutoCorrectDialog', 'common/main/lib/view/DocumentAccessDialog', 'common/main/lib/view/SaveAsDlg', @@ -78,7 +79,6 @@ require([ 'spreadsheeteditor/main/app/view/ShapeSettingsAdvanced', 'spreadsheeteditor/main/app/view/ProtectDialog', 'spreadsheeteditor/main/app/view/ProtectedRangesEditDlg', - 'spreadsheeteditor/main/app/view/Charts3DDlg', 'spreadsheeteditor/main/app/view/CreatePivotDialog', 'spreadsheeteditor/main/app/view/SortOptionsDialog', 'spreadsheeteditor/main/app/view/SetValueDialog', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index bb86282e62..0ecbef9a0c 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1268,6 +1268,26 @@ "Common.Views.UserNameDialog.textDontShow": "Don't ask me again", "Common.Views.UserNameDialog.textLabel": "Label:", "Common.Views.UserNameDialog.textLabelError": "Label must not be empty.", + "Common.Views.Charts3DDlg.txtXRotation": "X-rotation", + "Common.Views.Charts3DDlg.txtYRotation": "Y-rotation", + "Common.Views.Charts3DDlg.txtPerspective": "Perspective", + "Common.Views.Charts3DDlg.txtDepth": "Depth (% of base)", + "Common.Views.Charts3DDlg.txtHeight": "Height (% of base)", + "Common.Views.Charts3DDlg.txtDefRotation": "Default Rotation", + "Common.Views.Charts3DDlg.capRotation": "3D Rotation", + "Common.Views.Charts3DDlg.capRightAngleAxes": "Right angle axes", + "Common.Views.Charts3DDlg.capAutoscale": "Autoscale", + "Common.Views.Charts3DDlg.textLeft": "Left", + "Common.Views.Charts3DDlg.textRight": "Right", + "Common.Views.Charts3DDlg.textX": "X rotation", + "Common.Views.Charts3DDlg.textY": "Y rotation", + "Common.Views.Charts3DDlg.textUp": "Up", + "Common.Views.Charts3DDlg.textDown": "Down", + "Common.Views.Charts3DDlg.textPerspective": "Perspective", + "Common.Views.Charts3DDlg.textNarrow": "Narrow field of view", + "Common.Views.Charts3DDlg.textWiden": "Widen field of view", + "Common.Views.Charts3DDlg.text3dDepth": "Depth (% of base)", + "Common.Views.Charts3DDlg.text3dHeight": "Height (% of base)", "SSE.Controllers.DataTab.strSheet": "Sheet", "SSE.Controllers.DataTab.textColumns": "Columns", "SSE.Controllers.DataTab.textEmptyUrl": "You need to specify URL.", @@ -4206,26 +4226,6 @@ "SSE.Views.ProtectDialog.txtWarning": "Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place.", "SSE.Views.ProtectDialog.txtWBDescription": "To prevent other users from viewing hidden sheets, adding, moving, deleting, or hiding sheets and renaming sheets, you can protect the structure of your workbook with a password.", "SSE.Views.ProtectDialog.txtWBTitle": "Protect workbook structure", - "SSE.Views.Charts3DDlg.txtXRotation": "X-rotation", - "SSE.Views.Charts3DDlg.txtYRotation": "Y-rotation", - "SSE.Views.Charts3DDlg.txtPerspective": "Perspective", - "SSE.Views.Charts3DDlg.txtDepth": "Depth (% of base)", - "SSE.Views.Charts3DDlg.txtHeight": "Height (% of base)", - "SSE.Views.Charts3DDlg.txtDefRotation": "Default Rotation", - "SSE.Views.Charts3DDlg.capRotation": "3D Rotation", - "SSE.Views.Charts3DDlg.capRightAngleAxes": "Right angle axes", - "SSE.Views.Charts3DDlg.capAutoscale": "Autoscale", - "SSE.Views.Charts3DDlg.textLeft": "Left", - "SSE.Views.Charts3DDlg.textRight": "Right", - "SSE.Views.Charts3DDlg.textX": "X rotation", - "SSE.Views.Charts3DDlg.textY": "Y rotation", - "SSE.Views.Charts3DDlg.textUp": "Up", - "SSE.Views.Charts3DDlg.textDown": "Down", - "SSE.Views.Charts3DDlg.textPerspective": "Perspective", - "SSE.Views.Charts3DDlg.textNarrow": "Narrow field of view", - "SSE.Views.Charts3DDlg.textWiden": "Widen field of view", - "SSE.Views.Charts3DDlg.text3dDepth": "Depth (% of base)", - "SSE.Views.Charts3DDlg.text3dHeight": "Height (% of base)", "SSE.Views.ProtectedRangesEditDlg.textAnonymous": "Anonymous", "SSE.Views.ProtectedRangesEditDlg.textAnyone": "Anyone", "SSE.Views.ProtectedRangesEditDlg.textCanEdit": "Edit",