From 5d08a22c80d9f92d93f7d2878892230bef81ba4f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 15 May 2017 16:32:01 +0300 Subject: [PATCH] [SSE] Enhancement: apply text orientation for shapes from toolbar menu (disable 45/-45). --- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/controller/Toolbar.js | 53 +++++++++++++------ .../main/app/view/DocumentHolder.js | 4 +- .../main/app/view/Toolbar.js | 2 +- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 9c6d8e649..19a5dcb07 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -639,7 +639,7 @@ define([ this.api.asc_setGraphicObjectProps(properties); Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - Common.component.Analytics.trackEvent('DocumentHolder', 'Text Directio'); + Common.component.Analytics.trackEvent('DocumentHolder', 'Text Direction'); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 3114a1505..215909926 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -672,19 +672,31 @@ define([ }, onTextOrientationMenu: function(menu, item) { - var angle = 0; + if (this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() == Asc.c_oAscSelectionType.RangeShapeText) { + var angle = Asc.c_oAscVertDrawingText.normal; + switch (item.value) { + case 'rotateup': angle = Asc.c_oAscVertDrawingText.vert270; break; + case 'rotatedown': angle = Asc.c_oAscVertDrawingText.vert; break; + } - switch (item.value) { - case 'countcw': angle = 45; break; - case 'clockwise': angle = -45; break; - case 'rotateup': angle = 90; break; - case 'rotatedown': angle = -90; break; + var properties = new Asc.asc_CImgProperty(); + properties.asc_putVert(angle); + this.api.asc_setGraphicObjectProps(properties); + } else { + var angle = 0; + + switch (item.value) { + case 'countcw': angle = 45; break; + case 'clockwise': angle = -45; break; + case 'rotateup': angle = 90; break; + case 'rotatedown': angle = -90; break; + } + + this._state.angle = undefined; + if (this.api) + this.api.asc_setCellAngle(angle); } - this._state.angle = undefined; - if (this.api) - this.api.asc_setCellAngle(angle); - Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Text orientation'); }, @@ -1906,11 +1918,12 @@ define([ hIconEl.addClass(btnHorizontalAlign.options.icls); } } - - toolbar.btnTextOrient.menu.items[1].setDisabled(fontparam == 'justify'); - toolbar.btnTextOrient.menu.items[2].setDisabled(fontparam == 'justify'); } + need_disable = (fontparam == 'justify' || selectionType == Asc.c_oAscSelectionType.RangeShapeText); + toolbar.btnTextOrient.menu.items[1].setDisabled(need_disable); + toolbar.btnTextOrient.menu.items[2].setDisabled(need_disable); + /* read cell vertical align */ fontparam = info.asc_getVertAlign(); @@ -2013,14 +2026,22 @@ define([ } } - val = info.asc_getAngle(); + if (selectionType == Asc.c_oAscSelectionType.RangeShapeText) { + var SelectedObjects = this.api.asc_getGraphicObjectProps(); + for (var i=0; i