diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index 1ab292caf4..294a0c1063 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -337,6 +337,8 @@ define([ toolbar.btnLineSpace.menu.on('item:toggle', _.bind(this.onLineSpaceToggle, this)); toolbar.btnColumns.menu.on('item:click', _.bind(this.onColumnsSelect, this)); toolbar.btnColumns.menu.on('show:before', _.bind(this.onBeforeColumns, this)); + toolbar.btnTextDir.menu.on('item:click', _.bind(this.onTextDirClick, this)); + toolbar.btnTextDir.menu.on('show:after', _.bind(this.onTextDirShowAfter, this)); toolbar.btnClearStyle.on('click', _.bind(this.onClearStyleClick, this)); toolbar.btnShapeAlign.menu.on('item:click', _.bind(this.onShapeAlign, this)); toolbar.btnShapeAlign.menu.on('show:before', _.bind(this.onBeforeShapeAlign, this)); @@ -430,6 +432,7 @@ define([ this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this)); this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); this.api.asc_registerCallback('asc_onTextHighLight', _.bind(this.onApiTextHighlightColor, this)); + this.api.asc_registerCallback('asc_onTextDirection', _.bind(this.onApiTextDirection, this)); // this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this)); // this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); }, @@ -2555,6 +2558,38 @@ define([ this._setMarkerColor('transparent', 'menu'); }, + onTextDirClick: function(menu, item) { + this.api && this.api.asc_setRtlTextDirection(!!item.value); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onTextDirShowAfter: function(menu, item) { + Common.UI.TooltipManager.closeTip('rtlDirection'); + }, + + onApiTextDirection: function (isRtl){ + var toolbar = this.toolbar, + oldRtl = toolbar.btnTextDir.options.dirRtl, + newRtl = !!isRtl; + if (oldRtl !== newRtl) { + toolbar.btnTextDir.changeIcon({ + next: newRtl ? 'btn-rtl' : 'btn-ltr', + curr: oldRtl ? 'btn-rtl' : 'btn-ltr' + }); + toolbar.btnMarkers.changeIcon({ + next: newRtl ? 'btn-setmarkers-rtl' : 'btn-setmarkers', + curr: oldRtl ? 'btn-setmarkers-rtl' : 'btn-setmarkers' + }); + toolbar.btnNumbers.changeIcon({ + next: newRtl ? 'btn-numbering-rtl' : 'btn-numbering', + curr: oldRtl ? 'btn-numbering-rtl' : 'btn-numbering' + }); + toolbar.btnDecLeftOffset.cmpEl && toolbar.btnDecLeftOffset.cmpEl[newRtl ? 'addClass' : 'removeClass']('icon-mirrored') + toolbar.btnIncLeftOffset.cmpEl && toolbar.btnIncLeftOffset.cmpEl[newRtl ? 'addClass' : 'removeClass']('icon-mirrored') + toolbar.btnTextDir.options.dirRtl = !!isRtl; + } + }, + changePDFMode: function(data) { this.toolbar && this.toolbar.btnEditMode && this.toolbar.btnEditMode.toggle(!!this.mode.isPDFEdit, true); }, diff --git a/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template b/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template index 2b56d3a766..79c4df3d09 100644 --- a/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template +++ b/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template @@ -9,11 +9,11 @@
- +
- +
@@ -46,9 +46,13 @@
+
+
+
+
diff --git a/apps/pdfeditor/main/app/template/Toolbar.template b/apps/pdfeditor/main/app/template/Toolbar.template index 44f655800d..7959f7a00c 100644 --- a/apps/pdfeditor/main/app/template/Toolbar.template +++ b/apps/pdfeditor/main/app/template/Toolbar.template @@ -124,6 +124,7 @@ +
diff --git a/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js index 6a624e76bb..8da2f7bd43 100644 --- a/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js @@ -171,6 +171,9 @@ define([ }, this)); this.spinners.push(this.numIndentsRight); + this.lblIndentsLeft = $('#paragraphadv-lbl-indent-left'); + this.lblIndentsRight = $('#paragraphadv-lbl-indent-right'); + this.cmbSpecial = new Common.UI.ComboBox({ el: $('#paragraphadv-spin-special'), cls: 'input-group-nr', @@ -262,6 +265,22 @@ define([ this.spinners.push(this.numLineHeight); this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); + this.rbDirLtr = new Common.UI.RadioBox({ + el: $('#paragraphadv-dir-ltr'), + name : 'text-dir', + labelText : this.textDirLtr, + value: false + }); + this.rbDirLtr.on('change', _.bind(this.onTextDirChange, this)); + + this.rbDirRtl = new Common.UI.RadioBox({ + el: $('#paragraphadv-dir-rtl'), + name : 'text-dir', + labelText : this.textDirRtl, + value: true + }); + this.rbDirRtl.on('change', _.bind(this.onTextDirChange, this)); + // Font this.chStrike = new Common.UI.CheckBox({ @@ -408,7 +427,7 @@ define([ getFocusedComponents: function() { return this.btnsCategory.concat([ this.cmbTextAlignment, this.numIndentsLeft, this.numIndentsRight, this.cmbSpecial, this.numSpecialBy, - this.numSpacingBefore, this.numSpacingAfter, this.cmbLineRule, this.numLineHeight, // 0 tab + this.numSpacingBefore, this.numSpacingAfter, this.cmbLineRule, this.numLineHeight, this.rbDirLtr, this.rbDirRtl,// 0 tab this.chStrike, this.chSubscript, this.chDoubleStrike, this.chSmallCaps, this.chSuperscript, this.chAllCaps, this.numSpacing, // 1 tab this.numDefaultTab, this.numTab, this.cmbAlign, this.tabList, this.btnAddTab, this.btnRemoveTab, this.btnRemoveAll // 2 tab ]).concat(this.getFooterButtons()); @@ -486,6 +505,14 @@ define([ this.numLineHeight.setValue('', true); } + value = props.asc_getRtlDirection(); + if (value !== undefined) { + this.rbDirRtl.setValue(value, true); + this.rbDirLtr.setValue(!value, true); + } + this.lblIndentsLeft.text(value ? this.strIndentsSpacingBefore : this.strIndentsLeftText); + this.lblIndentsRight.text(value ? this.strIndentsSpacingAfter : this.strIndentsRightText); + // Font this._noApply = true; this.chStrike.setValue((props.get_Strikeout() !== null && props.get_Strikeout() !== undefined) ? props.get_Strikeout() : 'indeterminate', true); @@ -811,6 +838,14 @@ define([ this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, + onTextDirChange: function(field, newValue, eOpts) { + if (newValue && this._changedProps) { + this._changedProps.asc_putRtlDirection(field.options.value); + this.lblIndentsLeft.text(field.options.value ? this.strIndentsSpacingBefore : this.strIndentsLeftText); + this.lblIndentsRight.text(field.options.value ? this.strIndentsSpacingAfter : this.strIndentsRightText); + } + }, + textTitle: 'Paragraph - Advanced Settings', strIndentsLeftText: 'Left', strIndentsRightText: 'Right', diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index c0a83fa960..b832663dcb 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -622,6 +622,26 @@ define([ this.paragraphControls.push(this.btnColumns); arr.push(this.btnColumns); + this.btnTextDir = new Common.UI.Button({ + id: 'id-toolbar-btn-direction', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-ltr', + action: 'text-direction', + dirRtl: false, + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.disableOnStart, _set.inAnnotation], + menu: new Common.UI.Menu({ + items: [ + {caption: this.textDirLtr, value: false, iconCls: 'menu__icon btn-ltr'}, + {caption: this.textDirRtl, value: true, iconCls: 'menu__icon btn-rtl'}, + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnTextDir); + arr.push(this.btnTextDir); + this.mniAlignToSlide = new Common.UI.MenuItem({ caption: this.txtPageAlign, checkable: true, @@ -1410,6 +1430,7 @@ define([ _injectComponent('#slot-btn-valign', this.btnVerticalAlign); _injectComponent('#slot-btn-linespace', this.btnLineSpace); _injectComponent('#slot-btn-columns', this.btnColumns); + _injectComponent('#slot-btn-direction', this.btnTextDir); _injectComponent('#slot-btn-arrange-shape', this.btnShapeArrange); _injectComponent('#slot-btn-align-shape', this.btnShapeAlign); _injectComponent('#slot-btn-rotate', this.btnRotatePage); @@ -1675,6 +1696,7 @@ define([ this.btnIncLeftOffset.updateHint(this.tipIncPrLeft); this.btnLineSpace.updateHint(this.tipLineSpace); this.btnColumns.updateHint(this.tipColumns); + this.btnTextDir.updateHint(this.tipTextDir); this.btnShapeAlign.updateHint(this.tipShapeAlign); this.btnShapeArrange.updateHint(this.tipShapeArrange); this.btnShapesMerge.updateHint(this.tipShapeMerge); diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index ab984ea758..0ab9060d3b 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1760,6 +1760,9 @@ "PDFE.Views.ParagraphSettingsAdvanced.textTabRight": "Right", "PDFE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced settings", "PDFE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto", + "PDFE.Views.ParagraphSettingsAdvanced.textDirLtr": "Left-to-right", + "PDFE.Views.ParagraphSettingsAdvanced.textDirRtl": "Right-to-left", + "PDFE.Views.ParagraphSettingsAdvanced.strDirection": "Direction", "PDFE.Views.PrintWithPreview.textMarginsLast": "Last custom", "PDFE.Views.PrintWithPreview.textMarginsModerate": "Moderate", "PDFE.Views.PrintWithPreview.textMarginsNarrow": "Narrow", @@ -2209,6 +2212,9 @@ "PDFE.Views.Toolbar.txtRotatePageRight": "Rotate page right", "PDFE.Views.Toolbar.txtRotateRight": "Rotate right", "PDFE.Views.Toolbar.txtUngroup": "Ungroup", + "PDFE.Views.Toolbar.tipTextDir": "Text direction", + "PDFE.Views.Toolbar.textDirLtr": "Left-to-right", + "PDFE.Views.Toolbar.textDirRtl": "Right-to-left", "PDFE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar", "PDFE.Views.ViewTab.textDarkDocument": "Dark Document", "PDFE.Views.ViewTab.textFill": "Fill", diff --git a/apps/presentationeditor/main/app/template/ParagraphSettingsAdvanced.template b/apps/presentationeditor/main/app/template/ParagraphSettingsAdvanced.template index c221964c36..a81927fa70 100644 --- a/apps/presentationeditor/main/app/template/ParagraphSettingsAdvanced.template +++ b/apps/presentationeditor/main/app/template/ParagraphSettingsAdvanced.template @@ -46,11 +46,6 @@ -