From 8df803bac170b9819932a7f6d46f3108e52aea52 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 30 Mar 2022 23:19:46 +0300 Subject: [PATCH 1/3] [DE] Add conversions for equation --- .../main/app/view/DocumentHolder.js | 160 +++++++++++++++++- apps/documenteditor/main/locale/en.json | 8 + 2 files changed, 166 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 13cb8e868..e0a036b4b 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -3301,6 +3301,79 @@ define([ caption : '--' }); + var equationInput = function(item, e) { + if (me.api) { + me.api.asc_SetMathInputType(item.value); + } + }; + + var equationMathView = function(item, e) { + if (me.api) { + me.api.asc_ConvertMathView(item.value.linear, item.value.all); + } + }; + + var equationInline = function(item, e) { + if (me.api) { + me.api.asc_ConvertMathDisplayMode(item.checked); + } + }; + + var menuTableEquation = new Common.UI.MenuItem({ + caption : me.advancedEquationText, + menu : new Common.UI.Menu({ + cls: 'ppm-toolbar shifted-right', + menuAlign: 'tl-tr', + items : [ + (new Common.UI.MenuItem({ + caption : me.unicodeText, + iconCls : 'menu__icon text-orient-hor', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparaeqinput', + value : Asc.c_oAscMathInputType.Unicode + })).on('click', _.bind(equationInput, me)), + (new Common.UI.MenuItem({ + caption : me.latexText, + iconCls : 'menu__icon text-orient-rdown', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparaeqinput', + value : Asc.c_oAscMathInputType.LaTeX + })).on('click', _.bind(equationInput, me)), + { caption : '--' }, + (new Common.UI.MenuItem({ + caption : me.currProfText, + iconCls : 'menu__icon text-orient-hor', + value : {all: false, linear: false} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.currLinearText, + iconCls : 'menu__icon text-orient-rdown', + value : {all: false, linear: true} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.allProfText, + iconCls : 'menu__icon text-orient-hor', + value : {all: true, linear: false} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.allLinearText, + iconCls : 'menu__icon text-orient-rdown', + value : {all: true, linear: true} + })).on('click', _.bind(equationMathView, me)), + { caption : '--' }, + (new Common.UI.MenuItem({ + caption : me.eqToInlineText, + checkable : true, + checked : false + })).on('click', _.bind(equationInline, me)) + ] + }) + }); + this.tableMenu = new Common.UI.Menu({ cls: 'shifted-right', restoreHeightAndTop: true, @@ -3460,6 +3533,15 @@ define([ me.clearEquationMenu(false, 10); menuEquationSeparatorInTable.setVisible(isEquation && eqlen>0); + menuTableEquation.setVisible(isEquation); + menuTableEquation.setDisabled(disabled); + if (isEquation) { + var eq = me.api.asc_GetMathInputType(); + menuTableEquation.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + menuTableEquation.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + menuTableEquation.menu.items[8].setChecked(me.api.asc_IsInlineMath()); + } + var control_lock = (value.paraProps) ? (!value.paraProps.value.can_DeleteBlockContentControl() || !value.paraProps.value.can_EditBlockContentControl() || !value.paraProps.value.can_DeleteInlineContentControl() || !value.paraProps.value.can_EditInlineContentControl()) : false; var in_toc = me.api.asc_GetTableOfContentsPr(true), @@ -3646,7 +3728,8 @@ define([ menuTableRemoveForm, menuTableControl, menuTableTOC, - menuParagraphAdvancedInTable + menuParagraphAdvancedInTable, + menuTableEquation ] }).on('hide:after', function(menu, e, isFromInputControl) { if (me.suppressEditComplete) { @@ -3780,6 +3863,61 @@ define([ caption : me.advancedDropCapText }).on('click', _.bind(me.advancedFrameClick, me, false)); + var menuParagraphEquation = new Common.UI.MenuItem({ + caption : me.advancedEquationText, + menu : new Common.UI.Menu({ + cls: 'ppm-toolbar shifted-right', + menuAlign: 'tl-tr', + items : [ + (new Common.UI.MenuItem({ + caption : me.unicodeText, + iconCls : 'menu__icon text-orient-hor', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparaeqinput', + value : Asc.c_oAscMathInputType.Unicode + })).on('click', _.bind(equationInput, me)), + (new Common.UI.MenuItem({ + caption : me.latexText, + iconCls : 'menu__icon text-orient-rdown', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparaeqinput', + value : Asc.c_oAscMathInputType.LaTeX + })).on('click', _.bind(equationInput, me)), + { caption : '--' }, + (new Common.UI.MenuItem({ + caption : me.currProfText, + iconCls : 'menu__icon text-orient-hor', + value : {all: false, linear: false} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.currLinearText, + iconCls : 'menu__icon text-orient-rdown', + value : {all: false, linear: true} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.allProfText, + iconCls : 'menu__icon text-orient-hor', + value : {all: true, linear: false} + })).on('click', _.bind(equationMathView, me)), + (new Common.UI.MenuItem({ + caption : me.allLinearText, + iconCls : 'menu__icon text-orient-rdown', + value : {all: true, linear: true} + })).on('click', _.bind(equationMathView, me)), + { caption : '--' }, + (new Common.UI.MenuItem({ + caption : me.eqToInlineText, + checkable : true, + checked : false + })).on('click', _.bind(equationInline, me)) + ] + }) + }); + /** coauthoring begin **/ var menuCommentSeparatorPara = new Common.UI.MenuItem({ caption : '--' @@ -4168,6 +4306,15 @@ define([ menuEquationInsertCaption.setVisible(isEquation); menuEquationInsertCaptionSeparator.setVisible(isEquation); + menuParagraphEquation.setVisible(isEquation); + menuParagraphEquation.setDisabled(disabled); + if (isEquation) { + var eq = me.api.asc_GetMathInputType(); + menuParagraphEquation.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + menuParagraphEquation.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + menuParagraphEquation.menu.items[8].setChecked(me.api.asc_IsInlineMath()); + } + var frame_pr = value.paraProps.value.get_FramePr(); menuFrameAdvanced.setVisible(frame_pr !== undefined); menuDropCapAdvanced.setVisible(frame_pr !== undefined); @@ -4270,6 +4417,7 @@ define([ menuParagraphAdvanced, menuFrameAdvanced, menuDropCapAdvanced, + menuParagraphEquation, /** coauthoring begin **/ menuCommentSeparatorPara, menuAddCommentPara, @@ -4898,7 +5046,15 @@ define([ txtWarnUrl: 'Clicking this link can be harmful to your device and data.
Are you sure you want to continue?', textEditPoints: 'Edit Points', textAccept: 'Accept Change', - textReject: 'Reject Change' + textReject: 'Reject Change', + advancedEquationText: 'Equation Settings', + unicodeText: 'Unicode', + latexText: 'LaTeX', + currProfText: 'Current - Professional', + currLinearText: 'Current - Linear', + allProfText: 'All - Professional', + allLinearText: 'All - Linear', + eqToInlineText: 'Change to Inline' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index c70b45608..aa801a4f1 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1619,6 +1619,14 @@ "DE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.
Are you sure you want to continue?", "DE.Views.DocumentHolder.updateStyleText": "Update %1 style", "DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "DE.Views.DocumentHolder.advancedEquationText": "Equation Settings", + "DE.Views.DocumentHolder.unicodeText": "Unicode", + "DE.Views.DocumentHolder.latexText": "LaTeX", + "DE.Views.DocumentHolder.currProfText": "Current - Professional", + "DE.Views.DocumentHolder.currLinearText": "Current - Linear", + "DE.Views.DocumentHolder.allProfText": "All - Professional", + "DE.Views.DocumentHolder.allLinearText": "All - Linear", + "DE.Views.DocumentHolder.eqToInlineText": "Change to Inline", "DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill", "DE.Views.DropcapSettingsAdvanced.strDropcap": "Drop Cap", "DE.Views.DropcapSettingsAdvanced.strMargins": "Margins", From 77abebdf608f093e87bbf4372b2226d4968f0f71 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 1 Apr 2022 18:40:06 +0300 Subject: [PATCH 2/3] [DE] Update icons for equation settings --- .../main/app/view/DocumentHolder.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index e0a036b4b..29a76034f 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -3327,7 +3327,7 @@ define([ items : [ (new Common.UI.MenuItem({ caption : me.unicodeText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon unicode', checkable : true, checkmark : false, checked : false, @@ -3336,7 +3336,7 @@ define([ })).on('click', _.bind(equationInput, me)), (new Common.UI.MenuItem({ caption : me.latexText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon latex', checkable : true, checkmark : false, checked : false, @@ -3346,22 +3346,22 @@ define([ { caption : '--' }, (new Common.UI.MenuItem({ caption : me.currProfText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon professional-equation', value : {all: false, linear: false} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.currLinearText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon linear-equation', value : {all: false, linear: true} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.allProfText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon professional-equation', value : {all: true, linear: false} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.allLinearText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon linear-equation', value : {all: true, linear: true} })).on('click', _.bind(equationMathView, me)), { caption : '--' }, @@ -3871,7 +3871,7 @@ define([ items : [ (new Common.UI.MenuItem({ caption : me.unicodeText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon unicode', checkable : true, checkmark : false, checked : false, @@ -3880,7 +3880,7 @@ define([ })).on('click', _.bind(equationInput, me)), (new Common.UI.MenuItem({ caption : me.latexText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon latex', checkable : true, checkmark : false, checked : false, @@ -3890,22 +3890,22 @@ define([ { caption : '--' }, (new Common.UI.MenuItem({ caption : me.currProfText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon professional-equation', value : {all: false, linear: false} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.currLinearText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon linear-equation', value : {all: false, linear: true} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.allProfText, - iconCls : 'menu__icon text-orient-hor', + iconCls : 'menu__icon professional-equation', value : {all: true, linear: false} })).on('click', _.bind(equationMathView, me)), (new Common.UI.MenuItem({ caption : me.allLinearText, - iconCls : 'menu__icon text-orient-rdown', + iconCls : 'menu__icon linear-equation', value : {all: true, linear: true} })).on('click', _.bind(equationMathView, me)), { caption : '--' }, From 5bc35f0941092f59e65b39b6183d06b46deab783 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 21 Jul 2022 23:18:22 +0300 Subject: [PATCH 3/3] [PE] Bug 58182 --- .../main/app/controller/DocumentHolder.js | 34 +++++++++++++++++++ .../main/app/view/DocumentHolder.js | 14 ++++++-- apps/presentationeditor/main/locale/en.json | 1 + 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index e4988371d..0a66c5e07 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -408,6 +408,7 @@ define([ view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me)); view.menuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me)); view.menuParagraphAdvanced.on('click', _.bind(me.onParagraphAdvanced, me)); + view.menuChartAdvanced.on('click', _.bind(me.onChartAdvanced, me)); view.mnuGroupImg.on('click', _.bind(me.onGroupImg, me)); view.mnuUnGroupImg.on('click', _.bind(me.onUnGroupImg, me)); view.mnuArrangeFront.on('click', _.bind(me.onArrangeFront, me)); @@ -1930,6 +1931,39 @@ define([ } }, + onChartAdvanced: function(item, e){ + var me = this; + if (me.api) { + var selectedElements = me.api.getSelectedElements(); + + if (selectedElements && selectedElements.length > 0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Chart == elType) { + (new PE.Views.ChartSettingsAdvanced( + { + chartProps: elValue, + slideSize: PE.getController('Toolbar').currentPageSize, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ChartApply(value.chartProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Chart Settings Advanced'); + } + })).show(); + break; + } + } + } + } + }, + onGroupImg: function(item) { this.api && this.api.groupShapes(); this.editComplete(); diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index ebb431b4a..1a58a3772 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1383,6 +1383,11 @@ define([ caption : me.advancedParagraphText }); + me.menuChartAdvanced = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-menu-chart', + caption : me.advancedChartText + }); + var menuCommentParaSeparator = new Common.UI.MenuItem({ caption : '--' }); @@ -1542,7 +1547,6 @@ define([ }); me.menuChartEdit = new Common.UI.MenuItem({ - iconCls: 'menu__icon btn-menu-chart', caption : me.editChartText }); @@ -2155,7 +2159,8 @@ define([ me.menuImageAdvanced.setVisible(isimage); me.menuShapeAdvanced.setVisible(_.isUndefined(value.imgProps) && _.isUndefined(value.chartProps)); me.menuChartEdit.setVisible(_.isUndefined(value.imgProps) && !_.isUndefined(value.chartProps) && (_.isUndefined(value.shapeProps) || value.shapeProps.isChart)); - menuImgShapeSeparator.setVisible(me.menuImageAdvanced.isVisible() || me.menuShapeAdvanced.isVisible() || me.menuChartEdit.isVisible()); + me.menuChartAdvanced.setVisible(_.isUndefined(value.imgProps) && !_.isUndefined(value.chartProps) && (_.isUndefined(value.shapeProps) || value.shapeProps.isChart)); + menuImgShapeSeparator.setVisible(me.menuImageAdvanced.isVisible() || me.menuShapeAdvanced.isVisible() || me.menuChartEdit.isVisible() || me.menuChartAdvanced.isVisible()); /** coauthoring begin **/ me.menuAddCommentImg.setVisible(me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments); menuCommentSeparatorImg.setVisible(me.menuAddCommentImg.isVisible()); @@ -2170,6 +2175,7 @@ define([ } me.menuImageAdvanced.setDisabled(disabled); me.menuShapeAdvanced.setDisabled(disabled); + me.menuChartAdvanced.setDisabled(disabled); if (me.menuChartEdit.isVisible()) me.menuChartEdit.setDisabled(disabled); @@ -2195,6 +2201,7 @@ define([ me.menuImageAdvanced, me.menuShapeAdvanced ,me.menuChartEdit + ,me.menuChartAdvanced /** coauthoring begin **/ ,menuCommentSeparatorImg, me.menuAddCommentImg, @@ -2434,7 +2441,8 @@ define([ txtWarnUrl: 'Clicking this link can be harmful to your device and data.
Are you sure you want to continue?', textEditPoints: 'Edit Points', txtMoveSlidesToEnd: 'Move Slide to End', - txtMoveSlidesToStart: 'Move Slide to Beginning' + txtMoveSlidesToStart: 'Move Slide to Beginning', + advancedChartText : 'Chart Advanced Settings' }, PE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index f10ff9343..bd211bd25 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1401,6 +1401,7 @@ "PE.Views.DocumentHolder.advancedParagraphText": "Paragraph Advanced Settings", "PE.Views.DocumentHolder.advancedShapeText": "Shape Advanced Settings", "PE.Views.DocumentHolder.advancedTableText": "Table Advanced Settings", + "PE.Views.DocumentHolder.advancedChartText": "Chart Advanced Settings", "PE.Views.DocumentHolder.alignmentText": "Alignment", "PE.Views.DocumentHolder.belowText": "Below", "PE.Views.DocumentHolder.cellAlignText": "Cell Vertical Alignment",