From 8b7d463de6ca34cbc89fc4a63b16ede4bb0f5def Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 9 Jan 2017 11:57:45 +0300 Subject: [PATCH] [SSE mobile] refactoring --- .../mobile/app/controller/DocumentHolder.js | 23 ++++++++----------- .../mobile/app/controller/Statusbar.js | 8 ++++--- .../mobile/app/controller/add/AddContainer.js | 23 +++++++++++++++++++ .../mobile/app/controller/add/AddOther.js | 7 ------ 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index f4ebc2741..30cd29f5b 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -185,20 +185,16 @@ define([ }]; } else { - var menuItems = [ - { + var menuItems = [{ caption: 'Cut', event: 'cut' - }, - { + },{ caption: 'Copy', event: 'copy' - }, - { + },{ caption: 'Paste', event: 'paste' - } - ]; + }]; var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, seltype = cellinfo.asc_getFlags().asc_getSelectionType(), @@ -217,13 +213,13 @@ define([ case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = true; break; } - if (isimagemenu || isshapemenu || ischartmenu) { + if (isimagemenu || isshapemenu || ischartmenu || + istextshapemenu || istextchartmenu ) + { menuItems.push({ caption: 'Edit', event: 'edit' }); - } else - if (istextshapemenu || istextchartmenu) { } else { if ( iscolmenu || isrowmenu) { menuItems.push({ @@ -238,7 +234,6 @@ define([ }); } else if ( iscellmenu ) { - !iscelledited && menuItems.push({ caption: 'Delete', event: 'del' @@ -272,7 +267,7 @@ define([ event: 'wrap' }); - if ( cellinfo.asc_getHyperlink() && !iscelledited && !cellinfo.asc_getFlags().asc_getMultiselect() && + if ( cellinfo.asc_getHyperlink() && !cellinfo.asc_getFlags().asc_getMultiselect() && cellinfo.asc_getHyperlink().asc_getType() == Asc.c_oAscHyperlinkType.WebLink ) { menuItems.push({ @@ -280,7 +275,7 @@ define([ event: 'openlink' }); } else - if ( !cellinfo.asc_getHyperlink() && !iscelledited && !cellinfo.asc_getFlags().asc_getMultiselect() && + if ( !cellinfo.asc_getHyperlink() && !cellinfo.asc_getFlags().asc_getMultiselect() && !cellinfo.asc_getFlags().asc_getLockText() && !!cellinfo.asc_getText() ) { menuItems.push({ diff --git a/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js b/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js index 573239c61..88feee787 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Statusbar.js @@ -426,13 +426,15 @@ define([ var opened = $('.document-menu.modal-in').length; uiApp.closeModal('.document-menu.modal-in'); - var newindex = model.get('index'); - if ( newindex == this.api.asc_getActiveWorksheetIndex () ) { + var sdkindex = model.get('index'); + if ( sdkindex == this.api.asc_getActiveWorksheetIndex () ) { if ( !opened ) this.statusbar.showTabContextMenu(this._getTabMenuItems(), model); } else { - this.api.asc_showWorksheet( newindex ); + this.api.asc_showWorksheet( sdkindex ); this.statusbar.setActiveTab(index); + + Common.NotificationCenter.trigger('sheet:active', sdkindex); } }, diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js index 48f22c626..e9eb3167b 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js @@ -80,6 +80,29 @@ define([ uiApp.closeModal(); + me.api.asc_getCellInfo(); + var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu, + seltype = cellinfo.asc_getFlags().asc_getSelectionType(), + iscelllocked = cellinfo.asc_getLocked(), + isTableLocked = cellinfo.asc_getLockedTable()===true; + + switch ( seltype ) { + case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; + case Asc.c_oAscSelectionType.RangeRow: isrowmenu = true; break; + case Asc.c_oAscSelectionType.RangeCol: iscolmenu = true; break; + case Asc.c_oAscSelectionType.RangeMax: isallmenu = true; break; + case Asc.c_oAscSelectionType.RangeImage: isimagemenu = true; break; + case Asc.c_oAscSelectionType.RangeShape: isshapemenu = true; break; + case Asc.c_oAscSelectionType.RangeChart: ischartmenu = true; break; + case Asc.c_oAscSelectionType.RangeChartText: istextchartmenu = true; break; + case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = true; break; + } + + if ( iscellmenu ) {} + else { + + } + options = opts; parentButton = !opts ? '#toolbar-add' : opts.button; me._showByStack(Common.SharedSettings.get('phone')); diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js index 3e781a518..7037d1cb4 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddOther.js @@ -45,13 +45,6 @@ define([ 'use strict'; SSE.Controllers.AddOther = Backbone.Controller.extend(_.extend((function() { - var c_pageNumPosition = { - PAGE_NUM_POSITION_TOP: 0x01, - PAGE_NUM_POSITION_BOTTOM: 0x02, - PAGE_NUM_POSITION_RIGHT: 0, - PAGE_NUM_POSITION_LEFT: 1, - PAGE_NUM_POSITION_CENTER: 2 - }; return { models: [],