diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index bbc848e6d..5b5fcb140 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -182,7 +182,9 @@ define([ view.pmiAddComment.on('click', _.bind(me.onAddComment, me)); /** coauthoring end **/ view.pmiAddNamedRange.on('click', _.bind(me.onAddNamedRange, me)); - view.imgMenu.on('item:click', _.bind(me.onImgMenu, me)); + view.menuImageArrange.menu.on('item:click', _.bind(me.onImgMenu, me)); + view.menuImgRotate.menu.on('item:click', _.bind(me.onImgMenu, me)); + view.menuImageAlign.menu.on('item:click', _.bind(me.onImgMenuAlign, me)); view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); view.menuParagraphBullets.menu.on('item:click', _.bind(me.onSelectNoneBullet, me)); @@ -637,6 +639,41 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.documentHolder); Common.component.Analytics.trackEvent('DocumentHolder', (item.value == 'grouping') ? 'Grouping' : 'Ungrouping'); + } else if (item.options.type == 'rotate') { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180); + this.api.asc_setGraphicObjectProps(properties); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Rotate'); + } else if (item.options.type == 'flip') { + var properties = new Asc.asc_CImgProperty(); + if (item.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + this.api.asc_setGraphicObjectProps(properties); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Flip'); + } + } + }, + + onImgMenuAlign: function(menu, item) { + if (this.api) { + if (item.value>-1 && item.value < 6) { + this.api.asc_setSelectedDrawingObjectAlign(item.value); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Objects Align'); + } else if (item.value == 6) { + this.api.asc_DistributeSelectedDrawingObjectHor(); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute'); + } else if (item.value == 7){ + this.api.asc_DistributeSelectedDrawingObjectVer(); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute'); } } }, @@ -1461,8 +1498,15 @@ define([ } } + var cangroup = this.api.asc_canGroupGraphicsObjects(); documentHolder.mnuUnGroupImg.setDisabled(isObjLocked || !this.api.asc_canUnGroupGraphicsObjects()); - documentHolder.mnuGroupImg.setDisabled(isObjLocked || !this.api.asc_canGroupGraphicsObjects()); + documentHolder.mnuGroupImg.setDisabled(isObjLocked || !cangroup); + documentHolder.menuImageAlign.setDisabled(isObjLocked || !cangroup); + + var objcount = this.api.asc_getSelectedDrawingObjectsCount(); + documentHolder.menuImageAlign.menu.items[7].setDisabled(objcount<3); + documentHolder.menuImageAlign.menu.items[8].setDisabled(objcount<3); + documentHolder.mnuShapeAdvanced.setVisible(isshapemenu && !isimagemenu && !ischartmenu); documentHolder.mnuShapeAdvanced.setDisabled(isObjLocked); documentHolder.mnuChartEdit.setVisible(ischartmenu && !isimagemenu && !isshapemenu && has_chartprops); @@ -1478,10 +1522,10 @@ define([ var pluginGuid = (documentHolder.mnuImgAdvanced.imageInfo) ? documentHolder.mnuImgAdvanced.imageInfo.asc_getPluginGuid() : null; documentHolder.menuImgReplace.setVisible(isimageonly && (pluginGuid===null || pluginGuid===undefined)); documentHolder.menuImgReplace.setDisabled(isObjLocked || pluginGuid===null); - documentHolder.mnuBringToFront.setDisabled(isObjLocked); - documentHolder.mnuSendToBack.setDisabled(isObjLocked); - documentHolder.mnuBringForward.setDisabled(isObjLocked); - documentHolder.mnuSendBackward.setDisabled(isObjLocked); + documentHolder.menuImageArrange.setDisabled(isObjLocked); + + documentHolder.menuImgRotate.setVisible(!ischartmenu && (pluginGuid===null || pluginGuid===undefined)); + documentHolder.menuImgRotate.setDisabled(isObjLocked); var isInSign = !!signGuid; documentHolder.menuSignatureEditSign.setVisible(isInSign); diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 0c27ec0c8..4953afde4 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -607,28 +607,117 @@ define([ me.mnuBringToFront = new Common.UI.MenuItem({ caption : this.textArrangeFront, - iconCls : 'mnu-arrange-front', + iconCls : 'mnu-arrange-front', type : 'arrange', value : Asc.c_oAscDrawingLayerType.BringToFront }); me.mnuSendToBack = new Common.UI.MenuItem({ caption : this.textArrangeBack, - iconCls : 'mnu-arrange-back', - type : 'arrange', - value : Asc.c_oAscDrawingLayerType.SendToBack + iconCls : 'mnu-arrange-back', + type : 'arrange', + value : Asc.c_oAscDrawingLayerType.SendToBack }); me.mnuBringForward = new Common.UI.MenuItem({ caption : this.textArrangeForward, - iconCls : 'mnu-arrange-forward', - type : 'arrange', - value : Asc.c_oAscDrawingLayerType.BringForward + iconCls : 'mnu-arrange-forward', + type : 'arrange', + value : Asc.c_oAscDrawingLayerType.BringForward }); me.mnuSendBackward = new Common.UI.MenuItem({ caption: this.textArrangeBackward, - iconCls : 'mnu-arrange-backward', - type : 'arrange', - value : Asc.c_oAscDrawingLayerType.SendBackward + iconCls : 'mnu-arrange-backward', + type : 'arrange', + value : Asc.c_oAscDrawingLayerType.SendBackward }); + + me.menuImageArrange = new Common.UI.MenuItem({ + caption : me.textArrange, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + me.mnuBringToFront, + me.mnuSendToBack, + me.mnuBringForward, + me.mnuSendBackward, + { caption: '--' }, + me.mnuGroupImg, + me.mnuUnGroupImg + ] + }) + }); + + me.menuImageAlign = new Common.UI.MenuItem({ + caption : me.textAlign, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [{ + caption : me.textShapeAlignLeft, + iconCls : 'mnu-img-align-left', + value : 0 + }, { + caption : me.textShapeAlignCenter, + iconCls : 'mnu-img-align-center', + value : 4 + }, { + caption : me.textShapeAlignRight, + iconCls : 'mnu-img-align-right', + value : 1 + }, { + caption : me.textShapeAlignTop, + iconCls : 'mnu-img-align-top', + value : 3 + }, { + caption : me.textShapeAlignMiddle, + iconCls : 'mnu-img-align-middle', + value : 5 + }, { + caption : me.textShapeAlignBottom, + iconCls : 'mnu-img-align-bottom', + value : 2 + }, + {caption: '--'}, + { + caption: me.txtDistribHor, + iconCls: 'mnu-distrib-hor', + value: 6 + }, + { + caption: me.txtDistribVert, + iconCls: 'mnu-distrib-vert', + value: 7 + }] + }) + }); + + me.menuImgRotate = new Common.UI.MenuItem({ + caption : me.textRotate, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption: me.textRotate270, + type : 'rotate', + value : 0 + }), + new Common.UI.MenuItem({ + caption: me.textRotate90, + type : 'rotate', + value : 1 + }), + new Common.UI.MenuItem({ + caption: me.textFlipH, + type : 'flip', + value : 1 + }), + new Common.UI.MenuItem({ + caption: me.textFlipV, + type : 'flip', + value : 0 + }) + ] + }) + }); + this.imgMenu = new Common.UI.Menu({ items: [ me.pmiImgCut, @@ -638,13 +727,9 @@ define([ me.menuSignatureEditSign, me.menuSignatureEditSetup, me.menuEditSignSeparator, - me.mnuBringToFront, - me.mnuSendToBack, - me.mnuBringForward, - me.mnuSendBackward, - {caption: '--'}, - me.mnuGroupImg, - me.mnuUnGroupImg, + me.menuImageArrange, + me.menuImageAlign, + me.menuImgRotate, me.mnuShapeSeparator, me.mnuChartEdit, me.mnuShapeAdvanced, @@ -960,7 +1045,14 @@ define([ textShapeAlignBottom : 'Align Bottom', textShapeAlignMiddle : 'Align Middle', txtDistribHor: 'Distribute Horizontally', - txtDistribVert: 'Distribute Vertically' + txtDistribVert: 'Distribute Vertically', + textRotate270: 'Rotate Left 90°', + textRotate90: 'Rotate Right 90°', + textFlipV: 'Flip Vertically', + textFlipH: 'Flip Horizontally', + textRotate: 'Rotation', + textArrange: 'Arrange', + textAlign: 'Align' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index 800185d82..e801defd3 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -459,7 +459,7 @@ define([ textFlip: 'Flip', textHint270: 'Rotate Left 90°', textHint90: 'Rotate Right 90°', - textHintFlipV: 'Flip Vertical', - textHintFlipH: 'Flip Horizontal' + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally' }, SSE.Views.ImageSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 800e19c6c..a6f24bce8 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -1737,7 +1737,7 @@ define([ textFlip: 'Flip', textHint270: 'Rotate Left 90°', textHint90: 'Rotate Right 90°', - textHintFlipV: 'Flip Vertical', - textHintFlipH: 'Flip Horizontal' + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally' }, SSE.Views.ShapeSettings || {})); }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index cf77012b5..8c19abc1e 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1439,6 +1439,13 @@ "SSE.Views.DocumentHolder.txtUngroup": "Ungroup", "SSE.Views.DocumentHolder.txtWidth": "Width", "SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "SSE.Views.DocumentHolder.textRotate270": "Rotate Left 90°", + "SSE.Views.DocumentHolder.textRotate90": "Rotate Right 90°", + "SSE.Views.DocumentHolder.textFlipV": "Flip Vertically", + "SSE.Views.DocumentHolder.textFlipH": "Flip Horizontally", + "SSE.Views.DocumentHolder.textRotate": "Rotation", + "SSE.Views.DocumentHolder.textArrange": "Arrange", + "SSE.Views.DocumentHolder.textAlign": "Align", "SSE.Views.FileMenu.btnBackCaption": "Go to Documents", "SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu", "SSE.Views.FileMenu.btnCreateNewCaption": "Create New",