From d8c4b9be3d2e162ea4ef11c718fdbf8676eaab3c Mon Sep 17 00:00:00 2001 From: Alexei Koshelev <aleksei.koshelev@onlyoffice.com> Date: Wed, 23 Nov 2022 21:42:15 +0300 Subject: [PATCH] [PE SSE] Added "show as picture" item in context menu ( Bug 59446 ) --- .../main/app/controller/DocumentHolder.js | 7 ++++++ .../main/app/view/DocumentHolder.js | 24 ++++++++----------- apps/documenteditor/main/locale/en.json | 1 + apps/documenteditor/main/locale/ru.json | 1 + .../main/app/controller/DocumentHolder.js | 11 +++++++-- .../main/app/view/DocumentHolder.js | 16 ++++++++----- apps/spreadsheeteditor/main/locale/en.json | 1 + apps/spreadsheeteditor/main/locale/ru.json | 1 + 8 files changed, 40 insertions(+), 22 deletions(-) diff --git a/apps/documenteditor/main/app/controller/DocumentHolder.js b/apps/documenteditor/main/app/controller/DocumentHolder.js index 1dfdd92a6..26e7511a2 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolder.js +++ b/apps/documenteditor/main/app/controller/DocumentHolder.js @@ -427,6 +427,7 @@ define([ view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me)); view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me)); view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); + view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); me.onChangeProtectDocument(); }, @@ -2488,6 +2489,12 @@ define([ } }, + saveAsPicture: function() { + if(this.api) { + this.api.asc_SaveDrawingAsPicture(); + } + }, + onChangeProtectDocument: function(props) { if (!props) { var docprotect = this.getApplication().getController('DocProtection'); diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 06d162fb0..a41790e0a 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -271,6 +271,12 @@ define([ }); var menuInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' }); + me.menuSaveAsPicture = new Common.UI.MenuItem({ + caption : me.textSaveAsPicture + }); + + var menuSaveAsPictureSeparator = new Common.UI.MenuItem({ caption: '--'}); + me.menuEquationInsertCaption = new Common.UI.MenuItem({ caption : me.txtInsertCaption }); @@ -455,10 +461,6 @@ define([ caption : me.editChartText }); - var menuChartEditSeparator = new Common.UI.MenuItem({ - caption : '--' - }); - me.menuOriginalSize = new Common.UI.MenuItem({ caption : me.originalSizeText }); @@ -591,10 +593,6 @@ define([ caption: me.textEditPoints }); - var menuImgEditPointsSeparator = new Common.UI.MenuItem({ - caption : '--' - }); - this.pictureMenu = new Common.UI.Menu({ cls: 'shifted-right', restoreHeightAndTop: true, @@ -703,8 +701,6 @@ define([ if (me.menuChartEdit.isVisible()) me.menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts()); - menuChartEditSeparator.setVisible(me.menuChartEdit.isVisible()); - me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined); me.menuImageAdvanced.setDisabled(islocked); me.menuImageAlign.setDisabled( islocked || (wrapping == Asc.c_oAscWrapStyle2.Inline) ); @@ -755,7 +751,6 @@ define([ var canEditPoints = me.api && me.api.asc_canEditGeometry(); me.menuImgEditPoints.setVisible(canEditPoints); - menuImgEditPointsSeparator.setVisible(canEditPoints); canEditPoints && me.menuImgEditPoints.setDisabled(islocked); }, items: [ @@ -773,8 +768,6 @@ define([ me.menuImgRemoveControl, me.menuImgControlSettings, menuImgControlSeparator, - me.menuImgEditPoints, - menuImgEditPointsSeparator, me.menuImageArrange, me.menuImageAlign, me.menuImageWrap, @@ -782,11 +775,13 @@ define([ { caption: '--' }, me.menuInsertCaption, menuInsertCaptionSeparator, + me.menuSaveAsPicture, + menuSaveAsPictureSeparator, me.menuImgCrop, me.menuOriginalSize, me.menuImgReplace, me.menuChartEdit, - menuChartEditSeparator, + me.menuImgEditPoints, me.menuImageAdvanced ] }).on('hide:after', function(menu, e, isFromInputControl) { @@ -3149,6 +3144,7 @@ define([ textCells: 'Cells', textSeveral: 'Several Rows/Columns', txtInsertCaption: 'Insert Caption', + textSaveAsPicture: 'Save as picture', txtEmpty: '(Empty)', textFromStorage: 'From Storage', advancedDropCapText: 'Drop Cap Settings', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index ceeff19ba..f403aa6d4 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1821,6 +1821,7 @@ "DE.Views.DocumentHolder.txtInsertArgBefore": "Insert argument before", "DE.Views.DocumentHolder.txtInsertBreak": "Insert manual break", "DE.Views.DocumentHolder.txtInsertCaption": "Insert caption", + "DE.Views.DocumentHolder.textSaveAsPicture": "Save as picture", "DE.Views.DocumentHolder.txtInsertEqAfter": "Insert equation after", "DE.Views.DocumentHolder.txtInsertEqBefore": "Insert equation before", "DE.Views.DocumentHolder.txtKeepTextOnly": "Keep text only", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index 846ea2958..248c1d600 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -1821,6 +1821,7 @@ "DE.Views.DocumentHolder.txtInsertArgBefore": "Вставить аргумент перед", "DE.Views.DocumentHolder.txtInsertBreak": "Вставить принудительный разрыв", "DE.Views.DocumentHolder.txtInsertCaption": "Вставить название", + "DE.Views.DocumentHolder.textSaveAsPicture": "Сохранить как рисунок", "DE.Views.DocumentHolder.txtInsertEqAfter": "Вставить уравнение после", "DE.Views.DocumentHolder.txtInsertEqBefore": "Вставить уравнение перед", "DE.Views.DocumentHolder.txtKeepTextOnly": "Сохранить только текст", diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index e5147d165..f1e1b11f5 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -264,7 +264,9 @@ define([ view.menuImgMacro.on('click', _.bind(me.onImgMacro, me)); view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me)); view.pmiGetRangeList.on('click', _.bind(me.onGetLink, me)); - view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); + view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); + view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); + if (!me.permissions.isEditMailMerge && !me.permissions.isEditDiagram && !me.permissions.isEditOle) { var oleEditor = me.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); @@ -2140,7 +2142,6 @@ define([ var canEditPoints = this.api && this.api.asc_canEditGeometry(); documentHolder.menuImgEditPoints.setVisible(canEditPoints); - documentHolder.menuImgEditPointsSeparator.setVisible(canEditPoints); canEditPoints && documentHolder.menuImgEditPoints.setDisabled(isObjLocked); if (showMenu) this.showPopupMenu(documentHolder.imgMenu, {}, event); @@ -4411,6 +4412,12 @@ define([ } }, + saveAsPicture: function() { + if(this.api) { + this.api.asc_SaveDrawingAsPicture(); + } + }, + getUserName: function(id){ var usersStore = SSE.getCollection('Common.Collections.Users'); if (usersStore){ diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 90d3f9e3f..0fb83d941 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -851,12 +851,14 @@ define([ caption: me.textMacro }); - me.menuImgEditPoints = new Common.UI.MenuItem({ - caption: me.textEditPoints + me.menuSaveAsPicture = new Common.UI.MenuItem({ + caption : me.textSaveAsPicture }); - me.menuImgEditPointsSeparator = new Common.UI.MenuItem({ - caption : '--' + var menuSaveAsPictureSeparator = new Common.UI.MenuItem({ caption: '--'}); + + me.menuImgEditPoints = new Common.UI.MenuItem({ + caption: me.textEditPoints }); this.imgMenu = new Common.UI.Menu({ @@ -870,17 +872,18 @@ define([ me.menuSignatureEditSign, me.menuSignatureEditSetup, me.menuEditSignSeparator, - me.menuImgEditPoints, - me.menuImgEditPointsSeparator, me.menuImageArrange, me.menuImageAlign, me.menuImgRotate, me.menuImgMacro, + menuSaveAsPictureSeparator, + me.menuSaveAsPicture, me.mnuShapeSeparator, me.menuImgCrop, me.mnuChartData, me.mnuChartType, me.mnuChartEdit, + me.menuImgEditPoints, me.mnuShapeAdvanced, me.menuImgOriginalSize, me.menuImgReplace, @@ -1366,6 +1369,7 @@ define([ textBullets: 'Bullets', textNumbering: 'Numbering', textMacro: 'Assign Macro', + textSaveAsPicture: 'Save as picture', textEditPoints: 'Edit Points', tipNumCapitalLetters: 'A. B. C.', tipNumLettersParentheses: 'a) b) c)', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index bb419af66..7bb1d3ca3 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2178,6 +2178,7 @@ "SSE.Views.DocumentHolder.textFromUrl": "From URL", "SSE.Views.DocumentHolder.textListSettings": "List Settings", "SSE.Views.DocumentHolder.textMacro": "Assign Macro", + "SSE.Views.DocumentHolder.textSaveAsPicture": "Save as picture", "SSE.Views.DocumentHolder.textMax": "Max", "SSE.Views.DocumentHolder.textMin": "Min", "SSE.Views.DocumentHolder.textMore": "More functions", diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index 5a9af5ac2..d86565dce 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -2178,6 +2178,7 @@ "SSE.Views.DocumentHolder.textFromUrl": "По URL", "SSE.Views.DocumentHolder.textListSettings": "Параметры списка", "SSE.Views.DocumentHolder.textMacro": "Назначить макрос", + "SSE.Views.DocumentHolder.textSaveAsPicture": "Сохранить как рисунок", "SSE.Views.DocumentHolder.textMax": "Макс", "SSE.Views.DocumentHolder.textMin": "Мин", "SSE.Views.DocumentHolder.textMore": "Другие функции",