From a33df0aabeb56ddb581803de51234a0d9d415e35 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Thu, 14 May 2020 11:39:04 +0300 Subject: [PATCH] [SSE] Move Move asc_getSelectionType to cell info --- .../main/app/controller/CellEditor.js | 2 +- .../main/app/controller/DocumentHolder.js | 8 +++--- .../main/app/controller/Main.js | 2 +- .../main/app/controller/PivotTable.js | 3 +-- .../main/app/controller/RightMenu.js | 2 +- .../main/app/controller/Toolbar.js | 27 ++++++++++--------- .../mobile/app/controller/DocumentHolder.js | 6 ++--- .../mobile/app/controller/Toolbar.js | 2 +- .../mobile/app/controller/add/AddContainer.js | 4 +-- .../mobile/app/controller/add/AddLink.js | 4 +-- .../mobile/app/controller/add/AddOther.js | 2 +- .../mobile/app/controller/edit/EditCell.js | 2 +- .../app/controller/edit/EditContainer.js | 2 +- .../mobile/app/controller/edit/EditImage.js | 2 +- .../mobile/app/controller/edit/EditShape.js | 2 +- .../mobile/app/controller/edit/EditText.js | 2 +- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js index 6808260fd..837f5b986 100644 --- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js @@ -151,7 +151,7 @@ define([ }, onApiSelectionChanged: function(info) { - var seltype = info.asc_getFlags().asc_getSelectionType(), + var seltype = info.asc_getSelectionType(), coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true) : false; var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index bc1a4f15d..498dcc0b5 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -351,7 +351,7 @@ define([ onInsertEntire: function(item) { if (this.api) { - switch (this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()) { + switch (this.api.asc_getCellInfo().asc_getSelectionType()) { case Asc.c_oAscSelectionType.RangeRow: this.api.asc_insertCells(Asc.c_oAscInsertOptions.InsertRows); break; @@ -376,7 +376,7 @@ define([ onDeleteEntire: function(item) { if (this.api) { - switch (this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()) { + switch (this.api.asc_getCellInfo().asc_getSelectionType()) { case Asc.c_oAscSelectionType.RangeRow: this.api.asc_deleteCells(Asc.c_oAscDeleteOptions.DeleteRows); break; @@ -1567,7 +1567,7 @@ define([ fillMenuProps: function(cellinfo, showMenu, event){ var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, isimageonly, documentHolder = this.documentHolder, - seltype = cellinfo.asc_getFlags().asc_getSelectionType(), + seltype = cellinfo.asc_getSelectionType(), isCellLocked = cellinfo.asc_getLocked(), isTableLocked = cellinfo.asc_getLockedTable()===true, isObjLocked = false, @@ -1863,7 +1863,7 @@ define([ fillViewMenuProps: function(cellinfo, showMenu, event){ var documentHolder = this.documentHolder, - seltype = cellinfo.asc_getFlags().asc_getSelectionType(), + seltype = cellinfo.asc_getSelectionType(), isCellLocked = cellinfo.asc_getLocked(), isTableLocked = cellinfo.asc_getLockedTable()===true, commentsController = this.getApplication().getController('Common.Controllers.Comments'), diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 267225973..2d716ff0b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -529,7 +529,7 @@ define([ }, onSelectionChanged: function(info){ - if (!this._isChartDataReady && info.asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeChart) { + if (!this._isChartDataReady && info.asc_getSelectionType() == Asc.c_oAscSelectionType.RangeChart) { this._isChartDataReady = true; Common.Gateway.internalMessage('chartDataReady'); } diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 1d7ea91e9..d295b33f3 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -380,8 +380,7 @@ define([ onSelectionChanged: function(info) { if (this.rangeSelectionMode || !this.appConfig.isEdit || !this.view) return; - var selectType = info.asc_getFlags().asc_getSelectionType(), - pivotInfo = info.asc_getPivotTableInfo(); + var pivotInfo = info.asc_getPivotTableInfo(); Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls}); Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: [this.view.btnAddPivot]}); diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 7ea0ce290..4048a750a 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -133,7 +133,7 @@ define([ if (this.rangeSelectionMode) return; var SelectedObjects = [], - selectType = info.asc_getFlags().asc_getSelectionType(), + selectType = info.asc_getSelectionType(), formatTableInfo = info.asc_getFormatTableInfo(), sparkLineInfo = info.asc_getSparklineInfo(), cellInfo = info, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 405ef7321..793ae20bd 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -785,7 +785,7 @@ define([ }, onTextOrientationMenu: function(menu, item) { - if (this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeShapeText) { + if (this.api.asc_getCellInfo().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeShapeText) { var angle = Asc.c_oAscVertDrawingText.normal; switch (item.value) { case 'rotateup': angle = Asc.c_oAscVertDrawingText.vert270; break; @@ -908,7 +908,7 @@ define([ }; var cell = me.api.asc_getCellInfo(), - seltype = cell.asc_getFlags().asc_getSelectionType(); + seltype = cell.asc_getSelectionType(); props = cell.asc_getHyperlink(); win = new SSE.Views.HyperlinkSettingsDialog({ api: me.api, @@ -936,7 +936,8 @@ define([ onEditChart: function(btn) { if (!this.editMode) return; var me = this, info = me.api.asc_getCellInfo(); - if (info.asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeImage) { + var selectType = info.asc_getSelectionType(); + if (selectType !== Asc.c_oAscSelectionType.RangeImage) { var win, props; if (me.api){ props = me.api.asc_getChartObject(); @@ -950,7 +951,7 @@ define([ } } if (props) { - var ischartedit = ( me.toolbar.mode.isEditDiagram || info.asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeChart || info.asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeChartText); + var ischartedit = ( me.toolbar.mode.isEditDiagram || selectType === Asc.c_oAscSelectionType.RangeChart || selectType === Asc.c_oAscSelectionType.RangeChartText); (new SSE.Views.ChartSettingsDlg( { @@ -978,7 +979,7 @@ define([ if (!this.editMode) return; var me = this, info = me.api.asc_getCellInfo(), - seltype = info.asc_getFlags().asc_getSelectionType(), + seltype = info.asc_getSelectionType(), isSpark = (group == 'menu-chart-group-sparkcolumn' || group == 'menu-chart-group-sparkline' || group == 'menu-chart-group-sparkwin'); if (me.api) { @@ -1527,7 +1528,7 @@ define([ if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.toolbar.mode.isEditDiagram && !me.api.isCellEdited && !me._state.multiselect && !me._state.inpivot && !me.getApplication().getController('LeftMenu').leftMenu.menuFile.isVisible()) { var cellinfo = me.api.asc_getCellInfo(), - selectionType = cellinfo.asc_getFlags().asc_getSelectionType(); + selectionType = cellinfo.asc_getSelectionType(); if (selectionType !== Asc.c_oAscSelectionType.RangeShapeText || me.api.asc_canAddShapeHyperlink()!==false) me.onHyperlink(); } @@ -2069,7 +2070,7 @@ define([ if ( this.toolbar.mode.isEditMailMerge ) return this.onApiSelectionChanged_MailMergeEditor(info); - var selectionType = info.asc_getFlags().asc_getSelectionType(), + var selectionType = info.asc_getSelectionType(), coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true || info.asc_getLockedPivotTable()===true) : false, editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable), me = this, @@ -2447,7 +2448,7 @@ define([ }, onApiSelectionChangedRestricted: function(info) { - var selectionType = info.asc_getFlags().asc_getSelectionType(); + var selectionType = info.asc_getSelectionType(); this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) || this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), { array: this.btnsComment }); @@ -2497,7 +2498,7 @@ define([ return is_image; }; - var selectionType = info.asc_getFlags().asc_getSelectionType(), + var selectionType = info.asc_getSelectionType(), coauth_disable = false; if ( _disableEditOptions(selectionType, coauth_disable) ) return; @@ -2547,7 +2548,7 @@ define([ return is_image; }; - var selectionType = info.asc_getFlags().asc_getSelectionType(), + var selectionType = info.asc_getSelectionType(), coauth_disable = false, editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable), val, need_disable = false; @@ -3073,14 +3074,14 @@ define([ win.show(); win.setSettings({ api : me.api, - selectionType: me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() + selectionType: me.api.asc_getCellInfo().asc_getSelectionType() }); } else { me._state.filter = undefined; if (me._state.tablename) me.api.asc_changeAutoFilter(me._state.tablename, Asc.c_oAscChangeFilterOptions.style, fmtname); else { - var selectionType = me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType(); + var selectionType = me.api.asc_getCellInfo().asc_getSelectionType(); if (selectionType == Asc.c_oAscSelectionType.RangeMax || selectionType == Asc.c_oAscSelectionType.RangeRow || selectionType == Asc.c_oAscSelectionType.RangeCol) Common.UI.warning({ @@ -3289,7 +3290,7 @@ define([ this.btnsComment.forEach(function (btn) { btn.updateHint( _comments.textHintAddComment ); btn.on('click', function (btn, e) { - Common.NotificationCenter.trigger('app:comment:add', 'toolbar', me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() != Asc.c_oAscSelectionType.RangeCells); + Common.NotificationCenter.trigger('app:comment:add', 'toolbar', me.api.asc_getCellInfo().asc_getSelectionType() != Asc.c_oAscSelectionType.RangeCells); }); if (btn.cmpEl.closest('#review-changes-panel').length>0) btn.setCaption(me.toolbar.capBtnAddComment); diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index 88ea4658a..847e79265 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -219,10 +219,10 @@ define([ me.api.asc_mergeCells(Asc.c_oAscMergeOptions.None); break; case 'hide': - me.api[info.asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeRow ? 'asc_hideRows' : 'asc_hideColumns'](); + me.api[info.asc_getSelectionType() == Asc.c_oAscSelectionType.RangeRow ? 'asc_hideRows' : 'asc_hideColumns'](); break; case 'show': - me.api[info.asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeRow ? 'asc_showRows' : 'asc_showColumns'](); + me.api[info.asc_getSelectionType() == Asc.c_oAscSelectionType.RangeRow ? 'asc_showRows' : 'asc_showColumns'](); break; case 'addlink': me.view.hideMenu(); @@ -311,7 +311,7 @@ define([ var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu; var iscelllocked = cellinfo.asc_getLocked(), - seltype = cellinfo.asc_getFlags().asc_getSelectionType(); + seltype = cellinfo.asc_getSelectionType(); switch (seltype) { case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js index 44a808568..46328b544 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js @@ -176,7 +176,7 @@ define([ if ( !info ) info = this.api.asc_getCellInfo(); var islocked = false; - switch (info.asc_getFlags().asc_getSelectionType()) { + switch (info.asc_getSelectionType()) { case Asc.c_oAscSelectionType.RangeChart: case Asc.c_oAscSelectionType.RangeImage: case Asc.c_oAscSelectionType.RangeShape: diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js index 9581680ad..4fa1563cf 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js @@ -82,7 +82,7 @@ define([ var cellinfo = me.api.asc_getCellInfo(); var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, - seltype = cellinfo.asc_getFlags().asc_getSelectionType(), + seltype = cellinfo.asc_getSelectionType(), iscelllocked = cellinfo.asc_getLocked(), isTableLocked = cellinfo.asc_getLockedTable()===true; @@ -123,7 +123,7 @@ define([ var me = this, addViews = []; - // var seltype = this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType(); + // var seltype = this.api.asc_getCellInfo().asc_getSelectionType(); if ( !options ) addViews.push({ diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddLink.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddLink.js index 2ac49847a..793834217 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddLink.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddLink.js @@ -71,7 +71,7 @@ define([ var _view = view || this.getView(); var cell = this.api.asc_getCellInfo(), - celltype = cell.asc_getFlags().asc_getSelectionType(); + celltype = cell.asc_getSelectionType(); var allowinternal = (celltype!==Asc.c_oAscSelectionType.RangeImage && celltype!==Asc.c_oAscSelectionType.RangeShape && celltype!==Asc.c_oAscSelectionType.RangeShapeText && celltype!==Asc.c_oAscSelectionType.RangeChart && celltype!==Asc.c_oAscSelectionType.RangeChartText); @@ -158,7 +158,7 @@ define([ view.showPage(rootView, navbar); var cell = me.api.asc_getCellInfo(), - celltype = cell.asc_getFlags().asc_getSelectionType(); + celltype = cell.asc_getSelectionType(); var allowinternal = (celltype!==Asc.c_oAscSelectionType.RangeImage && celltype!==Asc.c_oAscSelectionType.RangeShape && celltype!==Asc.c_oAscSelectionType.RangeShapeText && celltype!==Asc.c_oAscSelectionType.RangeChart && celltype!==Asc.c_oAscSelectionType.RangeChartText); diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js index 70605b823..bde23be46 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js @@ -98,7 +98,7 @@ define([ isHideInsertComment: function() { var cellinfo = this.api.asc_getCellInfo(); var iscelllocked = cellinfo.asc_getLocked(), - seltype = cellinfo.asc_getFlags().asc_getSelectionType(); + seltype = cellinfo.asc_getSelectionType(); if (seltype === Asc.c_oAscSelectionType.RangeCells && !iscelllocked) { return false; } diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditCell.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditCell.js index f3de7b667..16e5ce37d 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditCell.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditCell.js @@ -316,7 +316,7 @@ define([ } var me = this, - selectionType = cellInfo.asc_getFlags().asc_getSelectionType(), + selectionType = cellInfo.asc_getSelectionType(), // coAuthDisable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (cellInfo.asc_getLocked()===true || cellInfo.asc_getLockedTable()===true) : false, // editOptionsDisabled = this._disableEditOptions(selectionType, coAuthDisable), _fontInfo = cellInfo.asc_getFont(), diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js index 24b694b84..3c962f9e6 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditContainer.js @@ -378,7 +378,7 @@ define([ _settings = []; var isCell, isRow, isCol, isAll, isChart, isImage, isTextShape, isShape, isTextChart, - selType = cellInfo.asc_getFlags().asc_getSelectionType(), + selType = cellInfo.asc_getSelectionType(), isCellLocked = cellInfo.asc_getLocked(), isTableLocked = cellInfo.asc_getLockedTable()===true, isObjLocked = false; diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js index d36fe488f..d19a2dc25 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js @@ -226,7 +226,7 @@ define([ var me = this, selectedObjects = [], - selectType = info.asc_getFlags().asc_getSelectionType(); + selectType = info.asc_getSelectionType(); if (selectType == Asc.c_oAscSelectionType.RangeImage) { selectedObjects = me.api.asc_getGraphicObjectProps(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditShape.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditShape.js index 7d2fe608f..a6e1f2d74 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditShape.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditShape.js @@ -361,7 +361,7 @@ define([ var me = this, selectedObjects = [], - selectType = info.asc_getFlags().asc_getSelectionType(); + selectType = info.asc_getSelectionType(); if (selectType == Asc.c_oAscSelectionType.RangeShape) { selectedObjects = me.api.asc_getGraphicObjectProps(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/edit/EditText.js b/apps/spreadsheeteditor/mobile/app/controller/edit/EditText.js index cdd296b61..6232c2008 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/edit/EditText.js +++ b/apps/spreadsheeteditor/mobile/app/controller/edit/EditText.js @@ -324,7 +324,7 @@ define([ _cellInfo = info; _fontInfo = info.asc_getFont(); - var selectType = info.asc_getFlags().asc_getSelectionType(); + var selectType = info.asc_getSelectionType(); switch (selectType) { case Asc.c_oAscSelectionType.RangeChartText: _textIn = TextType.inChart; break;