diff --git a/apps/common/main/lib/component/ColorButton.js b/apps/common/main/lib/component/ColorButton.js index e79dba52b0..dbe6ece2ca 100644 --- a/apps/common/main/lib/component/ColorButton.js +++ b/apps/common/main/lib/component/ColorButton.js @@ -69,6 +69,7 @@ define([ (this.options.themecolors!==undefined) && (config['themecolors'] = this.options.themecolors); (this.options.effects!==undefined) && (config['effects'] = this.options.effects); (this.options.colorHints!==undefined) && (config['colorHints'] = this.options.colorHints); + (this.options.paletteCls!==undefined) && (config['cls'] = this.options.paletteCls); this.colorPicker = new Common.UI.ThemeColorPalette(config); this.colorPicker.on('select', _.bind(this.onColorSelect, this)); @@ -95,6 +96,7 @@ define([ if (typeof this.menu !== 'object') { options = options || this.options; var height = options.paletteHeight ? options.paletteHeight + 'px' : 'auto', + width = options.paletteWidth ? options.paletteWidth + 'px' : '164px', id = Common.UI.getId(), auto = [], eyedropper = []; @@ -120,7 +122,7 @@ define([ cls: 'color-menu ' + (options.eyeDropper ? 'shifted-right' : 'shifted-left'), additionalAlign: options.additionalAlign, items: (options.additionalItems ? options.additionalItems : []).concat(auto).concat([ - { template: _.template('
') }, + { template: _.template('
') }, {caption: '--'} ]).concat(eyedropper).concat([ { diff --git a/apps/common/main/lib/component/ThemeColorPalette.js b/apps/common/main/lib/component/ThemeColorPalette.js index 866e7bc7ac..afa76e98f9 100644 --- a/apps/common/main/lib/component/ThemeColorPalette.js +++ b/apps/common/main/lib/component/ThemeColorPalette.js @@ -103,6 +103,7 @@ define([ colorRe: /(?:^|\s)color-(.{6})(?:\s|$)/, selectedCls: 'selected', + cls : '', initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); @@ -128,6 +129,7 @@ define([ me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT]; el.addClass('theme-colorpalette'); + me.options.cls && el.addClass(me.options.cls); this.render(); if (this.options.updateColorsArr) diff --git a/apps/common/main/lib/util/define.js b/apps/common/main/lib/util/define.js index a131004802..541026a7fa 100644 --- a/apps/common/main/lib/util/define.js +++ b/apps/common/main/lib/util/define.js @@ -1074,4 +1074,17 @@ define(function(){ 'use strict'; }, } })(), Common.define.smartArt || {}); + + Common.define.simpleColorsConfig = { + colors: [ + '1755A0', 'D43230', 'F5C346', 'EA3368', '12A489', '552F8B', '9D1F87', 'BB2765', '479ED2', '67C9FA', + '3D8A44', '80CA3D', '1C19B4', '7F4B0F', 'FF7E07', 'FFFFFF', 'D3D3D4', '879397', '575757', '000000' + ], + dynamiccolors: 5, + themecolors: 0, + effects: 0, + columns: 5, + cls: 'palette-large', + paletteWidth: 174 + }; }); \ No newline at end of file diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index d35128f0e2..be5bc6b591 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -264,9 +264,9 @@ define([ var me = this; config = config || appConfig; if (!me.btnPDFMode || !config) return; - me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate ? 'btn-menu-comments' : 'btn-sheet-view'))); - me.btnPDFMode.setCaption(config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate ? me.textComment : me.textView)); - me.btnPDFMode.updateHint(config.isPDFEdit ? me.tipEdit : (config.isPDFAnnotate ? me.tipComment : me.tipView)); + me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate && config.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view'))); + me.btnPDFMode.setCaption(config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate && config.canCoEditing ? me.textComment : me.textView)); + me.btnPDFMode.updateHint(config.isPDFEdit ? me.tipEdit : (config.isPDFAnnotate && config.canCoEditing ? me.tipComment : me.tipView)); } function changeDocMode(type, lockEditing) { @@ -459,18 +459,18 @@ define([ caption: me.textEdit, iconCls : 'menu__icon btn-edit', template: menuTemplate, - description: me.textEditDesc, + description: appConfig.canCoEditing ? me.textEditDesc : me.textEditDescNoCoedit, value: 'edit' }); arr.push({ - caption: me.textComment, - iconCls : 'menu__icon btn-menu-comments', + caption: appConfig.canCoEditing ? me.textComment : me.textView, + iconCls : 'menu__icon ' + (appConfig.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view'), template: menuTemplate, - description: me.textCommentDesc, + description: appConfig.canCoEditing ? me.textCommentDesc : me.textViewDescNoCoedit, value: 'comment', disabled: !appConfig.canPDFAnnotate }); - arr.push({ + appConfig.canCoEditing && arr.push({ caption: me.textView, iconCls : 'menu__icon btn-sheet-view', template: menuTemplate, @@ -1146,6 +1146,8 @@ define([ textViewDesc: 'All changes will be saved locally', textCommentDesc: 'All changes will be saved to the file. Real time collaboration', textEditDesc: 'All changes will be saved to the file. Real time collaboration', + textViewDescNoCoedit: 'View or annotate', + textEditDescNoCoedit: 'Add or edit text, shapes, images etc.', tipView: 'Viewing', tipComment: 'Commenting', tipEdit: 'Editing', diff --git a/apps/common/main/lib/view/SymbolTableDialog.js b/apps/common/main/lib/view/SymbolTableDialog.js index 85bc00a718..1f5e0c92d2 100644 --- a/apps/common/main/lib/view/SymbolTableDialog.js +++ b/apps/common/main/lib/view/SymbolTableDialog.js @@ -43,6 +43,7 @@ define([ 'common/main/lib/util/utils', 'common/main/lib/util/character', 'common/main/lib/component/InputField', + 'common/main/lib/component/ListView', 'common/main/lib/component/Window' ], function () { 'use strict'; diff --git a/apps/pdfeditor/main/app.js b/apps/pdfeditor/main/app.js index c3ad9a82f8..179a57c6d1 100644 --- a/apps/pdfeditor/main/app.js +++ b/apps/pdfeditor/main/app.js @@ -145,11 +145,13 @@ require([ 'DocumentHolder', 'Toolbar', 'Statusbar', + 'RightMenu', 'Navigation', 'PageThumbnails', 'LeftMenu', 'Main', 'ViewTab', + 'InsTab', 'Search', 'Print', 'Common.Controllers.Fonts', @@ -157,6 +159,8 @@ require([ 'Common.Controllers.Comments', 'Common.Controllers.Draw', 'Common.Controllers.Plugins', + // 'Common.Controllers.ExternalDiagramEditor', + // 'Common.Controllers.ExternalOleEditor', 'Common.Controllers.Protection' ] }); @@ -172,11 +176,13 @@ require([ 'pdfeditor/main/app/controller/DocumentHolder', 'pdfeditor/main/app/controller/Toolbar', 'pdfeditor/main/app/controller/Statusbar', + 'pdfeditor/main/app/controller/RightMenu', 'pdfeditor/main/app/controller/Navigation', 'pdfeditor/main/app/controller/PageThumbnails', 'pdfeditor/main/app/controller/LeftMenu', 'pdfeditor/main/app/controller/Main', 'pdfeditor/main/app/controller/ViewTab', + 'pdfeditor/main/app/controller/InsTab', 'pdfeditor/main/app/controller/Search', 'pdfeditor/main/app/controller/Print', 'pdfeditor/main/app/view/FileMenuPanels', @@ -186,6 +192,8 @@ require([ 'common/main/lib/controller/Chat', /** coauthoring end **/ 'common/main/lib/controller/Plugins', + // 'common/main/lib/controller/ExternalDiagramEditor', + // 'common/main/lib/controller/ExternalOleEditor', 'common/main/lib/controller/Draw', 'common/main/lib/controller/Protection' ], function() { diff --git a/apps/pdfeditor/main/app/collection/EquationGroups.js b/apps/pdfeditor/main/app/collection/EquationGroups.js new file mode 100644 index 0000000000..4d5a0ff8bd --- /dev/null +++ b/apps/pdfeditor/main/app/collection/EquationGroups.js @@ -0,0 +1,52 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * EquationGroups.js + * + * Created by Alexey Musinov on 29/10/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'backbone', + 'pdfeditor/main/app/model/EquationGroup' +], function(Backbone){ 'use strict'; + if (Common === undefined) + var Common = {}; + + Common.Collections = Common.Collections || {}; + + PDFE.Collections.EquationGroups = Backbone.Collection.extend({ + model: PDFE.Models.EquationGroup + }); +}); diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index c95d75d212..3cc68b546a 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -39,6 +39,25 @@ * */ +var c_paragraphLinerule = { + LINERULE_LEAST: 0, + LINERULE_AUTO: 1, + LINERULE_EXACT: 2 +}; + +var c_paragraphTextAlignment = { + RIGHT: 0, + LEFT: 1, + CENTERED: 2, + JUSTIFIED: 3 +}; + +var c_paragraphSpecial = { + NONE_SPECIAL: 0, + FIRST_LINE: 1, + HANGING: 2 +}; + define([ 'core', 'pdfeditor/main/app/view/DocumentHolder', @@ -75,6 +94,7 @@ define([ me.mouseMoveData = null; me.isTooltipHiding = false; me.lastMathTrackBounds = []; + me.lastTextBarBounds = []; me.screenTip = { toolTip: new Common.UI.Tooltip({ @@ -166,6 +186,10 @@ define([ this.api.asc_registerCallback('asc_onHideEyedropper', _.bind(this.hideEyedropper, this)); this.api.asc_registerCallback('asc_onShowPDFFormsActions', _.bind(this.onShowFormsPDFActions, this)); this.api.asc_registerCallback('asc_onHidePdfFormsActions', _.bind(this.onHidePdfFormsActions, this)); + this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this)); + // for text + this.api.asc_registerCallback('asc_onShowAnnotTextPrTrack', _.bind(this.onShowTextBar, this)); + this.api.asc_registerCallback('asc_onHideAnnotTextPrTrack', _.bind(this.onHideTextBar, this)); } if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); @@ -212,6 +236,112 @@ define([ view.menuPDFFormsCut.on('click', _.bind(me.onCutCopyPaste, me)); view.menuPDFFormsCopy.on('click', _.bind(me.onCutCopyPaste, me)); view.menuPDFFormsPaste.on('click', _.bind(me.onCutCopyPaste, me)); + } else if (type==='edit') { + view.menuPDFEditCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuEditAddComment.on('click', _.bind(me.addComment, me)); +/* + var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); + if (diagramEditor) { + diagramEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + ( diagramEditor.isEditMode() ) + ? this.api.asc_editChartDrawingObject(data) + : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); + } + }, this)); + diagramEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_onCloseChartFrame(); + this.api.asc_enableKeyEvents(true); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + + var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + oleEditor.isEditMode() + ? this.api.asc_editTableOleObject(data) + : this.api.asc_addTableOleObject(data); + } + }, this)); + oleEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_enableKeyEvents(true); + this.api.asc_onCloseChartFrame(); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + */ + view.menuParaCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuParaPaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuParaCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgPaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuImgCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTableCopy.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTablePaste.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuTableCut.on('click', _.bind(me.onCutCopyPaste, me)); + view.menuAddHyperlinkPara.on('click', _.bind(me.addHyperlink, me)); + view.menuAddHyperlinkTable.on('click', _.bind(me.addHyperlink, me)); + view.menuEditHyperlinkPara.on('click', _.bind(me.editHyperlink, me)); + view.menuEditHyperlinkTable.on('click', _.bind(me.editHyperlink, me)); + view.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me)); + view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me)); + // view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined)); + view.menuImgSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); + view.menuTableSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); + view.menuAddCommentPara.on('click', _.bind(me.addComment, me)); + view.menuAddCommentTable.on('click', _.bind(me.addComment, me)); + view.menuAddCommentImg.on('click', _.bind(me.addComment, me)); + view.mnuTableMerge.on('click', _.bind(me.onTableMerge, me)); + view.mnuTableSplit.on('click', _.bind(me.onTableSplit, me)); + view.menuTableCellAlign.menu.on('item:click', _.bind(me.tableCellsVAlign, me)); + view.menuTableDistRows.on('click', _.bind(me.onTableDistRows, me)); + view.menuTableDistCols.on('click', _.bind(me.onTableDistCols, me)); + view.menuTableAdvanced.on('click', _.bind(me.onTableAdvanced, me)); + view.menuImageAdvanced.on('click', _.bind(me.onImageAdvanced, me)); + view.menuImgOriginalSize.on('click', _.bind(me.onImgOriginalSize, me)); + view.menuImgShapeRotate.menu.items[0].on('click', _.bind(me.onImgRotate, me)); + view.menuImgShapeRotate.menu.items[1].on('click', _.bind(me.onImgRotate, me)); + view.menuImgShapeRotate.menu.items[3].on('click', _.bind(me.onImgFlip, me)); + view.menuImgShapeRotate.menu.items[4].on('click', _.bind(me.onImgFlip, me)); + view.menuImgCrop.menu.on('item:click', _.bind(me.onImgCrop, me)); + 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)); + view.mnuArrangeBack.on('click', _.bind(me.onArrangeBack, me)); + view.mnuArrangeForward.on('click', _.bind(me.onArrangeForward, me)); + view.mnuArrangeBackward.on('click', _.bind(me.onArrangeBackward, me)); + view.menuImgShapeAlign.menu.on('item:click', _.bind(me.onImgShapeAlign, me)); + view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); + view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); + view.menuTableSelectText.menu.on('item:click', _.bind(me.tableSelectText, me)); + view.menuTableInsertText.menu.on('item:click', _.bind(me.tableInsertText, me)); + view.menuTableDeleteText.menu.on('item:click', _.bind(me.tableDeleteText, me)); + view.menuTableEquationSettings.menu.on('item:click', _.bind(me.convertEquation, me)); + view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); + view.mnuNewPage.on('click', _.bind(me.onNewPage, me)); + view.mnuDeletePage.on('click', _.bind(me.onDeletePage, me)); + view.mnuRotatePageRight.on('click', _.bind(me.onRotatePage, me, 90)); + view.mnuRotatePageLeft.on('click', _.bind(me.onRotatePage, me, 270)); } }, @@ -268,6 +398,83 @@ define([ return {menu_to_show: documentHolder.viewPDFModeMenu, menu_props: {}}; }, + fillPDFEditMenuProps: function(selectedElements) { + var documentHolder = this.documentHolder; + if (!documentHolder.editPDFModeMenu) + documentHolder.createDelayedElementsPDFEditor(); + + if (!selectedElements || !_.isArray(selectedElements) || selectedElements.length<1) + return {menu_to_show: documentHolder.editPDFModeMenu, menu_props: {}} + + var me = this, + menu_props = {}, + menu_to_show = null; + _.each(selectedElements, function(element, index) { + var elType = element.get_ObjectType(), + elValue = element.get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Image == elType) { + menu_to_show = documentHolder.pictureMenu; + menu_props.imgProps = {}; + menu_props.imgProps.value = elValue; + menu_props.imgProps.locked = (elValue) ? elValue.get_Locked() : false; + } else if (Asc.c_oAscTypeSelectElement.Table == elType) { + menu_to_show = documentHolder.tableMenu; + menu_props.tableProps = {}; + menu_props.tableProps.value = elValue; + menu_props.tableProps.locked = (elValue) ? elValue.get_Locked() : false; + } else if (Asc.c_oAscTypeSelectElement.Hyperlink == elType) { + menu_props.hyperProps = {}; + menu_props.hyperProps.value = elValue; + } else if (Asc.c_oAscTypeSelectElement.Shape == elType) { // shape + menu_props.shapeProps = {}; + menu_props.shapeProps.value = elValue; + menu_props.shapeProps.locked = (elValue) ? elValue.get_Locked() : false; + if (elValue.get_FromChart()) + menu_props.shapeProps.isChart = true; + if (menu_props.paraProps && menu_props.paraProps.value && elValue.asc_getCanEditText()) // text in shape, need to show paragraph menu with vertical align + menu_to_show = documentHolder.textMenu; + else + menu_to_show = documentHolder.pictureMenu; + } + // else if (Asc.c_oAscTypeSelectElement.Chart == elType) { + // menu_to_show = documentHolder.pictureMenu; + // menu_props.chartProps = {}; + // menu_props.chartProps.value = elValue; + // menu_props.chartProps.locked = (elValue) ? elValue.get_Locked() : false; + // } + else if (Asc.c_oAscTypeSelectElement.Paragraph == elType) { + menu_props.paraProps = {}; + menu_props.paraProps.value = elValue; + menu_props.paraProps.locked = (elValue) ? elValue.get_Locked() : false; + if (menu_props.shapeProps && menu_props.shapeProps.value && menu_props.shapeProps.value.asc_getCanEditText()) // text in shape, need to show paragraph menu with vertical align + menu_to_show = documentHolder.textMenu; + } else if (Asc.c_oAscTypeSelectElement.Math == elType) { + menu_props.mathProps = {}; + menu_props.mathProps.value = elValue; + documentHolder._currentMathObj = elValue; + } + }); + if (menu_to_show === null) { + if (!_.isUndefined(menu_props.paraProps)) + menu_to_show = documentHolder.textMenu; + } + + return {menu_to_show: menu_to_show, menu_props: menu_props}; + }, + + applyEditorMode: function() { + if (this.mode && this.mode.isPDFEdit && !this.documentHolder.editPDFModeMenu) { + this.documentHolder.createDelayedElementsPDFEditor(); + this.api.asc_registerCallback('asc_onShowMathTrack', _.bind(this.onShowMathTrack, this)); + this.api.asc_registerCallback('asc_onHideMathTrack', _.bind(this.onHideMathTrack, this)); + this.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(this.onDialogAddHyperlink, this)); + this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this)); + } + if (this.mode) + this.mode.isPDFEdit ? this.onHideTextBar() : this.onHideMathTrack(); + }, + fillFormsMenuProps: function(selectedElements) { if (!selectedElements || !_.isArray(selectedElements)) return; @@ -308,7 +515,7 @@ define([ showObjectMenu: function(event, docElement, eOpts){ var me = this; if (me.api){ - var obj = me.mode && me.mode.isRestrictedEdit ? (event.get_Type() == 0 ? me.fillFormsMenuProps(me.api.getSelectedElements()) : null) : me.fillViewMenuProps(); + var obj = me.mode && me.mode.isRestrictedEdit ? (event.get_Type() == 0 ? me.fillFormsMenuProps(me.api.getSelectedElements()) : null) : (me.mode && me.mode.isEdit && me.mode.isPDFEdit ? me.fillPDFEditMenuProps(me.api.getSelectedElements()) : me.fillViewMenuProps()); if (obj) me.showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts); } }, @@ -323,7 +530,10 @@ define([ var me = this; _.delay(function(){ - me.showObjectMenu.call(me, event); + if (event.get_Type() == Asc.c_oAscPdfContextMenuTypes.Thumbnails) { + me.mode && me.mode.isEdit && me.mode.isPDFEdit && me.showPopupMenu.call(me, me.documentHolder.pageMenu, {isPageSelect: event.get_IsPageSelect()}, event); + } else + me.showObjectMenu.call(me, event); },10); }, @@ -331,7 +541,7 @@ define([ var me = this, currentMenu = me.documentHolder.currentMenu; if (currentMenu && currentMenu.isVisible()){ - var obj = me.mode && me.mode.isRestrictedEdit ? me.fillFormsMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements); + var obj = me.mode && me.mode.isRestrictedEdit ? me.fillFormsMenuProps(selectedElements) : (me.mode && me.mode.isPDFEdit ? me.fillPDFEditMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements)); if (obj) { if (obj.menu_to_show===currentMenu) { currentMenu.options.initMenu(obj.menu_props); @@ -339,6 +549,24 @@ define([ } } } + if (this.mode && this.mode.isPDFEdit) { + var i = -1, + in_equation = false, + locked = false; + while (++i < selectedElements.length) { + var type = selectedElements[i].get_ObjectType(); + if (type === Asc.c_oAscTypeSelectElement.Math) { + in_equation = true; + } else if (type === Asc.c_oAscTypeSelectElement.Paragraph) { + var value = selectedElements[i].get_ObjectValue(); + value && (locked = locked || value.get_Locked()); + } + } + if (in_equation) { + this._state.equationLocked = locked; + this.disableEquationBar(); + } + } }, handleDocumentWheel: function(event) { @@ -427,7 +655,7 @@ define([ } }); meEl.on('mousedown', function(e){ - if (e.target.localName == 'canvas') + if (e.target.localName == 'canvas' && $(e.target).closest('[type=menuitem]').length<1) Common.UI.Menu.Manager.hideAll(); }); @@ -540,6 +768,66 @@ define([ } }, + onDialogAddHyperlink: function() { + var win, props, text; + var me = this; + if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible()){ + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + props = dlg.getSettings(); + (text!==false) + ? me.api.add_Hyperlink(props) + : me.api.change_Hyperlink(props); + } + + me.editComplete(); + }; + + text = me.api.can_AddHyperlink(); + + var _arr = []; + for (var i=0; i'; + } + eqStr += '
'; + eqStr += ''; + eqStr += ''; + eqContainer = $(eqStr); + documentHolder.cmpEl.append(eqContainer); + var onShowBefore = function (menu) { + var index = menu.options.value, + group = equationsStore.at(index); + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-document-holder-btn-equation-menu-' + index, menu.cmpEl), + parentMenu: menu, + store: group.get('groupStore'), + scrollAlwaysVisible: true, + showLast: false, + restoreHeight: 450, + itemTemplate: _.template( + '
' + + '
' + + '
') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + } + }); + menu.off('show:before', onShowBefore); + }; + var bringForward = function (menu) { + eqContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + eqContainer.removeClass('has-open-menu'); + }; + for (var i = 0; i < equationsStore.length; ++i) { + var equationGroup = equationsStore.at(i); + var btn = new Common.UI.Button({ + parentEl: $('#id-document-holder-btn-equation-' + i, documentHolder.cmpEl), + cls : 'btn-toolbar no-caret', + iconCls : 'svgicon ' + equationGroup.get('groupIcon'), + hint : equationGroup.get('groupName'), + menu : new Common.UI.Menu({ + cls: 'menu-shapes', + value: i, + items: [ + { template: _.template('') } + ] + }) + }); + btn.menu.on('show:before', onShowBefore); + btn.menu.on('show:before', bringForward); + btn.menu.on('hide:after', sendBackward); + me.equationBtns.push(btn); + } + + me.equationSettingsBtn = new Common.UI.Button({ + parentEl: $('#id-document-holder-btn-equation-settings', documentHolder.cmpEl), + cls : 'btn-toolbar no-caret', + iconCls : 'toolbar__icon btn-more-vertical', + hint : me.documentHolder.advancedEquationText, + menu : me.documentHolder.createEquationMenu('popuptbeqinput', 'tl-bl') + }); + me.equationSettingsBtn.menu.options.initMenu = function() { + var eq = me.api.asc_GetMathInputType(), + menu = me.equationSettingsBtn.menu, + isEqToolbarHide = Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide'); + + menu.items[5].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + menu.items[6].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + menu.items[8].options.isToolbarHide = isEqToolbarHide; + menu.items[8].setCaption(isEqToolbarHide ? me.documentHolder.showEqToolbar : me.documentHolder.hideEqToolbar, true); + }; + me.equationSettingsBtn.menu.on('item:click', _.bind(me.convertEquation, me)); + me.equationSettingsBtn.menu.on('show:before', function(menu) { + bringForward(); + menu.options.initMenu(); + }); + me.equationSettingsBtn.menu.on('hide:after', sendBackward); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - eqContainer.outerWidth()/2, bounds[1] - eqContainer.outerHeight() - 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + if (showPoint[1]<0) { + showPoint[1] = bounds[3] + 10; + } + showPoint[1] = Math.min(me._Height - eqContainer.outerHeight(), Math.max(0, showPoint[1])); + eqContainer.css({left: showPoint[0], top : showPoint[1]}); + + if (_.isUndefined(me._XY)) { + me._XY = [ + documentHolder.cmpEl.offset().left - $(window).scrollLeft(), + documentHolder.cmpEl.offset().top - $(window).scrollTop() + ]; + me._Width = documentHolder.cmpEl.width(); + me._Height = documentHolder.cmpEl.height(); + me._BodyWidth = $('body').width(); + } + + var diffDown = me._Height - showPoint[1] - eqContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.equationBtns.forEach(function(item){ + item && (item.menu.menuAlign = menuAlign); + }); + me.equationSettingsBtn.menu.menuAlign = menuAlign; + if (eqContainer.is(':visible')) { + if (me.equationSettingsBtn.menu.isVisible()) { + me.equationSettingsBtn.menu.options.initMenu(); + me.equationSettingsBtn.menu.alignPosition(); + } + } else { + eqContainer.show(); + } + me.disableEquationBar(); + }, + + onHideMathTrack: function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + var eqContainer = this.documentHolder.cmpEl.find('#equation-container'); + if (eqContainer.is(':visible')) { + eqContainer.hide(); + } + }, + + disableEquationBar: function() { + var eqContainer = this.documentHolder.cmpEl.find('#equation-container'), + disabled = this._isDisabled || this._state.equationLocked; + + if (eqContainer.length>0 && eqContainer.is(':visible')) { + this.equationBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + this.equationSettingsBtn.setDisabled(!!disabled); + } + }, + + convertEquation: function(menu, item, e) { + if (this.api) { + if (item.options.type=='input') { + this.api.asc_SetMathInputType(item.value); + Common.localStorage.setBool("pdfe-equation-input-latex", item.value === Asc.c_oAscMathInputType.LaTeX) + } else if (item.options.type=='view') + this.api.asc_ConvertMathView(item.value.linear, item.value.all); + else if(item.options.type=='hide') { + item.options.isToolbarHide = !item.options.isToolbarHide; + Common.Utils.InternalSettings.set('pdfe-equation-toolbar-hide', item.options.isToolbarHide); + Common.localStorage.setBool('pdfe-equation-toolbar-hide', item.options.isToolbarHide); + if(item.options.isToolbarHide) this.onHideMathTrack(); + else this.onShowMathTrack(this.lastMathTrackBounds); + } + } + }, + + equationCallback: function(eqProps) { + if (eqProps) { + var eqObj; + switch (eqProps.type) { + case Asc.c_oAscMathInterfaceType.Accent: + eqObj = new CMathMenuAccent(); + break; + case Asc.c_oAscMathInterfaceType.BorderBox: + eqObj = new CMathMenuBorderBox(); + break; + case Asc.c_oAscMathInterfaceType.Box: + eqObj = new CMathMenuBox(); + break; + case Asc.c_oAscMathInterfaceType.Bar: + eqObj = new CMathMenuBar(); + break; + case Asc.c_oAscMathInterfaceType.Script: + eqObj = new CMathMenuScript(); + break; + case Asc.c_oAscMathInterfaceType.Fraction: + eqObj = new CMathMenuFraction(); + break; + case Asc.c_oAscMathInterfaceType.Limit: + eqObj = new CMathMenuLimit(); + break; + case Asc.c_oAscMathInterfaceType.Matrix: + eqObj = new CMathMenuMatrix(); + break; + case Asc.c_oAscMathInterfaceType.EqArray: + eqObj = new CMathMenuEqArray(); + break; + case Asc.c_oAscMathInterfaceType.LargeOperator: + eqObj = new CMathMenuNary(); + break; + case Asc.c_oAscMathInterfaceType.Delimiter: + eqObj = new CMathMenuDelimiter(); + break; + case Asc.c_oAscMathInterfaceType.GroupChar: + eqObj = new CMathMenuGroupCharacter(); + break; + case Asc.c_oAscMathInterfaceType.Radical: + eqObj = new CMathMenuRadical(); + break; + case Asc.c_oAscMathInterfaceType.Common: + eqObj = new CMathMenuBase(); + break; + } + if (eqObj) { + eqObj[eqProps.callback](eqProps.value); + this.api.asc_SetMathProps(eqObj); + } + } + this.editComplete(); + }, + + onChangeCropState: function(state) { + this.documentHolder.menuImgCrop && this.documentHolder.menuImgCrop.menu.items[0].setChecked(state, true); + }, + + addHyperlink: function(item){ + var win, me = this; + if (me.api) { + var _arr = []; + for (var i=0; i 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.Table == elType) { + (new PDFE.Views.TableSettingsAdvanced( + { + tableProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.tblApply(value.tableProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Table Settings Advanced'); + } + })).show(); + break; + } + } + } + } + }, + + onImageAdvanced: function(item) { + 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.Image == elType) { + var imgsizeOriginal; + + if (!me.documentHolder.menuImgOriginalSize.isDisabled()) { + imgsizeOriginal = me.api.get_OriginalSizeImage(); + if (imgsizeOriginal) + imgsizeOriginal = {width:imgsizeOriginal.get_ImageWidth(), height:imgsizeOriginal.get_ImageHeight()}; + } + + (new PDFE.Views.ImageSettingsAdvanced( + { + imageProps: elValue, + sizeOriginal: imgsizeOriginal, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ImgApply(value.imageProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Settings Advanced'); + } + })).show(); + break; + } + } + } + } + }, + + onImgOriginalSize: function(item){ + var me = this; + if (me.api){ + var originalImageSize = me.api.get_OriginalSizeImage(); + + if (originalImageSize) { + var properties = new Asc.asc_CImgProperty(); + + properties.put_Width(originalImageSize.get_ImageWidth()); + properties.put_Height(originalImageSize.get_ImageHeight()); + properties.put_ResetCrop(true); + properties.put_Rot(0); + me.api.ImgApply(properties); + } + + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Set Image Original Size'); + } + }, + + onImgRotate: function(item) { + var properties = new Asc.asc_CShapeProperty(); + properties.asc_putRotAdd((item.value==1 ? 90 : 270) * 3.14159265358979 / 180); + this.api.ShapeApply(properties); + this.editComplete(); + }, + + onImgFlip: function(item) { + var properties = new Asc.asc_CShapeProperty(); + if (item.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + this.api.ShapeApply(properties); + this.editComplete(); + }, + + onImgCrop: function(menu, item) { + if (item.value == 1) { + this.api.asc_cropFill(); + } else if (item.value == 2) { + this.api.asc_cropFit(); + } else { + item.checked ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop(); + } + this.editComplete(); + }, + + onImgEditPoints: function(item) { + this.api && this.api.asc_editPointsGeometry(); + }, + + onShapeAdvanced: function(item) { + 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.Shape == elType) { + (new PDFE.Views.ShapeSettingsAdvanced( + { + shapeProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ShapeApply(value.shapeProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Shape Advanced'); + } + })).show(); + break; + } + } + } + } + }, + + onParagraphAdvanced: function(item) { + 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.Paragraph == elType) { + (new PDFE.Views.ParagraphSettingsAdvanced( + { + paragraphProps: elValue, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.paraApply(value.paragraphProps); + } + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Image Paragraph Advanced'); + } + })).show(); + break; + } + } + } + } + }, + + onGroupImg: function(item) { + this.api && this.api.groupShapes(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Group Image'); + }, + + onUnGroupImg: function(item) { + this.api && this.api.unGroupShapes(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'UnGroup Image'); + }, + + onArrangeFront: function(item) { + this.api && this.api.shapes_bringToFront(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Front'); + }, + + onArrangeBack: function(item) { + this.api && this.api.shapes_bringToBack(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Bring To Back'); + }, + + onArrangeForward: function(item) { + this.api && this.api.shapes_bringForward(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Send Forward'); + }, + + onArrangeBackward: function(item) { + this.api && this.api.shapes_bringBackward(); + this.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Send Backward'); + }, + + onImgShapeAlign: function (menu, item) { + var me = this; + if (me.api) { + var value = me.api.asc_getSelectedDrawingObjectsCount()<2 || Common.Utils.InternalSettings.get("pdfe-align-to-slide"); + value = value ? Asc.c_oAscObjectsAlignType.Page : Asc.c_oAscObjectsAlignType.Selected; + if (item.value < 6) { + me.api.put_ShapesAlign(item.value, value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Shape Align'); + } else if (item.value == 6) { + me.api.DistributeHorizontally(value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Horizontally'); + } else if (item.value == 7){ + me.api.DistributeVertically(value); + Common.component.Analytics.trackEvent('DocumentHolder', 'Distribute Vertically'); + } + me.editComplete(); + } + }, + + onParagraphVAlign: function (menu, item) { + var me = this; + if (me.api) { + var properties = new Asc.asc_CShapeProperty(); + properties.put_VerticalTextAlign(item.value); + + me.api.ShapeApply(properties); + } + + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Text Vertical Align'); + }, + + onParagraphDirection: function(menu, item) { + var me = this; + if (me.api) { + var properties = new Asc.asc_CShapeProperty(); + properties.put_Vert(item.options.direction); + me.api.ShapeApply(properties); + } + me.editComplete(); + Common.component.Analytics.trackEvent('DocumentHolder', 'Text Direction'); + }, + + tableSelectText: function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.selectRow(); + break; + case 1: + this.api.selectColumn(); + break; + case 2: + this.api.selectCell(); + break; + case 3: + this.api.selectTable(); + break; + } + } + }, + + tableInsertText: function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.addColumnLeft(); + break; + case 1: + this.api.addColumnRight(); + break; + case 2: + this.api.addRowAbove(); + break; + case 3: + this.api.addRowBelow(); + break; + } + } + }, + + tableDeleteText: function(menu, item) { + if (this.api) { + switch (item.value) { + case 0: + this.api.remRow(); + break; + case 1: + this.api.remColumn(); + break; + case 2: + this.api.remTable(); + break; + } + } + }, + + onShowTextBar: function(bounds) { + if (this.mode && !(!this.mode.isPDFEdit && this.mode.isEdit)) return; + + this.lastTextBarBounds = bounds; + if (bounds[3] < 0) { + this.onHideTextBar(); + return; + } + var me = this, + documentHolder = me.documentHolder, + textContainer = documentHolder.cmpEl.find('#text-bar-container'); + + // Prepare menu container + if (textContainer.length < 1) { + me.textBarBtns = []; + textContainer = documentHolder.createTextBar(me.textBarBtns); + documentHolder.cmpEl.append(textContainer); + + var bringForward = function (menu) { + textContainer.addClass('has-open-menu'); + }; + var sendBackward = function (menu) { + textContainer.removeClass('has-open-menu'); + }; + me.textBarBtns.forEach(function(item){ + if (item && item.menu) { + item.menu.on('show:before', bringForward); + item.menu.on('hide:after', sendBackward); + } + }); + // annotation text bar + this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); + this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); + this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); + this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); + this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); + this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); + + documentHolder.btnBold.on('click', _.bind(this.onBold, this)); + documentHolder.btnItalic.on('click', _.bind(this.onItalic, this)); + documentHolder.btnTextUnderline.on('click', _.bind(this.onTextUnderline, this)); + documentHolder.btnTextStrikeout.on('click', _.bind(this.onTextStrikeout, this)); + documentHolder.btnSuperscript.on('click', _.bind(this.onSuperscript, this)); + documentHolder.btnSubscript.on('click', _.bind(this.onSubscript, this)); + documentHolder.btnFontColor.on('click', _.bind(this.onBtnFontColor, this)); + documentHolder.btnFontColor.on('color:select', _.bind(this.onSelectFontColor, this)); + documentHolder.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this)); + documentHolder.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true)); + documentHolder.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false)); + documentHolder.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true)); + documentHolder.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this)); + documentHolder.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this)); + documentHolder.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + documentHolder.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); + documentHolder.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); + documentHolder.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); + documentHolder.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this)); + documentHolder.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + + this.api.UpdateInterfaceState(); + } + + var showPoint = [(bounds[0] + bounds[2])/2 - textContainer.outerWidth()/2, bounds[1] - textContainer.outerHeight() - 10]; + (showPoint[0]<0) && (showPoint[0] = 0); + if (showPoint[1]<0) { + showPoint[1] = bounds[3] + 10; + } + showPoint[1] = Math.min(me._Height - textContainer.outerHeight(), Math.max(0, showPoint[1])); + textContainer.css({left: showPoint[0], top : showPoint[1]}); + + if (_.isUndefined(me._XY)) { + me._XY = [ + documentHolder.cmpEl.offset().left - $(window).scrollLeft(), + documentHolder.cmpEl.offset().top - $(window).scrollTop() + ]; + me._Width = documentHolder.cmpEl.width(); + me._Height = documentHolder.cmpEl.height(); + me._BodyWidth = $('body').width(); + } + + var diffDown = me._Height - showPoint[1] - textContainer.outerHeight(), + diffUp = me._XY[1] + showPoint[1], + menuAlign = (diffDown < 220 && diffDown < diffUp*0.9) ? 'bl-tl' : 'tl-bl'; + if (Common.UI.isRTL()) { + menuAlign = menuAlign === 'bl-tl' ? 'br-tr' : 'tr-br'; + } + me.textBarBtns.forEach(function(item){ + item && item.menu && (item.menu.menuAlign = menuAlign); + }); + if (!textContainer.is(':visible')) { + textContainer.show(); + } + me.disableTextBar(); + }, + + onHideTextBar: function() { + if (!this.documentHolder || !this.documentHolder.cmpEl) return; + var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'); + if (textContainer.is(':visible')) { + textContainer.hide(); + } + }, + + disableTextBar: function() { + var textContainer = this.documentHolder.cmpEl.find('#text-bar-container'), + disabled = this._isDisabled; + + if (textContainer.length>0 && textContainer.is(':visible')) { + this.textBarBtns.forEach(function(item){ + item && item.setDisabled(!!disabled); + }); + } + }, + + onApiChangeFont: function(font) { + if (!this.mode.isPDFAnnotate) return; + this._state.fontname = font; + !Common.Utils.ModalWindow.isVisible() && this.documentHolder.cmbFontName.onApiChangeFont(font); + }, + + onApiFontSize: function(size) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.fontsize !== size) { + this.documentHolder.cmbFontSize.setValue(size); + this._state.fontsize = size; + } + }, + + onApiBold: function(on) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.bold !== on) { + this.documentHolder.btnBold.toggle(on === true, true); + this._state.bold = on; + } + }, + + onApiItalic: function(on) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.italic !== on) { + this.documentHolder.btnItalic.toggle(on === true, true); + this._state.italic = on; + } + }, + + onApiUnderline: function(on) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.underline !== on) { + this.documentHolder.btnTextUnderline.toggle(on === true, true); + this._state.underline = on; + } + }, + + onApiStrikeout: function(on) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.strike !== on) { + this.documentHolder.btnTextStrikeout.toggle(on === true, true); + this._state.strike = on; + } + }, + + onApiVerticalAlign: function(typeBaseline) { + if (!this.mode.isPDFAnnotate) return; + if (this._state.valign !== typeBaseline) { + this.documentHolder.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true); + this.documentHolder.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true); + this._state.valign = typeBaseline; + } + }, + + onApiTextColor: function(color) { + if (!this.mode.isPDFAnnotate) return; + var clr; + var picker = this.documentHolder.mnuFontColorPicker; + + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else + clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + + var type1 = typeof(clr), + type2 = typeof(this._state.clrtext); + + if ((type1 !== type2) || (type1 == 'object' && + (clr.effectValue !== this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color) < 0)) || + (type1 != 'object' && this._state.clrtext.indexOf(clr) < 0)) { + + if (typeof(clr) == 'object') { + var isselected = false; + for ( var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue) { + picker.select(clr, true); + isselected = true; + break; + } + } + if (!isselected) picker.clearSelection(); + } else { + picker.select(clr,true); + } + this._state.clrtext = clr; + } + this._state.clrtext_asccolor = color; + }, + + onBold: function(btn, e) { + this._state.bold = undefined; + if (this.api) + this.api.put_TextPrBold(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onItalic: function(btn, e) { + this._state.italic = undefined; + if (this.api) + this.api.put_TextPrItalic(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onTextUnderline: function(btn, e) { + this._state.underline = undefined; + if (this.api) + this.api.put_TextPrUnderline(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onTextStrikeout: function(btn, e) { + this._state.strike = undefined; + if (this.api) + this.api.put_TextPrStrikeout(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onSuperscript: function(btn, e) { + if (!this.documentHolder.btnSubscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + onSubscript: function(btn, e) { + if (!this.documentHolder.btnSuperscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + onSelectFontColor: function(btn, color) { + this._state.clrtext = this._state.clrtext_asccolor = undefined; + + this.documentHolder.btnFontColor.currentColor = color; + this.documentHolder.btnFontColor.setColor((typeof(color) == 'object') ? color.color : color); + + this.documentHolder.mnuFontColorPicker.currentColor = color; + if (this.api) + this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor(color)); + }, + + onBtnFontColor: function() { + this.documentHolder.mnuFontColorPicker.trigger('select', this.documentHolder.mnuFontColorPicker, this.documentHolder.mnuFontColorPicker.currentColor); + }, + + onComboBlur: function() { + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onHideMenus: function(e){ + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onFontNameSelect: function(combo, record) { + if (this.api) { + if (record.isNewFont) { + !Common.Utils.ModalWindow.isVisible() && + Common.UI.warning({ + width: 500, + msg: this.documentHolder.confirmAddFontName, + buttons: ['yes', 'no'], + primary: 'yes', + callback: _.bind(function(btn) { + if (btn == 'yes') { + this.api.put_TextPrFontName(record.name); + } else { + this.documentHolder.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()); + } + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, this) + }); + } else { + this.api.put_TextPrFontName(record.name); + } + } + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onComboOpen: function(needfocus, combo, e, params) { + if (params && params.fromKeyDown) return; + _.delay(function() { + var input = $('input', combo.cmpEl).select(); + if (needfocus) input.focus(); + else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); }); + }, 10); + }, + + onFontSizeSelect: function(combo, record) { + this._state.fontsize = undefined; + if (this.api) + this.api.put_TextPrFontSize(record.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onFontSizeChanged: function(before, combo, record, e) { + var value, + me = this; + + if (before) { + var item = combo.store.findWhere({ + displayValue: record.value + }); + + if (!item) { + value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); + + if (!value) { + value = this._getApiTextSize(); + setTimeout(function(){ + Common.UI.warning({ + msg: me.textFontSizeErr, + callback: function() { + _.defer(function(btn) { + $('input', combo.cmpEl).focus(); + }) + } + }); + }, 1); + combo.setRawValue(value); + e.preventDefault(); + return false; + } + } + } else { + value = Common.Utils.String.parseFloat(record.value); + value = value > 300 ? 300 : + value < 1 ? 1 : Math.floor((value+0.4)*2)/2; + + combo.setRawValue(value); + + this._state.fontsize = undefined; + if (this.api) { + this.api.put_TextPrFontSize(value); + } + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + onCountPages: function(count) { + this.documentHolder && (this.documentHolder._pagesCount = count); + }, + + onNewPage: function() { + this.api && this.api.asc_AddPage(); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onDeletePage: function() { + this.api && this.api.asc_RemovePage(); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onRotatePage: function(angle) { + this.api && this.api.asc_RotatePage(angle); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + clearSelection: function() { + this.onHideMathTrack(); + this.onHideTextBar(); + }, + editComplete: function() { this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder); } diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js new file mode 100644 index 0000000000..f8459dd99e --- /dev/null +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -0,0 +1,1500 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * InsTab.js + * + * Created by Julia Radzhabova on 12.03.2024 + * Copyright (c) 2024 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core', + 'pdfeditor/main/app/view/InsTab', + 'pdfeditor/main/app/collection/ShapeGroups', + 'pdfeditor/main/app/collection/EquationGroups' +], function () { + 'use strict'; + + PDFE.Controllers.InsTab = Backbone.Controller.extend(_.extend({ + models : [], + collections : [ + 'ShapeGroups', + 'EquationGroups' + ], + views : [ + 'InsTab' + ], + sdkViewName : '#id_main', + + initialize: function () { + }, + + onLaunch: function () { + this._state = {}; + + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); + + this.binding = { + checkInsertAutoshape: _.bind(this.checkInsertAutoshape, this) + }; + PDFE.getCollection('ShapeGroups').bind({ + reset: this.onResetAutoshapes.bind(this) + }); + }, + + setApi: function (api) { + if (api) { + this.api = api; + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this)); //for shapes + this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); + // this.api.asc_registerCallback('asc_onBeginSmartArtPreview', _.bind(this.onApiBeginSmartArtPreview, this)); + // this.api.asc_registerCallback('asc_onAddSmartArtPreview', _.bind(this.onApiAddSmartArtPreview, this)); + // this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); + this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); + Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); + Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); + } + return this; + }, + + setConfig: function(config) { + this.mode = config.mode; + this.toolbar = config.toolbar; + this.view = this.createView('InsTab', { + toolbar: this.toolbar.toolbar, + mode: this.mode, + compactToolbar: this.toolbar.toolbar.isCompactView + }); + this.addListeners({ + 'InsTab': { + 'insert:image' : this.onInsertImageClick.bind(this), + 'insert:text-btn' : this.onBtnInsertTextClick.bind(this), + 'insert:text-menu' : this.onMenuInsertTextClick.bind(this), + 'insert:textart' : this.onInsertTextart.bind(this), + 'insert:shape' : this.onInsertShape.bind(this), + 'insert:page' : this.onAddPage.bind(this), + 'insert:chart' : this.onSelectChart, + // 'insert:header' : this.onEditHeaderClick, + 'insert:hyperlink' : this.onHyperlinkClick, + 'insert:table' : this.onInsertTableClick, + 'insert:equation' : this.onInsertEquationClick, + 'insert:symbol' : this.onInsertSymbolClick, + // 'insert:smartart' : this.onInsertSmartArt, + // 'smartart:mouseenter': this.mouseenterSmartArt, + // 'smartart:mouseleave': this.mouseleaveSmartArt, + } + }); + }, + + SetDisabled: function(state) { + this.view && this.view.SetDisabled(state); + }, + + createToolbarPanel: function() { + return this.view.getPanel(); + }, + + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); + }, + + onCoAuthoringDisconnect: function() { + Common.Utils.lockControls(Common.enumLock.lostConnect, true, {array: this.view.lockedControls}); + }, + + onAppReady: function (config) { + var me = this; + if (me.view && config.isPDFEdit) { + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + me.view.onAppReady(config); + me.view.setEvents(); + me.onApiMathTypes(); + }); + } + }, + + onDocumentReady: function() { + if (this.mode && this.mode.isPDFEdit) { + var shapes = this.api.asc_getPropertyEditorShapes(); + shapes && this.fillAutoShapes(shapes[0], shapes[1]); + + // this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.mode, customization: this.mode.customization}); + // this.getApplication().getController('Common.Controllers.ExternalOleEditor').setApi(this.api).loadConfig({config:this.mode, customization: this.mode.customization}); + + Common.Utils.lockControls(Common.enumLock.disableOnStart, false, {array: this.view.lockedControls}); + } + }, + + initNames: function() { + this.shapeGroupNames = [ + this.txtBasicShapes, + this.txtFiguredArrows, + this.txtMath, + this.txtCharts, + this.txtStarsRibbons, + this.txtCallouts, + this.txtButtons, + this.txtRectangles, + this.txtLines + ]; + }, + + fillAutoShapes: function(groupNames, shapes){ + if (_.isEmpty(shapes) || _.isEmpty(groupNames) || shapes.length != groupNames.length) + return; + + this.initNames(); + + var me = this, + shapegrouparray = [], + name_arr = {}; + + _.each(groupNames, function(groupName, index){ + var store = new Backbone.Collection([], { + model: PDFE.Models.ShapeModel + }), + arr = []; + + var cols = (shapes[index].length) > 18 ? 7 : 6, + height = Math.ceil(shapes[index].length/cols) * 35 + 3, + width = 30 * cols; + + _.each(shapes[index], function(shape, idx){ + var name = me['txtShape_' + shape.Type]; + arr.push({ + data : {shapeType: shape.Type}, + tip : name || (me.textShape + ' ' + (idx+1)), + allowSelected : true, + selected: false + }); + if (name) + name_arr[shape.Type] = name; + }); + store.add(arr); + shapegrouparray.push({ + groupName : me.shapeGroupNames[index], + groupStore : store, + groupWidth : width, + groupHeight : height + }); + }); + + this.getCollection('ShapeGroups').reset(shapegrouparray); + this.api.asc_setShapeNames(name_arr); + }, + + checkInsertAutoshape: function(e) { + var cmp = $(e.target), + cmp_sdk = cmp.closest('#editor_sdk'), + btn_id = cmp.closest('button').attr('id'), + me = this; + if (btn_id===undefined) + btn_id = cmp.closest('.btn-group').attr('id'); + if (btn_id===undefined) + btn_id = cmp.closest('.combo-dataview').attr('id'); + + if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) { + if ( this.view.btnsInsertText.pressed() && !this.view.btnsInsertText.contains(btn_id) || + this.view.btnsInsertShape.pressed() && !this.view.btnsInsertShape.contains(btn_id) || + this.view.cmbInsertShape.isComboViewRecActive() && this.view.cmbInsertShape.id !== btn_id) + { + this._isAddingShape = false; + + this._addAutoshape(false); + this.view.btnsInsertShape.toggle(false, true); + this.view.btnsInsertText.toggle(false, true); + this.view.cmbInsertShape.deactivateRecords(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + } else + if ( this.view.btnsInsertShape.pressed() && this.view.btnsInsertShape.contains(btn_id) ) { + _.defer(function(){ + me.api.StartAddShape('', false); + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + }, 100); + } + } + }, + + onApiEndAddShape: function() { + this.view.fireEvent('insertshape', this.view); + + if ( this.view.btnsInsertShape.pressed() ) + this.view.btnsInsertShape.toggle(false, true); + + if ( this.view.btnsInsertText.pressed() ) { + this.view.btnsInsertText.toggle(false, true); + this.view.btnsInsertText.forEach(function(button) { + button.menu.clearAll(); + }); + } + + if ( this.view.cmbInsertShape.isComboViewRecActive() ) + this.view.cmbInsertShape.deactivateRecords(); + + $(document.body).off('mouseup', this.binding.checkInsertAutoshape); + }, + + _addAutoshape: function(isstart, type) { + if (this.api) { + if (isstart) { + this.api.StartAddShape(type, true); + $(document.body).on('mouseup', this.binding.checkInsertAutoshape); + } else { + this.api.StartAddShape('', false); + $(document.body).off('mouseup', this.binding.checkInsertAutoshape); + } + } + }, + + onResetAutoshapes: function () { + var me = this, + collection = PDFE.getCollection('ShapeGroups'); + var onShowBefore = function(menu) { + me.view.updateAutoshapeMenu(menu, collection); + menu.off('show:before', onShowBefore); + }; + me.view.btnsInsertShape.forEach(function (btn, index) { + btn.menu.on('show:before', onShowBefore); + }); + var onComboShowBefore = function (menu) { + me.view.updateComboAutoshapeMenu(collection); + menu.off('show:before', onComboShowBefore); + } + me.view.cmbInsertShape.openButton.menu.on('show:before', onComboShowBefore); + me.view.cmbInsertShape.fillComboView(collection); + me.view.cmbInsertShape.on('click', function (btn, record, cancel) { + if (cancel) { + me._addAutoshape(false); + return; + } + if (record) { + me.view.cmbInsertShape.updateComboView(record); + me.onInsertShape(record.get('data').shapeType); + } + }); + }, + + onHyperlinkClick: function(btn) { + var me = this, + win, props, text; + + if (me.api){ + + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + props = dlg.getSettings(); + (text!==false) + ? me.api.add_Hyperlink(props) + : me.api.change_Hyperlink(props); + } + + Common.NotificationCenter.trigger('edit:complete', me.view); + }; + + text = me.api.can_AddHyperlink(); + + var _arr = []; + for (var i=0; i0) && this.api.AddImageUrl(data._urls, undefined, data.token);// for loading from storage + Common.component.Analytics.trackEvent('ToolBar', 'Image'); + } + }, + + insertImage: function(data) { // gateway + if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i0) return; + + var me = this, equationsStore = this.getApplication().getCollection('EquationGroups'); + + me.view.btnInsertEquation.menu.removeAll(); + var onShowAfter = function(menu) { + for (var i = 0; i < equationsStore.length; ++i) { + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-equationgroup' + i), + parentMenu: menu.items[i].menu, + store: equationsStore.at(i).get('groupStore'), + scrollAlwaysVisible: true, + itemTemplate: _.template( + '
' + + '
' + + '
') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + + if (me.view.btnsInsertText.pressed()) { + me.view.btnsInsertText.toggle(false, true); + } + if (me.view.btnsInsertShape.pressed()) { + me.view.btnsInsertShape.toggle(false, true); + } + + if (e.type !== 'click') + me.view.btnInsertEquation.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.view, me.view.btnInsertEquation); + Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.view.btnInsertEquation.menu.on('show:after', onShowAfter); + + for (var i = 0; i < equationsStore.length; ++i) { + var equationGroup = equationsStore.at(i); + var menuItem = new Common.UI.MenuItem({ + caption: equationGroup.get('groupName'), + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + { template: _.template('') } + ] + }) + }); + me.view.btnInsertEquation.menu.addItem(menuItem); + } + }, + + onInsertEquationClick: function() { + if (this.api) { + this.api.asc_AddMath(); + Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); + } + Common.NotificationCenter.trigger('edit:complete', this.view, this.view.btnInsertEquation); + }, + + onInsertSymbolClick: function(record) { + if (!this.api) return; + if (record) + this.insertSymbol(record.get('font') , record.get('symbol'), record.get('special')); + else { + var me = this, + selected = me.api.asc_GetSelectedText(), + win = new Common.Views.SymbolTableDialog({ + api: me.api, + lang: me.mode.lang, + type: 1, + special: true, + buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + font: selected && selected.length>0 ? me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined, + symbol: selected && selected.length>0 ? selected.charAt(0) : undefined, + handler: function(dlg, result, settings) { + if (result == 'ok') { + me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter); + } else + Common.NotificationCenter.trigger('edit:complete', me.view); + } + }); + win.show(); + win.on('symbol:dblclick', function(cmp, result, settings) { + me.insertSymbol(settings.font, settings.code, settings.special, settings.speccharacter); + }); + } + }, + + insertSymbol: function(fontRecord, symbol, special, specCharacter){ + var font = fontRecord ? fontRecord: this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(); + this.api.asc_insertSymbol(font, symbol, special); + !specCharacter && this.view.saveSymbol(symbol, font); + }, + + onApiMathTypes: function(equation) { + var me = this; + var onShowBefore = function(menu) { + var equationTemp = me.getApplication().getController('Toolbar')._equationTemp; + me.onMathTypes(equationTemp); + if (equationTemp && equationTemp.get_Data().length>0) + me.fillEquations(); + me.view.btnInsertEquation.menu.off('show:before', onShowBefore); + }; + me.view.btnInsertEquation.menu.on('show:before', onShowBefore); + }, + + onMathTypes: function(equation) { + var equationgrouparray = [], + equationsStore = this.getCollection('EquationGroups'); + + if (equationsStore.length>0) + return; + + // equations groups + + var c_oAscMathMainTypeStrings = {}; + + // [translate, count cells, scroll] + + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Symbol ] = [this.textSymbols, 11, false, 'svg-icon-symbols']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Fraction ] = [this.textFraction, 4, false, 'svg-icon-fraction']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Script ] = [this.textScript, 4, false, 'svg-icon-script']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Radical ] = [this.textRadical, 4, false, 'svg-icon-radical']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Integral ] = [this.textIntegral, 3, true, 'svg-icon-integral']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LargeOperator] = [this.textLargeOperator, 5, true, 'svg-icon-largeOperator']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Bracket ] = [this.textBracket, 4, true, 'svg-icon-bracket']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Function ] = [this.textFunction, 3, true, 'svg-icon-function']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Accent ] = [this.textAccent, 4, false, 'svg-icon-accent']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LimitLog ] = [this.textLimitAndLog, 3, false, 'svg-icon-limAndLog']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Operator ] = [this.textOperator, 4, false, 'svg-icon-operator']; + c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Matrix ] = [this.textMatrix, 4, true, 'svg-icon-matrix']; + + // equations sub groups + + // equations types + + var translationTable = {}, name = '', translate = ''; + for (name in Common.define.c_oAscMathType) { + if (Common.define.c_oAscMathType.hasOwnProperty(name)) { + var arr = name.split('_'); + if (arr.length==2 && arr[0]=='Symbol') { + translate = 'txt' + arr[0] + '_' + arr[1].toLocaleLowerCase(); + } else + translate = 'txt' + name; + translationTable[Common.define.c_oAscMathType[name]] = this[translate]; + } + } + var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data; + + if (equation) { + data = equation.get_Data(); + count = data.length; + if (count) { + for (var j = 0; j < count; ++j) { + var group = data[j]; + id = group.get_Id(); + width = group.get_W(); + height = group.get_H(); + + store = new Backbone.Collection([], { + model: PDFE.Models.EquationModel + }); + + if (store) { + var allItemsCount = 0, itemsCount = 0, ids = 0, arr = []; + length = group.get_Data().length; + for (i = 0; i < length; ++i) { + eqStore = group.get_Data()[i]; + itemsCount = eqStore.get_Data().length; + for (var p = 0; p < itemsCount; ++p) { + eq = eqStore.get_Data()[p]; + ids = eq.get_Id(); + + translate = ''; + + if (translationTable.hasOwnProperty(ids)) { + translate = translationTable[ids]; + } + arr.push({ + data : {equationType: ids}, + tip : translate, + allowSelected : true, + selected : false, + width : eqStore.get_W(), + height : eqStore.get_H(), + posX : -eq.get_X(), + posY : -eq.get_Y() + }); + } + + allItemsCount += itemsCount; + } + store.add(arr); + width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border + + var normHeight = parseInt(370 / (height + 10)) * (height + 10); + equationgrouparray.push({ + groupName : c_oAscMathMainTypeStrings[id][0], + groupStore : store, + groupWidth : width, + groupHeight : normHeight, + groupHeightStr : c_oAscMathMainTypeStrings[id][2] ? ' height:'+ normHeight +'px!important; ' : '', + groupIcon: c_oAscMathMainTypeStrings[id][3] + }); + } + } + equationsStore.add(equationgrouparray); + // this.fillEquations(); + } + } + }, + + onApiFocusObject: function(selectedObjects) { + var pr, i = -1, type, + paragraph_locked = false, + no_paragraph = true, + in_chart = false; + + while (++i < selectedObjects.length) { + type = selectedObjects[i].get_ObjectType(); + pr = selectedObjects[i].get_ObjectValue(); + + if (type === Asc.c_oAscTypeSelectElement.Paragraph) { + paragraph_locked = pr.get_Locked(); + no_paragraph = false; + } else if (type == Asc.c_oAscTypeSelectElement.Image || type == Asc.c_oAscTypeSelectElement.Shape || type == Asc.c_oAscTypeSelectElement.Chart || type == Asc.c_oAscTypeSelectElement.Table) { + if (type == Asc.c_oAscTypeSelectElement.Table || + type == Asc.c_oAscTypeSelectElement.Shape && !pr.get_FromImage() && !pr.get_FromChart()) { + no_paragraph = false; + } + if (type == Asc.c_oAscTypeSelectElement.Chart) { + in_chart = true; + } + } + } + + // if (in_chart !== this._state.in_chart) { + // this.view.btnInsertChart.updateHint(in_chart ? this.view.tipChangeChart : this.view.tipInsertChart); + // this._state.in_chart = in_chart; + // } + + if (this._state.prcontrolsdisable !== paragraph_locked) { + if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked; + Common.Utils.lockControls(Common.enumLock.paragraphLock, paragraph_locked===true, {array: this.view.lockedControls}); + } + + if (this._state.no_paragraph !== no_paragraph) { + if (this._state.activated) this._state.no_paragraph = no_paragraph; + Common.Utils.lockControls(Common.enumLock.noParagraphSelected, no_paragraph, {array: this.view.lockedControls}); + } + }, + + onApiCanAddHyperlink: function(value) { + if (this._state.can_hyper !== value) { + Common.Utils.lockControls(Common.enumLock.hyperlinkLock, !value, {array: [this.view.btnInsertHyperlink]}); + if (this._state.activated) this._state.can_hyper = value; + } + }, + + txtBasicShapes: 'Basic Shapes', + txtFiguredArrows: 'Figured Arrows', + txtMath: 'Math', + txtCharts: 'Charts', + txtStarsRibbons: 'Stars & Ribbons', + txtCallouts: 'Callouts', + txtButtons: 'Buttons', + txtRectangles: 'Rectangles', + txtLines: 'Lines', + textShape: 'Shape', + txtShape_textRect: 'Text Box', + txtShape_rect: 'Rectangle', + txtShape_ellipse: 'Ellipse', + txtShape_triangle: 'Triangle', + txtShape_rtTriangle: 'Right Triangle', + txtShape_parallelogram: 'Parallelogram', + txtShape_trapezoid: 'Trapezoid', + txtShape_diamond: 'Diamond', + txtShape_pentagon: 'Pentagon', + txtShape_hexagon: 'Hexagon', + txtShape_heptagon: 'Heptagon', + txtShape_octagon: 'Octagon', + txtShape_decagon: 'Decagon', + txtShape_dodecagon: 'Dodecagon', + txtShape_pie: 'Pie', + txtShape_chord: 'Chord', + txtShape_teardrop: 'Teardrop', + txtShape_frame: 'Frame', + txtShape_halfFrame: 'Half Frame', + txtShape_corner: 'Corner', + txtShape_diagStripe: 'Diagonal Stripe', + txtShape_plus: 'Plus', + txtShape_plaque: 'Sign', + txtShape_can: 'Can', + txtShape_cube: 'Cube', + txtShape_bevel: 'Bevel', + txtShape_donut: 'Donut', + txtShape_noSmoking: '"No" Symbol', + txtShape_blockArc: 'Block Arc', + txtShape_foldedCorner: 'Folded Corner', + txtShape_smileyFace: 'Smiley Face', + txtShape_heart: 'Heart', + txtShape_lightningBolt: 'Lightning Bolt', + txtShape_sun: 'Sun', + txtShape_moon: 'Moon', + txtShape_cloud: 'Cloud', + txtShape_arc: 'Arc', + txtShape_bracePair: 'Double Brace', + txtShape_leftBracket: 'Left Bracket', + txtShape_rightBracket: 'Right Bracket', + txtShape_leftBrace: 'Left Brace', + txtShape_rightBrace: 'Right Brace', + txtShape_rightArrow: 'Right Arrow', + txtShape_leftArrow: 'Left Arrow', + txtShape_upArrow: 'Up Arrow', + txtShape_downArrow: 'Down Arrow', + txtShape_leftRightArrow: 'Left Right Arrow', + txtShape_upDownArrow: 'Up Down Arrow', + txtShape_quadArrow: 'Quad Arrow', + txtShape_leftRightUpArrow: 'Left Right Up Arrow', + txtShape_bentArrow: 'Bent Arrow', + txtShape_uturnArrow: 'U-Turn Arrow', + txtShape_leftUpArrow: 'Left Up Arrow', + txtShape_bentUpArrow: 'Bent Up Arrow', + txtShape_curvedRightArrow: 'Curved Right Arrow', + txtShape_curvedLeftArrow: 'Curved Left Arrow', + txtShape_curvedUpArrow: 'Curved Up Arrow', + txtShape_curvedDownArrow: 'Curved Down Arrow', + txtShape_stripedRightArrow: 'Striped Right Arrow', + txtShape_notchedRightArrow: 'Notched Right Arrow', + txtShape_homePlate: 'Pentagon', + txtShape_chevron: 'Chevron', + txtShape_rightArrowCallout: 'Right Arrow Callout', + txtShape_downArrowCallout: 'Down Arrow Callout', + txtShape_leftArrowCallout: 'Left Arrow Callout', + txtShape_upArrowCallout: 'Up Arrow Callout', + txtShape_leftRightArrowCallout: 'Left Right Arrow Callout', + txtShape_quadArrowCallout: 'Quad Arrow Callout', + txtShape_circularArrow: 'Circular Arrow', + txtShape_mathPlus: 'Plus', + txtShape_mathMinus: 'Minus', + txtShape_mathMultiply: 'Multiply', + txtShape_mathDivide: 'Division', + txtShape_mathEqual: 'Equal', + txtShape_mathNotEqual: 'Not Equal', + txtShape_flowChartProcess: 'Flowchart: Process', + txtShape_flowChartAlternateProcess: 'Flowchart: Alternate Process', + txtShape_flowChartDecision: 'Flowchart: Decision', + txtShape_flowChartInputOutput: 'Flowchart: Data', + txtShape_flowChartPredefinedProcess: 'Flowchart: Predefined Process', + txtShape_flowChartInternalStorage: 'Flowchart: Internal Storage', + txtShape_flowChartDocument: 'Flowchart: Document', + txtShape_flowChartMultidocument: 'Flowchart: Multidocument ', + txtShape_flowChartTerminator: 'Flowchart: Terminator', + txtShape_flowChartPreparation: 'Flowchart: Preparation', + txtShape_flowChartManualInput: 'Flowchart: Manual Input', + txtShape_flowChartManualOperation: 'Flowchart: Manual Operation', + txtShape_flowChartConnector: 'Flowchart: Connector', + txtShape_flowChartOffpageConnector: 'Flowchart: Off-page Connector', + txtShape_flowChartPunchedCard: 'Flowchart: Card', + txtShape_flowChartPunchedTape: 'Flowchart: Punched Tape', + txtShape_flowChartSummingJunction: 'Flowchart: Summing Junction', + txtShape_flowChartOr: 'Flowchart: Or', + txtShape_flowChartCollate: 'Flowchart: Collate', + txtShape_flowChartSort: 'Flowchart: Sort', + txtShape_flowChartExtract: 'Flowchart: Extract', + txtShape_flowChartMerge: 'Flowchart: Merge', + txtShape_flowChartOnlineStorage: 'Flowchart: Stored Data', + txtShape_flowChartDelay: 'Flowchart: Delay', + txtShape_flowChartMagneticTape: 'Flowchart: Sequential Access Storage', + txtShape_flowChartMagneticDisk: 'Flowchart: Magnetic Disk', + txtShape_flowChartMagneticDrum: 'Flowchart: Direct Access Storage', + txtShape_flowChartDisplay: 'Flowchart: Display', + txtShape_irregularSeal1: 'Explosion 1', + txtShape_irregularSeal2: 'Explosion 2', + txtShape_star4: '4-Point Star', + txtShape_star5: '5-Point Star', + txtShape_star6: '6-Point Star', + txtShape_star7: '7-Point Star', + txtShape_star8: '8-Point Star', + txtShape_star10: '10-Point Star', + txtShape_star12: '12-Point Star', + txtShape_star16: '16-Point Star', + txtShape_star24: '24-Point Star', + txtShape_star32: '32-Point Star', + txtShape_ribbon2: 'Up Ribbon', + txtShape_ribbon: 'Down Ribbon', + txtShape_ellipseRibbon2: 'Curved Up Ribbon', + txtShape_ellipseRibbon: 'Curved Down Ribbon', + txtShape_verticalScroll: 'Vertical Scroll', + txtShape_horizontalScroll: 'Horizontal Scroll', + txtShape_wave: 'Wave', + txtShape_doubleWave: 'Double Wave', + txtShape_wedgeRectCallout: 'Rectangular Callout', + txtShape_wedgeRoundRectCallout: 'Rounded Rectangular Callout', + txtShape_wedgeEllipseCallout: 'Oval Callout', + txtShape_cloudCallout: 'Cloud Callout', + txtShape_borderCallout1: 'Line Callout 1', + txtShape_borderCallout2: 'Line Callout 2', + txtShape_borderCallout3: 'Line Callout 3', + txtShape_accentCallout1: 'Line Callout 1 (Accent Bar)', + txtShape_accentCallout2: 'Line Callout 2 (Accent Bar)', + txtShape_accentCallout3: 'Line Callout 3 (Accent Bar)', + txtShape_callout1: 'Line Callout 1 (No Border)', + txtShape_callout2: 'Line Callout 2 (No Border)', + txtShape_callout3: 'Line Callout 3 (No Border)', + txtShape_accentBorderCallout1: 'Line Callout 1 (Border and Accent Bar)', + txtShape_accentBorderCallout2: 'Line Callout 2 (Border and Accent Bar)', + txtShape_accentBorderCallout3: 'Line Callout 3 (Border and Accent Bar)', + txtShape_actionButtonBackPrevious: 'Back or Previous Button', + txtShape_actionButtonForwardNext: 'Forward or Next Button', + txtShape_actionButtonBeginning: 'Beginning Button', + txtShape_actionButtonEnd: 'End Button', + txtShape_actionButtonHome: 'Home Button', + txtShape_actionButtonInformation: 'Information Button', + txtShape_actionButtonReturn: 'Return Button', + txtShape_actionButtonMovie: 'Movie Button', + txtShape_actionButtonDocument: 'Document Button', + txtShape_actionButtonSound: 'Sound Button', + txtShape_actionButtonHelp: 'Help Button', + txtShape_actionButtonBlank: 'Blank Button', + txtShape_roundRect: 'Round Corner Rectangle', + txtShape_snip1Rect: 'Snip Single Corner Rectangle', + txtShape_snip2SameRect: 'Snip Same Side Corner Rectangle', + txtShape_snip2DiagRect: 'Snip Diagonal Corner Rectangle', + txtShape_snipRoundRect: 'Snip and Round Single Corner Rectangle', + txtShape_round1Rect: 'Round Single Corner Rectangle', + txtShape_round2SameRect: 'Round Same Side Corner Rectangle', + txtShape_round2DiagRect: 'Round Diagonal Corner Rectangle', + txtShape_line: 'Line', + txtShape_lineWithArrow: 'Arrow', + txtShape_lineWithTwoArrows: 'Double Arrow', + txtShape_bentConnector5: 'Elbow Connector', + txtShape_bentConnector5WithArrow: 'Elbow Arrow Connector', + txtShape_bentConnector5WithTwoArrows: 'Elbow Double-Arrow Connector', + txtShape_curvedConnector3: 'Curved Connector', + txtShape_curvedConnector3WithArrow: 'Curved Arrow Connector', + txtShape_curvedConnector3WithTwoArrows: 'Curved Double-Arrow Connector', + txtShape_spline: 'Curve', + txtShape_polyline1: 'Scribble', + txtShape_polyline2: 'Freeform', + textSymbols : 'Symbols', + textFraction : 'Fraction', + textScript : 'Script', + textRadical : 'Radical', + textIntegral : 'Integral', + textLargeOperator : 'Large Operator', + textBracket : 'Bracket', + textFunction : 'Function', + textAccent : 'Accent', + textLimitAndLog : 'Limit And Log', + textOperator : 'Operator', + textMatrix : 'Matrix', + + txtSymbol_pm : 'Plus Minus', + txtSymbol_infinity : 'Infinity', + txtSymbol_equals : 'Equal', + txtSymbol_neq : 'Not Equal To', + txtSymbol_about : 'Approximately', + txtSymbol_times : 'Multiplication Sign', + txtSymbol_div : 'Division Sign', + txtSymbol_factorial : 'Factorial', + txtSymbol_propto : 'Proportional To', + txtSymbol_less : 'Less Than', + txtSymbol_ll : 'Much Less Than', + txtSymbol_greater : 'Greater Than', + txtSymbol_gg : 'Much Greater Than', + txtSymbol_leq : 'Less Than or Equal To', + txtSymbol_geq : 'Greater Than or Equal To', + txtSymbol_mp : 'Minus Plus', + txtSymbol_cong : 'Approximately Equal To', + txtSymbol_approx : 'Almost Equal To', + txtSymbol_equiv : 'Identical To', + txtSymbol_forall : 'For All', + txtSymbol_additional : 'Complement', + txtSymbol_partial : 'Partial Differential', + txtSymbol_sqrt : 'Radical Sign', + txtSymbol_cbrt : 'Cube Root', + txtSymbol_qdrt : 'Fourth Root', + txtSymbol_cup : 'Union', + txtSymbol_cap : 'Intersection', + txtSymbol_emptyset : 'Empty Set', + txtSymbol_percent : 'Percentage', + txtSymbol_degree : 'Degrees', + txtSymbol_fahrenheit : 'Degrees Fahrenheit', + txtSymbol_celsius : 'Degrees Celsius', + txtSymbol_inc : 'Increment', + txtSymbol_nabla : 'Nabla', + txtSymbol_exists : 'There Exist', + txtSymbol_notexists : 'There Does Not Exist', + txtSymbol_in : 'Element Of', + txtSymbol_ni : 'Contains as Member', + txtSymbol_leftarrow : 'Left Arrow', + txtSymbol_uparrow : 'Up Arrow', + txtSymbol_rightarrow : 'Right Arrow', + txtSymbol_downarrow : 'Down Arrow', + txtSymbol_leftrightarrow : 'Left-Right Arrow', + txtSymbol_therefore : 'Therefore', + txtSymbol_plus : 'Plus', + txtSymbol_minus : 'Minus', + txtSymbol_not : 'Not Sign', + txtSymbol_ast : 'Asterisk Operator', + txtSymbol_bullet : 'Bulet Operator', + txtSymbol_vdots : 'Vertical Ellipsis', + txtSymbol_cdots : 'Midline Horizontal Ellipsis', + txtSymbol_rddots : 'Up Right Diagonal Ellipsis', + txtSymbol_ddots : 'Down Right Diagonal Ellipsis', + txtSymbol_aleph : 'Alef', + txtSymbol_beth : 'Bet', + txtSymbol_qed : 'End of Proof', + txtSymbol_alpha : 'Alpha', + txtSymbol_beta : 'Beta', + txtSymbol_gamma : 'Gamma', + txtSymbol_delta : 'Delta', + txtSymbol_varepsilon : 'Epsilon Variant', + txtSymbol_epsilon : 'Epsilon', + txtSymbol_zeta : 'Zeta', + txtSymbol_eta : 'Eta', + txtSymbol_theta : 'Theta', + txtSymbol_vartheta : 'Theta Variant', + txtSymbol_iota : 'Iota', + txtSymbol_kappa : 'Kappa', + txtSymbol_lambda : 'Lambda', + txtSymbol_mu : 'Mu', + txtSymbol_nu : 'Nu', + txtSymbol_xsi : 'Xi', + txtSymbol_o : 'Omicron', + txtSymbol_pi : 'Pi', + txtSymbol_varpi : 'Pi Variant', + txtSymbol_rho : 'Rho', + txtSymbol_varrho : 'Rho Variant', + txtSymbol_sigma : 'Sigma', + txtSymbol_varsigma : 'Sigma Variant', + txtSymbol_tau : 'Tau', + txtSymbol_upsilon : 'Upsilon', + txtSymbol_varphi : 'Phi Variant', + txtSymbol_phi : 'Phi', + txtSymbol_chi : 'Chi', + txtSymbol_psi : 'Psi', + txtSymbol_omega : 'Omega', + + txtFractionVertical : 'Stacked Fraction', + txtFractionDiagonal : 'Skewed Fraction', + txtFractionHorizontal : 'Linear Fraction', + txtFractionSmall : 'Small Fraction', + txtFractionDifferential_1 : 'Differential', + txtFractionDifferential_2 : 'Differential', + txtFractionDifferential_3 : 'Differential', + txtFractionDifferential_4 : 'Differential', + txtFractionPi_2 : 'Pi Over 2', + + txtScriptSup : 'Superscript', + txtScriptSub : 'Subscript', + txtScriptSubSup : 'Subscript-Superscript', + txtScriptSubSupLeft : 'Left Subscript-Superscript', + txtScriptCustom_1 : 'Script', + txtScriptCustom_2 : 'Script', + txtScriptCustom_3 : 'Script', + txtScriptCustom_4 : 'Script', + + txtRadicalSqrt : 'Square Root', + txtRadicalRoot_n : 'Radical With Degree', + txtRadicalRoot_2 : 'Square Root With Degree', + txtRadicalRoot_3 : 'Cubic Root', + txtRadicalCustom_1 : 'Radical', + txtRadicalCustom_2 : 'Radical', + + txtIntegral : 'Integral', + txtIntegralSubSup : 'Integral', + txtIntegralCenterSubSup : 'Integral', + txtIntegralDouble : 'Double Integral', + txtIntegralDoubleSubSup : 'Double Integral', + txtIntegralDoubleCenterSubSup : 'Double Integral', + txtIntegralTriple : 'Triple Integral', + txtIntegralTripleSubSup : 'Triple Integral', + txtIntegralTripleCenterSubSup : 'Triple Integral', + txtIntegralOriented : 'Contour Integral', + txtIntegralOrientedSubSup : 'Contour Integral', + txtIntegralOrientedCenterSubSup : 'Contour Integral', + txtIntegralOrientedDouble : 'Surface Integral', + txtIntegralOrientedDoubleSubSup : 'Surface Integral', + txtIntegralOrientedDoubleCenterSubSup : 'Surface Integral', + txtIntegralOrientedTriple : 'Volume Integral', + txtIntegralOrientedTripleSubSup : 'Volume Integral', + txtIntegralOrientedTripleCenterSubSup : 'Volume Integral', + txtIntegral_dx : 'Differential x', + txtIntegral_dy : 'Differential y', + txtIntegral_dtheta : 'Differential theta', + + txtLargeOperator_Sum : 'Summation', + txtLargeOperator_Sum_CenterSubSup : 'Summation', + txtLargeOperator_Sum_SubSup : 'Summation', + txtLargeOperator_Sum_CenterSub : 'Summation', + txtLargeOperator_Sum_Sub : 'Summation', + txtLargeOperator_Prod : 'Product', + txtLargeOperator_Prod_CenterSubSup : 'Product', + txtLargeOperator_Prod_SubSup : 'Product', + txtLargeOperator_Prod_CenterSub : 'Product', + txtLargeOperator_Prod_Sub : 'Product', + txtLargeOperator_CoProd : 'Co-Product', + txtLargeOperator_CoProd_CenterSubSup : 'Co-Product', + txtLargeOperator_CoProd_SubSup : 'Co-Product', + txtLargeOperator_CoProd_CenterSub : 'Co-Product', + txtLargeOperator_CoProd_Sub : 'Co-Product', + txtLargeOperator_Union : 'Union', + txtLargeOperator_Union_CenterSubSup : 'Union', + txtLargeOperator_Union_SubSup : 'Union', + txtLargeOperator_Union_CenterSub : 'Union', + txtLargeOperator_Union_Sub : 'Union', + txtLargeOperator_Intersection : 'Intersection', + txtLargeOperator_Intersection_CenterSubSup : 'Intersection', + txtLargeOperator_Intersection_SubSup : 'Intersection', + txtLargeOperator_Intersection_CenterSub : 'Intersection', + txtLargeOperator_Intersection_Sub : 'Intersection', + txtLargeOperator_Disjunction : 'Vee', + txtLargeOperator_Disjunction_CenterSubSup : 'Vee', + txtLargeOperator_Disjunction_SubSup : 'Vee', + txtLargeOperator_Disjunction_CenterSub : 'Vee', + txtLargeOperator_Disjunction_Sub : 'Vee', + txtLargeOperator_Conjunction : 'Wedge', + txtLargeOperator_Conjunction_CenterSubSup : 'Wedge', + txtLargeOperator_Conjunction_SubSup : 'Wedge', + txtLargeOperator_Conjunction_CenterSub : 'Wedge', + txtLargeOperator_Conjunction_Sub : 'Wedge', + txtLargeOperator_Custom_1 : 'Summation', + txtLargeOperator_Custom_2 : 'Summation', + txtLargeOperator_Custom_3 : 'Summation', + txtLargeOperator_Custom_4 : 'Product', + txtLargeOperator_Custom_5 : 'Union', + + txtBracket_Round : 'Brackets', + txtBracket_Square : 'Brackets', + txtBracket_Curve : 'Brackets', + txtBracket_Angle : 'Brackets', + txtBracket_LowLim : 'Brackets', + txtBracket_UppLim : 'Brackets', + txtBracket_Line : 'Brackets', + txtBracket_LineDouble : 'Brackets', + txtBracket_Square_OpenOpen : 'Brackets', + txtBracket_Square_CloseClose : 'Brackets', + txtBracket_Square_CloseOpen : 'Brackets', + txtBracket_SquareDouble : 'Brackets', + + txtBracket_Round_Delimiter_2 : 'Brackets with Separators', + txtBracket_Curve_Delimiter_2 : 'Brackets with Separators', + txtBracket_Angle_Delimiter_2 : 'Brackets with Separators', + txtBracket_Angle_Delimiter_3 : 'Brackets with Separators', + txtBracket_Round_OpenNone : 'Single Bracket', + txtBracket_Round_NoneOpen : 'Single Bracket', + txtBracket_Square_OpenNone : 'Single Bracket', + txtBracket_Square_NoneOpen : 'Single Bracket', + txtBracket_Curve_OpenNone : 'Single Bracket', + txtBracket_Curve_NoneOpen : 'Single Bracket', + txtBracket_Angle_OpenNone : 'Single Bracket', + txtBracket_Angle_NoneOpen : 'Single Bracket', + txtBracket_LowLim_OpenNone : 'Single Bracket', + txtBracket_LowLim_NoneNone : 'Single Bracket', + txtBracket_UppLim_OpenNone : 'Single Bracket', + txtBracket_UppLim_NoneOpen : 'Single Bracket', + txtBracket_Line_OpenNone : 'Single Bracket', + txtBracket_Line_NoneOpen : 'Single Bracket', + txtBracket_LineDouble_OpenNone : 'Single Bracket', + txtBracket_LineDouble_NoneOpen : 'Single Bracket', + txtBracket_SquareDouble_OpenNone : 'Single Bracket', + txtBracket_SquareDouble_NoneOpen : 'Single Bracket', + txtBracket_Custom_1 : 'Case (Two Conditions)', + txtBracket_Custom_2 : 'Cases (Three Conditions)', + txtBracket_Custom_3 : 'Stack Object', + txtBracket_Custom_4 : 'Stack Object', + txtBracket_Custom_5 : 'Cases Example', + txtBracket_Custom_6 : 'Binomial Coefficient', + txtBracket_Custom_7 : 'Binomial Coefficient', + + txtFunction_Sin : 'Sine Function', + txtFunction_Cos : 'Cosine Function', + txtFunction_Tan : 'Tangent Function', + txtFunction_Csc : 'Cosecant Function', + txtFunction_Sec : 'Secant Function', + txtFunction_Cot : 'Cotangent Function', + txtFunction_1_Sin : 'Inverse Sine Function', + txtFunction_1_Cos : 'Inverse Cosine Function', + txtFunction_1_Tan : 'Inverse Tangent Function', + txtFunction_1_Csc : 'Inverse Cosecant Function', + txtFunction_1_Sec : 'Inverse Secant Function', + txtFunction_1_Cot : 'Inverse Cotangent Function', + txtFunction_Sinh : 'Hyperbolic Sine Function', + txtFunction_Cosh : 'Hyperbolic Cosine Function', + txtFunction_Tanh : 'Hyperbolic Tangent Function', + txtFunction_Csch : 'Hyperbolic Cosecant Function', + txtFunction_Sech : 'Hyperbolic Secant Function', + txtFunction_Coth : 'Hyperbolic Cotangent Function', + txtFunction_1_Sinh : 'Hyperbolic Inverse Sine Function', + txtFunction_1_Cosh : 'Hyperbolic Inverse Cosine Function', + txtFunction_1_Tanh : 'Hyperbolic Inverse Tangent Function', + txtFunction_1_Csch : 'Hyperbolic Inverse Cosecant Function', + txtFunction_1_Sech : 'Hyperbolic Inverse Secant Function', + txtFunction_1_Coth : 'Hyperbolic Inverse Cotangent Function', + txtFunction_Custom_1 : 'Sine theta', + txtFunction_Custom_2 : 'Cos 2x', + txtFunction_Custom_3 : 'Tangent formula', + + txtAccent_Dot : 'Dot', + txtAccent_DDot : 'Double Dot', + txtAccent_DDDot : 'Triple Dot', + txtAccent_Hat : 'Hat', + txtAccent_Check : 'Check', + txtAccent_Accent : 'Acute', + txtAccent_Grave : 'Grave', + txtAccent_Smile : 'Breve', + txtAccent_Tilde : 'Tilde', + txtAccent_Bar : 'Bar', + txtAccent_DoubleBar : 'Double Overbar', + txtAccent_CurveBracketTop : 'Overbrace', + txtAccent_CurveBracketBot : 'Underbrace', + txtAccent_GroupTop : 'Grouping Character Above', + txtAccent_GroupBot : 'Grouping Character Below', + txtAccent_ArrowL : 'Leftwards Arrow Above', + txtAccent_ArrowR : 'Rightwards Arrow Above', + txtAccent_ArrowD : 'Right-Left Arrow Above', + txtAccent_HarpoonL : 'Leftwards Harpoon Above', + txtAccent_HarpoonR : 'Rightwards Harpoon Above', + txtAccent_BorderBox : 'Boxed Formula (With Placeholder)', + txtAccent_BorderBoxCustom : 'Boxed Formula (Example)', + txtAccent_BarTop : 'Overbar', + txtAccent_BarBot : 'Underbar', + txtAccent_Custom_1 : 'Vector A', + txtAccent_Custom_2 : 'ABC With Overbar', + txtAccent_Custom_3 : 'x XOR y With Overbar', + + txtLimitLog_LogBase : 'Logarithm', + txtLimitLog_Log : 'Logarithm', + txtLimitLog_Lim : 'Limit', + txtLimitLog_Min : 'Minimum', + txtLimitLog_Max : 'Maximum', + txtLimitLog_Ln : 'Natural Logarithm', + txtLimitLog_Custom_1 : 'Limit Example', + txtLimitLog_Custom_2 : 'Maximum Example', + + txtOperator_ColonEquals : 'Colon Equal', + txtOperator_EqualsEquals : 'Equal Equal', + txtOperator_PlusEquals : 'Plus Equal', + txtOperator_MinusEquals : 'Minus Equal', + txtOperator_Definition : 'Equal to By Definition', + txtOperator_UnitOfMeasure : 'Measured By', + txtOperator_DeltaEquals : 'Delta Equal To', + txtOperator_ArrowL_Top : 'Leftwards Arrow Above', + txtOperator_ArrowR_Top : 'Rightwards Arrow Above', + txtOperator_ArrowL_Bot : 'Leftwards Arrow Below', + txtOperator_ArrowR_Bot : 'Rightwards Arrow Below', + txtOperator_DoubleArrowL_Top : 'Leftwards Arrow Above', + txtOperator_DoubleArrowR_Top : 'Rightwards Arrow Above', + txtOperator_DoubleArrowL_Bot : 'Leftwards Arrow Below', + txtOperator_DoubleArrowR_Bot : 'Rightwards Arrow Below', + txtOperator_ArrowD_Top : 'Right-Left Arrow Above', + txtOperator_ArrowD_Bot : 'Right-Left Arrow Above', + txtOperator_DoubleArrowD_Top : 'Right-Left Arrow Below', + txtOperator_DoubleArrowD_Bot : 'Right-Left Arrow Below', + txtOperator_Custom_1 : 'Yileds', + txtOperator_Custom_2 : 'Delta Yields', + + txtMatrix_1_2 : '1x2 Empty Matrix', + txtMatrix_2_1 : '2x1 Empty Matrix', + txtMatrix_1_3 : '1x3 Empty Matrix', + txtMatrix_3_1 : '3x1 Empty Matrix', + txtMatrix_2_2 : '2x2 Empty Matrix', + txtMatrix_2_3 : '2x3 Empty Matrix', + txtMatrix_3_2 : '3x2 Empty Matrix', + txtMatrix_3_3 : '3x3 Empty Matrix', + txtMatrix_Dots_Center : 'Midline Dots', + txtMatrix_Dots_Baseline : 'Baseline Dots', + txtMatrix_Dots_Vertical : 'Vertical Dots', + txtMatrix_Dots_Diagonal : 'Diagonal Dots', + txtMatrix_Identity_2 : '2x2 Identity Matrix', + txtMatrix_Identity_2_NoZeros : '3x3 Identity Matrix', + txtMatrix_Identity_3 : '3x3 Identity Matrix', + txtMatrix_Identity_3_NoZeros : '3x3 Identity Matrix', + txtMatrix_2_2_RoundBracket : 'Empty Matrix with Brackets', + txtMatrix_2_2_SquareBracket : 'Empty Matrix with Brackets', + txtMatrix_2_2_LineBracket : 'Empty Matrix with Brackets', + txtMatrix_2_2_DLineBracket : 'Empty Matrix with Brackets', + txtMatrix_Flat_Round : 'Sparse Matrix', + txtMatrix_Flat_Square : 'Sparse Matrix', + + }, PDFE.Controllers.InsTab || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 75d8ea42ae..5da4abccbb 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -46,10 +46,10 @@ define([ 'common/main/lib/component/LoadMask', 'common/main/lib/component/Tooltip', 'common/main/lib/controller/Fonts', + 'common/main/lib/collection/TextArt', 'common/main/lib/view/OpenDialog', 'common/main/lib/view/UserNameDialog', 'common/main/lib/util/LocalStorage', - 'pdfeditor/main/app/collection/ShapeGroups', 'common/main/lib/controller/FocusManager', 'common/main/lib/controller/HintManager', 'common/main/lib/controller/LayoutManager', @@ -82,7 +82,7 @@ define([ models: [], collections: [ - 'ShapeGroups' + 'Common.Collections.TextArt', ], views: [], @@ -611,6 +611,7 @@ define([ viewMode: disable, allowSignature: false, statusBar: true, + rightMenu: {clear: !temp, disable: true}, leftMenu: {disable: true, previewMode: true}, fileMenu: {protect: true}, navigation: {disable: !temp, previewMode: true}, @@ -632,6 +633,11 @@ define([ !disable && this.stackDisableActions.pop({type: type}); var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null; + if (options.rightMenu && app.getController('RightMenu')) { + options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection(); + options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowSignature); + } + if (options.statusBar) { app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); } @@ -642,6 +648,7 @@ define([ app.getController('Toolbar').DisableToolbar(disable, options.viewMode, options.reviewMode, options.fillFormMode); } if (options.documentHolder) { + options.documentHolder.clear && app.getController('DocumentHolder').clearSelection(); options.documentHolder.disable && app.getController('DocumentHolder').SetDisabled(disable, options.allowProtect, options.fillFormMode); } if (options.leftMenu) { @@ -757,6 +764,11 @@ define([ this.api.SetMarkerFormat(toolbarView.btnHighlight.options.type, false); toolbarView.btnHighlight.toggle(false, false); } + + if (toolbarView.btnTextHighlightColor && toolbarView.btnTextHighlightColor.pressed && ( !_.isObject(arguments[1]) || arguments[1].id !== 'id-toolbar-btn-text-highlight')) { + this.api.SetMarkerFormat(null, false); + toolbarView.btnTextHighlightColor.toggle(false, false); + } } if (this.api && this.appOptions.isEdit && !toolbarView._state.previewmode) { @@ -764,7 +776,7 @@ define([ forcesave = this.appOptions.forcesave || this.appOptions.canSaveDocumentToBinary, isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.cmpEl.hasClass('notify') : false, isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); + toolbarView.btnSave.setDisabled(isDisabled && this.appOptions.canSaveToFile); } Common.UI.HintManager.clearHints(true); @@ -1044,10 +1056,11 @@ define([ var timer_sl = setTimeout(function(){ toolbarController.createDelayedElements(); - toolbarController.activateControls(); + documentHolderController.applyEditorMode(); if (me.needToUpdateVersion) toolbarController.onApiCoAuthoringDisconnect(); + toolbarController.onApiFocusObject([]); me.api.UpdateInterfaceState(); Common.NotificationCenter.trigger('document:ready', 'main'); @@ -1110,7 +1123,7 @@ define([ if (this.appOptions.isForm) return this.applyLicenseForm(); - if (this.appOptions.canSwitchMode && (this.appOptions.canPDFAnnotate || this.appOptions.canPDFEdit) && + if ((this.appOptions.canPDFAnnotate || this.appOptions.canPDFEdit) && !this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo || this.editorConfig.customization.font && (this.editorConfig.customization.font.size || this.editorConfig.customization.font.name))) { @@ -1209,23 +1222,23 @@ define([ this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable(); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); this.appOptions.isLightVersion = params.asc_getIsLight(); - /** coauthoring begin **/ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; - /** coauthoring end **/ this.appOptions.isOffline = this.api.asc_isOffline(); this.appOptions.canCreateNew = this.appOptions.canCreateNew && !this.appOptions.isOffline && !this.isForm; this.appOptions.isCrypted = this.api.asc_isCrypto(); this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canSwitchMode = !this.appOptions.isXpsViewer && !this.appOptions.isForm && false; // switch between View/pdf comments/pdf edit - this.appOptions.canEdit = !this.appOptions.isXpsViewer && !this.appOptions.isForm; - this.appOptions.isEdit = !this.appOptions.isXpsViewer && !this.appOptions.isForm; - this.appOptions.canPDFEdit = false;//(this.permissions.edit !== false) && this.appOptions.canLicense; + + var pdfEdit = !this.appOptions.isXpsViewer && !this.appOptions.isForm; + this.appOptions.canSwitchMode = pdfEdit; // switch between View/pdf comments/pdf edit + this.appOptions.canEdit = this.appOptions.isEdit = pdfEdit; + + this.appOptions.canCoEditing = false; // TODO: !(this.appOptions.isDesktopApp && this.appOptions.isOffline), switch between pdf comment/ pdf edit when false + this.appOptions.canPDFAnnotate = pdfEdit && this.appOptions.canLicense;// && (this.permissions.comment!== false) || this.appOptions.isDesktopApp && this.appOptions.isOffline; + this.appOptions.isPDFAnnotate = this.appOptions.canPDFAnnotate; // TODO: this.appOptions.isDesktopApp && this.appOptions.isOffline !! online files always open in view mode + this.appOptions.canPDFEdit = pdfEdit && this.appOptions.canLicense;//(this.permissions.edit !== false) || this.appOptions.isDesktopApp && this.appOptions.isOffline; this.appOptions.isPDFEdit = false; // this.appOptions.canPDFEdit && this.editorConfig.mode !== 'view'; !! always open in view mode - this.appOptions.canPDFAnnotate = (this.appOptions.canSwitchMode || !this.appOptions.isXpsViewer && !this.appOptions.isForm && this.appOptions.isDesktopApp && this.appOptions.isOffline) && this.appOptions.canLicense && (this.permissions.comment!== false); - this.appOptions.canPDFAnnotate = this.appOptions.canPDFAnnotate && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); - this.appOptions.isPDFAnnotate = this.appOptions.canPDFAnnotate && this.appOptions.isDesktopApp && this.appOptions.isOffline; // this.appOptions.canPDFAnnotate && !this.appOptions.isPDFEdit && this.editorConfig.mode !== 'view'; !! online files always open in view mode - this.appOptions.canComments = !this.appOptions.isXpsViewer && !this.appOptions.isForm; - this.appOptions.canViewComments = this.appOptions.canComments; + + this.appOptions.canComments = this.appOptions.canViewComments = pdfEdit && !(this.editorConfig.customization && (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !(this.permissions.chat===false || (this.permissions.chat===undefined) && (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat!==undefined) { @@ -1238,7 +1251,6 @@ define([ this.appOptions.buildVersion = params.asc_getBuildVersion(); this.appOptions.canForcesave = this.appOptions.isPDFEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; - this.appOptions.saveAlwaysEnabled = !this.appOptions.isPDFAnnotate; this.appOptions.canEditComments= this.appOptions.isOffline || !this.permissions.editCommentAuthorOnly; this.appOptions.canDeleteComments= this.appOptions.isOffline || !this.permissions.deleteCommentAuthorOnly; if ((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.commentAuthorOnly===true) { @@ -1367,7 +1379,7 @@ define([ onPdfModeChange: function(mode, callback) { if (!this.appOptions.canSwitchMode) return; - if (mode==='comment' || mode==='edit') { + if ((mode==='comment' || mode==='edit') && false) { // TODO: fix when use co-edit if (!this.appOptions.isAnonymousSupport && !!this.appOptions.user.anonymous) { Common.UI.warning({ title: this.notcriticalErrorTitle, @@ -1418,15 +1430,24 @@ define([ } callback && callback(); this.onPdfModeApply(); + var app = this.getApplication(), + toolbar = app.getController('Toolbar'); + toolbar.applyMode(); + app.getController('Viewport').applyEditorMode(); + app.getController('ViewTab').applyEditorMode(); + app.getController('DocumentHolder').applyEditorMode(); + app.getController('LeftMenu').leftMenu.getMenu('file').applyMode(); + toolbar.toolbar.clearActiveData(); + toolbar.toolbar.processPanelVisible(null, true); }, onPdfModeApply: function() { if (!this.api) return; - this._state.fastCoauth = (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) ? Common.Utils.InternalSettings.get("pdfe-settings-coauthmode") : this.appOptions.isForm; + this._state.fastCoauth = (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) && this.appOptions.canSaveToFile ? Common.Utils.InternalSettings.get("pdfe-settings-coauthmode") : this.appOptions.isForm; this.api.asc_SetFastCollaborative(this._state.fastCoauth); - this.api.asc_setAutoSaveGap(this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit ? Common.Utils.InternalSettings.get("pdfe-settings-autosave") : (this.appOptions.isForm ? 1 : 0)); - if (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) { + this.api.asc_setAutoSaveGap((this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) && this.appOptions.canSaveToFile ? Common.Utils.InternalSettings.get("pdfe-settings-autosave") : (this.appOptions.isForm ? 1 : 0)); + if ((this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) && this.appOptions.canSaveToFile) { var value = Common.Utils.InternalSettings.get((this._state.fastCoauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict"); switch(value) { case 'all': value = Asc.c_oAscCollaborativeMarksShowType.All; break; @@ -1445,7 +1466,7 @@ define([ window.editor_elements_prepared = true; var app = this.getApplication(), - viewport = app.getController('Viewport').getView('Viewport'), + viewport = app.getController('Viewport'), statusbarView = app.getController('Statusbar').getView('Statusbar'), documentHolder = app.getController('DocumentHolder'), toolbarController = app.getController('Toolbar'), @@ -1473,37 +1494,25 @@ define([ (value===undefined) && (value = Common.Utils.Metric.getDefaultMetric()); Common.Utils.Metric.setCurrentMetric(value); Common.Utils.InternalSettings.set("pdfe-settings-unit", value); - }, - applyModeEditorElements: function() { - /** coauthoring begin **/ this.contComments.setMode(this.appOptions); this.contComments.setConfig({config: this.editorConfig}, this.api); - /** coauthoring end **/ + + toolbarController.setApi(this.api); + }, + + applyModeEditorElements: function() { var me = this, application = this.getApplication(); // reviewController = application.getController('Common.Controllers.ReviewChanges'); // reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document}); - var toolbarController = application.getController('Toolbar'); - toolbarController && toolbarController.setApi(me.api); - if (this.appOptions.isEdit) { - // var fontsControllers = application.getController('Common.Controllers.Fonts'); - // fontsControllers && fontsControllers.setApi(me.api); - if (me.appOptions.isSignatureSupport || me.appOptions.isPasswordSupport) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - var viewport = this.getApplication().getController('Viewport').getView('Viewport'); - viewport.applyEditorMode(); - - var toolbarView = (toolbarController) ? toolbarController.getView() : null; - if (toolbarView) { - toolbarView.setApi(me.api); - toolbarView.on('editcomplete', _.bind(me.onEditComplete, me)); - } + application.getController('Viewport').applyEditorMode(); var value = Common.Utils.InternalSettings.get("pdfe-settings-unit"); me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); @@ -1591,6 +1600,18 @@ define([ config.msg = this.uploadImageFileCountMessage; break; + case Asc.c_oAscError.ID.SplitCellMaxRows: + config.msg = this.splitMaxRowsErrorText.replace('%1', errData.get_Value()); + break; + + case Asc.c_oAscError.ID.SplitCellMaxCols: + config.msg = this.splitMaxColsErrorText.replace('%1', errData.get_Value()); + break; + + case Asc.c_oAscError.ID.SplitCellRowsDivider: + config.msg = this.splitDividerErrorText.replace('%1', errData.get_Value()); + break; + case Asc.c_oAscError.ID.UplDocumentSize: config.msg = this.uploadDocSizeMessage; break; @@ -1623,6 +1644,18 @@ define([ config.msg = this.errorFilePassProtect; break; + case Asc.c_oAscError.ID.StockChartError: + config.msg = this.errorStockChart; + break; + + case Asc.c_oAscError.ID.DataRangeError: + config.msg = this.errorDataRange; + break; + + case Asc.c_oAscError.ID.Database: + config.msg = this.errorDatabaseConnection; + break; + case Asc.c_oAscError.ID.UserDrop: if (this._state.lostEditingRights) { this._state.lostEditingRights = false; @@ -1681,6 +1714,10 @@ define([ config.maxwidth = 600; break; + case Asc.c_oAscError.ID.ComboSeriesError: + config.msg = this.errorComboSeries; + break; + case Asc.c_oAscError.ID.DirectUrl: config.msg = this.errorDirectUrl; break; @@ -1946,7 +1983,7 @@ define([ var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave || this.appOptions.canSaveDocumentToBinary, isDisabled = !isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); + toolbarView.btnSave.setDisabled(isDisabled && this.appOptions.canSaveToFile); } /** coauthoring begin **/ @@ -1963,7 +2000,7 @@ define([ var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave || this.appOptions.canSaveDocumentToBinary, isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave || !this.appOptions.isPDFEdit && !this.appOptions.isPDFAnnotate; - toolbarView.btnSave.setDisabled(isDisabled && !this.appOptions.saveAlwaysEnabled); + toolbarView.btnSave.setDisabled(isDisabled && this.appOptions.canSaveToFile); } }, @@ -2455,6 +2492,26 @@ define([ } }, + fillTextArt: function(shapes, force){ + var arr = [], + artStore = this.getCollection('Common.Collections.TextArt'); + + if (!shapes && artStore.length>0 || force) {// shapes == undefined when update textart collection (from asc_onSendThemeColors) + shapes = this.api.asc_getTextArtPreviews(); + } + if (_.isEmpty(shapes)) return; + + _.each(shapes, function(shape, index){ + arr.push({ + imageUrl : shape, + data : index, + allowSelected : true, + selected: false + }); + }); + artStore.reset(arr); + }, + onSaveDocumentBinary: function(data) { Common.Gateway.saveDocument(data); }, @@ -2600,6 +2657,13 @@ define([ errorEmailClient: 'No email client could be found', errorTextFormWrongFormat: 'The value entered does not match the format of the field.', txtArt: 'Your text here', + splitMaxRowsErrorText: 'The number of rows must be less than %1', + splitMaxColsErrorText: 'The number of columns must be less than %1', + splitDividerErrorText: 'The number of rows must be a divisor of %1', + errorStockChart: 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.', + errorDataRange: 'Incorrect data range.', + errorDatabaseConnection: 'External error.
Database connection error. Please, contact support.', + errorComboSeries: 'To create a combination chart, select at least two series of data.' } })(), PDFE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/controller/Print.js b/apps/pdfeditor/main/app/controller/Print.js index ce95e8ba5a..611c61e2eb 100644 --- a/apps/pdfeditor/main/app/controller/Print.js +++ b/apps/pdfeditor/main/app/controller/Print.js @@ -348,10 +348,10 @@ define([ handler: function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); - Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin()); - Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin()); - Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin()); - Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin()); + Common.localStorage.setItem("pdfe-pgmargins-top", props.get_TopMargin()); + Common.localStorage.setItem("pdfe-pgmargins-left", props.get_LeftMargin()); + Common.localStorage.setItem("pdfe-pgmargins-bottom", props.get_BottomMargin()); + Common.localStorage.setItem("pdfe-pgmargins-right", props.get_RightMargin()); Common.NotificationCenter.trigger('margins:update', props); me.api.asc_SetSectionProps(props); @@ -369,10 +369,10 @@ define([ onUpdateLastCustomMargins: function(props) { this._state.lastmargins = props; if (this.printSettings.isVisible()) { - var top = props ? props.get_TopMargin() : Common.localStorage.getItem("de-pgmargins-top"), - left = props ? props.get_LeftMargin() : Common.localStorage.getItem("de-pgmargins-left"), - bottom = props ? props.get_BottomMargin() : Common.localStorage.getItem("de-pgmargins-bottom"), - right = props ? props.get_RightMargin() : Common.localStorage.getItem("de-pgmargins-right"); + var top = props ? props.get_TopMargin() : Common.localStorage.getItem("pdfe-pgmargins-top"), + left = props ? props.get_LeftMargin() : Common.localStorage.getItem("pdfe-pgmargins-left"), + bottom = props ? props.get_BottomMargin() : Common.localStorage.getItem("pdfe-pgmargins-bottom"), + right = props ? props.get_RightMargin() : Common.localStorage.getItem("pdfe-pgmargins-right"); if ( top!==null && left!==null && bottom!==null && right!==null ) { var rec = this.printSettings.cmbPaperMargins.store.at(0); if (rec.get('value')===-2) diff --git a/apps/pdfeditor/main/app/controller/RightMenu.js b/apps/pdfeditor/main/app/controller/RightMenu.js new file mode 100644 index 0000000000..181def2fe2 --- /dev/null +++ b/apps/pdfeditor/main/app/controller/RightMenu.js @@ -0,0 +1,456 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * RightMenu.js + * + * Created by Julia Radzhabova on 20/03/24 + * Copyright (c) 2024 Ascensio System SIA. All rights reserved. + * + */ + + +define([ + 'core', + 'pdfeditor/main/app/view/RightMenu' +], function () { + 'use strict'; + + PDFE.Controllers.RightMenu = Backbone.Controller.extend({ + models: [], + collections: [], + views: [ + 'RightMenu' + ], + + initialize: function() { + this.editMode = true; + this._state = {}; + this._initSettings = true; + this._priorityArr = []; + + this.addListeners({ + 'RightMenu': { + 'rightmenuclick': this.onRightMenuClick, + 'button:click': _.bind(this.onBtnCategoryClick, this) + }, + 'ViewTab': { + 'rightmenu:hide': _.bind(this.onRightMenuHide, this) + }, + 'Common.Views.Plugins': { + 'plugins:addtoright': _.bind(this.addNewPlugin, this), + 'pluginsright:open': _.bind(this.openPlugin, this), + 'pluginsright:close': _.bind(this.closePlugin, this), + 'pluginsright:hide': _.bind(this.onHidePlugins, this), + 'pluginsright:updateicons': _.bind(this.updatePluginButtonsIcons, this) + } + }); + }, + + onLaunch: function() { + this.rightmenu = this.createView('RightMenu'); + this.rightmenu.on('render:after', _.bind(this.onRightMenuAfterRender, this)); + }, + + onRightMenuAfterRender: function(rightMenu) { + rightMenu.imageSettings.application = rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication(); + + this._settings = []; + this._settings[Common.Utils.documentSettingsType.Paragraph] = {panelId: "id-paragraph-settings", panel: rightMenu.paragraphSettings,btn: rightMenu.btnText, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Table] = {panelId: "id-table-settings", panel: rightMenu.tableSettings, btn: rightMenu.btnTable, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Image] = {panelId: "id-image-settings", panel: rightMenu.imageSettings, btn: rightMenu.btnImage, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false}; + // this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false}; + // this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false}; + }, + + setApi: function(api) { + this.api = api; + // this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this)); + this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); + }, + + setMode: function(mode) { + this.mode = mode; + }, + + onRightMenuClick: function(menu, type, minimized, event) { + if (!minimized && this.editMode && this.mode.isPDFEdit) { + if (event) { // user click event + var idx = this._priorityArr.indexOf(type); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(type); + } + + var panel = this._settings[type].panel; + var props = this._settings[type].props; + if (props && panel) { + panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.Signature) ? undefined : props); + this.rightmenu.updateScroller(); + } + } + Common.NotificationCenter.trigger('layout:changed', 'rightmenu'); + Common.NotificationCenter.trigger('edit:complete', this.rightmenu) + }, + + onApiFocusObject: function(SelectedObjects) { + this.onFocusObject(SelectedObjects); + }, + + onFocusObject: function(SelectedObjects, forceSignature, forceOpen) { + if (!(this.editMode && this.mode.isPDFEdit) && !forceSignature) + return; + + var open = this._initSettings ? !Common.localStorage.getBool("pdfe-hide-right-settings", this.rightmenu.defaultHideRightMenu) : !!forceOpen; + this._initSettings = false; + + var needhide = true; + for (var i=0; i=this._settings.length || this._settings[settingsType]===undefined) + continue; + + var value = SelectedObjects[i].get_ObjectValue(); + this._settings[settingsType].props = value; + this._settings[settingsType].hidden = 0; + this._settings[settingsType].locked = value.get_Locked(); + if (settingsType == Common.Utils.documentSettingsType.Shape) { + if (value.asc_getIsMotionPath()) { + this._settings[settingsType].hidden = 1; + } else if (value.asc_getTextArtProperties()) { + this._settings[Common.Utils.documentSettingsType.TextArt].props = value; + this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 0; + this._settings[Common.Utils.documentSettingsType.TextArt].locked = value.get_Locked(); + } + } + } + + var lastactive = -1, currentactive, priorityactive = -1, + activePane = this.rightmenu.GetActivePane(); + for (i=0; i0) { + for (i=0; i-1) active = priorityactive; + else if (currentactive>=0) active = currentactive; + else if (lastactive>=0) active = lastactive; + // else if (forceSignature && !this._settings[Common.Utils.documentSettingsType.Signature].hidden) active = Common.Utils.documentSettingsType.Signature; + + if (active !== undefined) { + this.rightmenu.SetActivePane(active, open); + if (active!=Common.Utils.documentSettingsType.Signature) + this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props); + // else + // this._settings[active].panel.ChangeSettings.call(this._settings[active].panel); + (active !== currentactive) && this.rightmenu.updateScroller(); + } else + this.rightmenu.clearSelection(); + } + + this._settings[Common.Utils.documentSettingsType.Image].needShow = false; + // this._settings[Common.Utils.documentSettingsType.Chart].needShow = false; + this._settings[Common.Utils.documentSettingsType.Shape].needShow = false; + }, + + onCoAuthoringDisconnect: function() { + this.SetDisabled(true); + this.editMode = false; + }, + + SetDisabled: function(disabled, allowSignature) { + this.editMode = !disabled; + if (this.rightmenu && this.rightmenu.paragraphSettings) { + this.rightmenu.paragraphSettings.disableControls(disabled); + this.rightmenu.shapeSettings.disableControls(disabled); + this.rightmenu.textartSettings.disableControls(disabled); + this.rightmenu.tableSettings.disableControls(disabled); + this.rightmenu.imageSettings.disableControls(disabled); + // this.rightmenu.chartSettings.disableControls(disabled); + + // if (this.rightmenu.signatureSettings) { + // !allowSignature && this.rightmenu.btnSignature.setDisabled(disabled); + // allowSignature && disabled && this.onFocusObject([], true); // force press signature button + // } + + if (disabled) { + this.rightmenu.btnText.setDisabled(disabled); + this.rightmenu.btnTable.setDisabled(disabled); + this.rightmenu.btnImage.setDisabled(disabled); + this.rightmenu.btnShape.setDisabled(disabled); + this.rightmenu.btnTextArt.setDisabled(disabled); + // this.rightmenu.btnChart.setDisabled(disabled); + this.rightmenu.setDisabledAllMoreMenuItems(disabled); + } else { + var selectedElements = this.api.getSelectedElements(); + if (selectedElements.length > 0) + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("pdfe-hide-right-settings") && + !Common.Utils.InternalSettings.get("pdfe-hidden-rightmenu")); + } + } + }, + + onInsertTable: function() { + // this._settings[Common.Utils.documentSettingsType.Table].needShow = true; + var idx = this._priorityArr.indexOf(Common.Utils.documentSettingsType.Table); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(Common.Utils.documentSettingsType.Table); + }, + + onInsertImage: function() { + // this._settings[Common.Utils.documentSettingsType.Image].needShow = true; + var idx = this._priorityArr.indexOf(Common.Utils.documentSettingsType.Image); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(Common.Utils.documentSettingsType.Image); + }, + + onInsertChart: function() { + // this._settings[Common.Utils.documentSettingsType.Chart].needShow = true; + var idx = this._priorityArr.indexOf(Common.Utils.documentSettingsType.Chart); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(Common.Utils.documentSettingsType.Chart); + }, + + onInsertShape: function() { + // this._settings[Common.Utils.documentSettingsType.Shape].needShow = true; + var idx = this._priorityArr.indexOf(Common.Utils.documentSettingsType.Shape); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(Common.Utils.documentSettingsType.Shape); + }, + + onInsertTextArt: function() { + // this._settings[Common.Utils.documentSettingsType.TextArt].needShow = true; + var idx = this._priorityArr.indexOf(Common.Utils.documentSettingsType.TextArt); + if (idx>=0) + this._priorityArr.splice(idx, 1); + this._priorityArr.unshift(Common.Utils.documentSettingsType.TextArt); + }, + + UpdateThemeColors: function() { + // this.rightmenu.tableSettings.UpdateThemeColors(); + // this.rightmenu.shapeSettings.UpdateThemeColors(); + // this.rightmenu.textartSettings.UpdateThemeColors(); + }, + + updateMetricUnit: function() { + this.rightmenu.paragraphSettings.updateMetricUnit(); + // this.rightmenu.chartSettings.updateMetricUnit(); + this.rightmenu.imageSettings.updateMetricUnit(); + this.rightmenu.tableSettings.updateMetricUnit(); + }, + + createDelayedElements: function() { + if (this.editMode && this.mode.isPDFEdit && this.api) { + this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); + + var selectedElements = this.api.getSelectedElements(); + if (selectedElements.length>0) { + this.onFocusObject(selectedElements); + } + } + this.rightmenu.setButtons(); + this.rightmenu.setMoreButton(); + }, + + onDoubleClickOnObject: function(obj) { + if (!this.editMode || !this.mode.isPDFEdit) return; + + var eltype = obj.get_ObjectType(), + settingsType = this.getDocumentSettingsType(eltype); + if (settingsType===undefined || settingsType>=this._settings.length || this._settings[settingsType]===undefined) + return; + + if (settingsType !== Common.Utils.documentSettingsType.Paragraph) { + this.rightmenu.SetActivePane(settingsType, true); + this._settings[settingsType].panel.ChangeSettings.call(this._settings[settingsType].panel, this._settings[settingsType].props); + this.rightmenu.updateScroller(); + } + }, + + // onApiUpdateSignatures: function(valid){ + // if (!this.rightmenu.signatureSettings) return; + // + // var disabled = (!valid || valid.length<1), + // type = Common.Utils.documentSettingsType.Signature; + // this._settings[type].hidden = disabled ? 1 : 0; + // this._settings[type].btn.setDisabled(disabled); + // this.rightmenu.setDisabledMoreMenuItem(this._settings[type].btn, disabled); + // this._settings[type].panel.setLocked(this._settings[type].locked); + // }, + + getDocumentSettingsType: function(type) { + switch (type) { + case Asc.c_oAscTypeSelectElement.Paragraph: + return Common.Utils.documentSettingsType.Paragraph; + case Asc.c_oAscTypeSelectElement.Table: + return Common.Utils.documentSettingsType.Table; + case Asc.c_oAscTypeSelectElement.Image: + return Common.Utils.documentSettingsType.Image; + case Asc.c_oAscTypeSelectElement.Shape: + return Common.Utils.documentSettingsType.Shape; + case Asc.c_oAscTypeSelectElement.Chart: + return Common.Utils.documentSettingsType.Chart; + } + }, + + onRightMenuHide: function (view, status, preventSave) { + if (this.rightmenu) { + if (!status) { // remember last active pane + var active = this.rightmenu.GetActivePane(), + type; + if (active) { + for (var i=0; i 0) + this.onFocusObject(selectedElements, false, !Common.Utils.InternalSettings.get("pdfe-hide-right-settings")); + this._lastVisibleSettings = undefined; + } + if (!preventSave) { + Common.localStorage.setBool('pdfe-hidden-rightmenu', !status); + Common.Utils.InternalSettings.set("pdfe-hidden-rightmenu", !status); + } + } + + Common.NotificationCenter.trigger('layout:changed', 'main'); + Common.NotificationCenter.trigger('edit:complete', this.rightmenu); + }, + + addNewPlugin: function (button, $button, $panel) { + this.rightmenu.insertButton(button, $button); + this.rightmenu.insertPanel($panel); + }, + + openPlugin: function (guid) { + this.rightmenu.openPlugin(guid); + }, + + closePlugin: function (guid) { + this.rightmenu.closePlugin(guid); + this.rightmenu.onBtnMenuClick(); + Common.NotificationCenter.trigger('layout:changed', 'rightmenu'); + Common.NotificationCenter.trigger('edit:complete', this.rightmenu) + }, + + onHidePlugins: function() { + Common.NotificationCenter.trigger('layout:changed', 'rightmenu'); + }, + + updatePluginButtonsIcons: function (icons) { + this.rightmenu.updatePluginButtonsIcons(icons); + }, + + onBtnCategoryClick: function (btn) { + if (btn.options.type === 'plugin' && !btn.isDisabled()) { + this.rightmenu.onBtnMenuClick(btn); + if (btn.pressed) { + this.rightmenu.fireEvent('plugins:showpanel', [btn.options.value]); // show plugin panel + } else { + this.rightmenu.fireEvent('plugins:hidepanel', [btn.options.value]); + } + Common.NotificationCenter.trigger('layout:changed', 'rightmenu'); + Common.NotificationCenter.trigger('edit:complete', this.rightmenu) + } + }, + }); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/controller/Statusbar.js b/apps/pdfeditor/main/app/controller/Statusbar.js index 161ac27ee3..2a1059d08c 100644 --- a/apps/pdfeditor/main/app/controller/Statusbar.js +++ b/apps/pdfeditor/main/app/controller/Statusbar.js @@ -117,7 +117,7 @@ define([ onChangeCompactView: function (view, status) { this.statusbar.setVisible(!status); - Common.localStorage.setBool('de-hidden-status', status); + Common.localStorage.setBool('pdfe-hidden-status', status); if (view.$el.closest('.btn-slot').prop('id') === 'slot-btn-options') { this.statusbar.fireEvent('view:hide', [this, status]); diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index 9196432e97..2aa8a24238 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -43,6 +43,7 @@ define([ 'core', 'common/main/lib/component/Window', 'common/main/lib/view/CopyWarningDialog', + 'common/main/lib/view/ListSettingsDialog', 'common/main/lib/util/define', 'pdfeditor/main/app/view/Toolbar' ], function () { @@ -68,7 +69,21 @@ define([ clrstrike: undefined, clrunderline: undefined, clrhighlight: undefined, - pageCount: 1 + pageCount: 1, + bullets: {type:undefined, subtype:undefined}, + linespace: undefined, + pralign: undefined, + valign: undefined, + vtextalign: undefined, + bold: undefined, + italic: undefined, + strike: undefined, + underline: undefined, + can_increase: undefined, + can_decrease: undefined, + fontsize: undefined, + textclrhighlight: undefined, + initEditing: true }; this.editMode = true; this.binding = {}; @@ -138,8 +153,6 @@ define([ } }); - var me = this; - Common.NotificationCenter.on('toolbar:collapse', _.bind(function () { this.toolbar.collapse(); }, this)); @@ -161,11 +174,7 @@ define([ this.toolbar.applyLayout(mode); }, - attachUIEvents: function(toolbar) { - /** - * UI Events - */ - var me = this; + attachCommonUIEvents: function(toolbar) { toolbar.btnPrint.on('click', _.bind(this.onPrint, this)); toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled')); toolbar.btnUndo.on('click', _.bind(this.onUndo, this)); @@ -178,7 +187,7 @@ define([ toolbar.btnSelectTool.on('toggle', _.bind(this.onSelectTool, this, 'select')); toolbar.btnHandTool.on('toggle', _.bind(this.onSelectTool, this, 'hand')); toolbar.fieldPages.on('changed:after', _.bind(this.onPagesChanged, this)); - toolbar.fieldPages.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me.toolbar);}); + toolbar.fieldPages.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', toolbar);}); toolbar.fieldPages.cmpEl && toolbar.fieldPages.cmpEl.on('focus', 'input.form-control', function() { setTimeout(function(){toolbar.fieldPages._input && toolbar.fieldPages._input.select();}, 1); }); @@ -189,27 +198,9 @@ define([ this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled()); this.onBtnChangeState('redo:disabled', toolbar.btnRedo, toolbar.btnRedo.isDisabled()); + }, - if (this.mode && this.mode.isEdit) { - toolbar.btnSave.on('click', _.bind(this.tryToSave, this)); - toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this)); - toolbar.btnAddComment.on('click', function (btn, e) { - Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); - }); - toolbar.btnStrikeout.on('click', _.bind(this.onBtnStrikeout, this)); - toolbar.mnuStrikeoutColorPicker.on('select', _.bind(this.onSelectStrikeoutColor, this)); - toolbar.mnuStrikeoutTransparent.on('click', _.bind(this.onStrikeoutTransparentClick, this)); - toolbar.btnUnderline.on('click', _.bind(this.onBtnUnderline, this)); - toolbar.mnuUnderlineColorPicker.on('select', _.bind(this.onSelectUnderlineColor, this)); - toolbar.mnuUnderlineTransparent.on('click', _.bind(this.onUnderlineTransparentClick, this)); - toolbar.btnHighlight.on('click', _.bind(this.onBtnHighlight, this)); - toolbar.mnuHighlightColorPicker.on('select', _.bind(this.onSelectHighlightColor, this)); - toolbar.mnuHighlightTransparent.on('click', _.bind(this.onHighlightTransparentClick, this)); - toolbar.chShowComments.on('change', _.bind(this.onShowCommentsChange, this)); - // toolbar.btnRotate.on('click', _.bind(this.onRotateClick, this)); - Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this)); - Common.NotificationCenter.on('draw:start', _.bind(this.onDrawStart, this)); - } + attachRestrictedEditUIEvents: function(toolbar) { if (this.mode && this.mode.isRestrictedEdit) { toolbar.btnClear.on('click', _.bind(this.onClearClick, this)); toolbar.btnPrevForm.on('click', _.bind(this.onGoToForm, this, 'prev')); @@ -219,36 +210,175 @@ define([ } }, - setApi: function(api) { - this.api = api; + attachPDFAnnotateUIEvents: function(toolbar) { + if (!this.mode || !this.mode.isEdit) return; - if (this.mode.isEdit || this.mode.isRestrictedEdit) { - this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); - this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); - this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); - Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); - } + toolbar.btnSave.on('click', _.bind(this.tryToSave, this)); + toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this)); + toolbar.btnAddComment.on('click', function (btn, e) { + Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); + }); + toolbar.btnStrikeout.on('click', _.bind(this.onBtnStrikeout, this)); + toolbar.mnuStrikeoutColorPicker.on('select', _.bind(this.onSelectStrikeoutColor, this)); + toolbar.mnuStrikeoutTransparent.on('click', _.bind(this.onStrikeoutTransparentClick, this)); + toolbar.btnUnderline.on('click', _.bind(this.onBtnUnderline, this)); + toolbar.mnuUnderlineColorPicker.on('select', _.bind(this.onSelectUnderlineColor, this)); + toolbar.mnuUnderlineTransparent.on('click', _.bind(this.onUnderlineTransparentClick, this)); + toolbar.btnHighlight.on('click', _.bind(this.onBtnHighlight, this)); + toolbar.mnuHighlightColorPicker.on('select', _.bind(this.onSelectHighlightColor, this)); + toolbar.mnuHighlightTransparent.on('click', _.bind(this.onHighlightTransparentClick, this)); + toolbar.chShowComments.on('change', _.bind(this.onShowCommentsChange, this)); + toolbar.btnTextComment.on('click', _.bind(this.onBtnTextCommentClick, this)); + toolbar.btnTextComment.menu.on('item:click', _.bind(this.onMenuTextCommentClick, this)); + // toolbar.btnRotate.on('click', _.bind(this.onRotateClick, this)); + Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this)); + Common.NotificationCenter.on('draw:start', _.bind(this.onDrawStart, this)); + + }, + + attachPDFEditUIEvents: function(toolbar) { + if (!this.mode || !this.mode.isPDFEdit) return; + + toolbar.btnEditText.on('click', _.bind(this.onEditTextClick, this)); + toolbar.btnIncFontSize.on('click', _.bind(this.onIncrease, this)); + toolbar.btnDecFontSize.on('click', _.bind(this.onDecrease, this)); + toolbar.btnBold.on('click', _.bind(this.onBold, this)); + toolbar.btnItalic.on('click', _.bind(this.onItalic, this)); + toolbar.btnTextUnderline.on('click', _.bind(this.onTextUnderline, this)); + toolbar.btnTextStrikeout.on('click', _.bind(this.onTextStrikeout, this)); + toolbar.btnSuperscript.on('click', _.bind(this.onSuperscript, this)); + toolbar.btnSubscript.on('click', _.bind(this.onSubscript, this)); + toolbar.btnHorizontalAlign.menu.on('item:click', _.bind(this.onMenuHorizontalAlignSelect, this)); + toolbar.btnVerticalAlign.menu.on('item:click', _.bind(this.onMenuVerticalAlignSelect, this)); + toolbar.btnDecLeftOffset.on('click', _.bind(this.onDecOffset, this)); + toolbar.btnIncLeftOffset.on('click', _.bind(this.onIncOffset, this)); + toolbar.mnuChangeCase.on('item:click', _.bind(this.onChangeCase, this)); + toolbar.btnMarkers.on('click', _.bind(this.onMarkers, this)); + toolbar.btnNumbers.on('click', _.bind(this.onNumbers, this)); + toolbar.mnuMarkerSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 0)); + toolbar.mnuNumberSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 1)); + toolbar.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); + toolbar.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); + toolbar.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); + toolbar.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this)); + toolbar.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + toolbar.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this)); + toolbar.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true)); + toolbar.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false)); + toolbar.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true)); + toolbar.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this)); + toolbar.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this)); + toolbar.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false)); + toolbar.mnuMarkersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnMarkers)); + toolbar.mnuNumbersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnNumbers)); + toolbar.btnMarkers.menu.on('show:after', _.bind(this.onListShowAfter, this, 0, toolbar.mnuMarkersPicker)); + toolbar.btnNumbers.menu.on('show:after', _.bind(this.onListShowAfter, this, 1, toolbar.mnuNumbersPicker)); + toolbar.btnFontColor.on('click', _.bind(this.onBtnFontColor, this)); + toolbar.btnFontColor.on('color:select', _.bind(this.onSelectFontColor, this)); + toolbar.btnTextHighlightColor.on('click', _.bind(this.onBtnTextHighlightColor, this)); + toolbar.mnuTextHighlightColorPicker.on('select', _.bind(this.onSelectTextHighlightColor, this)); + toolbar.mnuTextHighlightTransparent.on('click', _.bind(this.onTextHighlightTransparentClick, this)); + 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.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)); + toolbar.btnShapeArrange.menu.on('item:click', _.bind(this.onShapeArrange, this)); + }, + + attachUIEvents: function(toolbar) { + /** + * UI Events + */ + this.attachCommonUIEvents(toolbar); if (this.mode.isEdit) { - this.toolbar.setApi(api); - this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); - this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); - this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this)); - } - if (this.mode.isRestrictedEdit) { - this.api.asc_registerCallback('asc_onStartAction', _.bind(this.onLongActionBegin, this)); - this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); - this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); - this.api.asc_registerCallback('sync_onAllRequiredFormsFilled', _.bind(this.onFillRequiredFields, this)); - } + this.attachPDFAnnotateUIEvents(toolbar); + this.mode.isPDFEdit && this.attachPDFEditUIEvents(toolbar); + } else if (this.mode.isRestrictedEdit) + this.attachRestrictedEditUIEvents(toolbar); + }, + + attachCommonApiEvents: function() { this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(this.onCurrentPage, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); this.api.asc_registerCallback('onPluginToolbarMenu', _.bind(this.onPluginToolbarMenu, this)); }, + attachRestrictedEditApiEvents: function() { + if (!this.mode.isRestrictedEdit) return; + + this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); + this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); + this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); + + this.api.asc_registerCallback('asc_onStartAction', _.bind(this.onLongActionBegin, this)); + this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); + this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); + this.api.asc_registerCallback('sync_onAllRequiredFormsFilled', _.bind(this.onFillRequiredFields, this)); + }, + + attachPDFAnnotateApiEvents: function() { + if (!this.mode.isEdit) return; + + this.toolbar.setApi(this.api); + + this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); + this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); + this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); + + this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); + this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this)); + this.getApplication().getController('Common.Controllers.Fonts').setApi(this.api); + + if (this.mode.canPDFEdit) { + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); + this.api.asc_registerCallback('asc_onInitStandartTextures', _.bind(this.onInitStandartTextures, this)); + } + }, + + attachPDFEditApiEvents: function() { + if (!this.mode.isPDFEdit) return; + + this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); + this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); + this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); + this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); + this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); + this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this)); + this.api.asc_registerCallback('asc_canIncreaseIndent', _.bind(this.onApiCanIncreaseIndent, this)); + this.api.asc_registerCallback('asc_canDecreaseIndent', _.bind(this.onApiCanDecreaseIndent, this)); + this.api.asc_registerCallback('asc_onLineSpacing', _.bind(this.onApiLineSpacing, this)); + this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this)); + 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_onCanGroup', _.bind(this.onApiCanGroup, this)); + // this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); + }, + + setApi: function(api) { + this.api = api; + this.attachCommonApiEvents(); + + if (this.mode.isEdit) { + this.attachPDFAnnotateApiEvents(); + this.mode.isPDFEdit && this.attachPDFEditApiEvents(); + } else if (this.mode.isRestrictedEdit) + this.attachRestrictedEditApiEvents(); + }, + onChangeCompactView: function(view, compact) { this.toolbar.setFolded(compact); this.toolbar.fireEvent('view:compact', [this, compact]); @@ -329,15 +459,21 @@ define([ }, onApiFocusObject: function(selectedObjects) { - if (!this.editMode) return; + if (!this.editMode || !this.mode.isPDFEdit) return; - var pr, sh, i = -1, type, + var pr, i = -1, type, paragraph_locked = false, - image_locked = false, - shape_pr = undefined, + shape_locked = undefined, + no_paragraph = true, + no_text = true, + no_object = true, + in_equation = false, toolbar = this.toolbar, - in_image = false, - in_para = false; + no_columns = false, + in_smartart = false, + in_smartart_internal = false, + in_annot = false, + annot_lock = false; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -345,17 +481,111 @@ define([ if (type === Asc.c_oAscTypeSelectElement.Paragraph) { paragraph_locked = pr.get_Locked(); - sh = pr.get_Shade(); - in_para = true; - } else if (type === Asc.c_oAscTypeSelectElement.Image) { - in_image = true; - image_locked = pr.get_Locked(); - if (pr && pr.get_ShapeProperties()) - shape_pr = pr.get_ShapeProperties(); + no_paragraph = false; + no_text = false; + } else if (type == Asc.c_oAscTypeSelectElement.Image || type == Asc.c_oAscTypeSelectElement.Shape || type == Asc.c_oAscTypeSelectElement.Chart || type == Asc.c_oAscTypeSelectElement.Table) { + shape_locked = pr.get_Locked(); + no_object = false; + if (type == Asc.c_oAscTypeSelectElement.Table || + type == Asc.c_oAscTypeSelectElement.Shape && !pr.get_FromImage()) { + no_text = false; + } + if (type == Asc.c_oAscTypeSelectElement.Table || + type == Asc.c_oAscTypeSelectElement.Shape && !pr.get_FromImage() && !pr.get_FromChart()) { + no_paragraph = false; + } + if (type == Asc.c_oAscTypeSelectElement.Chart) { + no_columns = true; + } + if (type == Asc.c_oAscTypeSelectElement.Shape) { + var shapetype = pr.asc_getType(); + if (shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1') + no_columns = true; + if (pr.get_FromSmartArt()) + in_smartart = true; + if (pr.get_FromSmartArtInternal()) + in_smartart_internal = true; + } + if (type == Asc.c_oAscTypeSelectElement.Image || type == Asc.c_oAscTypeSelectElement.Table) + no_columns = true; + } else if (type === Asc.c_oAscTypeSelectElement.Math) { + in_equation = true; + } else if (type === Asc.c_oAscTypeSelectElement.Annot) { + in_annot = true; + if (pr.asc_getCanEditText()) + no_text = false; } } - this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.toolbar.paragraphControls}); + if (this._state.prcontrolsdisable !== paragraph_locked) { + if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked; + if (paragraph_locked!==undefined) + this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: toolbar.paragraphControls}); + } + + if (this._state.no_paragraph !== no_paragraph) { + if (this._state.activated) this._state.no_paragraph = no_paragraph; + this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: toolbar.paragraphControls}); + // this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: [toolbar.btnCopyStyle]}); + } + + if (this._state.no_text !== no_text) { + if (this._state.activated) this._state.no_text = no_text; + this.toolbar.lockToolbar(Common.enumLock.noTextSelected, no_text, {array: toolbar.paragraphControls}); + } + + if (this._state.in_annot !== in_annot) { + if (this._state.activated) this._state.in_annot = in_annot; + this.toolbar.lockToolbar(Common.enumLock.inAnnotation, in_annot, {array: toolbar.paragraphControls}); + } + + if (this._state.no_object !== no_object ) { + if (this._state.activated) this._state.no_object = no_object; + this.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [toolbar.btnVerticalAlign ]}); + } + + var no_drawing_objects = this.api.asc_getSelectedDrawingObjectsCount()<1; + if (this._state.no_drawing_objects !== no_drawing_objects ) { + if (this._state.activated) this._state.no_drawing_objects = no_drawing_objects; + this.toolbar.lockToolbar(Common.enumLock.noDrawingObjects, no_drawing_objects, {array: [toolbar.btnShapeAlign, toolbar.btnShapeArrange]}); + } + + if (shape_locked!==undefined && this._state.shapecontrolsdisable !== shape_locked) { + if (this._state.activated) this._state.shapecontrolsdisable = shape_locked; + this.toolbar.lockToolbar(Common.enumLock.shapeLock, shape_locked, {array: toolbar.shapeControls.concat(toolbar.paragraphControls)}); + } + + if (shape_locked===undefined && !this._state.no_drawing_objects) { // several tables selected + this.toolbar.lockToolbar(Common.enumLock.shapeLock, false, {array: toolbar.shapeControls}); + } + + if (this._state.in_equation !== in_equation) { + if (this._state.activated) this._state.in_equation = in_equation; + this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: [toolbar.btnSuperscript, toolbar.btnSubscript]}); + } + + if (this._state.no_columns !== no_columns) { + if (this._state.activated) this._state.no_columns = no_columns; + this.toolbar.lockToolbar(Common.enumLock.noColumns, no_columns, {array: [toolbar.btnColumns]}); + } + + if (this._state.in_smartart !== in_smartart) { + this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smartart, {array: toolbar.paragraphControls}); + this._state.in_smartart = in_smartart; + } + + if (this._state.in_smartart_internal !== in_smartart_internal) { + this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smartart_internal, {array: toolbar.paragraphControls}); + this._state.in_smartart_internal = in_smartart_internal; + + toolbar.mnuArrangeFront.setDisabled(in_smartart_internal); + toolbar.mnuArrangeBack.setDisabled(in_smartart_internal); + toolbar.mnuArrangeForward.setDisabled(in_smartart_internal); + toolbar.mnuArrangeBackward.setDisabled(in_smartart_internal); + } }, onApiZoomChange: function(percent, type) {}, @@ -408,7 +638,7 @@ define([ var toolbar = this.toolbar, mode = toolbar.mode, me = this; - if (!mode.isPDFAnnotate && !mode.isPDFEdit) { + if (!mode.canSaveToFile) { var canDownload = mode.canDownload && (!mode.isDesktopApp || !mode.isOffline), saveSopy = (mode.canDownload && (!mode.isDesktopApp || !mode.isOffline)) && (mode.canRequestSaveAs || mode.saveAsUrl), saveAs = mode.canDownload && mode.isDesktopApp && mode.isOffline, @@ -417,9 +647,12 @@ define([ Common.UI.info({ maxwidth: 500, - buttons: (mode.canPDFAnnotate || mode.canPDFEdit || !mode.canDownload) ? ['ok'] : buttons.concat(['cancel']), - primary: (mode.canPDFAnnotate || mode.canPDFEdit || !mode.canDownload) ? 'ok' : primary, - msg: (mode.canPDFAnnotate || mode.canPDFEdit) ? this.txtNeedCommentMode : (mode.canDownload ? this.txtNeedDownload : this.errorAccessDeny), + // buttons: (mode.canPDFAnnotate || mode.canPDFEdit || !mode.canDownload) ? ['ok'] : buttons.concat(['cancel']), + // primary: (mode.canPDFAnnotate || mode.canPDFEdit || !mode.canDownload) ? 'ok' : primary, + // msg: (mode.canPDFAnnotate || mode.canPDFEdit) ? this.txtNeedCommentMode : (mode.canDownload ? this.txtNeedDownload : this.errorAccessDeny), + buttons: mode.canDownload ? buttons.concat(['cancel']) : ['ok'], + primary: mode.canDownload ? primary : 'ok' , + msg: mode.canDownload ? this.txtNeedDownload : this.errorAccessDeny, callback: function(btn) { if (saveAs && btn==='copy') me.api.asc_DownloadAs(); @@ -440,7 +673,7 @@ define([ // return; this.api.asc_Save(); - toolbar.btnSave && toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && !toolbar.mode.saveAlwaysEnabled && !toolbar.mode.canSaveDocumentToBinary); + toolbar.btnSave && toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && toolbar.mode.canSaveToFile && !toolbar.mode.canSaveDocumentToBinary); Common.component.Analytics.trackEvent('Save'); Common.component.Analytics.trackEvent('ToolBar', 'Save'); } @@ -697,19 +930,23 @@ define([ this.toolbar.btnStrikeout.toggle(pressed, true); else if (type === this.toolbar.btnUnderline.options.type) this.toolbar.btnUnderline.toggle(pressed, true); - else { - this.toolbar.btnHighlight.toggle(false, true); - this.toolbar.btnStrikeout.toggle(false, true); - this.toolbar.btnUnderline.toggle(false, true); - } + else if (type===undefined) + this.toolbar.btnTextHighlightColor && this.toolbar.btnTextHighlightColor.toggle(pressed, true); }, onDrawStart: function() { this.api && this.api.SetMarkerFormat(undefined, false); - this.onApiStartHighlight(); + this.onClearHighlight(); this.turnOnShowComments(); }, + onClearHighlight: function() { + this.toolbar.btnHighlight.toggle(false, true); + this.toolbar.btnStrikeout.toggle(false, true); + this.toolbar.btnUnderline.toggle(false, true); + this.toolbar.btnTextHighlightColor && this.toolbar.btnTextHighlightColor.toggle(false, true); + }, + onShowCommentsChange: function(checkbox, state) { var value = state === 'checked'; Common.Utils.InternalSettings.set("pdfe-settings-livecomment", value); @@ -720,6 +957,34 @@ define([ // this.api && this.api.asc_Rotate(); }, + onBtnTextCommentClick: function(btn, e) { + this.onInsertTextComment(btn.options.textboxType, btn, e); + }, + + onMenuTextCommentClick: function(btn, e) { + var oldType = this.toolbar.btnTextComment.options.textboxType; + var newType = e.value; + + if(newType !== oldType){ + this.toolbar.btnTextComment.changeIcon({ + next: e.options.iconClsForMainBtn, + curr: this.toolbar.btnTextComment.menu.items.filter(function(item){return item.value == oldType})[0].options.iconClsForMainBtn + }); + // this.toolbar.btnTextComment.updateHint([e.caption, this.toolbar.tipInsertText]); + this.toolbar.btnTextComment.updateHint(e.caption); + this.toolbar.btnTextComment.setCaption(e.options.captionForMainBtn); + this.toolbar.btnTextComment.options.textboxType = newType; + } + this.onInsertTextComment(newType, btn, e); + }, + + onInsertTextComment: function(type, btn, e) { + this.api && this.api.AddFreeTextAnnot(type); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnTextComment); + Common.component.Analytics.trackEvent('ToolBar', 'Add Text'); + }, + onFillRequiredFields: function(isFilled) { this.toolbar && this.toolbar.btnSubmit && this.toolbar.lockToolbar(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.toolbar.btnSubmit]}); }, @@ -792,7 +1057,7 @@ define([ this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]}); this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copy!==true, {array: [this.toolbar.btnCopy]}); this.toolbar.lockToolbar(Common.enumLock.cutLock, this._state.can_cut!==true, {array: [this.toolbar.btnCut]}); - this.api && this.toolbar.btnSave && this.toolbar.btnSave.setDisabled(!this.mode.saveAlwaysEnabled && !this.api.isDocumentModified()); + this.api && this.toolbar.btnSave && this.toolbar.btnSave.setDisabled(this.mode.canSaveToFile && !this.api.isDocumentModified()); this._state.activated = true; }, @@ -879,6 +1144,8 @@ define([ Array.prototype.push.apply(me.toolbar.lockControls, drawtab.getView().getButtons()); Array.prototype.push.apply(me.toolbar.paragraphControls, drawtab.getView().getButtons()); } + + !config.canViewComments && me.toolbar.setVisible('comment', false); } var tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'}; @@ -889,37 +1156,67 @@ define([ me.toolbar.addTab(tab, $panel, 8); me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view')); } + + if (config.isPDFEdit) { + me._state.initEditing = false; + tab = {caption: me.toolbar.textTabInsert, action: 'ins', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-insert', dataHintTitle: 'I'}; + var instab = me.getApplication().getController('InsTab'); + instab.setApi(me.api).setConfig({toolbar: me, mode: config}); + $panel = instab.createToolbarPanel(); + if ($panel) { + me.toolbar.addTab(tab, $panel, 1); + me.toolbar.setVisible('ins', true); + } + } }, + applyMode: function() { + var me = this, + toolbar = this.toolbar, + $host = $(toolbar.$layout); + if (this.mode.isPDFEdit && this._state.initEditing) { + Array.prototype.push.apply(me.toolbar.lockControls, toolbar.applyLayoutPDFEdit(this.mode)); + toolbar.rendererComponentsPDFEdit($host); + + setTimeout(function(){ + toolbar.createDelayedElementsPDFEdit(); + me.attachPDFEditApiEvents(); + me.attachPDFEditUIEvents(toolbar); + me.fillFontsStore(toolbar.cmbFontName, me._state.fontname); + toolbar.lockToolbar(Common.enumLock.disableOnStart, false); + me.onApiFocusObject([]); + me.api.UpdateInterfaceState(); + }, 50); + + var tab = {caption: toolbar.textTabInsert, action: 'ins', extcls: this.mode.isEdit ? 'canedit' : '', layoutname: 'toolbar-insert', dataHintTitle: 'I'}; + var instab = this.getApplication().getController('InsTab'); + instab.setApi(this.api).setConfig({toolbar: this, mode: this.mode}); + toolbar.addTab(tab, instab.createToolbarPanel(), 1); + instab.onAppReady(this.mode); + setTimeout(function(){ + instab.onDocumentReady(); + }, 50); + + this._state.initEditing = false; + } + if (!this.mode.isPDFEdit && toolbar.isTabActive('ins')) + toolbar.setTab('home'); + toolbar.setVisible('ins', this.mode.isPDFEdit); + $host.find('.annotate').toggleClass('hidden', this.mode.isPDFEdit); + $host.find('.pdfedit').toggleClass('hidden', !this.mode.isPDFEdit); + this.mode.isPDFEdit && me.turnOnSelectTool(); + }, + onAppReady: function (config) { var me = this; me.appOptions = config; - this.btnsComment = []; - // if ( config.canCoAuthoring && config.canComments ) { - // this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, - // [ Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.richDelLock, Common.enumLock.plainDelLock, - // Common.enumLock.cantAddQuotedComment, Common.enumLock.imageLock, Common.enumLock.inSpecificForm, Common.enumLock.inImage, Common.enumLock.lostConnect, Common.enumLock.disableOnStart, - // Common.enumLock.previewReviewMode, Common.enumLock.viewFormMode, Common.enumLock.docLockView, Common.enumLock.docLockForms ], - // undefined, undefined, undefined, '1', 'bottom'); - // if ( this.btnsComment.length ) { - // var _comments = PDFE.getController('Common.Controllers.Comments').getView(); - // this.btnsComment.forEach(function (btn) { - // btn.updateHint( _comments.textHintAddComment ); - // btn.on('click', function (btn, e) { - // Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); - // }); - // }, this); - // } - // Array.prototype.push.apply(this.toolbar.paragraphControls, this.btnsComment); - // Array.prototype.push.apply(this.toolbar.lockControls, this.btnsComment); - // } - (new Promise(function(accept) { accept(); })).then(function () { - (config.isEdit || config.isRestrictedEdit) && me.toolbar && me.toolbar.btnHandTool.toggle(true, true); - me.api && me.api.asc_setViewerTargetType('hand'); + var hand = (config.isEdit && !config.isPDFEdit || config.isRestrictedEdit); + me.toolbar && me.toolbar.btnHandTool && me.toolbar[hand ? 'btnHandTool' : 'btnSelectTool'].toggle(true, true); + me.api && me.api.asc_setViewerTargetType(hand ? 'hand' : 'select'); if (config.isRestrictedEdit && me.toolbar && me.toolbar.btnSubmit && me.api && !me.api.asc_IsAllRequiredFormsFilled()) { me.toolbar.lockToolbar(Common.enumLock.requiredNotFilled, true, {array: [me.toolbar.btnSubmit]}); if (!Common.localStorage.getItem("pdfe-embed-hide-submittip")) { @@ -976,6 +1273,950 @@ define([ this.toolbar && this.toolbar.chShowComments && this.toolbar.chShowComments.setValue(Common.Utils.InternalSettings.get("pdfe-settings-livecomment"), true); }, + onApiMathTypes: function(equation) { + this._equationTemp = equation; + }, + + onInitStandartTextures: function(texture) { + this._textureTemp = texture; + }, + + fillFontsStore: function(combo, name) { + if (combo.store.length===0) { + var fontstore = new Common.Collections.Fonts(), + fonts = this.getCollection('Common.Collections.Fonts').toJSON(); + var arr = []; + _.each(fonts, function(font, index){ + if (!font.cloneid) { + arr.push(_.clone(font)); + } + }); + fontstore.add(arr); + combo.fillFonts(fontstore); + name && combo.onApiChangeFont(name); + } + }, + + onApiChangeFont: function(font) { + if (!this.mode.isPDFEdit) return; + this._state.fontname = font; + !Common.Utils.ModalWindow.isVisible() && this.toolbar.cmbFontName.onApiChangeFont(font); + }, + + onApiFontSize: function(size) { + if (!this.mode.isPDFEdit) return; + if (this._state.fontsize !== size) { + this.toolbar.cmbFontSize.setValue(size); + this._state.fontsize = size; + } + }, + + onApiBold: function(on) { + if (!this.mode.isPDFEdit) return; + if (this._state.bold !== on) { + this.toolbar.btnBold.toggle(on === true, true); + this._state.bold = on; + } + }, + + onApiItalic: function(on) { + if (!this.mode.isPDFEdit) return; + if (this._state.italic !== on) { + this.toolbar.btnItalic.toggle(on === true, true); + this._state.italic = on; + } + }, + + onApiUnderline: function(on) { + if (!this.mode.isPDFEdit) return; + if (this._state.underline !== on) { + this.toolbar.btnTextUnderline.toggle(on === true, true); + this._state.underline = on; + } + }, + + onApiStrikeout: function(on) { + if (!this.mode.isPDFEdit) return; + if (this._state.strike !== on) { + this.toolbar.btnTextStrikeout.toggle(on === true, true); + this._state.strike = on; + } + }, + + onApiVerticalAlign: function(typeBaseline) { + if (!this.mode.isPDFEdit) return; + if (this._state.valign !== typeBaseline) { + this.toolbar.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true); + this.toolbar.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true); + this._state.valign = typeBaseline; + } + }, + + onApiCanIncreaseIndent: function(value) { + if (!this.mode.isPDFEdit) return; + if (this._state.can_increase !== value) { + this.toolbar.lockToolbar(Common.enumLock.incIndentLock, !value, {array: [this.toolbar.btnIncLeftOffset]}); + if (this._state.activated) this._state.can_increase = value; + } + }, + + onApiCanDecreaseIndent: function(value) { + if (!this.mode.isPDFEdit) return; + if (this._state.can_decrease !== value) { + this.toolbar.lockToolbar(Common.enumLock.decIndentLock, !value, {array: [this.toolbar.btnDecLeftOffset]}); + if (this._state.activated) this._state.can_decrease = value; + } + }, + + updateBulletTip: function(view, title) { + if (view) { + var tip = $(view.el).data('bs.tooltip'); + if (tip) { + tip.options.title = title; + tip.$tip.find('.tooltip-inner').text(title); + } + } + }, + + onApiBullets: function(v) { + if (!this.mode.isPDFEdit) return; + if (!(this.toolbar.mnuMarkersPicker && this.toolbar.mnuMarkersPicker.store)) { + this._state.needCallApiBullets = v; + return; + } + this._state.needCallApiBullets = undefined; + + if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===0x1000) { + this._state.bullets.type = v.get_ListType(); + this._state.bullets.subtype = v.get_ListSubType(); + + var rec = this.toolbar.mnuMarkersPicker.store.at(8), + drawDefBullet = (rec.get('data').subtype===0x1000) && (this._state.bullets.type===1 || this._state.bullets.subtype!==0x1000); + + this._clearBullets(); + + switch(this._state.bullets.type) { + case 0: + var idx; + if (this._state.bullets.subtype!==0x1000) + idx = this._state.bullets.subtype; + else { // custom + var bullet = v.asc_getListCustom(); + if (bullet) { + var type = bullet.asc_getType(); + if (type == Asc.asc_PreviewBulletType.char) { + var symbol = bullet.asc_getChar(); + if (symbol) { + var custombullet = new Asc.asc_CBullet(); + custombullet.asc_putSymbol(symbol); + custombullet.asc_putFont(bullet.asc_getSpecialFont()); + + rec.get('data').subtype = 0x1000; + rec.set('customBullet', custombullet); + rec.set('numberingInfo', JSON.stringify(custombullet.asc_getJsonBullet())); + rec.set('tip', ''); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); + drawDefBullet = false; + idx = 8; + } + } else if (type == Asc.asc_PreviewBulletType.image) { + var id = bullet.asc_getImageId(); + if (id) { + var custombullet = new Asc.asc_CBullet(); + custombullet.asc_fillBulletImage(id); + + rec.get('data').subtype = 0x1000; + rec.set('customBullet', custombullet); + rec.set('numberingInfo', JSON.stringify(custombullet.asc_getJsonBullet())); + rec.set('tip', ''); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], ''); + drawDefBullet = false; + idx = 8; + } + } + } + } + (idx!==undefined) ? this.toolbar.mnuMarkersPicker.selectByIndex(idx, true) : + this.toolbar.mnuMarkersPicker.deselectAll(true); + + this.toolbar.btnMarkers.toggle(true, true); + this.toolbar.mnuNumbersPicker.deselectAll(true); + break; + case 1: + var idx = 0; + switch(this._state.bullets.subtype) { + case 1: + idx = 4; + break; + case 2: + idx = 5; + break; + case 3: + idx = 6; + break; + case 4: + idx = 1; + break; + case 5: + idx = 2; + break; + case 6: + idx = 3; + break; + case 7: + idx = 7; + break; + } + this.toolbar.btnNumbers.toggle(true, true); + this.toolbar.mnuNumbersPicker.selectByIndex(idx, true); + this.toolbar.mnuMarkersPicker.deselectAll(true); + break; + } + if (drawDefBullet) { + rec.get('data').subtype = 8; + rec.set('numberingInfo', this.toolbar._markersArr[8]); + rec.set('tip', this.toolbar.tipMarkersDash); + this.toolbar.mnuMarkersPicker.dataViewItems && this.updateBulletTip(this.toolbar.mnuMarkersPicker.dataViewItems[8], this.toolbar.tipMarkersDash); + } + } + }, + + onApiParagraphAlign: function(v) { + if (!this.mode.isPDFEdit) return; + if (this._state.pralign !== v) { + this._state.pralign = v; + + var index = -1, + align, + btnHorizontalAlign = this.toolbar.btnHorizontalAlign; + + switch (v) { + case 0: index = 2; align = 'btn-align-right'; break; + case 1: index = 0; align = 'btn-align-left'; break; + case 2: index = 1; align = 'btn-align-center'; break; + case 3: index = 3; align = 'btn-align-just'; break; + default: index = -255; align = 'btn-align-left'; break; + } + if (!(index < 0)) { + btnHorizontalAlign.menu.items[index].setChecked(true); + } else if (index == -255) { + btnHorizontalAlign.menu.clearAll(); + } + + if ( btnHorizontalAlign.rendered && btnHorizontalAlign.$icon ) { + btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align); + btnHorizontalAlign.options.icls = align; + } + } + }, + + onApiVerticalTextAlign: function(v) { + if (!this.mode.isPDFEdit) return; + if (this._state.vtextalign !== v) { + this._state.vtextalign = v; + + var index = -1, + align = '', + btnVerticalAlign = this.toolbar.btnVerticalAlign; + + switch (v) { + case Asc.c_oAscVAlign.Top: index = 0; align = 'btn-align-top'; break; + case Asc.c_oAscVAlign.Center: index = 1; align = 'btn-align-middle'; break; + case Asc.c_oAscVAlign.Bottom: index = 2; align = 'btn-align-bottom'; break; + default: index = -255; align = 'btn-align-middle'; break; + } + + if (!(index < 0)) { + btnVerticalAlign.menu.items[index].setChecked(true); + } else if (index == -255) { + btnVerticalAlign.menu.clearAll(); + } + + if ( btnVerticalAlign.rendered && btnVerticalAlign.$icon ) { + btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls).addClass(align); + btnVerticalAlign.options.icls = align; + } + } + }, + + onApiLineSpacing: function(vc) { + if (!this.mode.isPDFEdit) return; + var line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line(); + + if (this._state.linespace !== line) { + this._state.linespace = line; + + var mnuLineSpace = this.toolbar.btnLineSpace.menu; + _.each(mnuLineSpace.items, function(item){ + item.setChecked(false, true); + }); + if (line<0) return; + + if ( Math.abs(line-1.)<0.0001 ) + mnuLineSpace.items[0].setChecked(true, true); + else if ( Math.abs(line-1.15)<0.0001 ) + mnuLineSpace.items[1].setChecked(true, true); + else if ( Math.abs(line-1.5)<0.0001 ) + mnuLineSpace.items[2].setChecked(true, true); + else if ( Math.abs(line-2)<0.0001 ) + mnuLineSpace.items[3].setChecked(true, true); + else if ( Math.abs(line-2.5)<0.0001 ) + mnuLineSpace.items[4].setChecked(true, true); + else if ( Math.abs(line-3)<0.0001 ) + mnuLineSpace.items[5].setChecked(true, true); + } + }, + + onApiCanGroup: function(value) { + if (this._state.can_group!==value) { + this.toolbar.mnuGroupShapes.setDisabled(!value); + if (this._state.activated) this._state.can_group = value; + } + }, + + onApiCanUnGroup: function(value) { + if (this._state.can_ungroup!==value) { + this.toolbar.mnuUnGroupShapes.setDisabled(!value); + if (this._state.activated) this._state.can_ungroup = value; + } + }, + + onIncrease: function(e) { + if (this.api) + this.api.FontSizeIn(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Font Size'); + }, + + onDecrease: function(e) { + if (this.api) + this.api.FontSizeOut(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Font Size'); + }, + + onBold: function(btn, e) { + this._state.bold = undefined; + if (this.api) + this.api.put_TextPrBold(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Bold'); + }, + + onItalic: function(btn, e) { + this._state.italic = undefined; + if (this.api) + this.api.put_TextPrItalic(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Italic'); + }, + + onTextUnderline: function(btn, e) { + this._state.underline = undefined; + if (this.api) + this.api.put_TextPrUnderline(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Underline'); + }, + + onTextStrikeout: function(btn, e) { + this._state.strike = undefined; + if (this.api) + this.api.put_TextPrStrikeout(btn.pressed); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Strikeout'); + }, + + onSuperscript: function(btn, e) { + if (!this.toolbar.btnSubscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Superscript'); + } + }, + + onSubscript: function(btn, e) { + if (!this.toolbar.btnSuperscript.pressed) { + this._state.valign = undefined; + if (this.api) + this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Subscript'); + } + }, + + onDecOffset: function(btn, e) { + if (this.api) + this.api.DecreaseIndent(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Indent'); + }, + + onIncOffset: function(btn, e) { + if (this.api) + this.api.IncreaseIndent(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Indent'); + }, + + onChangeCase: function(menu, item, e) { + if (this.api) + this.api.asc_ChangeTextCase(item.value); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onMenuHorizontalAlignSelect: function(menu, item) { + this._state.pralign = undefined; + var btnHorizontalAlign = this.toolbar.btnHorizontalAlign; + + btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls); + btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls; + btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls); + + if (this.api && item.checked) + this.api.put_PrAlign(item.value); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Horizontal Align'); + }, + + onMenuVerticalAlignSelect: function(menu, item) { + var btnVerticalAlign = this.toolbar.btnVerticalAlign; + + btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls); + btnVerticalAlign.options.icls = !item.checked ? 'btn-align-middle' : item.options.icls; + btnVerticalAlign.$icon.addClass(btnVerticalAlign.options.icls); + + this._state.vtextalign = undefined; + if (this.api && item.checked) + this.api.setVerticalAlign(item.value); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Vertical Align'); + }, + + onMarkers: function(btn, e) { + var record = { + data: { + type: 0, + subtype: btn.pressed ? 0: -1 + } + }; + + this.onSelectBullets(null, null, null, record); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onNumbers: function(btn, e) { + var record = { + data: { + type: 1, + subtype: btn.pressed ? 0: -1 + } + }; + this.onSelectBullets(null, null, null, record); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onMarkerSettingsClick: function(type) { + var me = this, + props; + + var selectedElements = me.api.getSelectedElements(); + if (selectedElements && _.isArray(selectedElements)) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + props = selectedElements[i].get_ObjectValue(); + break; + } + } + } + if (props) { + (new Common.Views.ListSettingsDialog({ + api: me.api, + props: props, + type: type, + storage: me.mode.canRequestInsertImage || me.mode.fileChoiceUrl && me.mode.fileChoiceUrl.indexOf("{documentType}")>-1, + interfaceLang: me.toolbar.mode.lang, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + props.asc_putBullet(value); + me.api.paraApply(props); + } + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + })).show(); + } + }, + + onComboBlur: function() { + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onFontNameSelect: function(combo, record) { + if (this.api) { + if (record.isNewFont) { + !Common.Utils.ModalWindow.isVisible() && + Common.UI.warning({ + width: 500, + msg: this.confirmAddFontName, + buttons: ['yes', 'no'], + primary: 'yes', + callback: _.bind(function(btn) { + if (btn == 'yes') { + this.api.put_TextPrFontName(record.name); + Common.component.Analytics.trackEvent('ToolBar', 'Font Name'); + } else { + this.toolbar.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, this) + }); + } else { + this.api.put_TextPrFontName(record.name); + Common.component.Analytics.trackEvent('ToolBar', 'Font Name'); + } + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onComboOpen: function(needfocus, combo, e, params) { + if (params && params.fromKeyDown) return; + _.delay(function() { + var input = $('input', combo.cmpEl).select(); + if (needfocus) input.focus(); + else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); }); + }, 10); + }, + + onFontSizeSelect: function(combo, record) { + this._state.fontsize = undefined; + if (this.api) + this.api.put_TextPrFontSize(record.value); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Font Size'); + }, + + onFontSizeChanged: function(before, combo, record, e) { + var value, + me = this; + + if (before) { + var item = combo.store.findWhere({ + displayValue: record.value + }); + + if (!item) { + value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); + + if (!value) { + value = this._getApiTextSize(); + setTimeout(function(){ + Common.UI.warning({ + msg: me.textFontSizeErr, + callback: function() { + _.defer(function(btn) { + $('input', combo.cmpEl).focus(); + }) + } + }); + }, 1); + combo.setRawValue(value); + e.preventDefault(); + return false; + } + } + } else { + value = Common.Utils.String.parseFloat(record.value); + value = value > 300 ? 300 : + value < 1 ? 1 : Math.floor((value+0.4)*2)/2; + + combo.setRawValue(value); + + this._state.fontsize = undefined; + if (this.api) { + this.api.put_TextPrFontSize(value); + } + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + } + }, + + onListShowAfter: function(type, picker) { + var store = picker.store; + var arr = []; + store.each(function(item){ + arr.push({ + numberingInfo: {bullet: item.get('numberingInfo')==='undefined' ? undefined : JSON.parse(item.get('numberingInfo'))}, + divId: item.get('id') + }); + }); + if (this.api && this.api.SetDrawImagePreviewBulletForMenu) { + this.api.SetDrawImagePreviewBulletForMenu(arr, type); + } + }, + + onSelectBullets: function(btn, picker, itemView, record) { + var rawData = {}, + isPickerSelect = _.isFunction(record.toJSON); + + if (isPickerSelect){ + if (record.get('selected')) { + rawData = record.toJSON(); + } else { + // record deselected + return; + } + } else { + rawData = record; + } + + if (btn) { + btn.toggle(rawData.data.subtype !== -1, true); + } + + if (this.api){ + if (rawData.data.type===0 && rawData.data.subtype===0x1000) {// custom bullet + var bullet = rawData.customBullet; + if (bullet) { + var selectedElements = this.api.getSelectedElements(); + if (selectedElements && _.isArray(selectedElements)) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + var props = selectedElements[i].get_ObjectValue(); + props.asc_putBullet(bullet); + this.api.paraApply(props); + break; + } + } + } + } + } else + this.api.put_ListType(rawData.data.type, rawData.data.subtype); + } + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'List Type'); + }, + + onLineSpaceToggle: function(menu, item, state, e) { + if (!!state) { + this._state.linespace = undefined; + if (this.api) + this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO, item.value); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Line Spacing'); + } + }, + + onColumnsSelect: function(menu, item) { + if (_.isUndefined(item.value)) + return; + + this._state.columns = undefined; + + if (this.api) { + if (item.value == 'advanced') { + var win, + me = this; + 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.Shape == elType) { + var win = new PE.Views.ShapeSettingsAdvanced( + { + shapeProps: elValue, + slideSize: PE.getController('Toolbar').currentPageSize, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ShapeApply(value.shapeProps); + } + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + }); + win.show(); + win.setActiveCategory(4); + break; + } + } + } + } else if (item.checked) { + var props = new Asc.asc_CShapeProperty(), + cols = item.value; + props.asc_putColumnNumber(cols+1); + this.api.ShapeApply(props); + } + } + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Insert Columns'); + }, + + onBeforeColumns: function() { + var index = -1; + var selectedElements = this.api.getSelectedElements(); + if (selectedElements && selectedElements.length>0){ + var elType, elValue; + for (var i = selectedElements.length - 1; i >= 0; i--) { + if (Asc.c_oAscTypeSelectElement.Shape == selectedElements[i].get_ObjectType()) { + var value = selectedElements[i].get_ObjectValue().asc_getColumnNumber(); + if (value<4) + index = value-1; + break; + } + } + } + if (this._state.columns === index) + return; + + if (index < 0) + this.toolbar.btnColumns.menu.clearAll(); + else + this.toolbar.btnColumns.menu.items[index].setChecked(true); + this._state.columns = index; + }, + + onClearStyleClick: function(btn, e) { + if (this.api) + this.api.ClearFormating(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onBeforeShapeAlign: function() { + var value = this.api.asc_getSelectedDrawingObjectsCount(), + slide_checked = Common.Utils.InternalSettings.get("pdfe-align-to-slide") || false; + this.toolbar.mniAlignObjects.setDisabled(value<2); + this.toolbar.mniAlignObjects.setChecked(value>1 && !slide_checked, true); + this.toolbar.mniAlignToSlide.setChecked(value<2 || slide_checked, true); + this.toolbar.mniDistribHor.setDisabled(value<3 && this.toolbar.mniAlignObjects.isChecked()); + this.toolbar.mniDistribVert.setDisabled(value<3 && this.toolbar.mniAlignObjects.isChecked()); + }, + + onShapeAlign: function(menu, item) { + if (this.api) { + var value = this.toolbar.mniAlignToSlide.isChecked() ? Asc.c_oAscObjectsAlignType.Page : Asc.c_oAscObjectsAlignType.Selected; + if (item.value>-1 && item.value < 6) { + this.api.put_ShapesAlign(item.value, value); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Align'); + } else if (item.value == 6) { + this.api.DistributeHorizontally(value); + Common.component.Analytics.trackEvent('ToolBar', 'Distribute'); + } else if (item.value == 7){ + this.api.DistributeVertically(value); + Common.component.Analytics.trackEvent('ToolBar', 'Distribute'); + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + } + }, + + onShapeArrange: function(menu, item) { + if (this.api) { + switch (item.value) { + case 1: + this.api.shapes_bringToFront(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Arrange'); + break; + case 2: + this.api.shapes_bringToBack(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Arrange'); + break; + case 3: + this.api.shapes_bringForward(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Arrange'); + break; + case 4: + this.api.shapes_bringBackward(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Arrange'); + break; + case 5: + this.api.groupShapes(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape Group'); + break; + case 6: + this.api.unGroupShapes(); + Common.component.Analytics.trackEvent('ToolBar', 'Shape UnGroup'); + break; + } + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + } + }, + + _clearBullets: function() { + this.toolbar.btnMarkers.toggle(false, true); + this.toolbar.btnNumbers.toggle(false, true); + + this.toolbar.mnuMarkersPicker.selectByIndex(0, true); + this.toolbar.mnuNumbersPicker.selectByIndex(0, true); + }, + + _getApiTextSize: function () { + var out_value = 12, + textPr = this.api.get_TextProps(); + + if (textPr && textPr.get_TextPr) { + out_value = textPr.get_TextPr().get_FontSize(); + } + + return out_value; + }, + + onSelectFontColor: function(btn, color) { + this._state.clrtext = this._state.clrtext_asccolor = undefined; + + this.toolbar.btnFontColor.currentColor = color; + this.toolbar.btnFontColor.setColor((typeof(color) == 'object') ? color.color : color); + + this.toolbar.mnuFontColorPicker.currentColor = color; + if (this.api) + this.api.put_TextColor(Common.Utils.ThemeColor.getRgbColor(color)); + + Common.component.Analytics.trackEvent('ToolBar', 'Text Color'); + }, + + onBtnFontColor: function() { + this.toolbar.mnuFontColorPicker.trigger('select', this.toolbar.mnuFontColorPicker, this.toolbar.mnuFontColorPicker.currentColor); + }, + + onEditTextClick: function() { + this.api && this.api.asc_EditPage(); + }, + + onApiTextColor: function(color) { + if (!this.mode.isPDFEdit) return; + var clr; + var picker = this.toolbar.mnuFontColorPicker; + + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; + } else + clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + + var type1 = typeof(clr), + type2 = typeof(this._state.clrtext); + + if ((type1 !== type2) || (type1 == 'object' && + (clr.effectValue !== this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color) < 0)) || + (type1 != 'object' && this._state.clrtext.indexOf(clr) < 0)) { + + if (typeof(clr) == 'object') { + var isselected = false; + for ( var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue) { + picker.select(clr, true); + isselected = true; + break; + } + } + if (!isselected) picker.clearSelection(); + } else { + picker.select(clr,true); + } + this._state.clrtext = clr; + } + this._state.clrtext_asccolor = color; + }, + + onApiTextHighlightColor: function(c) { + if (!this.mode.isPDFEdit) return; + if (c) { + if (c == -1) { + if (this._state.textclrhighlight != -1) { + this.toolbar.mnuTextHighlightTransparent.setChecked(true, true); + + if (this.toolbar.mnuTextHighlightColorPicker) { + this._state.textclrhighlight = -1; + this.toolbar.mnuTextHighlightColorPicker.clearSelection(); + } + } + } else if (c !== null) { + if (this._state.textclrhighlight != c.get_hex().toUpperCase()) { + this.toolbar.mnuTextHighlightTransparent.setChecked(false); + this._state.textclrhighlight = c.get_hex().toUpperCase(); + + if ( this.toolbar.mnuTextHighlightColorPicker && _.contains(this.toolbar.mnuTextHighlightColorPicker.colors, this._state.textclrhighlight) ) + this.toolbar.mnuTextHighlightColorPicker.selectByRGB(this._state.textclrhighlight, true); + } + } else { + if ( this._state.textclrhighlight !== c) { + this.toolbar.mnuTextHighlightTransparent.setChecked(false, true); + this.toolbar.mnuTextHighlightColorPicker && this.toolbar.mnuTextHighlightColorPicker.clearSelection(); + this._state.textclrhighlight = c; + } + } + } + }, + + _setMarkerColor: function(strcolor, h) { + var me = this; + + if (h === 'menu') { + me._state.textclrhighlight = undefined; + me.onApiTextHighlightColor(); + + me.toolbar.btnTextHighlightColor.currentColor = strcolor; + me.toolbar.btnTextHighlightColor.setColor(me.toolbar.btnTextHighlightColor.currentColor); + me.toolbar.btnTextHighlightColor.toggle(true, true); + } + + strcolor = strcolor || 'transparent'; + + if (strcolor == 'transparent') { + me.api.SetMarkerFormat(undefined, true, false); + } else { + var r = strcolor[0] + strcolor[1], + g = strcolor[2] + strcolor[3], + b = strcolor[4] + strcolor[5]; + me.api.SetMarkerFormat(undefined, true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)); + } + me.api.asc_StopInkDrawer(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnTextHighlightColor); + Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color'); + }, + + onBtnTextHighlightColor: function(btn) { + if (btn.pressed) { + this._setMarkerColor(btn.currentColor); + Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color'); + } + else { + this.api.SetMarkerFormat(undefined, false); + } + }, + + onSelectTextHighlightColor: function(picker, color) { + this._setMarkerColor(color, 'menu'); + }, + + onTextHighlightTransparentClick: function(item, e) { + this._setMarkerColor('transparent', 'menu'); + }, + onPluginToolbarMenu: function(data) { this.toolbar && Array.prototype.push.apply(this.toolbar.lockControls, Common.UI.LayoutManager.addCustomItems(this.toolbar, data)); }, @@ -990,7 +2231,8 @@ define([ txtUntitled: 'Untitled', textRequired: 'Fill all required fields to send form.', textGotIt: 'Got it', - textSubmited: 'Form submitted successfully
Click to close the tip.' + textSubmited: 'Form submitted successfully
Click to close the tip.', + confirmAddFontName: 'The font you are going to save is not available on the current device.
The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
Do you want to continue?', }, PDFE.Controllers.Toolbar || {})); }); diff --git a/apps/pdfeditor/main/app/controller/ViewTab.js b/apps/pdfeditor/main/app/controller/ViewTab.js index ce0396ce1a..7b80efabcc 100644 --- a/apps/pdfeditor/main/app/controller/ViewTab.js +++ b/apps/pdfeditor/main/app/controller/ViewTab.js @@ -74,11 +74,11 @@ define([ }, setConfig: function(config) { - var mode = config.mode; + this.mode = config.mode; this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { toolbar: this.toolbar.toolbar, - mode: mode, + mode: this.mode, compactToolbar: this.toolbar.toolbar.isCompactView }); this.addListeners({ @@ -148,6 +148,15 @@ define([ emptyGroup.shift().append(me.view.chLeftMenu.$el[0]); } + if (!config.canPDFEdit || config.canBrandingExt && config.customization && config.customization.rightMenu === false || !Common.UI.LayoutManager.isElementVisible('rightMenu')) { + emptyGroup.push(me.view.chRightMenu.$el.closest('.elset')); + me.view.chRightMenu.$el.remove(); + } else if (emptyGroup.length>0) { + emptyGroup.push(me.view.chRightMenu.$el.closest('.elset')); + emptyGroup.shift().append(me.view.chRightMenu.$el[0]); + } + config.canPDFEdit && me.applyEditorMode(config); + if (emptyGroup.length>1) { // remove empty group emptyGroup[emptyGroup.length-1].closest('.group').remove(); } @@ -295,6 +304,10 @@ define([ onComboBlur: function() { Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + applyEditorMode: function(config) { + this.view && this.view.chRightMenu && this.view.chRightMenu.setVisible((config || this.mode)['isPDFEdit']); } }, PDFE.Controllers.ViewTab || {})); diff --git a/apps/pdfeditor/main/app/controller/Viewport.js b/apps/pdfeditor/main/app/controller/Viewport.js index bdb12e03c9..1eb1028434 100644 --- a/apps/pdfeditor/main/app/controller/Viewport.js +++ b/apps/pdfeditor/main/app/controller/Viewport.js @@ -107,6 +107,7 @@ define([ } } }); + this._initEditing = true; }, setApi: function(api) { @@ -119,6 +120,11 @@ define([ return this.api; }, + setMode: function(mode) { + this.mode = mode; + this.viewport && this.viewport.setMode(mode); + }, + // When our application is ready, lets get started onLaunch: function() { // Create and render main view @@ -157,13 +163,11 @@ define([ onAppShowed: function (config) { var me = this; - me.appConfig = config; - var _intvars = Common.Utils.InternalSettings; var $filemenu = $('.toolbar-fullview-panel'); $filemenu.css('top', Common.UI.LayoutManager.isElementVisible('toolbar') ? _intvars.get('toolbar-height-tabs') : 0); - me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]); + me.viewport.$el.attr('applang', config.lang.split(/[\-_]/)[0]); if ( !(config.isEdit || config.isRestrictedEdit) || ( !Common.localStorage.itemExists("pdfe-compact-toolbar") && config.customization && config.customization.compactToolbar )) { @@ -209,6 +213,9 @@ define([ switch (area) { default: this.viewport.vlayout.doLayout(); + case 'rightmenu': + this.viewport.hlayout.doLayout(); + break; case 'leftmenu': var panel = this.viewport.hlayout.getItem('left'); if (panel.resize.el) { @@ -282,8 +289,8 @@ define([ return; } if (!this.searchBar) { - var hideLeftPanel = this.appConfig.canBrandingExt && - (!Common.UI.LayoutManager.isElementVisible('leftMenu') || this.appConfig.customization && this.appConfig.customization.leftMenu === false); + var hideLeftPanel = this.mode.canBrandingExt && + (!Common.UI.LayoutManager.isElementVisible('leftMenu') || this.mode.customization && this.mode.customization.leftMenu === false); this.searchBar = new Common.UI.SearchBar( hideLeftPanel ? { showOpenPanel: false, width: 303 @@ -308,6 +315,41 @@ define([ return this.searchBar && this.searchBar.isVisible(); }, + applyCommonMode: function() { + if ( Common.localStorage.getBool('pdfe-hidden-status') ) + this.getApplication().getController('Statusbar').getView('Statusbar').setVisible(false); + + var value = Common.UI.LayoutManager.getInitValue('leftMenu'); + value = (value!==undefined) ? !value : false; + Common.localStorage.getBool("pdfe-hidden-leftmenu", value) && this.getApplication().getController('LeftMenu').getView('LeftMenu').hide(); + }, + + applyEditorMode: function() { + if (!this.viewport) return; + + if (this.mode.isPDFEdit && this._initEditing) { + var rightmenuController = this.getApplication().getController('RightMenu'), + rightMenuView = rightmenuController.getView('RightMenu'); + + rightmenuController.setMode(this.mode); + rightmenuController.setApi(this.api); + + this._rightMenu = rightMenuView.render(this.mode); + var value = Common.UI.LayoutManager.getInitValue('rightMenu'); + value = (value!==undefined) ? !value : false; + Common.localStorage.getBool("pdfe-hidden-rightmenu", value) && this._rightMenu.hide(); + Common.Utils.InternalSettings.set("pdfe-hidden-rightmenu", Common.localStorage.getBool("pdfe-hidden-rightmenu", value)); + + rightMenuView.setApi(this.api); + rightMenuView.setMode(this.mode); + + this._initEditing = false; + } + if (!this._initEditing) { + this.getApplication().getController('RightMenu').onRightMenuHide(undefined, this.mode.isPDFEdit && !Common.Utils.InternalSettings.get("pdfe-hidden-rightmenu"), true); + } + }, + textFitPage: 'Fit to Page', textFitWidth: 'Fit to Width', txtDarkMode: 'Dark mode' diff --git a/apps/pdfeditor/main/app/model/EquationGroup.js b/apps/pdfeditor/main/app/model/EquationGroup.js new file mode 100644 index 0000000000..5145d37c2d --- /dev/null +++ b/apps/pdfeditor/main/app/model/EquationGroup.js @@ -0,0 +1,70 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * EquationGroup.js + * + * Created by Alexey Musinov on 29/10/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + + +define([ + 'backbone' +], function(Backbone){ 'use strict'; + + PDFE.Models = PDFE.Models || {}; + + PDFE.Models.EquationModel = Backbone.Model.extend({ + defaults: function() { + return { + id : Common.UI.getId(), + data : null, + width : 0, + height : 0, + posX : 0, + posY : 0 + } + } + }); + + PDFE.Models.EquationGroup = Backbone.Model.extend({ + defaults: function() { + return { + id : Common.UI.getId(), + groupName : null, + groupId : null, + groupStore : null + } + } + }); +}); diff --git a/apps/pdfeditor/main/app/template/ChartSettings.template b/apps/pdfeditor/main/app/template/ChartSettings.template new file mode 100644 index 0000000000..c531e7384e --- /dev/null +++ b/apps/pdfeditor/main/app/template/ChartSettings.template @@ -0,0 +1,128 @@ + + + + + + + + + +
+ +
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+ + + + + + + + +
+
+
+ +
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ImageSettings.template b/apps/pdfeditor/main/app/template/ImageSettings.template new file mode 100644 index 0000000000..ad5591b19d --- /dev/null +++ b/apps/pdfeditor/main/app/template/ImageSettings.template @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+ +
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ImageSettingsAdvanced.template b/apps/pdfeditor/main/app/template/ImageSettingsAdvanced.template new file mode 100644 index 0000000000..d9af1d4a86 --- /dev/null +++ b/apps/pdfeditor/main/app/template/ImageSettingsAdvanced.template @@ -0,0 +1,117 @@ +
+
+ + + + +
+ +
+
+
+
+
+
+ + + + + + + + + + +
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + +
+ + +
+
+
+
+
+
+
+
+ + + + + + + + + + +
+ +
+
+ + +
+ +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ParagraphSettings.template b/apps/pdfeditor/main/app/template/ParagraphSettings.template new file mode 100644 index 0000000000..aae81fa2d7 --- /dev/null +++ b/apps/pdfeditor/main/app/template/ParagraphSettings.template @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+ +
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template b/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template new file mode 100644 index 0000000000..2b56d3a766 --- /dev/null +++ b/apps/pdfeditor/main/app/template/ParagraphSettingsAdvanced.template @@ -0,0 +1,128 @@ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+ + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + + +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/RightMenu.template b/apps/pdfeditor/main/app/template/RightMenu.template new file mode 100644 index 0000000000..0d54ab3400 --- /dev/null +++ b/apps/pdfeditor/main/app/template/RightMenu.template @@ -0,0 +1,29 @@ +
+
+
+
+
+
+
+
+
+
+ + +
+
+ + +
+
+
+ + + + + + + +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ShapeSettings.template b/apps/pdfeditor/main/app/template/ShapeSettings.template new file mode 100644 index 0000000000..de5df5eaa9 --- /dev/null +++ b/apps/pdfeditor/main/app/template/ShapeSettings.template @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ + + + + + + + + +
+
+ +
+
+
+
+ +
+
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+ + + + + +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/ShapeSettingsAdvanced.template b/apps/pdfeditor/main/app/template/ShapeSettingsAdvanced.template new file mode 100644 index 0000000000..ab690219a5 --- /dev/null +++ b/apps/pdfeditor/main/app/template/ShapeSettingsAdvanced.template @@ -0,0 +1,238 @@ +
+
+ + + + +
+ +
+
+
+
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + +
+ + +
+
+
+
+
+
+
+
+ + + + + + + + +
+ +
+ +
+
+ +
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + +
+ +
+
+ + +
+ +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/TableSettings.template b/apps/pdfeditor/main/app/template/TableSettings.template new file mode 100644 index 0000000000..38c012bb99 --- /dev/null +++ b/apps/pdfeditor/main/app/template/TableSettings.template @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+ +
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/TableSettingsAdvanced.template b/apps/pdfeditor/main/app/template/TableSettingsAdvanced.template new file mode 100644 index 0000000000..edac27f065 --- /dev/null +++ b/apps/pdfeditor/main/app/template/TableSettingsAdvanced.template @@ -0,0 +1,150 @@ +
+
+ + + + +
+ +
+
+
+
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + +
+ +
+
+ + +
+ +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/TextArtSettings.template b/apps/pdfeditor/main/app/template/TextArtSettings.template new file mode 100644 index 0000000000..e777049ddc --- /dev/null +++ b/apps/pdfeditor/main/app/template/TextArtSettings.template @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + +
+ + + +
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ + + + + + + + + +
+
+ +
+
+
+
+ +
+
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/apps/pdfeditor/main/app/template/Toolbar.template b/apps/pdfeditor/main/app/template/Toolbar.template index 91c048da0b..1451c113f0 100644 --- a/apps/pdfeditor/main/app/template/Toolbar.template +++ b/apps/pdfeditor/main/app/template/Toolbar.template @@ -34,15 +34,15 @@
-
+
-
+
-
+
@@ -57,24 +57,24 @@ -
-
-
+
+
+
-
+
-
-
+
+
-
+
- <% if ( typeof config !== "undefined" && config.isRestrictedEdit) { %> + <% if ( config.isRestrictedEdit) { %>
@@ -86,11 +86,66 @@
+ <% } else { %> +
+ +
+
+
+
+ + + + + +
+
+ + + + + + + + + +
+
+
+
+
+ + + + +
+
+ + + + +
+
+
+
+ + + +
+
+
+ +
+
+ +
+
<% } %>
+
diff --git a/apps/pdfeditor/main/app/template/Viewport.template b/apps/pdfeditor/main/app/template/Viewport.template index 79cb9bb003..bf30a07235 100644 --- a/apps/pdfeditor/main/app/template/Viewport.template +++ b/apps/pdfeditor/main/app/template/Viewport.template @@ -10,6 +10,7 @@
+
diff --git a/apps/pdfeditor/main/app/view/ChartSettings.js b/apps/pdfeditor/main/app/view/ChartSettings.js new file mode 100644 index 0000000000..30d8bf8016 --- /dev/null +++ b/apps/pdfeditor/main/app/view/ChartSettings.js @@ -0,0 +1,937 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ChartSettings.js + * + * Created by Julia Radzhabova on 4/11/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'text!pdfeditor/main/app/template/ChartSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/Button', + 'common/main/lib/component/ComboDataView', + // 'pdfeditor/main/app/view/ChartSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.ChartSettings = Backbone.View.extend(_.extend({ + el: '#id-chart-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'ChartSettings' + }, + + initialize: function () { + this._initSettings = true; + + this._state = { + Width: 0, + Height: 0, + ChartStyle: 1, + ChartType: -1, + SeveralCharts: false, + DisabledControls: false, + keepRatio: false + }; + this._nRatio = 1; + this.spinners = []; + this.lockedControls = []; + this._locked = false; + + this._noApply = false; + this._originalProps = null; + + this.render(); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + }, + + setApi: function(api) { + this.api = api; + if (this.api) { + this.api.asc_registerCallback('asc_onUpdateChartStyles', _.bind(this._onUpdateChartStyles, this)); + this.api.asc_registerCallback('asc_onAddChartStylesPreview', _.bind(this.onAddChartStylesPreview, this)); + } + return this; + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + this.disableControls(this._locked); + + if (props){ + this._originalProps = props; + this._noApply = true; + this.chartProps = props.get_ChartProperties(); + + var value = props.get_SeveralCharts() || this._locked; + this.btnEditData.setDisabled(value); + this._state.SeveralCharts=value; + + value = props.get_SeveralChartTypes(); + if (this._state.SeveralCharts && value) { + this.btnChartType.setIconCls('svgicon'); + this._state.ChartType = null; + } else { + var type = props.getType(); + if (this._state.ChartType !== type) { + var record = this.mnuChartTypePicker.store.findWhere({type: type}); + this.mnuChartTypePicker.selectRecord(record, true); + if (record) { + this.btnChartType.setIconCls('svgicon ' + 'chart-' + record.get('iconCls')); + } else + this.btnChartType.setIconCls('svgicon'); + this.ShowCombinedProps(type); + !(type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom) && this.updateChartStyles(this.api.asc_getChartPreviews(type, undefined, true)); + this._state.ChartType = type; + } + } + + if (!(type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom)) { + value = props.get_SeveralChartStyles(); + if (this._state.SeveralCharts && value) { + this.cmbChartStyle.fieldPicker.deselectAll(); + this.cmbChartStyle.menuPicker.deselectAll(); + this._state.ChartStyle = null; + } else { + value = props.getStyle(); + if (this._state.ChartStyle !== value || this._isChartStylesChanged) { + this._state.ChartStyle = value; + var arr = this.selectCurrentChartStyle(); + this._isChartStylesChanged && this.api.asc_generateChartPreviews(this._state.ChartType, arr); + } + } + this._isChartStylesChanged = false; + } + + this._noApply = false; + + value = props.get_Width(); + if ( Math.abs(this._state.Width-value)>0.001 || + (this._state.Width===null || value===null)&&(this._state.Width!==value)) { + this.spnWidth.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Width = value; + } + + value = props.get_Height(); + if ( Math.abs(this._state.Height-value)>0.001 || + (this._state.Height===null || value===null)&&(this._state.Height!==value)) { + this.spnHeight.setValue((value!==null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height = value; + } + + if (props.get_Height()>0) + this._nRatio = props.get_Width()/props.get_Height(); + + value = props.asc_getLockAspect(); + if (this._state.keepRatio!==value) { + this.btnRatio.toggle(value); + this._state.keepRatio=value; + } + + var props3d = this.chartProps ? this.chartProps.getView3d() : null; + if ( this._state.is3D!==!!props3d ) { + this._state.is3D=!!props3d; + this.ShowHideElem(this._state.is3D); + } + if (props3d) { + value = props3d.asc_getRotX(); + if ((this._state.X===undefined || value===undefined)&&(this._state.X!==value) || + Math.abs(this._state.X-value)>0.001) { + this.spnX.setValue((value!==null && value !== undefined) ? value : '', true); + this._state.X = value; + } + + value = props3d.asc_getRotY(); + if ( (this._state.Y===undefined || value===undefined)&&(this._state.Y!==value) || + Math.abs(this._state.Y-value)>0.001) { + this.spnY.setValue((value!==null && value !== undefined) ? value : '', true); + this._state.Y = value; + } + + value = props3d.asc_getRightAngleAxes(); + if ( this._state.RightAngle!==value ) { + this.chRightAngle.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); + this._state.RightAngle=value; + } + + value = props3d.asc_getPerspective(); + if ( (this._state.Perspective===undefined || value===undefined)&&(this._state.Perspective!==value) || + Math.abs(this._state.Perspective-value)>0.001) { + this.spnPerspective.setMinValue((value!==null && value !== undefined) ? 0.1 : 0); + this.spnPerspective.setValue((value!==null && value !== undefined) ? value : 0, true); + this._state.Perspective = value; + } + this.spnPerspective.setDisabled(this._locked || !!this._state.RightAngle); + this.btnNarrow.setDisabled(this._locked || !!this._state.RightAngle); + this.btnWiden.setDisabled(this._locked || !!this._state.RightAngle); + + value = props3d.asc_getDepth(); + if ( Math.abs(this._state.Depth-value)>0.001 || + (this._state.Depth===undefined || value===undefined)&&(this._state.Depth!==value)) { + this.spn3DDepth.setValue((value!==null && value !== undefined) ? value : '', true); + this._state.Depth = value; + } + + value = props3d.asc_getHeight(); + if ( Math.abs(this._state.Height3d-value)>0.001 || + (this._state.Height3d===undefined || this._state.Height3d===null || value===null)&&(this._state.Height3d!==value)) { + (value!==null) && this.spn3DHeight.setValue(value, true); + this.chAutoscale.setValue(value===null, true); + this._state.Height3d = value; + } + this.spn3DHeight.setDisabled(this._locked || value===null); + } + } + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i') } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.btnChartType.on('render:after', function(btn) { + me.mnuChartTypePicker = new Common.UI.DataView({ + el: $('#id-chart-menu-type'), + parentMenu: btn.menu, + restoreHeight: 535, + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), + itemTemplate: _.template('
\">
'), + delayRenderTips: true, + delaySelect: Common.Utils.isSafari + }); + }); + this.btnChartType.render($('#chart-button-type')); + this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); + this.lockedControls.push(this.btnChartType); + + this.btnEditData = new Common.UI.Button({ + el: $('#chart-button-edit-data') + }); + this.btnEditData.on('click', _.bind(this.setEditData, this)); + this.lockedControls.push(this.btnEditData); + + this.spnWidth = new Common.UI.MetricSpinner({ + el: $('#chart-spin-width'), + step: .1, + width: 78, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.spinners.push(this.spnWidth); + this.lockedControls.push(this.spnWidth); + + this.spnHeight = new Common.UI.MetricSpinner({ + el: $('#chart-spin-height'), + step: .1, + width: 78, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.spinners.push(this.spnHeight); + this.lockedControls.push(this.spnHeight); + + this.spnWidth.on('change', _.bind(this.onWidthChange, this)); + this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + this.spnWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.spnHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnRatio = new Common.UI.Button({ + parentEl: $('#chart-button-ratio'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-advanced-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.lockedControls.push(this.btnRatio); + + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.spnHeight.getNumberValue()>0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + if (this.api) { + var props = new Asc.CAscChartProp(); + props.asc_putLockAspect(btn.pressed); + this.api.ChartApply(props); + } + this.fireEvent('editcomplete', this); + }, this)); + + // 3d rotation + this.spnX = new Common.UI.MetricSpinner({ + el: $('#chart-spin-x'), + step: 10, + width: 57, + defaultUnit : "°", + value: '20 °', + maxValue: 359.9, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spnX); + this.spnX.on('change', _.bind(this.onXRotation, this)); + this.spnX.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnLeft = new Common.UI.Button({ + parentEl: $('#chart-btn-x-left', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-270', + hint: this.textLeft, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnLeft); + this.btnLeft.on('click', _.bind(function() { + this.spnX.setValue(Math.ceil((this.spnX.getNumberValue() - 10)/10)*10); + }, this)); + + this.btnRight= new Common.UI.Button({ + parentEl: $('#chart-btn-x-right', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-90', + hint: this.textRight, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnRight); + this.btnRight.on('click', _.bind(function() { + this.spnX.setValue(Math.floor((this.spnX.getNumberValue() + 10)/10)*10); + }, this)); + + this.spnY = new Common.UI.MetricSpinner({ + el: $('#chart-spin-y'), + step: 10, + width: 57, + defaultUnit : "°", + value: '15 °', + maxValue: 90, + minValue: -90, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spnY); + this.spnY.on('change', _.bind(this.onYRotation, this)); + this.spnY.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnUp = new Common.UI.Button({ + parentEl: $('#chart-btn-y-up', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-y-clockwise', + hint: this.textUp, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnUp); + this.btnUp.on('click', _.bind(function() { + this.spnY.setValue(Math.ceil((this.spnY.getNumberValue() - 10)/10)*10); + }, this)); + + this.btnDown= new Common.UI.Button({ + parentEl: $('#chart-btn-y-down', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-y-counterclockwise', + hint: this.textDown, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnDown); + this.btnDown.on('click', _.bind(function() { + this.spnY.setValue(Math.floor((this.spnY.getNumberValue() + 10)/10)*10); + }, this)); + + this.spnPerspective = new Common.UI.MetricSpinner({ + el: $('#chart-spin-persp'), + step: 5, + width: 57, + defaultUnit : "°", + value: '0 °', + maxValue: 100, + minValue: 0.1, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spnPerspective); + this.spnPerspective.on('change', _.bind(this.onPerspective, this)); + this.spnPerspective.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnNarrow = new Common.UI.Button({ + parentEl: $('#chart-btn-narrow', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-up', + hint: this.textNarrow, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnNarrow); + this.btnNarrow.on('click', _.bind(function() { + this.spnPerspective.setValue(Math.ceil((this.spnPerspective.getNumberValue() - 5)/5)*5); + }, this)); + + this.btnWiden= new Common.UI.Button({ + parentEl: $('#chart-btn-widen', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-down', + hint: this.textWiden, + dataHint: '1', + dataHintDirection: 'top' + }); + this.lockedControls.push(this.btnWiden); + this.btnWiden.on('click', _.bind(function() { + this.spnPerspective.setValue(Math.floor((this.spnPerspective.getNumberValue() + 5)/5)*5); + }, this)); + + this.chRightAngle = new Common.UI.CheckBox({ + el: $('#chart-checkbox-right-angle'), + labelText: this.textRightAngle + }); + this.lockedControls.push(this.chRightAngle); + this.chRightAngle.on('change', _.bind(function(field, newValue, oldValue, eOpts) { + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setRightAngleAxes(field.getValue()=='checked'); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, this)); + + this.chAutoscale = new Common.UI.CheckBox({ + el: $('#chart-checkbox-autoscale'), + labelText: this.textAutoscale + }); + this.lockedControls.push(this.chAutoscale); + this.chAutoscale.on('change', _.bind(function(field, newValue, oldValue, eOpts) { + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setHeight(field.getValue()=='checked' ? null : this.spn3DHeight.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, this)); + + this.spn3DDepth = new Common.UI.MetricSpinner({ + el: $('#chart-spin-3d-depth'), + step: 10, + width: 70, + defaultUnit : "%", + value: '0 %', + maxValue: 2000, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spn3DDepth); + this.spn3DDepth.on('change', _.bind(this.on3DDepth, this)); + this.spn3DDepth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.spn3DHeight = new Common.UI.MetricSpinner({ + el: $('#chart-spin-3d-height'), + step: 10, + width: 70, + defaultUnit : "%", + value: '50 %', + maxValue: 500, + minValue: 5, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spn3DHeight); + this.spn3DHeight.on('change', _.bind(this.on3DHeight, this)); + this.spn3DHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.linkDefRotation = $('#chart-def-rotate-link'); + $(this.el).on('click', '#chart-def-rotate-link', _.bind(this.onDefRotation, this)); + + this.linkAdvanced = $('#chart-advanced-link'); + $(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this)); + + this.NotCombinedSettings = $('.not-combined'); + this.Chart3DContainer = $('#chart-panel-3d-rotate'); + }, + + createDelayedElements: function() { + this.createDelayedControls(); + this.updateMetricUnit(); + this._initSettings = false; + }, + + setEditData: function() { + var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); + if (diagramEditor) { + diagramEditor.setEditMode(true); + diagramEditor.show(); + + var chart = this.api.asc_getChartObject(); + if (chart) { + diagramEditor.setChartData(new Asc.asc_CChartBinary(chart)); + } + } + }, + + onSelectType: function(btn, picker, itemView, record) { + if (this._noApply) return; + + var rawData = {}, + isPickerSelect = _.isFunction(record.toJSON); + + if (isPickerSelect){ + if (record.get('selected')) { + rawData = record.toJSON(); + } else { + // record deselected + return; + } + } else { + rawData = record; + } + + if (this.api && !this._noApply) { + var isCombo = (rawData.type==Asc.c_oAscChartTypeSettings.comboBarLine || rawData.type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + rawData.type==Asc.c_oAscChartTypeSettings.comboAreaBar || rawData.type==Asc.c_oAscChartTypeSettings.comboCustom); + + if (isCombo && this.chartProps.getSeries().length<2) { + Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical); + this.mnuChartTypePicker.selectRecord(this.mnuChartTypePicker.store.findWhere({type: this._originalProps.getType()}), true); + } else { + this.btnChartType.setIconCls('svgicon ' + 'chart-' + rawData.iconCls); + this._state.ChartType = -1; + this._originalProps.changeType(rawData.type); + } + } + this.fireEvent('editcomplete', this); + }, + + onSelectStyle: function(combo, record) { + if (this._noApply) return; + + if (this.api && !this._noApply) { + var props = new Asc.CAscChartProp(); + this.chartProps.putStyle(record.get('data')); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + this.fireEvent('editcomplete', this); + }, + + selectCurrentChartStyle: function() { + if (!this.cmbChartStyle) return; + + this.cmbChartStyle.suspendEvents(); + var rec = this.cmbChartStyle.menuPicker.store.findWhere({data: this._state.ChartStyle}); + this.cmbChartStyle.menuPicker.selectRecord(rec); + this.cmbChartStyle.resumeEvents(); + + if (this._isChartStylesChanged) { + var currentRecords; + if (rec) + currentRecords = this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(), true); + else + currentRecords = this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0), true); + if (currentRecords && currentRecords.length>0) { + var arr = []; + _.each(currentRecords, function(style, index){ + arr.push(style.get('data')); + }); + return arr; + } + } + }, + + onAddChartStylesPreview: function(styles){ + if (!this.cmbChartStyle) return; + + var me = this; + if (styles && styles.length>0){ + var stylesStore = this.cmbChartStyle.menuPicker.store; + if (stylesStore) { + _.each(styles, function(item, index){ + var rec = stylesStore.findWhere({ + data: item.asc_getName() + }); + rec && rec.set('imageUrl', item.asc_getImage()); + }); + } + } + }, + + _onUpdateChartStyles: function() { + if (this.api && this._state.ChartType!==null && this._state.ChartType>-1 && + !(this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + this._state.ChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboCustom)) { + this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType, undefined, true)); + this.api.asc_generateChartPreviews(this._state.ChartType, this.selectCurrentChartStyle()); + } + }, + + updateChartStyles: function(styles) { + var me = this; + this._isChartStylesChanged = true; + + if (!this.cmbChartStyle) { + this.cmbChartStyle = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 270, + enableKeyEvents: true, + cls: 'combo-chart-style', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + delayRenderTips: true + }); + this.cmbChartStyle.render($('#chart-combo-style')); + this.cmbChartStyle.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbChartStyle.on('click', _.bind(this.onSelectStyle, this)); + this.cmbChartStyle.openButton.menu.on('show:after', function () { + me.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbChartStyle); + } + + if (styles && styles.length>0){ + var stylesStore = this.cmbChartStyle.menuPicker.store; + if (stylesStore) { + var stylearray = []; + _.each(styles, function(item, index){ + stylearray.push({ + imageUrl: item.asc_getImage(), + data : item.asc_getName(), + tip : me.textStyle + ' ' + item.asc_getName() + }); + }); + stylesStore.reset(stylearray, {silent: false}); + } + } else { + this.cmbChartStyle.menuPicker.store.reset(); + this.cmbChartStyle.clearComboView(); + } + this.cmbChartStyle.setDisabled(!styles || styles.length<1 || this._locked); + }, + + onWidthChange: function(field, newValue, oldValue, eOpts){ + var w = field.getNumberValue(); + var h = this.spnHeight.getNumberValue(); + if (this.btnRatio.pressed) { + h = w/this._nRatio; + if (h>this.spnHeight.options.maxValue) { + h = this.spnHeight.options.maxValue; + w = h * this._nRatio; + this.spnWidth.setValue(w, true); + } + this.spnHeight.setValue(h, true); + } + if (this.api) { + var props = new Asc.CAscChartProp(); + props.put_Width(Common.Utils.Metric.fnRecalcToMM(w)); + props.put_Height(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.ChartApply(props); + } + }, + + onHeightChange: function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = this.spnWidth.getNumberValue(); + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.spnWidth.options.maxValue) { + w = this.spnWidth.options.maxValue; + h = w/this._nRatio; + this.spnHeight.setValue(h, true); + } + this.spnWidth.setValue(w, true); + } + if (this.api) { + var props = new Asc.CAscChartProp(); + props.put_Width(Common.Utils.Metric.fnRecalcToMM(w)); + props.put_Height(Common.Utils.Metric.fnRecalcToMM(h)); + this.api.ChartApply(props); + } + }, + + openAdvancedSettings: function(e) { + if (this.linkAdvanced.hasClass('disabled')) return; + + var me = this; + var win; + if (me.api && !this._locked){ + 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: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ChartApply(value.chartProps); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + break; + } + } + } + } + }, + + ShowCombinedProps: function(type) { + this.NotCombinedSettings.toggleClass('settings-hidden', type===null || type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary || + type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom); + }, + + ShowHideElem: function(is3D) { + this.Chart3DContainer.toggleClass('settings-hidden', !is3D); + this.fireEvent('updatescroller', this); + }, + + onXRotation: function(field, newValue, oldValue, eOpts){ + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setRotX(field.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, + + onYRotation: function(field, newValue, oldValue, eOpts){ + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setRotY(field.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + + }, + + onPerspective: function(field, newValue, oldValue, eOpts){ + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setPerspective(field.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, + + on3DDepth: function(field, newValue, oldValue, eOpts){ + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setDepth(field.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, + + on3DHeight: function(field, newValue, oldValue, eOpts){ + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setHeight(field.getNumberValue()); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, + + onDefRotation: function() { + if (this._noApply) return; + if (this.api){ + if (this.chartProps) { + var props = new Asc.CAscChartProp(); + var oView3D = this.chartProps.getView3d(); + if (oView3D) { + oView3D.asc_setRotX(20); + oView3D.asc_setRotY(15); + this.chartProps.putView3d(oView3D); + props.put_ChartProperties(this.chartProps); + this.api.ChartApply(props); + } + } + } + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced.toggleClass('disabled', disable); + } + }, + + textKeepRatio: 'Constant Proportions', + textSize: 'Size', + textWidth: 'Width', + textHeight: 'Height', + textEditData: 'Edit Data', + textChartType: 'Change Chart Type', + textStyle: 'Style', + textAdvanced: 'Show advanced settings', + text3dRotation: '3D Rotation', + textX: 'X rotation', + textY: 'Y rotation', + textPerspective: 'Perspective', + text3dDepth: 'Depth (% of base)', + text3dHeight: 'Height (% of base)', + textLeft: 'Left', + textRight: 'Right', + textUp: 'Up', + textDown: 'Down', + textNarrow: 'Narrow field of view', + textWiden: 'Widen field of view', + textRightAngle: 'Right Angle Axes', + textAutoscale: 'Autoscale', + textDefault: 'Default Rotation' + }, PDFE.Views.ChartSettings || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/DocumentHolder.js b/apps/pdfeditor/main/app/view/DocumentHolder.js index 9730772dc1..029dceae88 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolder.js +++ b/apps/pdfeditor/main/app/view/DocumentHolder.js @@ -66,6 +66,7 @@ define([ this._isDisabled = false; this._preventCustomClick = null; this._hasCustomItems = false; + this._pagesCount = 0; }, render: function () { @@ -125,6 +126,1092 @@ define([ this.fireEvent('createdelayedelements', [this, 'pdf']); }, + createDelayedElementsPDFEditor: function() { + var me = this; + me.menuPDFEditCopy = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-copy', + caption: me.textCopy, + value: 'copy' + }); + + me.menuEditAddComment = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-add-comment', + caption : me.addCommentText + }); + + this.editPDFModeMenu = new Common.UI.Menu({ + cls: 'shifted-right', + initMenu: function (value) { + me.menuPDFEditCopy.setDisabled(!(me.api && me.api.can_CopyCut())); + me.menuEditAddComment.setVisible(me.mode && me.mode.canComments); + }, + items: [ + me.menuPDFEditCopy, + me.menuEditAddComment + ] + }).on('hide:after', function (menu, e, isFromInputControl) { + me.clearCustomItems(menu); + me.currentMenu = null; + if (me.suppressEditComplete) { + me.suppressEditComplete = false; + return; + } + + if (!isFromInputControl) me.fireEvent('editcomplete', me); + }); + + // Table + me.mnuTableMerge = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-merge-cells', + caption : me.mergeCellsText + }); + + me.mnuTableSplit = new Common.UI.MenuItem({ + caption : me.splitCellsText + }); + + me.menuTableCellAlign = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-top', + caption : me.cellAlignText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + me.menuTableCellTop = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-top', + caption : me.textShapeAlignTop, + checkable : true, + checkmark : false, + toggleGroup : 'popuptablecellalign', + value : Asc.c_oAscVertAlignJc.Top + }), + me.menuTableCellCenter = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-middle', + caption : me.textShapeAlignMiddle, + checkable : true, + checkmark : false, + toggleGroup : 'popuptablecellalign', + value : Asc.c_oAscVertAlignJc.Center + }), + me.menuTableCellBottom = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-bottom', + caption : me.textShapeAlignBottom, + checkable : true, + checkmark : false, + toggleGroup : 'popuptablecellalign', + value : Asc.c_oAscVertAlignJc.Bottom + }) + ] + }) + }); + + me.menuTableSaveAsPicture = new Common.UI.MenuItem({ + caption : me.textSaveAsPicture + }); + + var menuTableSaveAsPictureSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuTableDistRows = new Common.UI.MenuItem({ + caption : me.textDistributeRows + }); + + me.menuTableDistCols = new Common.UI.MenuItem({ + caption : me.textDistributeCols + }); + + me.menuTableSelectText = new Common.UI.MenuItem({ + caption : me.selectText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption : me.rowText, + value: 0 + }), + new Common.UI.MenuItem({ + caption : me.columnText, + value: 1 + }), + new Common.UI.MenuItem({ + caption : me.cellText, + value: 2 + }), + new Common.UI.MenuItem({ + caption : me.tableText, + value: 3 + }) + ] + }) + }); + + me.menuTableInsertText = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-addcell', + caption : me.insertText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + style : 'width: 100px', + items : [ + new Common.UI.MenuItem({ + caption: me.insertColumnLeftText, + value: 0 + }), + new Common.UI.MenuItem({ + caption: me.insertColumnRightText, + value: 1 + }), + new Common.UI.MenuItem({ + caption: me.insertRowAboveText, + value: 2 + }), + new Common.UI.MenuItem({ + caption: me.insertRowBelowText, + value: 3 + }) + ] + }) + }); + + me.menuTableDeleteText = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-delcell', + caption : me.deleteText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption : me.rowText, + value: 0 + }), + new Common.UI.MenuItem({ + caption : me.columnText, + value: 1 + }), + new Common.UI.MenuItem({ + caption : me.tableText, + value: 2 + }) + ] + }) + }); + + me.menuTableAdvanced = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-menu-table', + caption : me.advancedTableText + }); + + var menuTableSettingsSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuAddHyperlinkTable = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-inserthyperlink', + caption : me.hyperlinkText + }); + + me.menuEditHyperlinkTable = new Common.UI.MenuItem({ + caption : me.editHyperlinkText + }); + + me.menuRemoveHyperlinkTable = new Common.UI.MenuItem({ + caption : me.removeHyperlinkText + }); + + var menuHyperlinkTable = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-inserthyperlink', + caption : me.hyperlinkText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + me.menuEditHyperlinkTable, + me.menuRemoveHyperlinkTable + ] + }) + }); + + var menuHyperlinkSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuAddCommentTable = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-add-comment', + caption : me.addCommentText + }); + me.menuAddCommentTable.hide(); + + me.menuTableCopy = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-copy', + caption : me.textCopy, + value : 'copy' + }); + + me.menuTablePaste = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-paste', + caption : me.textPaste, + value : 'paste' + }); + + me.menuTableCut = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-cut', + caption : me.textCut, + value : 'cut' + }); + + var menuTableEquationSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + var menuTableEquationSettingsSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuTableEquationSettings = new Common.UI.MenuItem({ + caption : me.advancedEquationText, + iconCls : 'menu__icon btn-equation', + menu : me.createEquationMenu('popuptableeqinput', 'tl-tr') + }); + + me.tableMenu = new Common.UI.Menu({ + cls: 'shifted-right', + restoreHeightAndTop: true, + scrollToCheckedItem: false, + initMenu: function(value){ + // table properties + if (_.isUndefined(value.tableProps)) + return; + + var isEquation= (value.mathProps && value.mathProps.value); + for (var i = 4; i < 16; i++) { + me.tableMenu.items[i].setVisible(!isEquation); + } + + var align = value.tableProps.value.get_CellsVAlign(); + var cls = ''; + switch (align) { + case Asc.c_oAscVertAlignJc.Top: + cls = 'menu__icon btn-align-top'; + break; + case Asc.c_oAscVertAlignJc.Center: + cls = 'menu__icon btn-align-middle'; + break; + case Asc.c_oAscVertAlignJc.Bottom: + cls = 'menu__icon btn-align-bottom'; + break; + } + me.menuTableCellAlign.setIconCls(cls); + me.menuTableCellTop.setChecked(align == Asc.c_oAscVertAlignJc.Top); + me.menuTableCellCenter.setChecked(align == Asc.c_oAscVertAlignJc.Center); + me.menuTableCellBottom.setChecked(align == Asc.c_oAscVertAlignJc.Bottom); + + if (me.api) { + me.mnuTableMerge.setDisabled(value.tableProps.locked || !me.api.CheckBeforeMergeCells()); + me.mnuTableSplit.setDisabled(value.tableProps.locked || !me.api.CheckBeforeSplitCells()); + } + me.menuTableDistRows.setDisabled(value.tableProps.locked); + me.menuTableDistCols.setDisabled(value.tableProps.locked); + + me.tableMenu.items[5].setDisabled(value.tableProps.locked); + me.tableMenu.items[6].setDisabled(value.tableProps.locked); + + me.menuTableCellAlign.setDisabled(value.tableProps.locked); + + me.menuTableSaveAsPicture.setVisible(!isEquation); + menuTableSaveAsPictureSeparator.setVisible(!isEquation); + + me.menuTableAdvanced.setVisible(!isEquation); + me.menuTableAdvanced.setDisabled(value.tableProps.locked); + menuTableSettingsSeparator.setVisible(me.menuTableAdvanced.isVisible()); + + var cancopy = me.api && me.api.can_CopyCut(); + me.menuTableCopy.setDisabled(!cancopy); + me.menuTableCut.setDisabled(value.tableProps.locked || !cancopy); + me.menuTablePaste.setDisabled(value.tableProps.locked); + + // hyperlink properties + var text = null; + + if (me.api) { + text = me.api.can_AddHyperlink(); + } + + me.menuAddHyperlinkTable.setVisible(!_.isUndefined(value.paraProps) && _.isUndefined(value.hyperProps) && text!==false); + menuHyperlinkTable.setVisible(!_.isUndefined(value.paraProps) && !_.isUndefined(value.hyperProps)); + menuHyperlinkSeparator.setVisible(me.menuAddHyperlinkTable.isVisible() || menuHyperlinkTable.isVisible()); + + me.menuEditHyperlinkTable.hyperProps = value.hyperProps; + + if (text!==false) { + me.menuAddHyperlinkTable.hyperProps = {}; + me.menuAddHyperlinkTable.hyperProps.value = new Asc.CHyperlinkProperty(); + me.menuAddHyperlinkTable.hyperProps.value.put_Text(text); + } + if (!_.isUndefined(value.paraProps)) { + me.menuAddHyperlinkTable.setDisabled(value.paraProps.locked); + menuHyperlinkTable.setDisabled(value.paraProps.locked); + me._currentParaObjDisabled = value.paraProps.locked; + } + + me.menuAddCommentTable.setVisible(me.mode && me.mode.canComments); + menuHyperlinkSeparator.setVisible(menuHyperlinkSeparator.isVisible() || me.menuAddCommentTable.isVisible()); + + //equation menu + var eqlen = 0; + if (isEquation) { + eqlen = me.addEquationMenu(false, 4); + } else + me.clearEquationMenu(false, 4); + + menuTableEquationSeparator.setVisible(eqlen>0); + me.menuTableEquationSettings.setVisible(isEquation); + menuTableEquationSettingsSeparator.setVisible(isEquation); + if (isEquation) { + var eq = me.api.asc_GetMathInputType(), + isEqToolbarHide = Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide'); + + me.menuTableEquationSettings.menu.items[5].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + me.menuTableEquationSettings.menu.items[6].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + me.menuTableEquationSettings.menu.items[8].options.isToolbarHide = isEqToolbarHide; + me.menuTableEquationSettings.menu.items[8].setCaption(isEqToolbarHide ? me.showEqToolbar : me.hideEqToolbar); + } + }, + items: [ + me.menuTableCut, //0 + me.menuTableCopy, //1 + me.menuTablePaste, //2 + { caption: '--' }, //3 + me.menuTableSelectText, //4 + me.menuTableInsertText, //5 + me.menuTableDeleteText, //6 + { caption: '--' }, //7 + me.mnuTableMerge, //8 + me.mnuTableSplit, //9 + { caption: '--' }, //10 + me.menuTableDistRows, //11 + me.menuTableDistCols, //12 + { caption: '--' }, //13 + me.menuTableCellAlign, //14 + { caption: '--'}, //15 + menuTableEquationSeparator, //16 + me.menuTableSaveAsPicture, //17 + menuTableSaveAsPictureSeparator,//18 + me.menuTableAdvanced, //19 + menuTableSettingsSeparator, //20 + me.menuTableEquationSettings, //21 + menuTableEquationSettingsSeparator, //22 + /** coauthoring begin **/ + me.menuAddCommentTable, //23 + /** coauthoring end **/ + me.menuAddHyperlinkTable, //24 + menuHyperlinkTable, //25 + menuHyperlinkSeparator //26 + ] + }).on('hide:after', function(menu, e, isFromInputControl) { + me.clearCustomItems(menu); + me.currentMenu = null; + if (me.suppressEditComplete) { + me.suppressEditComplete = false; + return; + } + + if (!isFromInputControl) me.fireEvent('editcomplete', me); + }); + + // Image + me.menuImageAdvanced = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-menu-image', + caption : me.advancedImageText + }); + + me.menuShapeAdvanced = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-menu-shape', + caption : me.advancedShapeText + }); + + var menuAdvancedSettingsSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.mnuGroupImg = new Common.UI.MenuItem({ + caption : this.txtGroup, + iconCls : 'menu__icon btn-shape-group' + }); + + me.mnuUnGroupImg = new Common.UI.MenuItem({ + caption : this.txtUngroup, + iconCls : 'menu__icon btn-shape-ungroup' + }); + + me.mnuArrangeFront = new Common.UI.MenuItem({ + caption : this.textArrangeFront, + iconCls : 'menu__icon btn-arrange-front' + }); + + me.mnuArrangeBack = new Common.UI.MenuItem({ + caption : this.textArrangeBack, + iconCls : 'menu__icon btn-arrange-back' + }); + + me.mnuArrangeForward = new Common.UI.MenuItem({ + caption : this.textArrangeForward, + iconCls : 'menu__icon btn-arrange-forward' + }); + + me.mnuArrangeBackward = new Common.UI.MenuItem({ + caption : this.textArrangeBackward, + iconCls : 'menu__icon btn-arrange-backward' + }); + + var menuImgShapeArrange = new Common.UI.MenuItem({ + caption : me.txtArrange, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + me.mnuArrangeFront, + me.mnuArrangeBack, + me.mnuArrangeForward, + me.mnuArrangeBackward, + // {caption: '--'}, + // me.mnuGroupImg, + // me.mnuUnGroupImg + ] + }) + }); + + me.menuImgShapeAlign = new Common.UI.MenuItem({ + caption : me.txtAlign, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption : me.textShapeAlignLeft, + iconCls : 'menu__icon btn-shape-align-left', + value : Asc.c_oAscAlignShapeType.ALIGN_LEFT + }), + new Common.UI.MenuItem({ + caption : me.textShapeAlignCenter, + iconCls : 'menu__icon btn-shape-align-center', + value : Asc.c_oAscAlignShapeType.ALIGN_CENTER + }), + new Common.UI.MenuItem({ + caption : me.textShapeAlignRight, + iconCls : 'menu__icon btn-shape-align-right', + value : Asc.c_oAscAlignShapeType.ALIGN_RIGHT + }), + new Common.UI.MenuItem({ + caption : me.textShapeAlignTop, + iconCls : 'menu__icon btn-shape-align-top', + value : Asc.c_oAscAlignShapeType.ALIGN_TOP + }), + new Common.UI.MenuItem({ + caption : me.textShapeAlignMiddle, + iconCls : 'menu__icon btn-shape-align-middle', + value : Asc.c_oAscAlignShapeType.ALIGN_MIDDLE + }), + new Common.UI.MenuItem({ + caption : me.textShapeAlignBottom, + iconCls : 'menu__icon btn-shape-align-bottom', + value : Asc.c_oAscAlignShapeType.ALIGN_BOTTOM + }), + {caption : '--'}, + new Common.UI.MenuItem({ + caption : me.txtDistribHor, + iconCls : 'menu__icon btn-shape-distribute-hor', + value : 6 + }), + new Common.UI.MenuItem({ + caption : me.txtDistribVert, + iconCls : 'menu__icon btn-shape-distribute-vert', + value : 7 + }) + ] + }) + }); + + var menuImgShapeSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuImgOriginalSize = new Common.UI.MenuItem({ + caption : me.originalSizeText + }); + + me.menuImgReplace = new Common.UI.MenuItem({ + caption : me.textReplace, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption : this.textFromFile, + value: 0 + }), + new Common.UI.MenuItem({ + caption : this.textFromUrl, + value: 1 + }), + new Common.UI.MenuItem({ + caption : this.textFromStorage, + value: 2 + }) + ] + }) + }); + + me.menuImgShapeRotate = new Common.UI.MenuItem({ + caption : me.textRotate, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-rotate-90', + caption: me.textRotate90, + value : 1 + }), + new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-rotate-270', + caption: me.textRotate270, + value : 0 + }), + { caption: '--' }, + new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-flip-hor', + caption: me.textFlipH, + value : 1 + }), + new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-flip-vert', + caption: me.textFlipV, + value : 0 + }) + ] + }) + }); + + me.menuImgCrop = new Common.UI.MenuItem({ + caption : me.textCrop, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + new Common.UI.MenuItem({ + caption: me.textCrop, + checkable: true, + allowDepress: true, + value : 0 + }), + new Common.UI.MenuItem({ + caption: me.textCropFill, + value : 1 + }), + new Common.UI.MenuItem({ + caption: me.textCropFit, + value : 2 + }) + ] + }) + }); + + me.menuImgSaveAsPicture = new Common.UI.MenuItem({ + caption : me.textSaveAsPicture + }); + + var menuImgSaveAsPictureSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuAddCommentImg = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-add-comment', + caption : me.addCommentText + }); + me.menuAddCommentImg.hide(); + + me.menuImgCopy = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-copy', + caption : me.textCopy, + value : 'copy' + }); + + me.menuImgPaste = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-paste', + caption : me.textPaste, + value : 'paste' + }); + + me.menuImgCut = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-cut', + caption : me.textCut, + value : 'cut' + }); + + me.menuImgEditPoints = new Common.UI.MenuItem({ + caption: me.textEditPoints + }); + + me.pictureMenu = new Common.UI.Menu({ + cls: 'shifted-right', + restoreHeightAndTop: true, + scrollToCheckedItem: false, + initMenu: function(value){ + if (me.api) { + me.mnuUnGroupImg.setDisabled(!me.api.canUnGroup()); + me.mnuGroupImg.setDisabled(!me.api.canGroup()); + } + + var isimage = (_.isUndefined(value.shapeProps) || value.shapeProps.value.get_FromImage()) && _.isUndefined(value.chartProps), + imgdisabled = (value.imgProps!==undefined && value.imgProps.locked), + shapedisabled = (value.shapeProps!==undefined && value.shapeProps.locked), + chartdisabled = (value.chartProps!==undefined && value.chartProps.locked), + disabled = imgdisabled || shapedisabled || chartdisabled, + pluginGuid = (value.imgProps) ? value.imgProps.value.asc_getPluginGuid() : null, + inSmartartInternal = value.shapeProps && value.shapeProps.value.get_FromSmartArtInternal(), + lastSeparator = menuImgSaveAsPictureSeparator; + + me.mnuArrangeFront.setDisabled(inSmartartInternal); + me.mnuArrangeBack.setDisabled(inSmartartInternal); + me.mnuArrangeForward.setDisabled(inSmartartInternal); + me.mnuArrangeBackward.setDisabled(inSmartartInternal); + + me.menuImgShapeRotate.setVisible(_.isUndefined(value.chartProps) && (pluginGuid===null || pluginGuid===undefined)); + if (me.menuImgShapeRotate.isVisible()) { + me.menuImgShapeRotate.setDisabled(disabled || (value.shapeProps && value.shapeProps.value.get_FromSmartArt())); + me.menuImgShapeRotate.menu.items[3].setDisabled(inSmartartInternal); + me.menuImgShapeRotate.menu.items[4].setDisabled(inSmartartInternal); + } + + // image properties + me.menuImgOriginalSize.setVisible(isimage); + if (me.menuImgOriginalSize.isVisible()) + me.menuImgOriginalSize.setDisabled(disabled || _.isNull(value.imgProps.value.get_ImageUrl()) || _.isUndefined(value.imgProps.value.get_ImageUrl())); + + me.menuImgReplace.setVisible(isimage && (pluginGuid===null || pluginGuid===undefined)); + if (me.menuImgReplace.isVisible()) + me.menuImgReplace.setDisabled(disabled || pluginGuid===null); + me.menuImgReplace.menu.items[2].setVisible(me.mode.canRequestInsertImage || me.mode.fileChoiceUrl && me.mode.fileChoiceUrl.indexOf("{documentType}")>-1); + + me.menuImgCrop.setVisible(me.api.asc_canEditCrop()); + if (me.menuImgCrop.isVisible()) + me.menuImgCrop.setDisabled(disabled); + + var canEditPoints = me.api && me.api.asc_canEditGeometry(); + me.menuImgEditPoints.setVisible(canEditPoints); + canEditPoints && me.menuImgEditPoints.setDisabled(disabled); + + 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)); + // 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()); + menuAdvancedSettingsSeparator.setVisible( + me.menuImgCrop.isVisible() || me.menuImgOriginalSize.isVisible() || + me.menuImgReplace.isVisible() || me.menuImageAdvanced.isVisible() || + me.menuImgEditPoints.isVisible() || me.menuShapeAdvanced.isVisible() /*|| + me.menuChartEdit.isVisible() || me.menuChartAdvanced.isVisible()*/ + ); + menuAdvancedSettingsSeparator.isVisible() && (lastSeparator = menuAdvancedSettingsSeparator); + + /** coauthoring begin **/ + me.menuAddCommentImg.setVisible(me.mode && me.mode.canComments); + !me.menuAddCommentImg.isVisible() && lastSeparator.setVisible(false); + /** coauthoring end **/ + me.menuImgShapeAlign.setDisabled(disabled); + if (!disabled) { + var objcount = me.api.asc_getSelectedDrawingObjectsCount(), + slide_checked = Common.Utils.InternalSettings.get("pdfe-align-to-slide") || false; + me.menuImgShapeAlign.menu.items[7].setDisabled(objcount==2 && !slide_checked); + me.menuImgShapeAlign.menu.items[8].setDisabled(objcount==2 && !slide_checked); + } + me.menuImageAdvanced.setDisabled(disabled); + me.menuShapeAdvanced.setDisabled(disabled); + // me.menuChartAdvanced.setDisabled(disabled); + // if (me.menuChartEdit.isVisible()) + // me.menuChartEdit.setDisabled(disabled); + + var cancopy = me.api && me.api.can_CopyCut(); + me.menuImgCopy.setDisabled(!cancopy); + me.menuImgCut.setDisabled(disabled || !cancopy); + me.menuImgPaste.setDisabled(disabled); + menuImgShapeArrange.setDisabled(disabled); + }, + items: [ + me.menuImgCut, + me.menuImgCopy, + me.menuImgPaste, + { caption: '--' }, //Separator + menuImgShapeArrange, + me.menuImgShapeAlign, + me.menuImgShapeRotate, + menuImgShapeSeparator, //Separator + me.menuImgSaveAsPicture, + menuImgSaveAsPictureSeparator, //Separator + me.menuImgCrop, + me.menuImgOriginalSize, + me.menuImgReplace, + me.menuImageAdvanced, + me.menuImgEditPoints, + me.menuShapeAdvanced, + // me.menuChartEdit, + // me.menuChartAdvanced, + menuAdvancedSettingsSeparator, //Separator + /** coauthoring begin **/ + me.menuAddCommentImg + ] + }).on('hide:after', function(menu, e, isFromInputControl) { + me.clearCustomItems(menu); + me.currentMenu = null; + if (me.suppressEditComplete) { + me.suppressEditComplete = false; + return; + } + + if (!isFromInputControl) me.fireEvent('editcomplete', me); + }); + + // Paragraph + me.menuParagraphAdvanced = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-paragraph', + caption : me.advancedParagraphText + }); + + var menuCommentParaSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuAddHyperlinkPara = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-inserthyperlink', + caption : me.hyperlinkText + }); + + me.menuEditHyperlinkPara = new Common.UI.MenuItem({ + caption : me.editHyperlinkText + }); + + me.menuRemoveHyperlinkPara = new Common.UI.MenuItem({ + caption : me.removeHyperlinkText + }); + + var menuHyperlinkPara = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-inserthyperlink', + caption : me.hyperlinkText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + me.menuEditHyperlinkPara, + me.menuRemoveHyperlinkPara + ] + }) + }); + + me.menuParagraphVAlign = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-top', + caption : me.vertAlignText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items: [ + me.menuParagraphTop = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-top', + caption : me.textShapeAlignTop, + checkable : true, + checkmark : false, + toggleGroup : 'popupparagraphvalign', + value : Asc.c_oAscVAlign.Top + }), + me.menuParagraphCenter = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-middle', + caption : me.textShapeAlignMiddle, + checkable : true, + checkmark : false, + toggleGroup : 'popupparagraphvalign', + value : Asc.c_oAscVAlign.Center + }), + me.menuParagraphBottom = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-align-bottom', + caption : me.textShapeAlignBottom, + checkable : true, + checkmark : false, + toggleGroup : 'popupparagraphvalign', + value : Asc.c_oAscVAlign.Bottom + }) + ] + }) + }); + + me.menuParagraphDirection = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-text-orient-hor', + caption : me.directionText, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + me.menuParagraphDirectH = new Common.UI.MenuItem({ + caption : me.directHText, + iconCls : 'menu__icon btn-text-orient-hor', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparagraphdirect', + direction : Asc.c_oAscVertDrawingText.normal + }), + me.menuParagraphDirect90 = new Common.UI.MenuItem({ + caption : me.direct90Text, + iconCls : 'menu__icon btn-text-orient-rdown', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparagraphdirect', + direction : Asc.c_oAscVertDrawingText.vert + }), + me.menuParagraphDirect270 = new Common.UI.MenuItem({ + caption : me.direct270Text, + iconCls : 'menu__icon btn-text-orient-rup', + checkable : true, + checkmark : false, + checked : false, + toggleGroup : 'popupparagraphdirect', + direction : Asc.c_oAscVertDrawingText.vert270 + }) + ] + }) + }); + + me.menuAddCommentPara = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-add-comment', + caption : me.addCommentText + }); + me.menuAddCommentPara.hide(); + + me.menuParaCopy = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-copy', + caption : me.textCopy, + value : 'copy' + }); + + me.menuParaPaste = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-paste', + caption : me.textPaste, + value : 'paste' + }); + + me.menuParaCut = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-cut', + caption : me.textCut, + value : 'cut' + }); + + var menuEquationSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.menuParagraphEquation = new Common.UI.MenuItem({ + caption : me.advancedEquationText, + iconCls : 'menu__icon btn-equation', + menu : me.createEquationMenu('popupparaeqinput', 'tl-tr') + }); + + me.textMenu = new Common.UI.Menu({ + cls: 'shifted-right', + scrollToCheckedItem: false, + initMenu: function(value){ + var isInShape = (value.shapeProps && !_.isNull(value.shapeProps.value)); + var isInChart = (value.chartProps && !_.isNull(value.chartProps.value)); + + var disabled = (value.paraProps!==undefined && value.paraProps.locked) || + (isInShape && value.shapeProps.locked); + var isEquation= (value.mathProps && value.mathProps.value); + me._currentParaObjDisabled = disabled; + + me.menuParagraphVAlign.setVisible(isInShape && !isInChart && !isEquation); // после того, как заголовок можно будет растягивать по вертикали, вернуть "|| isInChart" !! + me.menuParagraphDirection.setVisible(isInShape && !isInChart && !isEquation); // после того, как заголовок можно будет растягивать по вертикали, вернуть "|| isInChart" !! + if (isInShape || isInChart) { + var align = value.shapeProps.value.get_VerticalTextAlign(); + var cls = ''; + switch (align) { + case Asc.c_oAscVAlign.Top: + cls = 'menu__icon btn-align-top'; + break; + case Asc.c_oAscVAlign.Center: + cls = 'menu__icon btn-align-middle'; + break; + case Asc.c_oAscVAlign.Bottom: + cls = 'menu__icon btn-align-bottom'; + break; + } + me.menuParagraphVAlign.setIconCls(cls); + me.menuParagraphTop.setChecked(align == Asc.c_oAscVAlign.Top); + me.menuParagraphCenter.setChecked(align == Asc.c_oAscVAlign.Center); + me.menuParagraphBottom.setChecked(align == Asc.c_oAscVAlign.Bottom); + + var dir = value.shapeProps.value.get_Vert(); + cls = ''; + switch (dir) { + case Asc.c_oAscVertDrawingText.normal: + cls = 'menu__icon btn-text-orient-hor'; + break; + case Asc.c_oAscVertDrawingText.vert: + cls = 'menu__icon btn-text-orient-rdown'; + break; + case Asc.c_oAscVertDrawingText.vert270: + cls = 'menu__icon btn-text-orient-rup'; + break; + } + me.menuParagraphDirection.setIconCls(cls); + me.menuParagraphDirectH.setChecked(dir == Asc.c_oAscVertDrawingText.normal); + me.menuParagraphDirect90.setChecked(dir == Asc.c_oAscVertDrawingText.vert); + me.menuParagraphDirect270.setChecked(dir == Asc.c_oAscVertDrawingText.vert270); + } else { + me.menuParagraphVAlign.setIconCls(''); + me.menuParagraphDirection.setIconCls(''); + } + me.menuParagraphVAlign.setDisabled(disabled); + me.menuParagraphDirection.setDisabled(disabled); + + var text = null; + + if (me.api) { + text = me.api.can_AddHyperlink(); + } + + me.menuAddHyperlinkPara.setVisible(value.hyperProps===undefined && text!==false); + menuHyperlinkPara.setVisible(value.hyperProps!==undefined); + + me.menuEditHyperlinkPara.hyperProps = value.hyperProps; + + if (text!==false) { + me.menuAddHyperlinkPara.hyperProps = {}; + me.menuAddHyperlinkPara.hyperProps.value = new Asc.CHyperlinkProperty(); + me.menuAddHyperlinkPara.hyperProps.value.put_Text(text); + } + + /** coauthoring begin **/ + me.menuAddCommentPara.setVisible(me.mode && me.mode.canComments); + /** coauthoring end **/ + + menuCommentParaSeparator.setVisible(/** coauthoring begin **/ me.menuAddCommentPara.isVisible() || /** coauthoring end **/ me.menuAddHyperlinkPara.isVisible() || menuHyperlinkPara.isVisible()); + me.menuAddHyperlinkPara.setDisabled(disabled); + menuHyperlinkPara.setDisabled(disabled); + + me.menuParagraphAdvanced.setDisabled(disabled); + var cancopy = me.api && me.api.can_CopyCut(); + me.menuParaCopy.setDisabled(!cancopy); + me.menuParaCut.setDisabled(disabled || !cancopy); + me.menuParaPaste.setDisabled(disabled); + + //equation menu + var eqlen = 0; + if (isEquation) { + eqlen = me.addEquationMenu(true, 4); + } else + me.clearEquationMenu(true, 4); + menuEquationSeparator.setVisible(isEquation && eqlen>0); + + me.menuParagraphEquation.setVisible(isEquation); + me.menuParagraphEquation.setDisabled(disabled); + if (isEquation) { + var eq = me.api.asc_GetMathInputType(), + isEqToolbarHide = Common.Utils.InternalSettings.get('pdfe-equation-toolbar-hide'); + + me.menuParagraphEquation.menu.items[5].setChecked(eq===Asc.c_oAscMathInputType.Unicode); + me.menuParagraphEquation.menu.items[6].setChecked(eq===Asc.c_oAscMathInputType.LaTeX); + me.menuParagraphEquation.menu.items[8].options.isToolbarHide = isEqToolbarHide; + me.menuParagraphEquation.menu.items[8].setCaption(isEqToolbarHide ? me.showEqToolbar : me.hideEqToolbar); + } + }, + items: [ + me.menuParaCut, + me.menuParaCopy, + me.menuParaPaste, + menuEquationSeparator, + { caption: '--' }, + me.menuParagraphVAlign, + me.menuParagraphDirection, + me.menuParagraphAdvanced, + me.menuParagraphEquation, + menuCommentParaSeparator, + /** coauthoring begin **/ + me.menuAddCommentPara, + /** coauthoring end **/ + me.menuAddHyperlinkPara, + menuHyperlinkPara + ] + }).on('hide:after', function(menu, e, isFromInputControl) { + me.clearCustomItems(menu); + me.currentMenu = null; + if (me.suppressEditComplete) { + me.suppressEditComplete = false; + return; + } + + if (!isFromInputControl) me.fireEvent('editcomplete', me); + }); + + me.mnuDeletePage = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-cc-remove', + caption : me.txtDeletePage + }); + me.mnuNewPage = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-add-text', + caption : me.txtNewPage + }); + me.mnuRotatePageRight = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-rotate-90', + caption : me.txtRotateRight + }); + me.mnuRotatePageLeft = new Common.UI.MenuItem({ + iconCls: 'menu__icon btn-rotate-270', + caption : me.txtRotateLeft + }); + + var menuPageDelSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + var menuPageNewSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + + me.pageMenu = new Common.UI.Menu({ + cls: 'shifted-right', + restoreHeightAndTop: true, + scrollToCheckedItem: false, + initMenu: function(value) { + me.mnuRotatePageRight.setVisible(value.isPageSelect===true); + me.mnuRotatePageLeft.setVisible(value.isPageSelect===true); + me.mnuDeletePage.setVisible(value.isPageSelect===true); + menuPageNewSeparator.setVisible(value.isPageSelect===true); + menuPageDelSeparator.setVisible(value.isPageSelect===true); + + me.mnuDeletePage.setDisabled(me._pagesCount<2); + }, + items: [ + me.mnuNewPage, + menuPageNewSeparator, + me.mnuRotatePageRight, + me.mnuRotatePageLeft, + menuPageDelSeparator, + me.mnuDeletePage + ] + }).on('hide:after', function(menu, e, isFromInputControl) { + me.clearCustomItems(menu); + me.currentMenu = null; + if (me.suppressEditComplete) { + me.suppressEditComplete = false; + return; + } + + if (!isFromInputControl) me.fireEvent('editcomplete', me); + }); + + this.fireEvent('createdelayedelements', [this, 'edit']); + }, + createDelayedElementsPDFForms: function() { var me = this; @@ -199,6 +1286,773 @@ define([ this.fireEvent('createdelayedelements', [this, 'forms']); }, + createEquationMenu: function(toggleGroup, menuAlign) { + return new Common.UI.Menu({ + cls: 'ppm-toolbar shifted-right', + menuAlign: menuAlign, + items : [ + new Common.UI.MenuItem({ + caption : this.currProfText, + iconCls : 'menu__icon btn-professional-equation', + type : 'view', + value : {all: false, linear: false} + }), + new Common.UI.MenuItem({ + caption : this.currLinearText, + iconCls : 'menu__icon btn-linear-equation', + type : 'view', + value : {all: false, linear: true} + }), + new Common.UI.MenuItem({ + caption : this.allProfText, + iconCls : 'menu__icon btn-professional-equation', + type : 'view', + value : {all: true, linear: false} + }), + new Common.UI.MenuItem({ + caption : this.allLinearText, + iconCls : 'menu__icon btn-linear-equation', + type : 'view', + value : {all: true, linear: true} + }), + { caption : '--' }, + new Common.UI.MenuItem({ + caption : this.unicodeText, + checkable : true, + checked : false, + toggleGroup : toggleGroup, + type : 'input', + value : Asc.c_oAscMathInputType.Unicode + }), + new Common.UI.MenuItem({ + caption : this.latexText, + checkable : true, + checked : false, + toggleGroup : toggleGroup, + type : 'input', + value : Asc.c_oAscMathInputType.LaTeX + }), + { caption : '--' }, + new Common.UI.MenuItem({ + caption : this.hideEqToolbar, + isToolbarHide: false, + type : 'hide', + }) + ] + }); + }, + + initEquationMenu: function() { + var me = this; + if (!me._currentMathObj) return; + var type = me._currentMathObj.get_Type(), + value = me._currentMathObj, + mnu, arr = []; + + switch (type) { + case Asc.c_oAscMathInterfaceType.Accent: + mnu = new Common.UI.MenuItem({ + caption : me.txtRemoveAccentChar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'remove_AccentCharacter'} + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.BorderBox: + mnu = new Common.UI.MenuItem({ + caption : me.txtBorderProps, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: value.get_HideTop() ? me.txtAddTop : me.txtHideTop, + equationProps: {type: type, callback: 'put_HideTop', value: !value.get_HideTop()} + }, + { + caption: value.get_HideBottom() ? me.txtAddBottom : me.txtHideBottom, + equationProps: {type: type, callback: 'put_HideBottom', value: !value.get_HideBottom()} + }, + { + caption: value.get_HideLeft() ? me.txtAddLeft : me.txtHideLeft, + equationProps: {type: type, callback: 'put_HideLeft', value: !value.get_HideLeft()} + }, + { + caption: value.get_HideRight() ? me.txtAddRight : me.txtHideRight, + equationProps: {type: type, callback: 'put_HideRight', value: !value.get_HideRight()} + }, + { + caption: value.get_HideHor() ? me.txtAddHor : me.txtHideHor, + equationProps: {type: type, callback: 'put_HideHor', value: !value.get_HideHor()} + }, + { + caption: value.get_HideVer() ? me.txtAddVer : me.txtHideVer, + equationProps: {type: type, callback: 'put_HideVer', value: !value.get_HideVer()} + }, + { + caption: value.get_HideTopLTR() ? me.txtAddLT : me.txtHideLT, + equationProps: {type: type, callback: 'put_HideTopLTR', value: !value.get_HideTopLTR()} + }, + { + caption: value.get_HideTopRTL() ? me.txtAddLB : me.txtHideLB, + equationProps: {type: type, callback: 'put_HideTopRTL', value: !value.get_HideTopRTL()} + } + ] + }) + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.Bar: + mnu = new Common.UI.MenuItem({ + caption : me.txtRemoveBar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'remove_Bar'} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : (value.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top) ? me.txtUnderbar : me.txtOverbar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top) ? Asc.c_oAscMathInterfaceBarPos.Bottom : Asc.c_oAscMathInterfaceBarPos.Top} + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.Script: + var scripttype = value.get_ScriptType(); + if (scripttype == Asc.c_oAscMathInterfaceScript.PreSubSup) { + mnu = new Common.UI.MenuItem({ + caption : me.txtScriptsAfter, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.SubSup} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtRemScripts, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.None} + }); + arr.push(mnu); + } else { + if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) { + mnu = new Common.UI.MenuItem({ + caption : me.txtScriptsBefore, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.PreSubSup} + }); + arr.push(mnu); + } + if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup || scripttype == Asc.c_oAscMathInterfaceScript.Sub ) { + mnu = new Common.UI.MenuItem({ + caption : me.txtRemSubscript, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_ScriptType', value: (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) ? Asc.c_oAscMathInterfaceScript.Sup : Asc.c_oAscMathInterfaceScript.None } + }); + arr.push(mnu); + } + if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup || scripttype == Asc.c_oAscMathInterfaceScript.Sup ) { + mnu = new Common.UI.MenuItem({ + caption : me.txtRemSuperscript, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_ScriptType', value: (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) ? Asc.c_oAscMathInterfaceScript.Sub : Asc.c_oAscMathInterfaceScript.None } + }); + arr.push(mnu); + } + } + break; + case Asc.c_oAscMathInterfaceType.Fraction: + var fraction = value.get_FractionType(); + if (fraction==Asc.c_oAscMathInterfaceFraction.Skewed || fraction==Asc.c_oAscMathInterfaceFraction.Linear) { + mnu = new Common.UI.MenuItem({ + caption : me.txtFractionStacked, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Bar} + }); + arr.push(mnu); + } + if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.Linear) { + mnu = new Common.UI.MenuItem({ + caption : me.txtFractionSkewed, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Skewed} + }); + arr.push(mnu); + } + if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.Skewed) { + mnu = new Common.UI.MenuItem({ + caption : me.txtFractionLinear, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Linear} + }); + arr.push(mnu); + } + if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.NoBar) { + mnu = new Common.UI.MenuItem({ + caption : (fraction==Asc.c_oAscMathInterfaceFraction.Bar) ? me.txtRemFractionBar : me.txtAddFractionBar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_FractionType', value: (fraction==Asc.c_oAscMathInterfaceFraction.Bar) ? Asc.c_oAscMathInterfaceFraction.NoBar : Asc.c_oAscMathInterfaceFraction.Bar} + }); + arr.push(mnu); + } + break; + case Asc.c_oAscMathInterfaceType.Limit: + mnu = new Common.UI.MenuItem({ + caption : (value.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top) ? me.txtLimitUnder : me.txtLimitOver, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top) ? Asc.c_oAscMathInterfaceLimitPos.Bottom : Asc.c_oAscMathInterfaceLimitPos.Top} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtRemLimit, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_Pos', value: Asc.c_oAscMathInterfaceLimitPos.None} + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.Matrix: + mnu = new Common.UI.MenuItem({ + caption : value.get_HidePlaceholder() ? me.txtShowPlaceholder : me.txtHidePlaceholder, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HidePlaceholder', value: !value.get_HidePlaceholder()} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.insertText, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: me.insertRowAboveText, + equationProps: {type: type, callback: 'insert_MatrixRow', value: true} + }, + { + caption: me.insertRowBelowText, + equationProps: {type: type, callback: 'insert_MatrixRow', value: false} + }, + { + caption: me.insertColumnLeftText, + equationProps: {type: type, callback: 'insert_MatrixColumn', value: true} + }, + { + caption: me.insertColumnRightText, + equationProps: {type: type, callback: 'insert_MatrixColumn', value: false} + } + ] + }) + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.deleteText, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: me.deleteRowText, + equationProps: {type: type, callback: 'delete_MatrixRow'} + }, + { + caption: me.deleteColumnText, + equationProps: {type: type, callback: 'delete_MatrixColumn'} + } + ] + }) + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtMatrixAlign, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: me.txtTop, + checkable : true, + checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top), + equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top} + }, + { + caption: me.centerText, + checkable : true, + checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center), + equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center} + }, + { + caption: me.txtBottom, + checkable : true, + checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom), + equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom} + } + ] + }) + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtColumnAlign, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: me.leftText, + checkable : true, + checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left), + equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Left} + }, + { + caption: me.centerText, + checkable : true, + checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center), + equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Center} + }, + { + caption: me.rightText, + checkable : true, + checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right), + equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Right} + } + ] + }) + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.EqArray: + mnu = new Common.UI.MenuItem({ + caption : me.txtInsertEqBefore, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'insert_Equation', value: true} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtInsertEqAfter, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'insert_Equation', value: false} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtDeleteEq, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'delete_Equation'} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.alignmentText, + equation : true, + disabled : me._currentParaObjDisabled, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign: 'tl-tr', + items : [ + { + caption: me.txtTop, + checkable : true, + checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top), + equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Top} + }, + { + caption: me.centerText, + checkable : true, + checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center), + equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Center} + }, + { + caption: me.txtBottom, + checkable : true, + checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom), + equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Bottom} + } + ] + }) + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.LargeOperator: + mnu = new Common.UI.MenuItem({ + caption : me.txtLimitChange, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_LimitLocation', value: (value.get_LimitLocation() == Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr) ? Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup : Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr} + }); + arr.push(mnu); + if (value.get_HideUpper() !== undefined) { + mnu = new Common.UI.MenuItem({ + caption : value.get_HideUpper() ? me.txtShowTopLimit : me.txtHideTopLimit, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HideUpper', value: !value.get_HideUpper()} + }); + arr.push(mnu); + } + if (value.get_HideLower() !== undefined) { + mnu = new Common.UI.MenuItem({ + caption : value.get_HideLower() ? me.txtShowBottomLimit : me.txtHideBottomLimit, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HideLower', value: !value.get_HideLower()} + }); + arr.push(mnu); + } + break; + case Asc.c_oAscMathInterfaceType.Delimiter: + mnu = new Common.UI.MenuItem({ + caption : me.txtInsertArgBefore, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'insert_DelimiterArgument', value: true} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtInsertArgAfter, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'insert_DelimiterArgument', value: false} + }); + arr.push(mnu); + if (value.can_DeleteArgument()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtDeleteArg, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'delete_DelimiterArgument'} + }); + arr.push(mnu); + } + mnu = new Common.UI.MenuItem({ + caption : value.has_Separators() ? me.txtDeleteCharsAndSeparators : me.txtDeleteChars, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'remove_DelimiterCharacters'} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : value.get_HideOpeningBracket() ? me.txtShowOpenBracket : me.txtHideOpenBracket, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HideOpeningBracket', value: !value.get_HideOpeningBracket()} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : value.get_HideClosingBracket() ? me.txtShowCloseBracket : me.txtHideCloseBracket, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HideClosingBracket', value: !value.get_HideClosingBracket()} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtStretchBrackets, + equation : true, + disabled : me._currentParaObjDisabled, + checkable : true, + checked : value.get_StretchBrackets(), + equationProps: {type: type, callback: 'put_StretchBrackets', value: !value.get_StretchBrackets()} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtMatchBrackets, + equation : true, + disabled : (!value.get_StretchBrackets() || me._currentParaObjDisabled), + checkable : true, + checked : value.get_StretchBrackets() && value.get_MatchBrackets(), + equationProps: {type: type, callback: 'put_MatchBrackets', value: !value.get_MatchBrackets()} + }); + arr.push(mnu); + break; + case Asc.c_oAscMathInterfaceType.GroupChar: + if (value.can_ChangePos()) { + mnu = new Common.UI.MenuItem({ + caption : (value.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top) ? me.txtGroupCharUnder : me.txtGroupCharOver, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top) ? Asc.c_oAscMathInterfaceGroupCharPos.Bottom : Asc.c_oAscMathInterfaceGroupCharPos.Top} + }); + arr.push(mnu); + mnu = new Common.UI.MenuItem({ + caption : me.txtDeleteGroupChar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_Pos', value: Asc.c_oAscMathInterfaceGroupCharPos.None} + }); + arr.push(mnu); + } + break; + case Asc.c_oAscMathInterfaceType.Radical: + if (value.get_HideDegree() !== undefined) { + mnu = new Common.UI.MenuItem({ + caption : value.get_HideDegree() ? me.txtShowDegree : me.txtHideDegree, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'put_HideDegree', value: !value.get_HideDegree()} + }); + arr.push(mnu); + } + mnu = new Common.UI.MenuItem({ + caption : me.txtDeleteRadical, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'remove_Radical'} + }); + arr.push(mnu); + break; + } + if (value.can_IncreaseArgumentSize()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtIncreaseArg, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'increase_ArgumentSize'} + }); + arr.push(mnu); + } + if (value.can_DecreaseArgumentSize()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtDecreaseArg, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'decrease_ArgumentSize'} + }); + arr.push(mnu); + } + if (value.can_InsertManualBreak()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtInsertBreak, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'insert_ManualBreak'} + }); + arr.push(mnu); + } + if (value.can_DeleteManualBreak()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtDeleteBreak, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'delete_ManualBreak'} + }); + arr.push(mnu); + } + if (value.can_AlignToCharacter()) { + mnu = new Common.UI.MenuItem({ + caption : me.txtAlignToChar, + equation : true, + disabled : me._currentParaObjDisabled, + equationProps: {type: type, callback: 'align_ToCharacter'} + }); + arr.push(mnu); + } + return arr; + }, + + addEquationMenu: function(isParagraph, insertIdx) { + var me = this; + if (_.isUndefined(isParagraph)) { + isParagraph = me.textMenu.isVisible(); + } + + me.clearEquationMenu(isParagraph, insertIdx); + + var equationMenu = (isParagraph) ? me.textMenu : me.tableMenu, + menuItems = me.initEquationMenu(); + + if (menuItems.length > 0) { + _.each(menuItems, function(menuItem, index) { + if (menuItem.menu) { + _.each(menuItem.menu.items, function(item) { + item.on('click', _.bind(me.equationCallback, me, item.options.equationProps)); + }); + } else + menuItem.on('click', _.bind(me.equationCallback, me, menuItem.options.equationProps)); + equationMenu.insertItem(insertIdx, menuItem); + insertIdx++; + }); + } + return menuItems.length; + }, + + equationCallback: function(eqProps) { + this.fireEvent('equation:callback', [eqProps]); + }, + + clearEquationMenu: function(isParagraph, insertIdx) { + var me = this; + var equationMenu = (isParagraph) ? me.textMenu : me.tableMenu; + for (var i = insertIdx; i < equationMenu.items.length; i++) { + if (equationMenu.items[i].options.equation) { + if (equationMenu.items[i].menu) { + _.each(equationMenu.items[i].menu.items, function(item) { + item.off('click'); + }); + } else + equationMenu.items[i].off('click'); + equationMenu.removeItem(equationMenu.items[i]); + i--; + } else + break; + } + }, + + createTextBar: function(textBarBtns) { + var container = $('
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'), + toolbarController = PDFE.getController('Toolbar'), + toolbar = toolbarController.getView('Toolbar'); + + this.cmbFontName = new Common.UI.ComboBoxFonts({ + el: $('#text-bar-fonts', container), + cls : 'input-group-nr', + style : 'width: 100px;', + menuCls : 'scrollable-menu menu-absolute', + menuStyle : 'min-width: 100%;max-height: 270px;', + store : new Common.Collections.Fonts(), + hint : toolbar.tipFontName + }); + textBarBtns.push(this.cmbFontName); + toolbarController.fillFontsStore(this.cmbFontName); + + this.cmbFontSize = new Common.UI.ComboBox({ + el: $('#text-bar-font-size', container), + cls: 'input-group-nr', + style: 'width: 45px;', + menuCls : 'scrollable-menu menu-absolute', + menuStyle: 'min-width: 45px;max-height: 270px;', + hint: toolbar.tipFontSize, + data: [ + {value: 8, displayValue: "8"}, + {value: 9, displayValue: "9"}, + {value: 10, displayValue: "10"}, + {value: 11, displayValue: "11"}, + {value: 12, displayValue: "12"}, + {value: 14, displayValue: "14"}, + {value: 16, displayValue: "16"}, + {value: 18, displayValue: "18"}, + {value: 20, displayValue: "20"}, + {value: 22, displayValue: "22"}, + {value: 24, displayValue: "24"}, + {value: 26, displayValue: "26"}, + {value: 28, displayValue: "28"}, + {value: 36, displayValue: "36"}, + {value: 48, displayValue: "48"}, + {value: 72, displayValue: "72"}, + {value: 96, displayValue: "96"} + ] + }); + this.cmbFontSize.setValue(''); + textBarBtns.push(this.cmbFontSize); + + this.btnBold = new Common.UI.Button({ + parentEl: $('#text-bar-bold', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-bold', + enableToggle: true, + hint: toolbar.textBold + }); + textBarBtns.push(this.btnBold); + + this.btnItalic = new Common.UI.Button({ + parentEl: $('#text-bar-italic', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-italic', + enableToggle: true, + hint: toolbar.textItalic + }); + textBarBtns.push(this.btnItalic); + + this.btnTextUnderline = new Common.UI.Button({ + parentEl: $('#text-bar-underline', container), + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-underline', + enableToggle: true, + hint: toolbar.textUnderline + }); + textBarBtns.push(this.btnTextUnderline); + + this.btnTextStrikeout = new Common.UI.Button({ + parentEl: $('#text-bar-strikeout', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-strikeout', + enableToggle: true, + hint: toolbar.textStrikeout + }); + textBarBtns.push(this.btnTextStrikeout); + + this.btnSuperscript = new Common.UI.Button({ + parentEl: $('#text-bar-super', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-superscript', + enableToggle: true, + toggleGroup: 'superscriptGroup', + hint: toolbar.textSuperscript + }); + textBarBtns.push(this.btnSuperscript); + + this.btnSubscript = new Common.UI.Button({ + parentEl: $('#text-bar-sub', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-subscript', + enableToggle: true, + toggleGroup: 'superscriptGroup', + hint: toolbar.textSubscript + }); + textBarBtns.push(this.btnSubscript); + + var config = Common.define.simpleColorsConfig; + this.btnFontColor = new Common.UI.ButtonColored({ + parentEl: $('#text-bar-textcolor', container), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-fontcolor', + split: true, + menu: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + hint: toolbar.tipFontColor + }); + textBarBtns.push(this.btnFontColor); + this.btnFontColor.setMenu(); + this.mnuFontColorPicker = this.btnFontColor.getPicker(); + + return container; + }, + updateCustomItems: function(menu, data) { if (!menu || !data || data.length<1) return; @@ -349,7 +2203,164 @@ define([ textRedo: 'Redo', textCut: 'Cut', textPaste: 'Paste', - textClearField: 'Clear field' + textClearField: 'Clear field', + advancedEquationText: 'Equation Settings', + unicodeText: 'Unicode', + latexText: 'LaTeX', + currProfText: 'Current - Professional', + currLinearText: 'Current - Linear', + allProfText: 'All - Professional', + allLinearText: 'All - Linear', + hideEqToolbar: 'Hide Equation Toolbar', + showEqToolbar: 'Show Equation Toolbar', + insertRowAboveText : 'Row Above', + insertRowBelowText : 'Row Below', + insertColumnLeftText : 'Column Left', + insertColumnRightText : 'Column Right', + deleteText : 'Delete', + deleteRowText : 'Delete Row', + deleteColumnText : 'Delete Column', + deleteTableText : 'Delete Table', + mergeCellsText : 'Merge Cells', + splitCellsText : 'Split Cell...', + splitCellTitleText : 'Split Cell', + originalSizeText : 'Actual Size', + advancedImageText : 'Image Advanced Settings', + hyperlinkText : 'Hyperlink', + editHyperlinkText : 'Edit Hyperlink', + removeHyperlinkText : 'Remove Hyperlink', + txtPressLink : 'Press {0} and click link', + selectText : 'Select', + insertRowText : 'Insert Row', + insertColumnText : 'Insert Column', + rowText : 'Row', + columnText : 'Column', + cellText : 'Cell', + tableText : 'Table', + aboveText : 'Above', + belowText : 'Below', + advancedTableText : 'Table Advanced Settings', + txtSelectAll : 'Select All', + textShapeAlignLeft : 'Align Left', + textShapeAlignRight : 'Align Right', + textShapeAlignCenter : 'Align Center', + textShapeAlignTop : 'Align Top', + textShapeAlignBottom : 'Align Bottom', + textShapeAlignMiddle : 'Align Middle', + textArrangeFront : 'Bring To Front', + textArrangeBack : 'Send To Back', + textArrangeForward : 'Bring Forward', + textArrangeBackward : 'Send Backward', + txtGroup : 'Group', + txtUngroup : 'Ungroup', + txtArrange : 'Arrange', + txtAlign : 'Align', + txtDistribHor : 'Distribute Horizontally', + txtDistribVert : 'Distribute Vertically', + cellAlignText : 'Cell Vertical Alignment', + advancedShapeText : 'Shape Advanced Settings', + textSaveAsPicture : 'Save as picture', + vertAlignText : 'Vertical Alignment', + advancedParagraphText : 'Text Advanced Settings', + insertText: 'Insert', + directionText: 'Text Direction', + directHText: 'Horizontal', + direct90Text: 'Rotate Text Down', + direct270Text: 'Rotate Text Up', + txtRemoveAccentChar: 'Remove accent character', + txtBorderProps: 'Borders property', + txtHideTop: 'Hide top border', + txtHideBottom: 'Hide bottom border', + txtHideLeft: 'Hide left border', + txtHideRight: 'Hide right border', + txtHideHor: 'Hide horizontal line', + txtHideVer: 'Hide vertical line', + txtHideLT: 'Hide left top line', + txtHideLB: 'Hide left bottom line', + txtAddTop: 'Add top border', + txtAddBottom: 'Add bottom border', + txtAddLeft: 'Add left border', + txtAddRight: 'Add right border', + txtAddHor: 'Add horizontal line', + txtAddVer: 'Add vertical line', + txtAddLT: 'Add left top line', + txtAddLB: 'Add left bottom line', + txtRemoveBar: 'Remove bar', + txtOverbar: 'Bar over text', + txtUnderbar: 'Bar under text', + txtRemScripts: 'Remove scripts', + txtRemSubscript: 'Remove subscript', + txtRemSuperscript: 'Remove superscript', + txtScriptsAfter: 'Scripts after text', + txtScriptsBefore: 'Scripts before text', + txtFractionStacked: 'Change to stacked fraction', + txtFractionSkewed: 'Change to skewed fraction', + txtFractionLinear: 'Change to linear fraction', + txtRemFractionBar: 'Remove fraction bar', + txtAddFractionBar: 'Add fraction bar', + txtRemLimit: 'Remove limit', + txtLimitOver: 'Limit over text', + txtLimitUnder: 'Limit under text', + txtHidePlaceholder: 'Hide placeholder', + txtShowPlaceholder: 'Show placeholder', + txtMatrixAlign: 'Matrix alignment', + txtColumnAlign: 'Column alignment', + txtTop: 'Top', + txtBottom: 'Bottom', + txtInsertEqBefore: 'Insert equation before', + txtInsertEqAfter: 'Insert equation after', + txtDeleteEq: 'Delete equation', + txtLimitChange: 'Change limits location', + txtHideTopLimit: 'Hide top limit', + txtShowTopLimit: 'Show top limit', + txtHideBottomLimit: 'Hide bottom limit', + txtShowBottomLimit: 'Show bottom limit', + txtInsertArgBefore: 'Insert argument before', + txtInsertArgAfter: 'Insert argument after', + txtDeleteArg: 'Delete argument', + txtHideOpenBracket: 'Hide opening bracket', + txtShowOpenBracket: 'Show opening bracket', + txtHideCloseBracket: 'Hide closing bracket', + txtShowCloseBracket: 'Show closing bracket', + txtStretchBrackets: 'Stretch brackets', + txtMatchBrackets: 'Match brackets to argument height', + txtGroupCharOver: 'Char over text', + txtGroupCharUnder: 'Char under text', + txtDeleteGroupChar: 'Delete char', + txtHideDegree: 'Hide degree', + txtShowDegree: 'Show degree', + txtIncreaseArg: 'Increase argument size', + txtDecreaseArg: 'Decrease argument size', + txtInsertBreak: 'Insert manual break', + txtDeleteBreak: 'Delete manual break', + txtAlignToChar: 'Align to character', + txtDeleteRadical: 'Delete radical', + txtDeleteChars: 'Delete enclosing characters', + txtDeleteCharsAndSeparators: 'Delete enclosing characters and separators', + alignmentText: 'Alignment', + leftText: 'Left', + rightText: 'Right', + centerText: 'Center', + textDistributeRows: 'Distribute rows', + textDistributeCols: 'Distribute columns', + textReplace: 'Replace image', + textFromUrl: 'From URL', + textFromFile: 'From File', + textRotate270: 'Rotate 90° Counterclockwise', + textRotate90: 'Rotate 90° Clockwise', + textFlipV: 'Flip Vertically', + textFlipH: 'Flip Horizontally', + textRotate: 'Rotate', + textCrop: 'Crop', + textCropFill: 'Fill', + textCropFit: 'Fit', + textFromStorage: 'From Storage', + textEditPoints: 'Edit Points', + confirmAddFontName: 'The font you are going to save is not available on the current device.
The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
Do you want to continue?', + txtDeletePage: 'Delete page', + txtNewPage: 'Insert blank page', + txtRotateRight: 'Rotate page right', + txtRotateLeft: 'Rotate page left' }, PDFE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/FileMenuPanels.js b/apps/pdfeditor/main/app/view/FileMenuPanels.js index 3c1e0ad93b..9166051981 100644 --- a/apps/pdfeditor/main/app/view/FileMenuPanels.js +++ b/apps/pdfeditor/main/app/view/FileMenuPanels.js @@ -361,6 +361,10 @@ define([ '
', '
', '', + '', + '', + '', + '', '', '', '
', @@ -569,6 +573,23 @@ define([ }); this.cmbFontRender.on('selected', _.bind(this.onFontRenderSelected, this)); + this.cmbUnit = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-unit'), + style : 'width: 160px;', + editable : false, + menuCls : 'menu-aligned', + menuStyle : 'min-width:100%;', + cls : 'input-group-nr', + data : [ + { value: Common.Utils.Metric.c_MetricUnits['cm'], displayValue: this.txtCm }, + { value: Common.Utils.Metric.c_MetricUnits['pt'], displayValue: this.txtPt }, + { value: Common.Utils.Metric.c_MetricUnits['inch'], displayValue: this.txtInch } + ], + dataHint: '2', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbTheme = new Common.UI.ComboBox({ el : $markup.findById('#fms-cmb-theme'), style : 'width: 160px;', @@ -663,9 +684,9 @@ define([ this.mode = mode; var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"), - canPDFSave = (mode.isPDFAnnotate || mode.isPDFEdit) && !mode.isOffline; + canPDFSave = (mode.isPDFAnnotate || mode.isPDFEdit) && mode.canSaveToFile && !mode.isOffline; - $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); + $('tr.edit', this.el)[mode.isPDFEdit?'show':'hide'](); $('tr.autosave', this.el)[mode.isEdit && canPDFSave && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide'](); $('tr.forcesave', this.el)[mode.canForcesave && canPDFSave ? 'show' : 'hide'](); $('tr.editsave',this.el)[(mode.isEdit || mode.canForcesave) && canPDFSave ? 'show' : 'hide'](); @@ -726,6 +747,11 @@ define([ item && value && item.set('checked', !!value); item && value && this.cmbFontRender.cmpEl.find('#' + item.get('id') + ' a').addClass('checked'); + value = Common.Utils.InternalSettings.get("pdfe-settings-unit"); + item = this.cmbUnit.store.findWhere({value: value}); + this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric()); + this._oldUnits = this.cmbUnit.getValue(); + value = Common.Utils.InternalSettings.get("pdfe-settings-autosave"); this.chAutosave.setValue(value == 1); @@ -776,6 +802,8 @@ define([ if (this.mode.canForcesave) Common.localStorage.setItem("pdfe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); + Common.localStorage.setItem("pdfe-settings-unit", this.cmbUnit.getValue()); + var isRtlChanged = this.chRTL.$el.is(':visible') && Common.localStorage.getBool("ui-rtl", Common.Locale.isCurrentLanguageRtl()) !== this.chRTL.isChecked(); Common.localStorage.setBool("ui-rtl", this.chRTL.isChecked()); Common.localStorage.setBool("pdfe-settings-quick-print-button", this.chQuickPrint.isChecked()); @@ -784,6 +812,8 @@ define([ if (this.menu) { this.menu.fireEvent('settings:apply', [this.menu]); + if (this._oldUnits !== this.cmbUnit.getValue()) + Common.NotificationCenter.trigger('settings:unitschanged', this); } if (isRtlChanged) { @@ -859,7 +889,12 @@ define([ txtWorkspaceSettingChange: 'Workspace setting (RTL interface) change', txtRestartEditor: 'Please restart document editor so that your workspace settings can take effect', txtLastUsed: 'Last used', - txtScreenReader: 'Turn on screen reader support' + txtScreenReader: 'Turn on screen reader support', + strUnit: 'Unit of Measurement', + txtInch: 'Inch', + txtCm: 'Centimeter', + txtPt: 'Point' + }, PDFE.Views.FileMenuPanels.Settings || {})); PDFE.Views.FileMenuPanels.CreateNew = Common.UI.BaseView.extend(_.extend({ diff --git a/apps/pdfeditor/main/app/view/ImageSettings.js b/apps/pdfeditor/main/app/view/ImageSettings.js new file mode 100644 index 0000000000..3303e22d81 --- /dev/null +++ b/apps/pdfeditor/main/app/view/ImageSettings.js @@ -0,0 +1,559 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ImageSettings.js + * + * Created by Julia Radzhabova on 4/11/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'text!pdfeditor/main/app/template/ImageSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/Button', + 'common/main/lib/view/ImageFromUrlDialog', + 'pdfeditor/main/app/view/ImageSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.ImageSettings = Backbone.View.extend(_.extend({ + el: '#id-image-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'ImageSettings' + }, + + initialize: function () { + this._initSettings = true; + + this._state = { + Width: 0, + Height: 0, + DisabledControls: false, + isOleObject: false, + cropMode: false + }; + this.lockedControls = []; + this._locked = false; + + this._noApply = false; + this._originalProps = null; + + this.render(); + + this.labelWidth = $(this.el).find('#image-label-width'); + this.labelHeight = $(this.el).find('#image-label-height'); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + }, + + setApi: function(api) { + this.api = api; + if (this.api) { + this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this._changeCropState, this)); + } + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); + return this; + }, + + setMode: function(mode) { + this.mode = mode; + }, + + updateMetricUnit: function() { + var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + + value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + }, + + createDelayedControls: function() { + this.btnOriginalSize = new Common.UI.Button({ + el: $('#image-button-original-size') + }); + this.lockedControls.push(this.btnOriginalSize); + + this.btnSelectImage = new Common.UI.Button({ + parentEl: $('#image-button-replace'), + cls: 'btn-text-menu-default', + caption: this.textInsert, + style: "width:100%;", + menu: new Common.UI.Menu({ + style: 'min-width: 194px;', + maxHeight: 200, + items: [ + {caption: this.textFromFile, value: 0}, + {caption: this.textFromUrl, value: 1}, + {caption: this.textFromStorage, value: 2} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnSelectImage); + this.btnSelectImage.menu.on('item:click', _.bind(this.onImageSelect, this)); + this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); + + this.btnEditObject = new Common.UI.Button({ + el: $('#image-button-edit-object') + }); + this.lockedControls.push(this.btnEditObject); + + this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); + this.btnEditObject.on('click', _.bind(function(btn){ + if (this.api) { + var oleobj = this.api.asc_canEditTableOleObject(true); + if (oleobj) { + var oleEditor = PDFE.getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.setEditMode(true); + oleEditor.show(); + oleEditor.setOleData(Asc.asc_putBinaryDataToFrameFromTableOleObject(oleobj)); + } + } else + this.api.asc_startEditCurrentOleObject(); + } + this.fireEvent('editcomplete', this); + }, this)); + + this.btnFitSlide = new Common.UI.Button({ + el: $('#image-button-fit-slide') + }); + this.lockedControls.push(this.btnFitSlide); + this.btnFitSlide.on('click', _.bind(this.setFitSlide, this)); + + var w = Math.max(this.btnOriginalSize.cmpEl.width(), this.btnFitSlide.cmpEl.width()); + this.btnOriginalSize.cmpEl.width(w); + this.btnFitSlide.cmpEl.width(w); + + w = this.btnOriginalSize.cmpEl.outerWidth(); + this.btnCrop = new Common.UI.Button({ + parentEl: $('#image-button-crop'), + cls: 'btn-text-split-default', + caption: this.textCrop, + split: true, + enableToggle: true, + allowDepress: true, + pressed: this._state.cropMode, + width: w, + menu : new Common.UI.Menu({ + style : 'min-width:' + w + 'px;', + items: [ + { + caption: this.textCrop, + checkable: true, + allowDepress: true, + checked: this._state.cropMode, + value: 0 + }, + { + caption: this.textCropToShape, + menu: new Common.UI.Menu({ + menuAlign: 'tl-tl', + cls: 'menu-shapes menu-change-shape', + items: [] + }) + }, + { + caption: this.textCropFill, + value: 1 + }, + { + caption: this.textCropFit, + value: 2 + }] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.btnCrop.on('click', _.bind(this.onCrop, this)); + this.btnCrop.menu.on('item:click', _.bind(this.onCropMenu, this)); + this.lockedControls.push(this.btnCrop); + this.btnChangeShape= this.btnCrop.menu.items[1]; + + this.btnRotate270 = new Common.UI.Button({ + parentEl: $('#image-button-270', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-270', + value: 0, + hint: this.textHint270, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.btnRotate270.on('click', _.bind(this.onBtnRotateClick, this)); + this.lockedControls.push(this.btnRotate270); + + this.btnRotate90 = new Common.UI.Button({ + parentEl: $('#image-button-90', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-90', + value: 1, + hint: this.textHint90, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.btnRotate90.on('click', _.bind(this.onBtnRotateClick, this)); + this.lockedControls.push(this.btnRotate90); + + this.btnFlipV = new Common.UI.Button({ + parentEl: $('#image-button-flipv', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-flip-vert', + value: 0, + hint: this.textHintFlipV, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.btnFlipV.on('click', _.bind(this.onBtnFlipClick, this)); + this.lockedControls.push(this.btnFlipV); + + this.btnFlipH = new Common.UI.Button({ + parentEl: $('#image-button-fliph', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-flip-hor', + value: 1, + hint: this.textHintFlipH, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.btnFlipH.on('click', _.bind(this.onBtnFlipClick, this)); + this.lockedControls.push(this.btnFlipH); + + this.linkAdvanced = $('#image-advanced-link'); + $(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + + createDelayedElements: function() { + this.createDelayedControls(); + this.updateMetricUnit(); + this.onApiAutoShapes(); + this._initSettings = false; + }, + + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.btnChangeShape.menu.on('show:before', onShowBefore); + }, + + fillAutoShapes: function() { + var me = this, + recents = Common.localStorage.getItem('pdfe-recent-shapes'); + + var menuitem = new Common.UI.MenuItem({ + template: _.template(''), + index: 0 + }); + me.btnChangeShape.menu.addItem(menuitem); + + var shapePicker = new Common.UI.DataViewShape({ + el: $('#id-img-change-shape-menu'), + itemTemplate: _.template('
\">
'), + groups: me.application.getCollection('ShapeGroups'), + parentMenu: me.btnChangeShape.menu, + restoreHeight: 652, + textRecentlyUsed: me.textRecentlyUsed, + recentShapes: recents ? JSON.parse(recents) : null, + hideTextRect: true, + hideLines: true + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + PDFE.getController('InsTab').view.cmbInsertShape.updateComboView(record); + me.api.ChangeShapeType(record.get('data').shapeType); + me.fireEvent('editcomplete', me); + } + if (e.type !== 'click') + me.btnCrop.menu.hide(); + }); + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + this.disableControls(this._locked); + + if (props ){ + this._originalProps = new Asc.asc_CImgProperty(props); + + var value = props.get_Width(); + if ( Math.abs(this._state.Width-value)>0.001 ) { + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this._state.Width = value; + } + + value = props.get_Height(); + if ( Math.abs(this._state.Height-value)>0.001 ) { + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this._state.Height = value; + } + + this.btnOriginalSize.setDisabled(props.get_ImageUrl()===null || props.get_ImageUrl()===undefined || this._locked); + + var pluginGuid = props.asc_getPluginGuid(); + value = (pluginGuid !== null && pluginGuid !== undefined); // undefined - only images are selected, null - selected images and ole-objects + if (this._state.isOleObject!==value) { + this.btnSelectImage.setVisible(!value); + this.btnEditObject.setVisible(value); + this._state.isOleObject=value; + } + this.btnRotate270.setDisabled(value || this._locked); + this.btnRotate90.setDisabled(value || this._locked); + this.btnFlipV.setDisabled(value || this._locked); + this.btnFlipH.setDisabled(value || this._locked); + + if (this._state.isOleObject) { + var plugin = PDFE.getCollection('Common.Collections.Plugins').findWhere({guid: pluginGuid}); + this.btnEditObject.setDisabled(!this.api.asc_canEditTableOleObject() && (plugin===null || plugin ===undefined) || this._locked); + } else { + this.btnSelectImage.setDisabled(pluginGuid===null || this._locked); + } + } + }, + + setOriginalSize: function() { + if (this.api) { + var imgsize = this.api.get_OriginalSizeImage(); + var w = imgsize.get_ImageWidth(); + var h = imgsize.get_ImageHeight(); + + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + + var properties = new Asc.asc_CImgProperty(); + properties.put_Width(w); + properties.put_Height(h); + properties.put_ResetCrop(true); + properties.put_Rot(0); + this.api.ImgApply(properties); + this.fireEvent('editcomplete', this); + } + }, + + setImageUrl: function(url, token) { + var props = new Asc.asc_CImgProperty(); + props.put_ImageUrl(url, token); + this.api.ImgApply(props); + }, + + insertImageFromStorage: function(data) { + if (data && data._urls && data.c=='change') { + this.setImageUrl(data._urls[0], data.token); + } + }, + + onImageSelect: function(menu, item) { + if (item.value==1) { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.setImageUrl(checkUrl); + } + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + } else if (item.value==2) { + Common.NotificationCenter.trigger('storage:image-load', 'change'); + } else { + if (this._isFromFile) return; + this._isFromFile = true; + if (this.api) this.api.ChangeImageFromFile(); + this.fireEvent('editcomplete', this); + this._isFromFile = false; + } + }, + + openAdvancedSettings: function(e) { + if (this.linkAdvanced.hasClass('disabled')) return; + + var me = this; + if (me.api && !this._locked){ + 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.Image == elType) { + var imgsizeOriginal; + if (!me.btnOriginalSize.isDisabled()) { + imgsizeOriginal = me.api.get_OriginalSizeImage(); + if (imgsizeOriginal) + imgsizeOriginal = {width:imgsizeOriginal.get_ImageWidth(), height:imgsizeOriginal.get_ImageHeight()}; + } + + (new PDFE.Views.ImageSettingsAdvanced( + { + imageProps: elValue, + sizeOriginal: imgsizeOriginal, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ImgApply(value.imageProps); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + break; + } + } + } + } + }, + + _changeCropState: function(state) { + this._state.cropMode = state; + + if (!this.btnCrop) return; + this.btnCrop.toggle(state, true); + this.btnCrop.menu.items[0].setChecked(state, true); + }, + + onCrop: function(btn, e) { + if (this.api) { + btn.pressed ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop(); + } + this.fireEvent('editcomplete', this); + }, + + onCropMenu: function(menu, item) { + if (this.api) { + if (item.value == 1) { + this.api.asc_cropFill(); + } else if (item.value == 2) { + this.api.asc_cropFit(); + } else { + item.checked ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop(); + } + } + this.fireEvent('editcomplete', this); + }, + + setFitSlide: function() { + this.api && this.api.asc_FitImagesToPage(); + this.fireEvent('editcomplete', this); + }, + + onBtnRotateClick: function(btn) { + var properties = new Asc.asc_CImgProperty(); + properties.asc_putRotAdd((btn.options.value==1 ? 90 : 270) * 3.14159265358979 / 180); + this.api.ImgApply(properties); + this.fireEvent('editcomplete', this); + }, + + onBtnFlipClick: function(btn) { + var properties = new Asc.asc_CImgProperty(); + if (btn.options.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + this.api.ImgApply(properties); + this.fireEvent('editcomplete', this); + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced.toggleClass('disabled', disable); + } + this.btnCrop.setDisabled(disable || !this.api.asc_canEditCrop()); + }, + + textSize: 'Size', + textWidth: 'Width', + textHeight: 'Height', + textOriginalSize: 'Actual Size', + textInsert: 'Replace Image', + textFromUrl: 'From URL', + textFromFile: 'From File', + textAdvanced: 'Show advanced settings', + textEditObject: 'Edit Object', + textEdit: 'Edit', + textRotation: 'Rotation', + textRotate90: 'Rotate 90°', + textFlip: 'Flip', + textHint270: 'Rotate 90° Counterclockwise', + textHint90: 'Rotate 90° Clockwise', + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally', + textCrop: 'Crop', + textCropFill: 'Fill', + textCropFit: 'Fit', + textFitPage: 'Fit to page', + textCropToShape: 'Crop to shape', + textFromStorage: 'From Storage', + textRecentlyUsed: 'Recently Used' + }, PDFE.Views.ImageSettings || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/ImageSettingsAdvanced.js b/apps/pdfeditor/main/app/view/ImageSettingsAdvanced.js new file mode 100644 index 0000000000..8ca4f31298 --- /dev/null +++ b/apps/pdfeditor/main/app/view/ImageSettingsAdvanced.js @@ -0,0 +1,435 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ImageSettingsAdvanced.js + * + * Created by Julia Radzhabova on 4/16/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!pdfeditor/main/app/template/ImageSettingsAdvanced.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/CheckBox' +], function (contentTemplate) { + 'use strict'; + + PDFE.Views.ImageSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + alias: 'ImageSettingsAdvanced', + contentWidth: 340, + contentHeight: 257, + sizeOriginal: {width: 0, height: 0}, + sizeMax: {width: 55.88, height: 55.88}, + storageName: 'pdfe-img-settings-adv-category' + }, + + initialize : function(options) { + _.extend(this.options, { + title: this.textTitle, + items: [ + {panelId: 'id-adv-image-general', panelCaption: this.textGeneral}, + {panelId: 'id-adv-image-size', panelCaption: this.textPlacement}, + {panelId: 'id-adv-image-rotate', panelCaption: this.textRotation}, + {panelId: 'id-adv-image-alttext', panelCaption: this.textAlt} + ], + contentTemplate: _.template(contentTemplate)({ + scope: this + }) + }, options); + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + this.spinners = []; + + this._nRatio = 1; + this._isDefaultSize = false; + this._originalProps = this.options.imageProps; + this.slideSize = this.options.slideSize; + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + + // General + this.inputImageName = new Common.UI.InputField({ + el : $('#image-general-name'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isImgNameChanged = true; + }); + + // Placement + this.spnWidth = new Common.UI.MetricSpinner({ + el: $('#image-advanced-spin-width'), + step: .1, + width: 70, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this.btnRatio.pressed) { + var w = field.getNumberValue(); + var h = w/this._nRatio; + if (h>this.sizeMax.height) { + h = this.sizeMax.height; + w = h * this._nRatio; + this.spnWidth.setValue(w, true); + } + this.spnHeight.setValue(h, true); + } + this._isDefaultSize = false; + }, this)); + this.spinners.push(this.spnWidth); + + this.spnHeight = new Common.UI.MetricSpinner({ + el: $('#image-advanced-spin-height'), + step: .1, + width: 70, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = null; + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.sizeMax.width) { + w = this.sizeMax.width; + h = w/this._nRatio; + this.spnHeight.setValue(h, true); + } + this.spnWidth.setValue(w, true); + } + this._isDefaultSize = false; + }, this)); + this.spinners.push(this.spnHeight); + + this.btnOriginalSize = new Common.UI.Button({ + el: $('#image-advanced-button-original-size') + }); + this.btnOriginalSize.on('click', _.bind(function(btn, e) { + this.spnAngle.setValue(0); + this.spnWidth.setValue(this.sizeOriginal.width, true); + this.spnHeight.setValue(this.sizeOriginal.height, true); + this._nRatio = this.sizeOriginal.width/this.sizeOriginal.height; + this._isDefaultSize = true; + }, this)); + + this.btnRatio = new Common.UI.Button({ + parentEl: $('#image-advanced-button-ratio'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-advanced-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.spnHeight.getNumberValue()>0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + }, this)); + + this.spnX = new Common.UI.MetricSpinner({ + el: $('#image-advanced-spin-x'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnX); + + this.spnY = new Common.UI.MetricSpinner({ + el: $('#image-advanced-spin-y'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnY); + + this.cmbFromX = new Common.UI.ComboBox({ + el: $('#image-advanced-combo-from-x'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + this.cmbFromY = new Common.UI.ComboBox({ + el: $('#image-advanced-combo-from-y'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + // Rotation + this.spnAngle = new Common.UI.MetricSpinner({ + el: $('#image-advanced-spin-angle'), + step: 1, + width: 80, + defaultUnit : "°", + value: '0 °', + maxValue: 3600, + minValue: -3600 + }); + + this.chFlipHor = new Common.UI.CheckBox({ + el: $('#image-advanced-checkbox-hor'), + labelText: this.textHorizontally + }); + + this.chFlipVert = new Common.UI.CheckBox({ + el: $('#image-advanced-checkbox-vert'), + labelText: this.textVertically + }); + + // Alt Text + + this.inputAltTitle = new Common.UI.InputField({ + el : $('#image-advanced-alt-title'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isAltTitleChanged = true; + }); + + this.textareaAltDescription = this.$window.find('textarea'); + this.textareaAltDescription.keydown(function (event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + event.stopPropagation(); + } + me.isAltDescChanged = true; + }); + + this.afterRender(); + }, + + getFocusedComponents: function() { + return this.btnsCategory.concat([ + this.inputImageName, // 0 tab + this.spnWidth, this.btnRatio, this.spnHeight, this.btnOriginalSize, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY,// 1 tab + this.spnAngle, this.chFlipHor, this.chFlipVert, // 2 tab + this.inputAltTitle, this.textareaAltDescription // 3 tab + ]).concat(this.getFooterButtons()); + }, + + onCategoryClick: function(btn, index) { + Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index); + + var me = this; + setTimeout(function(){ + switch (index) { + case 0: + me.inputImageName.focus(); + break; + case 1: + me.spnWidth.focus(); + break; + case 2: + me.spnAngle.focus(); + break; + case 3: + me.inputAltTitle.focus(); + break; + } + }, 10); + }, + + afterRender: function() { + this.updateMetricUnit(); + this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } + }, + + _setDefaults: function(props) { + if (props ){ + var value = props.asc_getName(); + this.inputImageName.setValue(value ? value : ''); + + this.spnWidth.setMaxValue(this.sizeMax.width); + this.spnHeight.setMaxValue(this.sizeMax.height); + value = props.get_Width(); + this.spnWidth.setValue((value!==undefined) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); + value = props.get_Height(); + this.spnHeight.setValue((value!==undefined) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); + + this.btnOriginalSize.setDisabled(props.get_ImageUrl()===null || props.get_ImageUrl()===undefined); + + value = props.asc_getLockAspect(); + this.btnRatio.toggle(value); + if (props.get_Height()>0) + this._nRatio = props.get_Width()/props.get_Height(); + + this.cmbFromX.setValue('left'); + this.cmbFromY.setValue('left'); + + if (props.get_Position()) { + var Position = {X: props.get_Position().get_X(), Y: props.get_Position().get_Y()}; + this.spnX.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true); + this.spnY.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true); + } else { + this.spnX.setValue('', true); + this.spnY.setValue('', true); + } + + value = props.asc_getRot(); + this.spnAngle.setValue((value==undefined || value===null) ? '' : Math.floor(value*180/3.14159265358979+0.5), true); + this.chFlipHor.setValue(props.asc_getFlipH()); + this.chFlipVert.setValue(props.asc_getFlipV()); + + value = props.asc_getTitle(); + this.inputAltTitle.setValue(value ? value : ''); + + value = props.asc_getDescription(); + this.textareaAltDescription.val(value ? value : ''); + + var pluginGuid = props.asc_getPluginGuid(); + this.btnsCategory[2].setVisible(pluginGuid === null || pluginGuid === undefined); // Rotation + } + }, + + getSettings: function() { + var properties = new Asc.asc_CImgProperty(); + if (this.isImgNameChanged) + properties.asc_putName(this.inputImageName.getValue()); + if (this.spnHeight.getValue()!=='') + properties.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())); + if (this.spnWidth.getValue()!=='') + properties.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())); + properties.asc_putLockAspect(this.btnRatio.pressed); + properties.put_ResetCrop(this._isDefaultSize); + + var Position = new Asc.CPosition(); + if (this.spnX.getValue() !== '') { + var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()); + if (this.cmbFromX.getValue() === 'center') { + x = (this.slideSize.width/36000)/2 + x; + } + Position.put_X(x); + } + if (this.spnY.getValue() !== '') { + var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue()); + if (this.cmbFromY.getValue() === 'center') { + y = (this.slideSize.height/36000)/2 + y; + } + Position.put_Y(y); + } + properties.put_Position(Position); + + if (this.isAltTitleChanged) + properties.asc_putTitle(this.inputAltTitle.getValue()); + + if (this.isAltDescChanged) + properties.asc_putDescription(this.textareaAltDescription.val()); + + properties.asc_putRot(this.spnAngle.getNumberValue() * 3.14159265358979 / 180); + properties.asc_putFlipH(this.chFlipHor.getValue()=='checked'); + properties.asc_putFlipV(this.chFlipVert.getValue()=='checked'); + + return { imageProps: properties }; + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i' + + '
' + + '' + + '
' + + '' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '' + + '' + + // '' + + // '' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + // '
' + + // '' + + // '' + + // '' + + // '
' + + // '
' + + '
' + + '' + + '' + + '
' + + ''; + + return { + options: {}, + + setEvents: function () { + var me = this; + + me.btnAddPage.on('click', _.bind(function () { + me.fireEvent('insert:page'); + }, me)); + // me.btnEditHeader.on('click', _.bind(function () { + // me.fireEvent('insert:header', ['header']); + // }, me)); + // me.btnInsDateTime.on('click', _.bind(function () { + // me.fireEvent('insert:header', ['datetime']); + // }, me)); + // me.btnInsSlideNum.on('click', _.bind(function () { + // me.fireEvent('insert:header', ['slidenum']); + // }, me)); + me.btnInsertHyperlink.on('click', _.bind(function () { + me.fireEvent('insert:hyperlink'); + }, me)); + me.mnuTablePicker.on('select', _.bind(function (picker, columns, rows, e) { + me.fireEvent('insert:table', ['picker', columns, rows]); + }, me)); + me.btnInsertTable.menu.on('item:click', function (menu, item, e) { + me.fireEvent('insert:table', [item.value]); + }); + me.btnInsertEquation.on('click', _.bind(function () { + me.fireEvent('insert:equation'); + }, me)); + me.btnInsertSymbol.menu.items[2].on('click', _.bind(function () { + me.fireEvent('insert:symbol'); + }, this)); + me.mnuInsertSymbolsPicker.on('item:click',_.bind(function (picker, item, record, e) { + me.fireEvent('insert:symbol', [record]); + }, this)); + }, + + initialize: function (options) { + Common.UI.BaseView.prototype.initialize.call(this); + this.toolbar = options.toolbar; + this.appConfig = options.mode; + + this.lockedControls = []; + + var me = this; + var _set = Common.enumLock; + + me.btnInsertTable = new Common.UI.Button({ + id: 'tlbtn-inserttable', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-inserttable', + caption: me.capInsertTable, + lock: [_set.lostConnect, _set.disableOnStart], + menu: new Common.UI.Menu({ + cls: 'shifted-left', + items: [ + {template: _.template('
')}, + {caption: me.mniCustomTable, value: 'custom'}, + // {caption: me.mniInsertSSE, value: 'sse'} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertTable); +/* + me.btnInsertChart = new Common.UI.Button({ + id: 'tlbtn-insertchart', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-insertchart', + caption: me.capInsertChart, + lock: [_set.lostConnect, _set.disableOnStart], + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertChart); + + this.btnInsertSmartArt = new Common.UI.Button({ + id: 'tlbtn-insertsmartart', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-smart-art', + lock: [_set.lostConnect, _set.disableOnStart], + caption: me.capBtnInsSmartArt, + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(this.btnInsertSmartArt); +*/ + me.btnInsertEquation = new Common.UI.Button({ + id: 'tlbtn-insertequation', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-insertequation', + caption: me.capInsertEquation, + lock: [_set.paragraphLock, _set.lostConnect, _set.disableOnStart], + split: true, + menu: new Common.UI.Menu({cls: 'menu-shapes'}), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(this.btnInsertEquation); + + me.btnInsertSymbol = new Common.UI.Button({ + id: 'tlbtn-insertsymbol', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-symbol', + caption: me.capBtnInsSymbol, + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected], + menu: new Common.UI.Menu({ + style: 'min-width: 100px;', + items: [ + {template: _.template('
')}, + {caption: '--'}, + new Common.UI.MenuItem({ + caption: this.textMoreSymbols + }) + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertSymbol); + + me.btnInsertHyperlink = new Common.UI.Button({ + id: 'tlbtn-insertlink', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-inserthyperlink', + caption: me.capInsertHyperlink, + lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.noParagraphSelected], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertHyperlink); + + me.btnInsertTextArt = new Common.UI.Button({ + id: 'tlbtn-inserttextart', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-textart', + caption: me.capInsertTextArt, + lock: [_set.lostConnect, _set.disableOnStart], + menu: new Common.UI.Menu({ + cls: 'menu-shapes', + items: [ + {template: _.template('
')} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertTextArt); +/* + me.btnEditHeader = new Common.UI.Button({ + id: 'id-toolbar-btn-editheader', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-editheader', + caption: me.capBtnInsHeaderFooter, + lock: [_set.lostConnect, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnEditHeader); + + me.btnInsDateTime = new Common.UI.Button({ + id: 'id-toolbar-btn-datetime', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-datetime', + caption: me.capBtnDateTime, + lock: [_set.lostConnect, _set.paragraphLock, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsDateTime); + + me.btnInsSlideNum = new Common.UI.Button({ + id: 'id-toolbar-btn-slidenum', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-pagenum', + caption: me.capBtnSlideNum, + lock: [_set.lostConnect, _set.paragraphLock, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsSlideNum); +*/ + me.btnInsertShape = new Common.UI.Button({ + id: 'tlbtn-insertshape', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-insertshape', + caption: me.capInsertShape, + lock: [_set.lostConnect, _set.disableOnStart], + menu: true, + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnInsertShape); + + me.btnAddPage = new Common.UI.Button({ + id: 'tlbtn-addpage', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-blankpage', + caption: me.capAddPage, + lock: [_set.lostConnect, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.lockedControls.push(me.btnAddPage); + + me.cmbInsertShape = new Common.UI.ComboDataViewShape({ + cls: 'combo-styles shapes', + itemWidth: 20, + itemHeight: 20, + menuMaxHeight: 652, + menuWidth: 330, + style: 'width: 140px;', + enableKeyEvents: true, + lock: [_set.lostConnect, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '-16, 0' + }); + me.lockedControls.push(me.cmbInsertShape); + + Common.Utils.lockControls(_set.disableOnStart, true, {array: this.lockedControls}); + }, + + render: function (el) { + if ( el ) el.html( this.getPanel() ); + + return this; + }, + + getPanel: function () { + this.$el = $(_.template(template)( {} )); + var $host = this.$el; + var _injectComponent = function (id, cmp) { + Common.Utils.injectComponent($host.find(id), cmp); + }; + // _injectComponent('#slot-btn-inssmartart', this.btnInsertSmartArt); + _injectComponent('#slot-btn-addpage', this.btnAddPage); + _injectComponent('#slot-btn-insertequation', this.btnInsertEquation); + _injectComponent('#slot-btn-inssymbol', this.btnInsertSymbol); + _injectComponent('#slot-btn-insertlink', this.btnInsertHyperlink); + _injectComponent('#slot-btn-inserttable', this.btnInsertTable); + // _injectComponent('#slot-btn-insertchart', this.btnInsertChart); + _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); + // _injectComponent('#slot-btn-editheader', this.btnEditHeader); + // _injectComponent('#slot-btn-datetime', this.btnInsDateTime); + // _injectComponent('#slot-btn-slidenum', this.btnInsSlideNum); + _injectComponent('#slot-combo-insertshape', this.cmbInsertShape); + + if (this.toolbar && this.toolbar.$el) { + this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg').add(this.toolbar.$el.find('.slot-insertimg')), 'tlbtn-insertimage-', 'toolbar__icon btn-insertimage', this.capInsertImage, + [Common.enumLock.lostConnect, Common.enumLock.disableOnStart], false, true, undefined, '1', 'bottom', 'small'); + this.btnsInsertText = Common.Utils.injectButtons($host.find('.slot-instext').add(this.toolbar.$el.find('.slot-instext')), 'tlbtn-inserttext-', 'toolbar__icon btn-big-text', this.capInsertText, + [Common.enumLock.lostConnect, Common.enumLock.disableOnStart], true, false, true, '1', 'bottom', 'small'); + this.btnsInsertShape = Common.Utils.injectButtons($host.find('.slot-insertshape').add(this.toolbar.$el.find('.slot-insertshape')), 'tlbtn-insertshape-', 'toolbar__icon btn-insertshape', this.capInsertShape, + [Common.enumLock.lostConnect, Common.enumLock.disableOnStart], false, true, true, '1', 'bottom', 'small'); + } + + var created = this.btnsInsertImage.concat(this.btnsInsertText, this.btnsInsertShape); + Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: created}); + Array.prototype.push.apply(this.lockedControls, created); + + return this.$el; + }, + + onAppReady: function (config) { + var me = this; + me.btnsInsertImage.forEach(function (btn) { + btn.updateHint(me.tipInsertImage); + btn.setMenu( + new Common.UI.Menu({ + items: [ + {caption: me.mniImageFromFile, value: 'file'}, + {caption: me.mniImageFromUrl, value: 'url'}, + {caption: me.mniImageFromStorage, value: 'storage'} + ] + }).on('item:click', function (menu, item, e) { + me.fireEvent('insert:image', [item.value]); + }) + ); + btn.menu.items[2].setVisible(config.canRequestInsertImage || config.fileChoiceUrl && config.fileChoiceUrl.indexOf("{documentType}")>-1); + }); + + me.btnsInsertText.forEach(function (button) { + button.updateHint([me.tipInsertHorizontalText, me.tipInsertText]); + button.options.textboxType = 'textRect'; + button.setMenu(new Common.UI.Menu({ + items: [ + { + caption: me.tipInsertHorizontalText, + checkable: true, + checkmark: false, + iconCls : 'menu__icon btn-text', + toggleGroup: 'textbox', + value: 'textRect', + iconClsForMainBtn: 'btn-big-text' + }, + { + caption: me.tipInsertVerticalText, + checkable: true, + checkmark: false, + iconCls : 'menu__icon btn-text-vertical', + toggleGroup: 'textbox', + value: 'textRectVertical', + iconClsForMainBtn: 'btn-big-text-vertical' + }, + ] + })); + button.on('click', function (btn, e) { + me.fireEvent('insert:text-btn', [btn, e]); + }); + button.menu.on('item:click', function(btn, e) { + button.toggle(true); + me.fireEvent('insert:text-menu', [button, e]); + }); + }); + + me.btnsInsertShape.forEach(function (btn) { + btn.updateHint(me.tipInsertShape); + btn.setMenu( + new Common.UI.Menu({ + cls: 'menu-shapes menu-insert-shape' + }).on('hide:after', function (e) { + me.fireEvent('insert:shape', ['menu:hide']); + }) + ); + }); + + this.btnInsertTable.updateHint(this.tipInsertTable); + // this.btnInsertChart.updateHint(this.tipInsertChart); + // this.btnInsertSmartArt.updateHint(this.tipInsertSmartArt); + this.btnInsertEquation.updateHint(this.tipInsertEquation); + this.btnInsertSymbol.updateHint(this.tipInsertSymbol); + this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); + this.btnInsertTextArt.updateHint(this.tipInsertTextArt); + // this.btnEditHeader.updateHint(this.tipEditHeaderFooter); + // this.btnInsDateTime.updateHint(this.tipDateTime); + // this.btnInsSlideNum.updateHint(this.tipPageNum); + this.btnAddPage.updateHint(this.tipAddPage); +/* + this.btnInsertChart.setMenu( new Common.UI.Menu({ + style: 'width: 364px;padding-top: 12px;', + items: [ + {template: _.template('')} + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 535, + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), + itemTemplate: _.template('
\">
') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('insert:chart', [record.get('type')]); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); + + this.btnInsertSmartArt.setMenu(new Common.UI.Menu({ + cls: 'shifted-right', + items: [] + })); + + var smartArtData = Common.define.smartArt.getSmartArtData(); + smartArtData.forEach(function (item, index) { + var length = item.items.length, + width = 399; + if (length < 5) { + width = length * (70 + 8) + 9; // 4px margin + 4px margin + } + me.btnInsertSmartArt.menu.addItem({ + caption: item.caption, + value: item.sectionId, + itemId: item.id, + itemsLength: length, + iconCls: item.icon ? 'menu__icon ' + item.icon : undefined, + menu: new Common.UI.Menu({ + items: [ + {template: _.template('')} + ], + menuAlign: 'tl-tr', + })}); + }); + var onShowBeforeSmartArt = function (menu) { // + <% if(typeof imageUrl === "undefined" || imageUrl===null || imageUrl==="") { %> style="visibility: hidden;" <% } %>/>', + me.btnInsertSmartArt.menu.items.forEach(function (item, index) { + var items = []; + for (var i=0; i', + '
', + '', + '
', + '<% } else { %>', + '
', + '', + '
', + '<% } %>' + ].join('')), + store: new Common.UI.DataViewStore(items), + delayRenderTips: true, + scrollAlwaysVisible: true, + showLast: false + }); + item.menuPicker.on('item:click', function(picker, item, record, e) { + if (record && record.get('value') !== null) { + me.fireEvent('insert:smartart', [record.get('value')]); + } + Common.NotificationCenter.trigger('edit:complete', me); + }); + item.menuPicker.loaded = false; + item.$el.on('mouseenter', function () { + if (!item.menuPicker.loaded) { + me.fireEvent('smartart:mouseenter', [item.value]); + } + }); + item.$el.on('mouseleave', function () { + me.fireEvent('smartart:mouseleave', [item.value]); + }); + }); + menu.off('show:before', onShowBeforeSmartArt); + }; + this.btnInsertSmartArt.menu.on('show:before', onShowBeforeSmartArt); +*/ + var onShowBeforeTextArt = function (menu) { + var collection = PDFE.getCollection('Common.Collections.TextArt'); + if (collection.length<1) + PDFE.getController('Main').fillTextArt(null, true); + var picker = new Common.UI.DataView({ + el: $('#view-insert-art', menu.$el), + store: collection, + parentMenu: menu, + showLast: false, + itemTemplate: _.template('
') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('insert:textart', [record.get('data')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBeforeTextArt); + }; + this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt); + + // set dataviews + this.specSymbols = [ + {symbol: 8226, description: this.textBullet}, + {symbol: 8364, description: this.textEuro}, + {symbol: 65284, description: this.textDollar}, + {symbol: 165, description: this.textYen}, + {symbol: 169, description: this.textCopyright}, + {symbol: 174, description: this.textRegistered}, + {symbol: 189, description: this.textOneHalf}, + {symbol: 188, description: this.textOneQuarter}, + {symbol: 8800, description: this.textNotEqualTo}, + {symbol: 177, description: this.textPlusMinus}, + {symbol: 247, description: this.textDivision}, + {symbol: 8730, description: this.textSquareRoot}, + {symbol: 8804, description: this.textLessEqual}, + {symbol: 8805, description: this.textGreaterEqual}, + {symbol: 8482, description: this.textTradeMark}, + {symbol: 8734, description: this.textInfinity}, + {symbol: 126, description: this.textTilde}, + {symbol: 176, description: this.textDegree}, + {symbol: 167, description: this.textSection}, + {symbol: 945, description: this.textAlpha}, + {symbol: 946, description: this.textBetta}, + {symbol: 960, description: this.textLetterPi}, + {symbol: 916, description: this.textDelta}, + {symbol: 9786, description: this.textSmile}, + {symbol: 9829, description: this.textBlackHeart} + ]; + this.mnuInsertSymbolsPicker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-symbols'), + parentMenu: this.btnInsertSymbol.menu, + outerMenu: {menu: this.btnInsertSymbol.menu, index:0}, + restoreHeight: 290, + delayRenderTips: true, + scrollAlwaysVisible: true, + store: new Common.UI.DataViewStore(this.loadRecentSymbolsFromStorage()), + itemTemplate: _.template('
style ="font-family: <%= font %>"<% } %>>&#<%= symbol %>
') + }); + this.btnInsertSymbol.menu.setInnerMenu([{menu: this.mnuInsertSymbolsPicker, index: 0}]); + this.btnInsertSymbol.menu.on('show:before', _.bind(function() { + this.mnuInsertSymbolsPicker.deselectAll(); + }, this)); + + this.mnuTablePicker = new Common.UI.DimensionPicker({ + el: $('#id-toolbar-menu-tablepicker'), + minRows: 8, + minColumns: 10, + maxRows: 8, + maxColumns: 10 + }); + + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this); + this.fireEvent('show', this); + }, + + getButtons: function(type) { + if (type===undefined) + return this.lockedControls; + return []; + }, + + SetDisabled: function (state) { + this.lockedControls && this.lockedControls.forEach(function(button) { + if ( button ) { + button.setDisabled(state); + } + }, this); + }, + + loadRecentSymbolsFromStorage: function(){ + var recents = Common.localStorage.getItem('pdfe-fastRecentSymbols'); + var arr = (!!recents) ? JSON.parse(recents) : + [ + { symbol: 8226, font: 'Arial'}, + { symbol: 8364, font: 'Arial'}, + { symbol: 65284, font: 'Arial'}, + { symbol: 165, font: 'Arial'}, + { symbol: 169, font: 'Arial'}, + { symbol: 174, font: 'Arial'}, + { symbol: 189, font: 'Arial'}, + { symbol: 188, font: 'Arial'}, + { symbol: 8800, font: 'Arial'}, + { symbol: 177, font: 'Arial'}, + { symbol: 247, font: 'Arial'}, + { symbol: 8730, font: 'Arial'}, + { symbol: 8804, font: 'Arial'}, + { symbol: 8805, font: 'Arial'}, + { symbol: 8482, font: 'Arial'}, + { symbol: 8734, font: 'Arial'}, + { symbol: 126, font: 'Arial'}, + { symbol: 176, font: 'Arial'}, + { symbol: 167, font: 'Arial'}, + { symbol: 945, font: 'Arial'}, + { symbol: 946, font: 'Arial'}, + { symbol: 960, font: 'Arial'}, + { symbol: 916, font: 'Arial'}, + { symbol: 9786, font: 'Arial'}, + { symbol: 9829, font: 'Arial'} + ]; + arr.forEach(function (item){ + item.tip = this.getSymbolDescription(item.symbol); + }.bind(this)); + return arr; + }, + + saveSymbol: function(symbol, font) { + var maxLength =25, + picker = this.mnuInsertSymbolsPicker; + var item = picker.store.find(function(item){ + return item.get('symbol') == symbol && item.get('font') == font + }); + + item && picker.store.remove(item); + picker.store.add({symbol: symbol, font: font, tip: this.getSymbolDescription(symbol)},{at:0}); + picker.store.length > maxLength && picker.store.remove(picker.store.last()); + + var arr = picker.store.map(function (item){ + return {symbol: item.get('symbol'), font: item.get('font')}; + }); + var sJSON = JSON.stringify(arr); + Common.localStorage.setItem( 'pdfe-fastRecentSymbols', sJSON); + }, + + getSymbolDescription: function(symbol){ + var specSymbol = this.specSymbols.find(function (item){return item.symbol == symbol}); + return !!specSymbol ? specSymbol.description : this.capBtnInsSymbol + ': ' + symbol; + }, + + onComboOpen: function (needfocus, combo, e, params) { + if (params && params.fromKeyDown) return; + _.delay(function() { + var input = $('input', combo.cmpEl).select(); + if (needfocus) input.focus(); + else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); }); + }, 10); + }, + + updateComboAutoshapeMenu: function (collection) { + var me = this, + recents = Common.localStorage.getItem('pdfe-recent-shapes'); + recents = recents ? JSON.parse(recents) : null; + me.cmbInsertShape.setMenuPicker(collection, recents, me.textRecentlyUsed); + }, + + updateAutoshapeMenu: function (menuShape, collection) { + var me = this, + index = $(menuShape.el).prop('id').slice(-1); + + var menuitem = new Common.UI.MenuItem({ + template: _.template(''), + index: index + }); + menuShape.addItem(menuitem); + + var recents = Common.localStorage.getItem('pdfe-recent-shapes'); + recents = recents ? JSON.parse(recents) : null; + + var shapePicker = new Common.UI.DataViewShape({ + el: $('#id-toolbar-menu-insertshape-'+index), + itemTemplate: _.template('
\">
'), + groups: collection, + parentMenu: menuShape, + restoreHeight: 652, + textRecentlyUsed: me.textRecentlyUsed, + recentShapes: recents + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (e.type !== 'click') Common.UI.Menu.Manager.hideAll(); + if (record) { + me.fireEvent('insert:shape', [record.get('data').shapeType]); + me.cmbInsertShape.updateComboView(record); + } + }); + + }, + + tipInsertTable: 'Insert Table', + tipInsertImage: 'Insert Image', + mniImageFromFile: 'Image from file', + mniImageFromUrl: 'Image from url', + mniImageFromStorage: 'Image from Storage', + mniCustomTable: 'Insert Custom Table', + tipInsertHyperlink: 'Add Hyperlink', + tipInsertHorizontalText: 'Insert horizontal text box', + tipInsertVerticalText: 'Insert vertical text box', + tipInsertText: 'Insert Text', + tipInsertTextArt: 'Insert Text Art', + tipInsertShape: 'Insert Autoshape', + tipInsertEquation: 'Insert Equation', + tipInsertSmartArt: 'Insert SmartArt', + tipChangeChart: 'Change Chart Type', + capInsertText: 'Text', + capInsertTextArt: 'Text Art', + capInsertImage: 'Image', + capInsertShape: 'Shape', + capInsertTable: 'Table', + capInsertChart: 'Chart', + capInsertHyperlink: 'Hyperlink', + capInsertEquation: 'Equation', + capAddPage: 'Add Page', + tipAddPage: 'Add page', + tipInsertChart: 'Insert Chart', + tipPageNum: 'Insert page number', + tipDateTime: 'Insert current date and time', + capBtnPageNum: 'Page Number', + capBtnDateTime: 'Date & Time', + capBtnInsSymbol: 'Symbol', + capBtnInsSmartArt: 'SmartArt', + tipInsertSymbol: 'Insert symbol', + mniInsertSSE: 'Insert Spreadsheet', + textMoreSymbols: 'More symbols', + textAlpha: 'Greek Small Letter Alpha', + textBetta: 'Greek Small Letter Betta', + textBlackHeart: 'Black Heart Suit', + textBullet: 'Bullet', + textCopyright: 'Copyright Sign', + textDegree: 'Degree Sign', + textDelta: 'Greek Small Letter Delta', + textDivision: 'Division Sign', + textDollar: 'Dollar Sign', + textEuro: 'Euro Sign', + textGreaterEqual: 'Greater-Than Or Equal To', + textInfinity: 'Infinity', + textLessEqual: 'Less-Than Or Equal To', + textLetterPi: 'Greek Small Letter Pi', + textNotEqualTo: 'Not Equal To', + textOneHalf: 'Vulgar Fraction One Half', + textOneQuarter: 'Vulgar Fraction One Quarter', + textPlusMinus: 'Plus-Minus Sign', + textRegistered: 'Registered Sign', + textSection: 'Section Sign', + textSmile: 'White Smiling Fase', + textSquareRoot: 'Square Root', + textTilde: 'Tilde', + textTradeMark: 'Trade Mark Sign', + textYen: 'Yen Sign', + capBtnInsHeaderFooter: 'Header & Footer', + tipEditHeaderFooter: 'Edit header or footer', + textRecentlyUsed: 'Recently Used' + } + }()), PDFE.Views.InsTab || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/ParagraphSettings.js b/apps/pdfeditor/main/app/view/ParagraphSettings.js new file mode 100644 index 0000000000..784d9fe42e --- /dev/null +++ b/apps/pdfeditor/main/app/view/ParagraphSettings.js @@ -0,0 +1,410 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ParagraphSettings.js + * + * Created by Julia Radzhabova on 4/11/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'text!pdfeditor/main/app/template/ParagraphSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/MetricSpinner', + 'pdfeditor/main/app/view/ParagraphSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.ParagraphSettings = Backbone.View.extend(_.extend({ + el: '#id-paragraph-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'ParagraphSettings' + }, + + initialize: function () { + this._initSettings = true; + + this._state = { + LineRule: c_paragraphLinerule.LINERULE_AUTO, + LineHeight: 1.5, + LineSpacingBefore: 0, + LineSpacingAfter: 0.35, + DisabledControls: false + }; + this.spinners = []; + this.lockedControls = []; + this._locked = false; + + this.render(); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + + this.linkAdvanced = $('#paragraph-advanced-link'); + }, + + setApi: function(api) { + this.api = api; + if (this.api) + this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this)); + return this; + }, + + onNumLineHeightChange: function(field, newValue, oldValue, eOpts){ + if ( this.cmbLineRule.getRawValue() === '' ) + return; + if (this.api) + this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + }, + + onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + var num = field.getNumberValue(); + if (num<0) + this.api.put_LineSpacingBeforeAfter(0, -1); + else + this.api.put_LineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, + + onNumSpacingAfterChange: function(field, newValue, oldValue, eOpts){ + if (this.api){ + var num = field.getNumberValue(); + if (num<0) + this.api.put_LineSpacingBeforeAfter(1, -1); + else + this.api.put_LineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, + + onLineRuleSelect: function(combo, record) { + if (this.api) + this.api.put_PrLineSpacing(record.value, record.defaultValue); + this.numLineHeight.setDefaultUnit(record.defaultUnit); + this.numLineHeight.setMinValue(record.minValue); + this.numLineHeight.setStep(record.step); + this.fireEvent('editcomplete', this); + }, + + _onLineSpacing: function(value) { + if (this._initSettings) return; + + var linerule = value.get_LineRule(); + var line = value.get_Line(); + + if ( this._state.LineRule!==linerule ) { + var obj, + rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=linerule, obj)); + if (!rec) rec = this.cmbLineRule.store.at(0); + this.cmbLineRule.setValue((linerule !== null) ? linerule : ''); + this.numLineHeight.setMinValue(rec.get('minValue')); + this.numLineHeight.setDefaultUnit(rec.get('defaultUnit')); + this.numLineHeight.setStep(rec.get('step')); + this._state.LineRule=linerule; + } + + if ( Math.abs(this._state.LineHeight-line)>0.001 || + (this._state.LineHeight===null || line===null)&&(this._state.LineHeight!==line)) { + var val = ''; + if ( linerule == c_paragraphLinerule.LINERULE_AUTO ) { + val = line; + } else if (linerule !== null && line !== null ) { + val = Common.Utils.Metric.fnRecalcFromMM(line); + } + this.numLineHeight.setValue((val !== null) ? val : '', true); + + this._state.LineHeight=line; + } + }, + + ChangeSettings: function(prop) { + if (this._initSettings) + this.createDelayedElements(); + + this.disableControls(this._locked); + + if (prop) { + var Spacing = { + Line: prop.get_Spacing().get_Line(), + Before: prop.get_Spacing().get_Before(), + After: prop.get_Spacing().get_After(), + LineRule: prop.get_Spacing().get_LineRule() + }; + + var other = { + ContextualSpacing: prop.get_ContextualSpacing() + }; + + if ( this._state.LineRule!==Spacing.LineRule ) { + var obj, + rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=Spacing.LineRule, obj)); + if (!rec) rec = this.cmbLineRule.store.at(0); + this.cmbLineRule.setValue((Spacing.LineRule !== null) ? Spacing.LineRule : ''); + this.numLineHeight.setMinValue(rec.get('minValue')); + this.numLineHeight.setDefaultUnit(rec.get('defaultUnit')); + this.numLineHeight.setStep(rec.get('step')); + + this._state.LineRule=Spacing.LineRule; + } + + if ( Math.abs(this._state.LineHeight-Spacing.Line)>0.001 || + (this._state.LineHeight===null || Spacing.Line===null)&&(this._state.LineHeight!==Spacing.Line)) { + var val = ''; + if ( Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO ) { + val = Spacing.Line; + } else if (Spacing.LineRule !== null && Spacing.Line !== null ) { + val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line); + } + this.numLineHeight.setValue((val !== null) ? val : '', true); + + this._state.LineHeight=Spacing.Line; + } + + if ( Math.abs(this._state.LineSpacingBefore-Spacing.Before)>0.001 || + (this._state.LineSpacingBefore===null || Spacing.Before===null)&&(this._state.LineSpacingBefore!==Spacing.Before)) { + + this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before<0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before) ) : '', true); + this._state.LineSpacingBefore=Spacing.Before; + } + + if ( Math.abs(this._state.LineSpacingAfter-Spacing.After)>0.001 || + (this._state.LineSpacingAfter===null || Spacing.After===null)&&(this._state.LineSpacingAfter!==Spacing.After)) { + + this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After<0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After) ) : '', true); + this._state.LineSpacingAfter=Spacing.After; + } + } + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i0){ + 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.Paragraph == elType) { + (new PDFE.Views.ParagraphSettingsAdvanced( + { + paragraphProps: elValue, + api: me.api, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.paraApply(value.paragraphProps); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + break; + } + } + } + } + }, + + onHideMenus: function(menu, e, isFromInputControl){ + if (!isFromInputControl) this.fireEvent('editcomplete', this); + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced.toggleClass('disabled', disable); + } + }, + + strParagraphSpacing: 'Paragraph Spacing', + strLineHeight: 'Line Spacing', + strSpacingBefore: 'Before', + strSpacingAfter: 'After', + textAuto: 'Multiple', + textAtLeast: 'At least', + textExact: 'Exactly', + textAdvanced: 'Show advanced settings', + textAt: 'At', + txtAutoText: 'Auto' + }, PDFE.Views.ParagraphSettings || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js new file mode 100644 index 0000000000..c0b8f3bc4b --- /dev/null +++ b/apps/pdfeditor/main/app/view/ParagraphSettingsAdvanced.js @@ -0,0 +1,854 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ParagraphSettingsAdvanced.js + * + * Created by Julia Radzhabova on 4/15/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!pdfeditor/main/app/template/ParagraphSettingsAdvanced.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/RadioBox', + 'common/main/lib/component/ListView' +], function (contentTemplate) { + 'use strict'; + + PDFE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 370, + contentHeight: 309, + toggleGroup: 'paragraph-adv-settings-group', + storageName: 'pdfe-para-settings-adv-category' + }, + + initialize : function(options) { + var me = this; + _.extend(this.options, { + title: this.textTitle, + items: [ + {panelId: 'id-adv-paragraph-indents', panelCaption: this.strParagraphIndents}, + {panelId: 'id-adv-paragraph-font', panelCaption: this.strParagraphFont}, + {panelId: 'id-adv-paragraph-tabs', panelCaption: this.strTabs} + ], + contentTemplate: _.template(contentTemplate)({ + scope: this + }) + }, options); + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + + this._changedProps = null; + this.checkGroup = 0; // 1-strike, 2-sub/super-script, 3-caps + this._noApply = true; + this._tabListChanged = false; + this.spinners = []; + this.FirstLine = undefined; + this.Spacing = null; + + this.api = this.options.api; + this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps); + + this._arrLineRule = [ + {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, + {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} + ]; + + var curLineRule = this._originalProps.get_Spacing().get_LineRule(), + curItem = _.findWhere(this._arrLineRule, {value: curLineRule}); + this.CurLineRuleIdx = this._arrLineRule.indexOf(curItem); + + this._arrTextAlignment = [ + {displayValue: this.textTabLeft, value: c_paragraphTextAlignment.LEFT}, + {displayValue: this.textTabCenter, value: c_paragraphTextAlignment.CENTERED}, + {displayValue: this.textTabRight, value: c_paragraphTextAlignment.RIGHT}, + {displayValue: this.textJustified, value: c_paragraphTextAlignment.JUSTIFIED} + ]; + + this._arrSpecial = [ + {displayValue: this.textNoneSpecial, value: c_paragraphSpecial.NONE_SPECIAL, defaultValue: 0}, + {displayValue: this.textFirstLine, value: c_paragraphSpecial.FIRST_LINE, defaultValue: 12.7}, + {displayValue: this.textHanging, value: c_paragraphSpecial.HANGING, defaultValue: 12.7} + ]; + + this._arrTabAlign = [ + { value: Asc.c_oAscTabType.Left, displayValue: this.textTabLeft }, + { value: Asc.c_oAscTabType.Center, displayValue: this.textTabCenter }, + { value: Asc.c_oAscTabType.Right, displayValue: this.textTabRight } + ]; + this._arrKeyTabAlign = []; + this._arrTabAlign.forEach(function(item) { + me._arrKeyTabAlign[item.value] = item.displayValue; + }); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + + // Indents & Placement + + this.cmbTextAlignment = new Common.UI.ComboBox({ + el: $('#paragraphadv-spin-text-alignment'), + cls: 'input-group-nr', + editable: false, + data: this._arrTextAlignment, + style: 'width: 173px;', + menuStyle : 'min-width: 173px;', + takeFocusOnClose: true + }); + this.cmbTextAlignment.setValue(''); + + this.numIndentsLeft = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-indent-left'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.numIndentsLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var numval = field.getNumberValue(); + if (this._changedProps) { + if (this._changedProps.get_Ind()===null || this._changedProps.get_Ind()===undefined) + this._changedProps.put_Ind(new Asc.asc_CParagraphInd()); + this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(numval)); + } + }, this)); + this.spinners.push(this.numIndentsLeft); + + this.numIndentsRight = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-indent-right'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.numIndentsRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_Ind()===null || this._changedProps.get_Ind()===undefined) + this._changedProps.put_Ind(new Asc.asc_CParagraphInd()); + this._changedProps.get_Ind().put_Right(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, this)); + this.spinners.push(this.numIndentsRight); + + this.cmbSpecial = new Common.UI.ComboBox({ + el: $('#paragraphadv-spin-special'), + cls: 'input-group-nr', + editable: false, + data: this._arrSpecial, + style: 'width: 85px;', + menuStyle : 'min-width: 85px;', + takeFocusOnClose: true + }); + this.cmbSpecial.setValue(''); + this.cmbSpecial.on('selected', _.bind(this.onSpecialSelect, this)); + + this.numSpecialBy = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-special-by'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spinners.push(this.numSpecialBy); + this.numSpecialBy.on('change', _.bind(this.onFirstLineChange, this)); + + this.numSpacingBefore = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-spacing-before'), + step: .1, + width: 85, + value: '', + defaultUnit : "cm", + maxValue: 55.88, + minValue: 0, + allowAuto : true, + autoText : this.txtAutoText + }); + this.numSpacingBefore.on('change', _.bind(function (field, newValue, oldValue, eOpts) { + if (this.Spacing === null) { + var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); + this.Spacing = properties.get_Spacing(); + } + var value = field.getNumberValue(); + this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); + }, this)); + this.spinners.push(this.numSpacingBefore); + + this.numSpacingAfter = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-spacing-after'), + step: .1, + width: 85, + value: '', + defaultUnit : "cm", + maxValue: 55.88, + minValue: 0, + allowAuto : true, + autoText : this.txtAutoText + }); + this.numSpacingAfter.on('change', _.bind(function (field, newValue, oldValue, eOpts) { + if (this.Spacing === null) { + var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); + this.Spacing = properties.get_Spacing(); + } + var value = field.getNumberValue(); + this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value)); + }, this)); + this.spinners.push(this.numSpacingAfter); + + this.cmbLineRule = new Common.UI.ComboBox({ + el: $('#paragraphadv-spin-line-rule'), + cls: 'input-group-nr', + editable: false, + data: this._arrLineRule, + style: 'width: 85px;', + menuStyle : 'min-width: 85px;', + takeFocusOnClose: true + }); + this.cmbLineRule.setValue(''); + this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); + + this.numLineHeight = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-line-height'), + step: .01, + width: 85, + value: '', + defaultUnit : "", + maxValue: 132, + minValue: 0.5 + }); + this.spinners.push(this.numLineHeight); + this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); + + // Font + + this.chStrike = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-strike'), + labelText: this.strStrike + }); + this.chStrike.on('change', _.bind(this.onStrikeChange, this)); + + this.chDoubleStrike = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-double-strike'), + labelText: this.strDoubleStrike + }); + this.chDoubleStrike.on('change', _.bind(this.onDoubleStrikeChange, this)); + + this.chSuperscript = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-superscript'), + labelText: this.strSuperscript + }); + this.chSuperscript.on('change', _.bind(this.onSuperscriptChange, this)); + + this.chSubscript = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-subscript'), + labelText: this.strSubscript + }); + this.chSubscript.on('change', _.bind(this.onSubscriptChange, this)); + + this.chSmallCaps = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-small-caps'), + labelText: this.strSmallCaps + }); + this.chSmallCaps.on('change', _.bind(this.onSmallCapsChange, this)); + + this.chAllCaps = new Common.UI.CheckBox({ + el: $('#paragraphadv-checkbox-all-caps'), + labelText: this.strAllCaps + }); + this.chAllCaps.on('change', _.bind(this.onAllCapsChange, this)); + + this.numSpacing = new Common.UI.MetricSpinner({ + el: $('#paragraphadv-spin-spacing'), + step: .01, + width: 100, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.numSpacing.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + this._changedProps.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + if (this.api && !this._noApply) { + var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); + properties.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.SetDrawImagePlaceParagraph('paragraphadv-font-img', properties); + } + }, this)); + this.spinners.push(this.numSpacing); + + // Tabs + this.numTab = new Common.UI.MetricSpinner({ + el: $('#paraadv-spin-tab'), + step: .1, + width: 108, + defaultUnit : "cm", + value: '1.25 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spinners.push(this.numTab); + + this.numDefaultTab = new Common.UI.MetricSpinner({ + el: $('#paraadv-spin-default-tab'), + step: .1, + width: 108, + defaultUnit : "cm", + value: '1.25 cm', + maxValue: 55.87, + minValue: 0 + }); + this.numDefaultTab.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + this._changedProps.put_DefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()).toFixed(1))); + } + }, this)); + this.spinners.push(this.numDefaultTab); + + this.tabList = new Common.UI.ListView({ + el: $('#paraadv-list-tabs'), + emptyText: this.noTabs, + store: new Common.UI.DataViewStore(), + template: _.template(['
'].join('')), + itemTemplate: _.template([ + '
', + '
<%= value %>
', + '
<%= displayTabAlign %>
', + '
' + ].join('')), + tabindex: 1 + }); + this.tabList.store.comparator = function(rec) { + return rec.get("tabPos"); + }; + this.tabList.on('item:select', _.bind(this.onSelectTab, this)); + + var storechanged = function() { + if (!me._noApply) + me._tabListChanged = true; + }; + this.listenTo(this.tabList.store, 'add', storechanged); + this.listenTo(this.tabList.store, 'remove', storechanged); + this.listenTo(this.tabList.store, 'reset', storechanged); + + this.cmbAlign = new Common.UI.ComboBox({ + el : $('#paraadv-cmb-align'), + style : 'width: 108px;', + menuStyle : 'min-width: 108px;', + editable : false, + cls : 'input-group-nr', + data : this._arrTabAlign, + takeFocusOnClose: true + }); + this.cmbAlign.setValue(Asc.c_oAscTabType.Left); + + this.btnAddTab = new Common.UI.Button({ + el: $('#paraadv-button-add-tab') + }); + this.btnAddTab.on('click', _.bind(this.addTab, this)); + + this.btnRemoveTab = new Common.UI.Button({ + el: $('#paraadv-button-remove-tab') + }); + this.btnRemoveTab.on('click', _.bind(this.removeTab, this)); + + this.btnRemoveAll = new Common.UI.Button({ + el: $('#paraadv-button-remove-all') + }); + this.btnRemoveAll.on('click', _.bind(this.removeAllTabs, this)); + + this.afterRender(); + }, + + 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.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()); + }, + + onCategoryClick: function(btn, index, cmp, e) { + Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index); + + var me = this; + setTimeout(function(){ + switch (index) { + case 0: + me.cmbTextAlignment.focus(); + break; + case 1: + me.chStrike.focus(); + if (e && (e instanceof jQuery.Event)) + me.api.SetDrawImagePlaceParagraph('paragraphadv-font-img', me._originalProps || new Asc.asc_CParagraphProperty()); + break; + case 2: + me.numDefaultTab.focus(); + break; + } + }, 10); + }, + + onAnimateAfter: function() { + (this.getActiveCategory()==1) && this.api.SetDrawImagePlaceParagraph('paragraphadv-font-img', this._originalProps || new Asc.asc_CParagraphProperty()); + }, + + getSettings: function() { + if ( this._tabListChanged ) { + if (this._changedProps.get_Tabs()===null || this._changedProps.get_Tabs()===undefined) + this._changedProps.put_Tabs(new Asc.asc_CParagraphTabs()); + this.tabList.store.each(function (item, index) { + var tab = new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(item.get('tabPos')), item.get('tabAlign')); + this._changedProps.get_Tabs().add_Tab(tab); + }, this); + } + + var horizontalAlign = this.cmbTextAlignment.getValue(); + this._changedProps.asc_putJc((horizontalAlign !== undefined && horizontalAlign !== null) ? horizontalAlign : c_paragraphTextAlignment.LEFT); + + if (this.Spacing !== null) { + this._changedProps.asc_putSpacing(this.Spacing); + } + + return { paragraphProps: this._changedProps }; + }, + + _setDefaults: function(props) { + if (props ){ + this._originalProps = new Asc.asc_CParagraphProperty(props); + this.FirstLine = (props.get_Ind() !== null) ? props.get_Ind().get_FirstLine() : null; + + this.numIndentsLeft.setValue((props.get_Ind() !== null && props.get_Ind().get_Left() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Left()) : '', true); + this.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true); + + this.cmbTextAlignment.setValue((props.get_Jc() !== undefined && props.get_Jc() !== null) ? props.get_Jc() : c_paragraphTextAlignment.CENTERED, true); + + if(this.CurSpecial === undefined) { + this.CurSpecial = (props.get_Ind().get_FirstLine() === 0) ? c_paragraphSpecial.NONE_SPECIAL : ((props.get_Ind().get_FirstLine() > 0) ? c_paragraphSpecial.FIRST_LINE : c_paragraphSpecial.HANGING); + } + this.cmbSpecial.setValue(this.CurSpecial); + this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true); + + var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null; + this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); + value = props.get_Spacing() ? props.get_Spacing().get_After() : null; + this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true); + + var linerule = props.get_Spacing().get_LineRule(); + this.cmbLineRule.setValue((linerule !== null) ? linerule : ''); + + if(props.get_Spacing() !== null && props.get_Spacing().get_Line() !== null) { + this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.get_Spacing().get_Line() : Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Line()), true); + } else { + this.numLineHeight.setValue('', true); + } + + // Font + this._noApply = true; + this.chStrike.setValue((props.get_Strikeout() !== null && props.get_Strikeout() !== undefined) ? props.get_Strikeout() : 'indeterminate', true); + this.chDoubleStrike.setValue((props.get_DStrikeout() !== null && props.get_DStrikeout() !== undefined) ? props.get_DStrikeout() : 'indeterminate', true); + this.chSubscript.setValue((props.get_Subscript() !== null && props.get_Subscript() !== undefined) ? props.get_Subscript() : 'indeterminate', true); + this.chSuperscript.setValue((props.get_Superscript() !== null && props.get_Superscript() !== undefined) ? props.get_Superscript() : 'indeterminate', true); + this.chSmallCaps.setValue((props.get_SmallCaps() !== null && props.get_SmallCaps() !== undefined) ? props.get_SmallCaps() : 'indeterminate', true); + this.chAllCaps.setValue((props.get_AllCaps() !== null && props.get_AllCaps() !== undefined) ? props.get_AllCaps() : 'indeterminate', true); + + this.numSpacing.setValue((props.get_TextSpacing() !== null && props.get_TextSpacing() !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(props.get_TextSpacing()) : '', true); + + // Tabs + this.numDefaultTab.setValue((props.get_DefaultTab() !== null && props.get_DefaultTab() !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(parseFloat(props.get_DefaultTab().toFixed(1))) : '', true); + + var store = this.tabList.store; + var tabs = props.get_Tabs(); + if (tabs) { + var arr = []; + var count = tabs.get_Count(); + for (var i=0; istore.length-1) idx = store.length-1; + if (store.length>0) { + this.tabList.selectByIndex(idx); + this.tabList.scrollToRecord(store.at(idx)); + } + } + }, + + removeAllTabs: function(btn, eOpts){ + this.tabList.store.reset(); + }, + + onSelectTab: function(lisvView, itemView, record) { + if (!record) return; + var rawData = {}, + isViewSelect = _.isFunction(record.toJSON); + + if (isViewSelect){ + if (record.get('selected')) { + rawData = record.toJSON(); + } else { + // record deselected + return; + } + } else { + rawData = record; + } + this.numTab.setValue(rawData.tabPos); + this.cmbAlign.setValue(rawData.tabAlign); + }, + + onSpecialSelect: function(combo, record) { + this.CurSpecial = record.value; + if (this.CurSpecial === c_paragraphSpecial.NONE_SPECIAL) { + this.numSpecialBy.setValue(0, true); + } + if (this._changedProps) { + if (this._changedProps.get_Ind()===null || this._changedProps.get_Ind()===undefined) + this._changedProps.put_Ind(new Asc.asc_CParagraphInd()); + var value = Common.Utils.Metric.fnRecalcToMM(this.numSpecialBy.getNumberValue()); + if (value === 0) { + this.numSpecialBy.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrSpecial[record.value].defaultValue), true); + value = this._arrSpecial[record.value].defaultValue; + } + if (this.CurSpecial === c_paragraphSpecial.HANGING) { + value = -value; + } + this._changedProps.get_Ind().put_FirstLine(value); + } + }, + + onFirstLineChange: function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_Ind()===null || this._changedProps.get_Ind()===undefined) + this._changedProps.put_Ind(new Asc.asc_CParagraphInd()); + var value = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); + if (this.CurSpecial === c_paragraphSpecial.HANGING) { + value = -value; + } else if (this.CurSpecial === c_paragraphSpecial.NONE_SPECIAL && value > 0 ) { + this.CurSpecial = c_paragraphSpecial.FIRST_LINE; + this.cmbSpecial.setValue(c_paragraphSpecial.FIRST_LINE); + } else if (value === 0) { + this.CurSpecial = c_paragraphSpecial.NONE_SPECIAL; + this.cmbSpecial.setValue(c_paragraphSpecial.NONE_SPECIAL); + } + this._changedProps.get_Ind().put_FirstLine(value); + } + }, + + onLineRuleSelect: function(combo, record) { + if (this.Spacing === null) { + var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); + this.Spacing = properties.get_Spacing(); + } + this.Spacing.put_LineRule(record.value); + var selectItem = _.findWhere(this._arrLineRule, {value: record.value}), + indexSelectItem = this._arrLineRule.indexOf(selectItem); + if ( this.CurLineRuleIdx !== indexSelectItem ) { + this.numLineHeight.setDefaultUnit(this._arrLineRule[indexSelectItem].defaultUnit); + this.numLineHeight.setMinValue(this._arrLineRule[indexSelectItem].minValue); + this.numLineHeight.setStep(this._arrLineRule[indexSelectItem].step); + if (this.Spacing.get_LineRule() === c_paragraphLinerule.LINERULE_AUTO) { + this.numLineHeight.setValue(this._arrLineRule[indexSelectItem].defaultValue); + } else { + this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[indexSelectItem].defaultValue)); + } + this.CurLineRuleIdx = indexSelectItem; + } + }, + + onNumLineHeightChange: function(field, newValue, oldValue, eOpts) { + if ( this.cmbLineRule.getRawValue() === '' ) + return; + if (this.Spacing === null) { + var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); + this.Spacing = properties.get_Spacing(); + } + this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + }, + + textTitle: 'Paragraph - Advanced Settings', + strIndentsLeftText: 'Left', + strIndentsRightText: 'Right', + strParagraphIndents: 'Indents & Spacing', + strParagraphFont: 'Font', + textEffects: 'Effects', + textCharacterSpacing: 'Character Spacing', + strDoubleStrike: 'Double strikethrough', + strStrike: 'Strikethrough', + strSuperscript: 'Superscript', + strSubscript: 'Subscript', + strSmallCaps: 'Small caps', + strAllCaps: 'All caps', + strTabs: 'Tab', + textSet: 'Specify', + textRemove: 'Remove', + textRemoveAll: 'Remove All', + textTabLeft: 'Left', + textTabRight: 'Right', + textTabCenter: 'Center', + textAlign: 'Alignment', + textTabPosition: 'Tab Position', + textDefault: 'Default Tab', + noTabs: 'The specified tabs will appear in this field', + textJustified: 'Justified', + strIndentsSpecial: 'Special', + textNoneSpecial: '(none)', + textFirstLine: 'First line', + textHanging: 'Hanging', + strIndentsSpacingBefore: 'Before', + strIndentsSpacingAfter: 'After', + strIndentsLineSpacing: 'Line Spacing', + txtAutoText: 'Auto', + textAuto: 'Multiple', + textExact: 'Exactly', + strIndent: 'Indents', + strSpacing: 'Spacing' + }, PDFE.Views.ParagraphSettingsAdvanced || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/RightMenu.js b/apps/pdfeditor/main/app/view/RightMenu.js new file mode 100644 index 0000000000..9db45da0cb --- /dev/null +++ b/apps/pdfeditor/main/app/view/RightMenu.js @@ -0,0 +1,329 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * RightMenu.js + * + * Created by Julia Radzhabova on 20/03/24 + * Copyright (c) 2024 Ascensio System SIA. All rights reserved. + * + */ + +var SCALE_MIN = 40; +var MENU_SCALE_PART = 260; + +define([ + 'text!pdfeditor/main/app/template/RightMenu.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/SideMenu', + 'common/main/lib/component/Button', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/CheckBox', + 'pdfeditor/main/app/view/ParagraphSettings', + 'pdfeditor/main/app/view/ImageSettings', + // 'pdfeditor/main/app/view/ChartSettings', + 'pdfeditor/main/app/view/TableSettings', + 'pdfeditor/main/app/view/ShapeSettings', + 'pdfeditor/main/app/view/TextArtSettings', + // 'pdfeditor/main/app/view/SignatureSettings', + 'common/main/lib/component/Scroller' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.RightMenu = Common.UI.SideMenu.extend(_.extend({ + el: '#right-menu', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + initialize: function () { + this.minimizedMode = true; + + this.btnText = new Common.UI.Button({ + hint: this.txtParagraphSettings, + asctype: Common.Utils.documentSettingsType.Paragraph, + enableToggle: true, + disabled: true, + iconCls: 'btn-paragraph', + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + this.btnTable = new Common.UI.Button({ + hint: this.txtTableSettings, + asctype: Common.Utils.documentSettingsType.Table, + enableToggle: true, + disabled: true, + iconCls: 'btn-menu-table', + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + this.btnImage = new Common.UI.Button({ + hint: this.txtImageSettings, + asctype: Common.Utils.documentSettingsType.Image, + enableToggle: true, + disabled: true, + iconCls: 'btn-menu-image', + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + // this.btnChart = new Common.UI.Button({ + // hint: this.txtChartSettings, + // asctype: Common.Utils.documentSettingsType.Chart, + // enableToggle: true, + // disabled: true, + // iconCls: 'btn-menu-chart', + // toggleGroup: 'tabpanelbtnsGroup', + // allowMouseEventsOnDisabled: true + // }); + this.btnShape = new Common.UI.Button({ + hint: this.txtShapeSettings, + asctype: Common.Utils.documentSettingsType.Shape, + enableToggle: true, + disabled: true, + iconCls: 'btn-menu-shape', + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + + this.btnTextArt = new Common.UI.Button({ + hint: this.txtTextArtSettings, + asctype: Common.Utils.documentSettingsType.TextArt, + enableToggle: true, + disabled: true, + iconCls: 'btn-menu-textart', + toggleGroup: 'tabpanelbtnsGroup', + allowMouseEventsOnDisabled: true + }); + + this._settings = []; + this._settings[Common.Utils.documentSettingsType.Paragraph] = {panel: "id-paragraph-settings", btn: this.btnText}; + this._settings[Common.Utils.documentSettingsType.Table] = {panel: "id-table-settings", btn: this.btnTable}; + this._settings[Common.Utils.documentSettingsType.Image] = {panel: "id-image-settings", btn: this.btnImage}; + this._settings[Common.Utils.documentSettingsType.Shape] = {panel: "id-shape-settings", btn: this.btnShape}; + // this._settings[Common.Utils.documentSettingsType.Chart] = {panel: "id-chart-settings", btn: this.btnChart}; + this._settings[Common.Utils.documentSettingsType.TextArt] = {panel: "id-textart-settings", btn: this.btnTextArt}; + + return this; + }, + + render: function (mode) { + var el = $(this.el); + + this.trigger('render:before', this); + + this.defaultHideRightMenu = !(mode.customization && (mode.customization.hideRightMenu===false)); + var open = !Common.localStorage.getBool("pdfe-hide-right-settings", this.defaultHideRightMenu); + Common.Utils.InternalSettings.set("pdfe-hide-right-settings", !open); + el.css('width', SCALE_MIN + 'px'); + // el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); + el.show(); + + el.html(this.template({})); + + this.btnMoreContainer = $('#slot-right-menu-more'); + Common.UI.SideMenu.prototype.render.call(this); + this.btnMore.menu.menuAlign = 'tr-tl'; + + this.btnText.setElement($('#id-right-menu-text'), false); this.btnText.render(); + this.btnTable.setElement($('#id-right-menu-table'), false); this.btnTable.render(); + this.btnImage.setElement($('#id-right-menu-image'), false); this.btnImage.render(); + // this.btnChart.setElement($('#id-right-menu-chart'), false); this.btnChart.render(); + this.btnShape.setElement($('#id-right-menu-shape'), false); this.btnShape.render(); + this.btnTextArt.setElement($('#id-right-menu-textart'), false); this.btnTextArt.render(); + + this.btnText.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnTable.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnImage.on('click', _.bind(this.onBtnMenuClick, this)); + // this.btnChart.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnShape.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnTextArt.on('click', _.bind(this.onBtnMenuClick, this)); + + this.paragraphSettings = new PDFE.Views.ParagraphSettings(); + this.imageSettings = new PDFE.Views.ImageSettings(); + // this.chartSettings = new PDFE.Views.ChartSettings(); + this.tableSettings = new PDFE.Views.TableSettings(); + this.shapeSettings = new PDFE.Views.ShapeSettings(); + this.textartSettings = new PDFE.Views.TextArtSettings(); + + // if (mode && mode.isSignatureSupport) { + // this.btnSignature = new Common.UI.Button({ + // hint: this.txtSignatureSettings, + // asctype: Common.Utils.documentSettingsType.Signature, + // enableToggle: true, + // disabled: true, + // iconCls: 'btn-menu-signature', + // toggleGroup: 'tabpanelbtnsGroup', + // allowMouseEventsOnDisabled: true + // }); + // this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature}; + // + // this.btnSignature.setElement($('#id-right-menu-signature'), false); this.btnSignature.render().setVisible(true); + // this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this)); + // this.signatureSettings = new PDFE.Views.SignatureSettings(); + // } + + if (_.isUndefined(this.scroller)) { + this.scroller = new Common.UI.Scroller({ + el: $(this.el).find('.right-panel'), + suppressScrollX: true, + useKeyboard: false + }); + } + + if (open) { + $('#id-slide-settings').parent().css("display", "inline-block" ); + $('#id-slide-settings').addClass("active"); + } + + this.trigger('render:after', this); + + return this; + }, + + setApi: function(api) { + var me = this; + this.api = api; + var fire = function() { Common.NotificationCenter.trigger('edit:complete', this); }; + var _isEyedropperStart = function (isStart) {this._isEyedropperStart = isStart;}; + var _updateScroller = function () {me.updateScroller();}; + this.paragraphSettings.setApi(api).on('editcomplete', _.bind( fire, this)); + this.imageSettings.setApi(api).on('editcomplete', _.bind( fire, this)); + // this.chartSettings.setApi(api).on('editcomplete', _.bind( fire, this)).on('updatescroller', _updateScroller); + this.tableSettings.setApi(api).on('editcomplete', _.bind( fire, this)).on('eyedropper', _.bind(_isEyedropperStart, this)); + this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this)).on('eyedropper', _.bind(_isEyedropperStart, this)).on('updatescroller', _updateScroller); + this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this)).on('eyedropper', _.bind(_isEyedropperStart, this)).on('updatescroller', _updateScroller); + // if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _.bind( fire, this)); + }, + + setMode: function(mode) { + this.imageSettings && this.imageSettings.setMode(mode); + this.shapeSettings && this.shapeSettings.setMode(mode); + }, + + onBtnMenuClick: function(btn, e) { + var isPlugin = btn && btn.options.type === 'plugin', + target_pane_parent = $(this.el).find('.right-panel'), + target_pane; + if (btn && !isPlugin) { + target_pane = $("#" + this._settings[btn.options.asctype].panel); + } + + if (btn && btn.pressed) { + if ( this.minimizedMode ) { + $(this.el).width(MENU_SCALE_PART); + target_pane_parent.css("display", "inline-block" ); + this.minimizedMode = false; + Common.localStorage.setItem("pdfe-hide-right-settings", 0); + Common.Utils.InternalSettings.set("pdfe-hide-right-settings", false); + } + target_pane_parent.find('> .active').removeClass('active'); + target_pane && target_pane.addClass("active"); + + if (this.scroller) { + this.scroller.scrollTop(0); + } + } else { + target_pane_parent.css("display", "none" ); + $(this.el).width(SCALE_MIN); + this.minimizedMode = true; + Common.localStorage.setItem("pdfe-hide-right-settings", 1); + Common.Utils.InternalSettings.set("pdfe-hide-right-settings", true); + } + + btn && !isPlugin && this.fireEvent('rightmenuclick', [this, btn.options.asctype, this.minimizedMode, e]); + }, + + SetActivePane: function(type, open) { + if (this.minimizedMode && open!==true || this._settings[type]===undefined ) return; + + if (this.minimizedMode) { + this._settings[type].btn.toggle(true, false); + this._settings[type].btn.trigger('click', this._settings[type].btn); + } else { + var target_pane = $("#" + this._settings[type].panel ); + if ( !target_pane.hasClass('active') ) { + target_pane.parent().find('> .active').removeClass('active'); + target_pane.addClass("active"); + if (this.scroller) { + this.scroller.update(); + this.scroller.scrollTop(0); + } + } + if (!this._settings[type].btn.isActive()) + this._settings[type].btn.toggle(true, false); + } + }, + + GetActivePane: function() { + var active = this.$el.find(".settings-panel.active"); + return (this.minimizedMode || active.length === 0) ? null : active[0].id; + }, + + clearSelection: function() { + var target_pane = $(".right-panel"); + target_pane.find('> .active').removeClass('active'); + this._settings.forEach(function(item){ + if (item.btn.isActive()) + item.btn.toggle(false, true); + }); + target_pane.css("display", "none" ); + $(this.el).width(SCALE_MIN); + this.minimizedMode = true; + Common.NotificationCenter.trigger('layout:changed', 'rightmenu'); + }, + + updateScroller: function() { + if (this.scroller) { + this.scroller.update(); + this.scroller.scrollTop(0); + } + }, + + setButtons: function () { + var allButtons = [this.btnShape, this.btnImage, this.btnText, this.btnTable, this.btnTextArt/*, this.btnChart, this.btnSignature*/]; + Common.UI.SideMenu.prototype.setButtons.apply(this, [allButtons]); + }, + + txtParagraphSettings: 'Text Settings', + txtImageSettings: 'Image Settings', + txtTableSettings: 'Table Settings', + txtShapeSettings: 'Shape Settings', + txtTextArtSettings: 'Text Art Settings', + txtChartSettings: 'Chart Settings', + txtSignatureSettings: 'Signature Settings' + }, PDFE.Views.RightMenu || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/ShapeSettings.js b/apps/pdfeditor/main/app/view/ShapeSettings.js new file mode 100644 index 0000000000..e75738db08 --- /dev/null +++ b/apps/pdfeditor/main/app/view/ShapeSettings.js @@ -0,0 +1,2455 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ShapeSettings.js + * + * Created by Julia Radzhabova on 4/14/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'text!pdfeditor/main/app/template/ShapeSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/ComboBorderSize', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/ThemeColorPalette', + 'common/main/lib/component/ColorButton', + 'common/main/lib/component/ComboDataView', + 'common/main/lib/component/Slider', + 'common/main/lib/component/MultiSliderGradient', + 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/view/ShapeShadowDialog', + 'pdfeditor/main/app/view/ShapeSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.ShapeSettings = Backbone.View.extend(_.extend({ + el: '#id-shape-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'ShapeSettings' + }, + + initialize: function () { + this._initSettings = true; + this._originalProps = null; + this._noApply = true; + this._sendUndoPoint = true; + this._sliderChanged = false; + this._texturearray = null; + + this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); + + this._state = { + Transparency: null, + FillType: Asc.c_oAscFill.FILL_TYPE_SOLID, + ShapeColor: 'transparent', + BlipFillType: Asc.c_oAscFillBlipType.STRETCH, + StrokeType: Asc.c_oAscStrokeType.STROKE_COLOR, + StrokeWidth: this._pt2mm(1), + StrokeColor: '000000', + StrokeBorderType: Asc.c_oDashType.solid, + FGColor: '000000', + BGColor: 'ffffff', + GradColor: '000000', + ShadowColor: 'transparent', + ShadowPreset: null, + GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR, + DisabledFillPanels: false, + DisabledControls: false, + HideShapeOnlySettings: false, + HideChangeTypeSettings: false, + HideRotationSettings: false, + isFromImage: false, + isFromSmartArtInternal: false + }; + this.lockedControls = []; + this._locked = false; + + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; + this.ShapeColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + this.BlipFillType = Asc.c_oAscFillBlipType.STRETCH; + this.GradFillType = Asc.c_oAscFillGradType.GRAD_LINEAR; + this.GradColor = { values: [0, 100], colors: ['000000', 'ffffff'], currentIdx: 0}; + this.GradRadialDirectionIdx = 0; + this.GradLinearDirectionType = 0; + this.PatternFillType = 0; + this.FGColor = {Value: 1, Color: '000000'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + this.BGColor = {Value: 1, Color: 'ffffff'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + + this.BorderColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + this.BorderSize = 0; + this.BorderType = Asc.c_oDashType.solid; + + this.ShadowColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + + this.textureNames = [this.txtCanvas, this.txtCarton, this.txtDarkFabric, this.txtGrain, this.txtGranite, this.txtGreyPaper, + this.txtKnit, this.txtLeather, this.txtBrownPaper, this.txtPapyrus, this.txtWood]; + + this.fillControls = []; + this.gradientColorsStr = "#000, #fff"; + this.typeGradient = 90 ; + this.shapeRestoreHeight = 615; + + this.render(); + + this.FillColorContainer = $('#shape-panel-color-fill'); + this.FillImageContainer = $('#shape-panel-image-fill'); + this.FillPatternContainer = $('#shape-panel-pattern-fill'); + this.FillGradientContainer = $('#shape-panel-gradient-fill'); + this.TransparencyContainer = $('#shape-panel-transparent-fill'); + this.EditShapeContainer = $('#shape-button-edit-shape-container'); + this.EditChangeShapeContainer = $('#shape-button-change-shape-container'); + this.ShapeOnlySettings = $('.shape-only'); + this.CanChangeType = $('.change-type'); + this.RotationSettings = $('.shape-rotation'); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + }, + + setApi: function(api) { + this.api = api; + if (this.api) { + this.api.asc_setInterfaceDrawImagePlaceShape('shape-texture-img'); + this.api.asc_registerCallback('asc_onInitStandartTextures', _.bind(this.onInitStandartTextures, this)); + } + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); + return this; + }, + + setMode: function(mode) { + this.mode = mode; + }, + + onFillSrcSelect: function(combo, record) { + this.ShowHideElem(record.value); + switch (record.value){ + case Asc.c_oAscFill.FILL_TYPE_SOLID: + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_SOLID; + if (!this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID); + fill.put_fill( new Asc.asc_CFillSolid()); + fill.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor((this.ShapeColor.Color=='transparent') ? {color: '4f81bd', effectId: 24} : this.ShapeColor.Color)); + props.put_fill(fill); + this.api.ShapeApply(props); + } + break; + case Asc.c_oAscFill.FILL_TYPE_GRAD: + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_GRAD; + if (!this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { + this.GradColor.values = [0, 100]; + this.GradColor.colors = [this.GradColor.colors[0], this.GradColor.colors[this.GradColor.colors.length - 1]]; + this.GradColor.currentIdx = 0; + var HexColor0 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(), + HexColor1 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex(); + + if (HexColor0 === 'ffffff' && HexColor1 === 'ffffff') { + HexColor0 = {color: '4f81bd', effectId: 24}; // color accent1 + } else { + HexColor0 = this.GradColor.colors[0]; + } + + fill.get_fill().put_positions([this.GradColor.values[0]*1000, this.GradColor.values[1]*1000]); + fill.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(HexColor0), Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])]); + } + props.put_fill(fill); + this.api.ShapeApply(props); + } + break; + case Asc.c_oAscFill.FILL_TYPE_BLIP: + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + break; + case Asc.c_oAscFill.FILL_TYPE_PATT: + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_PATT; + if (!this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_PATT); + fill.put_fill( new Asc.asc_CFillHatch()); + fill.get_fill().put_pattern_type(this.PatternFillType); + + var fHexColor = Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(); + var bHexColor = Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex(); + + if (bHexColor === 'ffffff' && fHexColor === 'ffffff') { + fHexColor = {color: '4f81bd', effectId: 24}; // color accent1 + } else { + fHexColor = this.FGColor.Color; + } + + fill.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(fHexColor)); + fill.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)); + + props.put_fill(fill); + this.api.ShapeApply(props); + } + break; + case Asc.c_oAscFill.FILL_TYPE_NOFILL: + this._state.FillType = Asc.c_oAscFill.FILL_TYPE_NOFILL; + if (!this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL); + fill.put_fill(null); + props.put_fill(fill); + this.api.ShapeApply(props); + } + break; + } + this.fireEvent('editcomplete', this); + }, + + onColorsBackSelect: function(btn, color) { + this.ShapeColor = {Value: 1, Color: color}; + + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + + if (this.ShapeColor.Color=='transparent') { + fill.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL); + fill.put_fill(null); + } else { + fill.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID); + fill.put_fill( new Asc.asc_CFillSolid()); + fill.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color)); + } + + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onPatternSelect: function(combo, record){ + if (this.api && !this._noApply) { + this.PatternFillType = record.get('type'); + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_PATT); + fill.put_fill( new Asc.asc_CFillHatch()); + fill.get_fill().put_pattern_type(this.PatternFillType); + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_PATT) { + fill.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)); + fill.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)); + } + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onColorsFGSelect: function(btn, color) { + this.FGColor = {Value: 1, Color: color}; + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_PATT); + fill.put_fill( new Asc.asc_CFillHatch()); + fill.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)); + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_PATT) { + fill.get_fill().put_pattern_type(this.PatternFillType); + fill.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)); + } + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onColorsBGSelect: function(btn, color) { + this.BGColor = {Value: 1, Color: color}; + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_PATT); + fill.put_fill( new Asc.asc_CFillHatch()); + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_PATT) { + fill.get_fill().put_pattern_type(this.PatternFillType); + fill.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)); + } + fill.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)); + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onFillTypeSelect: function(combo, record) { + this.BlipFillType = record.value; + + if (this.api && this._fromTextureCmb !== true && this.OriginalFillType == Asc.c_oAscFill.FILL_TYPE_BLIP) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + + fill.get_fill().put_type(this.BlipFillType); + + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onNumTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrTransparency.setValue(field.getNumberValue(), true); + if (this.api) { + var num = field.getNumberValue(); + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_transparent(num * 2.55); + props.put_fill(fill); + this.api.ShapeApply(props); + } + }, + + onTransparencyChange: function(field, newValue, oldValue){ + this._sliderChanged = newValue; + this.numTransparency.setValue(newValue, true); + + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._transparencyApplyFunc, this), 100); + } + }, + + onTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = newValue; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._transparencyApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyApplyFunc: function() { + if (this._sliderChanged!==undefined) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_transparent(this._sliderChanged * 2.55); + props.put_fill(fill); + this.api.ShapeApply(props); + this._sliderChanged = undefined; + } + }, + + onGradTypeSelect: function(combo, record){ + this.GradFillType = record.value; + + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.mnuDirectionPicker.store.reset(this._viewDataLinear); + this.mnuDirectionPicker.cmpEl.width(175); + this.mnuDirectionPicker.restoreHeight = 174; + var record = this.mnuDirectionPicker.store.findWhere({type: this.GradLinearDirectionType}); + this.mnuDirectionPicker.selectRecord(record, true); + if(record) + this.typeGradient = this.GradLinearDirectionType +90; + else + this.typeGradient= -1; + this.numGradientAngle.setValue(this.GradLinearDirectionType, true); + this.numGradientAngle.setDisabled(this._locked); + } else if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { + this.mnuDirectionPicker.store.reset(this._viewDataRadial); + this.mnuDirectionPicker.cmpEl.width(60); + this.mnuDirectionPicker.restoreHeight = 58; + this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx, true); + if (this.GradRadialDirectionIdx>=0) + this.typeGradient = this._viewDataRadial[this.GradRadialDirectionIdx].type; + else + this.typeGradient= -1; + this.numGradientAngle.setValue(0, true); + this.numGradientAngle.setDisabled(true); + } + + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + props.put_fill(fill); + this.api.ShapeApply(props); + } + + this.fireEvent('editcomplete', this); + }, + + onSelectGradient: function(btn, picker, itemView, record) { + if (this._noApply) return; + + var rawData = {}, + isPickerSelect = _.isFunction(record.toJSON); + + if (isPickerSelect){ + if (record.get('selected')) { + rawData = record.toJSON(); + } else { + // record deselected + return; + } + } else { + rawData = record; + } + + if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.GradLinearDirectionType = rawData.type; + this.typeGradient = rawData.type + 90; + } else { + this.GradRadialDirectionIdx = 0; + this.typeGradient = rawData.type; + } + if (this.api) { + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.numGradientAngle.setValue(rawData.type, true); + + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + fill.get_fill().put_linear_angle(rawData.type * 60000); + fill.get_fill().put_linear_scale(true); + + props.put_fill(fill); + this.api.ShapeApply(props); + } + } + + this.fireEvent('editcomplete', this); + }, + + onColorsGradientSelect: function(btn, color) { + this.GradColor.colors[this.GradColor.currentIdx] = color; + this.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(color) == 'object') ? color.color : color)); + + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + } + props.put_fill(fill); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onGradientChange: function(slider, newValue, oldValue){ + this.GradColor.values = slider.getValues(); + var curValue = this.GradColor.values[this.GradColor.currentIdx]; + this.spnGradPosition.setValue(Common.UI.isRTL() ? this.sldrGradient.maxValue - curValue : curValue, true); + this._sliderChanged = true; + if (this.api && !this._noApply) { + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._gradientApplyFunc, this), 100); + } + } + }, + + onGradientChangeComplete: function(slider, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = true; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._gradientApplyFunc(); + } + + var arrGrCollors=[]; + var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7; + for (var index=0; index < slider.thumbs.length; index++) { + arrGrCollors.push(slider.getColorValue(index)+ ' '+ slider.getValue(index)*scale +'%'); + } + + this.btnDirectionRedraw(slider, arrGrCollors.join(', ')); + this._sendUndoPoint = true; + }, + + btnDirectionRedraw: function(slider, gradientColorsStr) { + this.gradientColorsStr = gradientColorsStr; + _.each(this._viewDataLinear, function(item){ + item.gradientColorsStr = gradientColorsStr; + }); + this._viewDataRadial.gradientColorsStr = this.gradientColorsStr; + this.mnuDirectionPicker.store.each(function(item){ + item.set('gradientColorsStr', gradientColorsStr); + }, this); + + if (this.typeGradient == -1) + this.btnDirection.$icon.css({'background': 'none'}); + else if (this.typeGradient == 2) + this.btnDirection.$icon.css({'background': ('radial-gradient(' + gradientColorsStr + ')')}); + else + this.btnDirection.$icon.css({ + 'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + gradientColorsStr + ')') + }); + }, + + _gradientApplyFunc: function() { + if (this._sliderChanged) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + + props.put_fill(fill); + this.api.ShapeApply(props); + this._sliderChanged = false; + } + }, + + applyBorderSize: function(value) { + value = Common.Utils.String.parseFloat(value); + value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); + + this.BorderSize = value; + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + this._state.StrokeType = this._state.StrokeWidth = -1; + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + if (this.BorderColor.Color == 'transparent' || this.BorderColor.Color.color == 'transparent') + stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29})); + else if (this._state.StrokeType == Asc.c_oAscStrokeType.STROKE_NONE || this._state.StrokeType === null) + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.put_transparent(this._state.LineTransparency); + } + props.put_stroke(stroke); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onComboBlur: function() { + this.fireEvent('editcomplete', this); + }, + + onBorderSizeChanged: function(before, combo, record, e) { + var me = this; + if (before) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { + this._state.StrokeType = this._state.StrokeWidth = -1; + setTimeout( function() { + Common.UI.error({ + msg: me.textBorderSizeErr, + callback: function() { + _.defer(function(btn) { + me.fireEvent('editcomplete', me); + }) + } + }); + }, 10); + } + } else + this.applyBorderSize(record.value); + }, + + onBorderSizeSelect: function(combo, record) { + this.applyBorderSize(record.value); + }, + + onBorderTypeSelect: function(combo, record) { + this.BorderType = record.value; + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_transparent(this._state.LineTransparency); + } + props.put_stroke(stroke); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onColorsBorderSelect: function(btn, color) { + this.BorderColor = {Value: 1, Color: color}; + if (this.api && this.BorderSize>0 && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_transparent(this._state.LineTransparency); + } + props.put_stroke(stroke); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onNumLineTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrLineTransparency.setValue(field.getNumberValue(), true); + this._state.LineTransparency = field.getNumberValue() * 2.55; + if (this.api && this.BorderSize>0 && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var stroke = new Asc.asc_CStroke(); + stroke.put_transparent(this._state.LineTransparency); + props.put_stroke(stroke); + this.api.ShapeApply(props); + } + this.fireEvent('editcomplete', this); + }, + + onLineTransparencyChange: function(field, newValue, oldValue){ + this._sliderChangedLine = newValue; + this.numLineTransparency.setValue(newValue, true); + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updatesliderline = setInterval(_.bind(this._transparencyLineApplyFunc, this), 100); + } + }, + + onLineTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updatesliderline); + this._sliderChangedLine = newValue; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._transparencyLineApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyLineApplyFunc: function() { + if (this._sliderChangedLine!==undefined) { + this._state.LineTransparency = this._sliderChangedLine * 2.55; + var props = new Asc.asc_CShapeProperty(); + var stroke = new Asc.asc_CStroke(); + stroke.put_transparent(this._state.LineTransparency); + props.put_stroke(stroke); + this.api.ShapeApply(props); + this._sliderChangedLine = undefined; + } + this.fireEvent('editcomplete', this); + }, + + setImageUrl: function(url, token) { + if (this.BlipFillType !== null) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(this.BlipFillType); + fill.get_fill().put_url(url, token); + + props.put_fill(fill); + this.api.ShapeApply(props); + } + }, + + insertImageFromStorage: function(data) { + if (data && data._urls && data.c=='fill') { + this.setImageUrl(data._urls[0], data.token); + } + }, + + onImageSelect: function(menu, item) { + if (item.value==1) { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.setImageUrl(checkUrl); + } + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + } else if (item.value==2) { + Common.NotificationCenter.trigger('storage:image-load', 'fill'); + } else { + if (this.api) this.api.ChangeShapeImageFromFile(this.BlipFillType); + this.fireEvent('editcomplete', this); + } + }, + + openAdvancedSettings: function(e) { + if (this.linkAdvanced.hasClass('disabled')) return; + + var me = this; + var win; + if (me.api && !this._locked){ + 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.Shape == elType) { + (new PDFE.Views.ShapeSettingsAdvanced( + { + shapeProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.ShapeApply(value.shapeProps); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + break; + } + } + } + } + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + if (props) + { + this._originalProps = props; + this._noApply = true; + this._state.isFromImage = !!props.get_FromImage(); + this._state.isFromSmartArtInternal = !!props.get_FromSmartArtInternal(); + + var shapetype = props.asc_getType(); + + this.disableControls(this._locked==true, props.get_CanFill() !== true); + this.hideShapeOnlySettings(props.get_FromChart() || !!props.get_FromImage()); + this.hideRotationSettings(props.get_FromChart() || !!props.get_FromImage() || props.get_FromSmartArt()); + + this.canEditPoint = this.api && this.api.asc_canEditGeometry(); + this.toggleBtnEditShape(); + var hidechangetype = props.get_FromChart() || props.get_FromSmartArt() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1'; + this.hideChangeTypeSettings(hidechangetype); + if (!hidechangetype && this.btnChangeShape.menu.items.length) { + this.btnChangeShape.shapePicker.hideTextRect(props.get_FromImage() || this._state.isFromSmartArtInternal); + } + + // background colors + var rec = null; + var fill = props.get_fill(); + var fill_type = fill.get_type(); + var color = null; + var transparency = fill.get_transparent(); + if ( Math.abs(this._state.Transparency-transparency)>0.001 || Math.abs(this.numTransparency.getNumberValue()-transparency)>0.001 || + (this._state.Transparency===null || transparency===null)&&(this._state.Transparency!==transparency || this.numTransparency.getNumberValue()!==transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency===null) ? 100 : transparency/255*100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency=transparency; + } + + if (fill===null || fill_type===null) { // заливка не совпадает у неск. фигур + this.OriginalFillType = null; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_NOFILL) { // заливки нет + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_NOFILL; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_SOLID) { + fill = fill.get_fill(); + color = fill.get_color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.ShapeColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.ShapeColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + + } else + this.ShapeColor = {Value: 0, Color: 'transparent'}; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; + this.FGColor = (this.ShapeColor.Color!=='transparent') ? {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)} : {Value: 1, Color: '000000'}; + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.GradColor.colors[0] = (this.ShapeColor.Color!=='transparent') ? Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color) : '000000'; + this.GradColor.colors[this.GradColor.colors.length-1] = 'ffffff'; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_BLIP) { + fill = fill.get_fill(); + this.BlipFillType = fill.get_type(); // null - не совпадают у нескольких фигур + if (this._state.BlipFillType !== this.BlipFillType) { + if (this.BlipFillType == Asc.c_oAscFillBlipType.STRETCH || this.BlipFillType == Asc.c_oAscFillBlipType.TILE) { + this.cmbFillType.setValue(this.BlipFillType); + } else + this.cmbFillType.setValue(''); + this._state.BlipFillType = this.BlipFillType; + } + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_PATT) { + fill = fill.get_fill(); + this.PatternFillType = fill.get_pattern_type(); // null - не совпадают у нескольких фигур + if (this._state.PatternFillType !== this.PatternFillType) { + this.cmbPattern.suspendEvents(); + var rec = this.cmbPattern.menuPicker.store.findWhere({ + type: this.PatternFillType + }); + this.cmbPattern.menuPicker.selectRecord(rec); + this.cmbPattern.resumeEvents(); + this._state.PatternFillType = this.PatternFillType; + } + + color = fill.get_color_fg(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.FGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.FGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + } else + this.FGColor = {Value: 1, Color: '000000'}; + + color = fill.get_color_bg(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.BGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + } else + this.BGColor = {Value: 1, Color: 'ffffff'}; + + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_PATT; + this.ShapeColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)}; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color); + this.GradColor.colors[this.GradColor.colors.length-1] = 'ffffff'; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_GRAD) { + fill = fill.get_fill(); + var gradfilltype = fill.get_grad_type(); // null - не совпадают у нескольких фигур + if (this._state.GradFillType !== gradfilltype || this.GradFillType !== gradfilltype) { + this.GradFillType = gradfilltype; + rec = undefined; + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR || this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { + this.cmbGradType.setValue(this.GradFillType); + rec = this.cmbGradType.store.findWhere({value: this.GradFillType}); + this.onGradTypeSelect(this.cmbGradType, rec.attributes); + } else { + this.cmbGradType.setValue(''); + this.typeGradient = -1; + } + this._state.GradFillType = this.GradFillType; + } + + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR ) { + var value = Math.floor(fill.get_linear_angle()/60000); + if (Math.abs(this.GradLinearDirectionType-value)>0.001) { + this.GradLinearDirectionType=value; + var record = this.mnuDirectionPicker.store.findWhere({type: value}); + this.mnuDirectionPicker.selectRecord(record, true); + if (record) + this.typeGradient = value + 90; + else + this.typeGradient= -1; + this.numGradientAngle.setValue(value, true); + } + } else + this.numGradientAngle.setValue(0, true); + + var me = this; + var colors = fill.get_colors(), + positions = fill.get_positions(), + length = colors ? colors.length : this.GradColor.colors.length; + this.sldrGradient.setThumbs(length); + if (this.GradColor.colors.length>length) { + this.GradColor.colors.splice(length, this.GradColor.colors.length - length); + this.GradColor.values.splice(length, this.GradColor.colors.length - length); + this.GradColor.currentIdx = 0; + } + colors && colors.forEach(function(color, index) { + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + me.GradColor.colors[index] = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value()}; + Common.Utils.ThemeColor.colorValue2EffectId(me.GradColor.colors[index]); + } else { + me.GradColor.colors[index] = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + } else + me.GradColor.colors[index] = '000000'; + + var position = positions[index]; + if (position!==null) { + position = position/1000; + me.GradColor.values[index] = position; + } + }); + + var arrGrCollors=[]; + var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7; + for (var index=0; index= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + this.sldrGradient.setActiveThumb(me.GradColor.currentIdx); + var curValue = me.GradColor.values[me.GradColor.currentIdx]; + this.spnGradPosition.setValue(Common.UI.isRTL() ? me.sldrGradient.maxValue - curValue : curValue); + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; + this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.ShapeColor = {Value: 1, Color: this.GradColor.colors[0]}; + } + + if ( this._state.FillType!==this.OriginalFillType ) { + this.cmbFillSrc.setValue((this.OriginalFillType===null) ? '' : this.OriginalFillType); + this._state.FillType=this.OriginalFillType; + this.ShowHideElem(this.OriginalFillType); + } + + this.btnTexture && $(this.btnTexture.el).find('.form-control').prop('innerHTML', this.textSelectTexture); + + var type1 = typeof(this.ShapeColor.Color), + type2 = typeof(this._state.ShapeColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue || this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)) || + (type1!='object' && this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0 )) { + + this.btnBackColor.setColor(this.ShapeColor.Color); + if ( typeof(this.ShapeColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.ShapeColor.Color.effectValue ) { + this.colorsBack.select(this.ShapeColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBack.clearSelection(); + } else + this.colorsBack.select(this.ShapeColor.Color,true); + + this._state.ShapeColor = this.ShapeColor.Color; + } + + // border colors + var stroke = props.get_stroke(), + strokeType = stroke.get_type(), + borderType, + update = (this._state.StrokeColor == 'transparent' && this.BorderColor.Color !== 'transparent'); // border color was changed for shape without line and then shape was reselected (or apply other settings) + + if (stroke) { + transparency = stroke.get_transparent(); + if ( Math.abs(this._state.LineTransparency-transparency)>0.001 || Math.abs(this.numLineTransparency.getNumberValue()-transparency)>0.001 || + (this._state.LineTransparency===null || transparency===null)&&(this._state.LineTransparency!==transparency || this.numLineTransparency.getNumberValue()!==transparency)) { + + if (transparency !== undefined) { + this.sldrLineTransparency.setValue((transparency===null) ? 100 : transparency/255*100, true); + this.numLineTransparency.setValue(this.sldrLineTransparency.getValue(), true); + } + this._state.LineTransparency=transparency; + } + if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { + color = stroke.get_color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BorderColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } + else + this.BorderColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + else + this.BorderColor = {Value: 1, Color: 'transparent'}; + } else { + this.BorderColor = {Value: 1, Color: 'transparent'}; + } + borderType = stroke.asc_getPrstDash(); + } else { // no stroke + strokeType = null; + this.BorderColor = {Value: 0, Color: 'transparent'}; + } + + type1 = typeof(this.BorderColor.Color); + type2 = typeof(this._state.StrokeColor); + + if ( update || (type1 !== type2) || (type1=='object' && + (this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue || this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)) || + (type1!='object' && (this._state.StrokeColor.indexOf(this.BorderColor.Color)<0 || typeof(this.btnBorderColor.color)=='object'))) { + + this.btnBorderColor.setColor(this.BorderColor.Color); + if ( typeof(this.BorderColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.BorderColor.Color.effectValue ) { + this.colorsBorder.select(this.BorderColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBorder.clearSelection(); + } else + this.colorsBorder.select(this.BorderColor.Color,true); + + this._state.StrokeColor = this.BorderColor.Color; + } + + if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { + if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { + var w = stroke.get_width(); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.00001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); + if ( Math.abs(this._state.StrokeWidth-w)>0.00001 || check_value || + (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { + this._state.StrokeWidth = w; + + if (w!==null) w = this._mm2pt(w); + var _selectedItem = (w===null) ? w : _.find(this.cmbBorderSize.store.models, function(item) { + if ( witem.attributes.value-0.0001) { + return true; + } + }); + if (_selectedItem) + this.cmbBorderSize.selectRecord(_selectedItem); + else { + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); + } + this.BorderSize = w; + } + } else if (strokeType == Asc.c_oAscStrokeType.STROKE_NONE) { + this._state.StrokeWidth = 0; + this.BorderSize = this.cmbBorderSize.store.at(0).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + } else { + this._state.StrokeWidth = null; + this.BorderSize = -1; + this.cmbBorderSize.setValue(null); + } + this._state.StrokeType = strokeType; + } + + if (this._state.StrokeBorderType !== borderType) { + this.BorderType = this._state.StrokeBorderType = borderType; + this.cmbBorderType.setValue(borderType); + } + + // pattern colors + type1 = typeof(this.FGColor.Color); + type2 = typeof(this._state.FGColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.FGColor.Color.effectValue!==this._state.FGColor.effectValue || this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)) || + (type1!='object' && this._state.FGColor.indexOf(this.FGColor.Color)<0 )) { + + this.btnFGColor.setColor(this.FGColor.Color); + if ( typeof(this.FGColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.FGColor.Color.effectValue ) { + this.colorsFG.select(this.FGColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsFG.clearSelection(); + } else + this.colorsFG.select(this.FGColor.Color,true); + + this._state.FGColor = this.FGColor.Color; + } + + type1 = typeof(this.BGColor.Color); + type2 = typeof(this._state.BGColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.BGColor.Color.effectValue!==this._state.BGColor.effectValue || this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)) || + (type1!='object' && this._state.BGColor.indexOf(this.BGColor.Color)<0 )) { + + this.btnBGColor.setColor(this.BGColor.Color); + if ( typeof(this.BGColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.BGColor.Color.effectValue ) { + this.colorsBG.select(this.BGColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBG.clearSelection(); + } else + this.colorsBG.select(this.BGColor.Color,true); + + this._state.BGColor = this.BGColor.Color; + } + + color = this.GradColor.colors[this.GradColor.currentIdx]; + type1 = typeof(color); + type2 = typeof(this._state.GradColor); + + if ( (type1 !== type2) || (type1=='object' && + (color.effectValue!==this._state.GradColor.effectValue || this._state.GradColor.color.indexOf(color.color)<0)) || + (type1!='object' && this._state.GradColor.indexOf(color)<0 )) { + + this.btnGradColor.setColor(color); + if ( typeof(color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue ) { + this.colorsGrad.select(color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsGrad.clearSelection(); + } else + this.colorsGrad.select(color,true); + + this._state.GradColor = color; + } + + + var shadow = props.asc_getShadow(), + shadowPresetRecord = null; + if(shadow) { + var shadowPreset = shadow.getPreset(); + if(shadowPreset) { + shadowPresetRecord = this.viewShadowShapePresets.store.findWhere({value: shadowPreset}); + } + + color = shadow.getColor(); + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.ShadowColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.ShadowColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + + color = this.ShadowColor.Color; + type1 = typeof(this.ShadowColor); + type2 = typeof(this._state.ShadowColor); + + if ( (type1 !== type2) || (type1=='object' && + (color.effectValue!==this._state.ShadowColor.effectValue || this._state.ShadowColor.color.indexOf(color.color)<0)) || + (type1!='object' && this._state.ShadowColor.indexOf(color)<0 )) { + + if ( typeof(color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue ) { + this.mnuShadowShapeColorPicker.select(color,true); + isselected = true; + break; + } + } + if (!isselected) this.mnuShadowShapeColorPicker.clearSelection(); + } else + this.mnuShadowShapeColorPicker.select(color,true); + + this._state.ShadowColor = color; + } + } + + if(shadowPresetRecord) { + this._state.ShadowPreset = shadowPresetRecord; + this.viewShadowShapePresets.selectRecord(shadowPresetRecord); + } else { + this._state.ShadowPreset = null; + this.viewShadowShapePresets.deselectAll(); + } + + this.btnShadowShape.menu.items[1].setChecked(!shadow, true) + + + this._noApply = false; + } + }, + + createDelayedControls: function() { + var me = this; + + this._arrFillSrc = [ + {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, + {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, + {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, + {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, + {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} + ]; + + this.cmbFillSrc = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-src'), + cls: 'input-group-nr', + style: 'width: 100%;', + menuStyle: 'min-width: 100%;', + editable: false, + data: this._arrFillSrc, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbFillSrc.setValue(this._arrFillSrc[0].value); + this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); + this.fillControls.push(this.cmbFillSrc); + + var itemWidth = 28, + itemHeight = 28; + this.cmbPattern = new Common.UI.ComboDataView({ + itemWidth: itemWidth, + itemHeight: itemHeight, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-pattern', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + itemTemplate: _.template([ + '
', + '', + '
' + ].join('')) + }); + this.cmbPattern.render($('#shape-combo-pattern')); + this.cmbPattern.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); + this.cmbPattern.openButton.menu.on('show:after', function () { + me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.fillControls.push(this.cmbPattern); + + this.btnSelectImage = new Common.UI.Button({ + parentEl: $('#shape-button-replace'), + cls: 'btn-text-menu-default', + caption: this.textSelectImage, + style: "width:100%;", + menu: new Common.UI.Menu({ + style: 'min-width: 194px;', + maxHeight: 200, + items: [ + {caption: this.textFromFile, value: 0}, + {caption: this.textFromUrl, value: 1}, + {caption: this.textFromStorage, value: 2} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.btnSelectImage); + this.btnSelectImage.menu.on('item:click', _.bind(this.onImageSelect, this)); + this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); + + this._arrFillType = [ + {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, + {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} + ]; + + this.cmbFillType = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrFillType, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbFillType.setValue(this._arrFillType[0].value); + this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); + this.fillControls.push(this.cmbFillType); + + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#shape-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.fillControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#shape-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.fillControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#shape-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#shape-lbl-transparency-end'); + + this._arrGradType = [ + {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, + {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} + ]; + + this.cmbGradType = new Common.UI.ComboBox({ + el: $('#shape-combo-grad-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 100%;', + editable: false, + data: this._arrGradType, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbGradType.setValue(this._arrGradType[0].value); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.fillControls.push(this.cmbGradType); + + this._viewDataLinear = [ + { type:45, subtype:-1}, + { type:90, subtype:4}, + { type:135, subtype:5}, + { type:0, subtype:6, cls: 'item-gradient-separator', selected: true}, + { type:180, subtype:1}, + { type:315, subtype:2}, + { type:270, subtype:3}, + { type:225, subtype:7} + ]; + _.each(this._viewDataLinear, function(item){ + item.gradientColorsStr = me.gradientColorsStr; + }); + + this._viewDataRadial = [ + { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr} + ]; + + this.btnDirection = new Common.UI.Button({ + cls : 'btn-large-dataview', + scaling : false, + iconCls : 'item-gradient', + menu : new Common.UI.Menu({ + style: 'min-width: 60px;', + menuAlign: 'tr-br', + items: [ + { template: _.template('
') } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.btnDirection.on('render:after', function(btn) { + me.mnuDirectionPicker = new Common.UI.DataView({ + el: $('#id-shape-menu-direction'), + parentMenu: btn.menu, + restoreHeight: 174, + store: new Common.UI.DataViewStore(me._viewDataLinear), + itemTemplate: _.template('
') + }); + }); + this.btnDirection.render($('#shape-button-direction')); + this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.fillControls.push(this.btnDirection); + + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#shape-slider-gradient'), + width: 192, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + var pos = me.GradColor.values[me.GradColor.currentIdx]; + me.spnGradPosition.setValue(Common.UI.isRTL() ? me.sldrGradient.maxValue - pos : pos, true); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){ + var colors = [], + currentIdx; + _.each (recalc_indexes, function(recalc_index, index) { + colors.push(me.GradColor.colors[recalc_index]); + if (me.GradColor.currentIdx == recalc_index) + currentIdx = index; + }); + me.OriginalFillType = null; + me.GradColor.colors = colors; + me.GradColor.currentIdx = currentIdx; + }); + this.sldrGradient.on('addthumb', function(cmp, index, pos){ + me.GradColor.colors[index] = me.GradColor.colors[me.GradColor.currentIdx]; + me.GradColor.currentIdx = index; + var color = me.sldrGradient.addNewThumb(index, pos); + me.GradColor.colors[me.GradColor.currentIdx] = color; + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= me.GradColor.colors.length) { + var newIndex = index > 0 ? index - 1 : index; + newIndex = (newIndex === 0 && me.GradColor.values.length > 2) ? me.GradColor.values.length - 2 : newIndex; + me.GradColor.currentIdx = newIndex; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); + }); + this.fillControls.push(this.sldrGradient); + + this.spnGradPosition = new Common.UI.MetricSpinner({ + el: $('#shape-gradient-position'), + step: 1, + width: 60, + defaultUnit : "%", + value: '50 %', + allowDecimal: false, + maxValue: 100, + minValue: 0, + disabled: this._locked, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.spnGradPosition); + this.spnGradPosition.on('change', _.bind(this.onPositionChange, this)); + this.spnGradPosition.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnAddGradientStep = new Common.UI.Button({ + parentEl: $('#shape-gradient-add-step'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-add-breakpoint', + disabled: this._locked, + hint: this.tipAddGradientPoint, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnAddGradientStep.on('click', _.bind(this.onAddGradientStep, this)); + this.fillControls.push(this.btnAddGradientStep); + + this.btnRemoveGradientStep = new Common.UI.Button({ + parentEl: $('#shape-gradient-remove-step'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-remove-breakpoint', + disabled: this._locked, + hint: this.tipRemoveGradientPoint, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnRemoveGradientStep.on('click', _.bind(this.onRemoveGradientStep, this)); + this.fillControls.push(this.btnRemoveGradientStep); + + this.numGradientAngle = new Common.UI.MetricSpinner({ + el: $('#shape-spin-gradient-angle'), + step: 10, + width: 60, + defaultUnit : "°", + value: '0 °', + allowDecimal: true, + maxValue: 359.9, + minValue: 0, + disabled: this._locked, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.numGradientAngle); + this.numGradientAngle.on('change', _.bind(this.onGradientAngleChange, this)); + this.numGradientAngle.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ + el: $('#shape-combo-border-size'), + style: "width: 93px;", + txtNoBorders: this.txtNoBorders, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }) + .on('selected', _.bind(this.onBorderSizeSelect, this)) + .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) + .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.lockedControls.push(this.cmbBorderSize); + + this.cmbBorderType = new Common.UI.ComboBorderType({ + el: $('#shape-combo-border-type'), + style: "width: 93px;", + menuStyle: 'min-width: 93px;', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }).on('selected', _.bind(this.onBorderTypeSelect, this)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderType = Asc.c_oDashType.solid; + this.cmbBorderType.setValue(this.BorderType); + this.lockedControls.push(this.cmbBorderType); + + this.numLineTransparency = new Common.UI.MetricSpinner({ + el: $('#shape-line-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numLineTransparency.on('change', _.bind(this.onNumLineTransparencyChange, this)); + this.numLineTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.numLineTransparency); + + this.sldrLineTransparency = new Common.UI.SingleSlider({ + el: $('#shape-line-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrLineTransparency.on('change', _.bind(this.onLineTransparencyChange, this)); + this.sldrLineTransparency.on('changecomplete', _.bind(this.onLineTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrLineTransparency); + + this.lblLineTransparencyStart = $(this.el).find('#shape-line-lbl-transparency-start'); + this.lblLineTransparencyEnd = $(this.el).find('#shape-line-lbl-transparency-end'); + + this.btnRotate270 = new Common.UI.Button({ + parentEl: $('#shape-button-270', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-270', + value: 0, + hint: this.textHint270, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnRotate270.on('click', _.bind(this.onBtnRotateClick, this)); + this.lockedControls.push(this.btnRotate270); + + this.btnRotate90 = new Common.UI.Button({ + parentEl: $('#shape-button-90', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-rotate-90', + value: 1, + hint: this.textHint90, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnRotate90.on('click', _.bind(this.onBtnRotateClick, this)); + this.lockedControls.push(this.btnRotate90); + + this.btnFlipV = new Common.UI.Button({ + parentEl: $('#shape-button-flipv', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-flip-vert', + value: 0, + hint: this.textHintFlipV, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnFlipV.on('click', _.bind(this.onBtnFlipClick, this)); + this.lockedControls.push(this.btnFlipV); + + this.btnFlipH = new Common.UI.Button({ + parentEl: $('#shape-button-fliph', me.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-flip-hor', + value: 1, + hint: this.textHintFlipH, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnFlipH.on('click', _.bind(this.onBtnFlipClick, this)); + this.lockedControls.push(this.btnFlipH); + + this.btnEditShape = new Common.UI.Button({ + parentEl: $('#shape-button-edit-shape'), + cls: 'btn-toolbar align-left', + caption: this.textEditShape, + iconCls: 'toolbar__icon btn-menu-shape', + style: "width:100%;", + menu: new Common.UI.Menu({ + style: 'min-width: 194px;', + // maxHeight: 200, + items: [ + {caption: this.textEditPoints, value: 0, iconCls: 'toolbar__icon btn-edit-points'}, + { + caption: this.strChange, + menu : new Common.UI.Menu({ + menuAlign: 'tl-tl', + cls: 'menu-shapes menu-change-shape', + items: [], + restoreHeightAndTop: true, + additionalAlign: function(menuRoot, left, top) { + menuRoot.css({left: left, top: Math.max($(me.el).parent().offset().top, Common.Utils.innerHeight() - 10 - me.shapeRestoreHeight) - parseInt(menuRoot.css('margin-top'))}); + } + })} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnEditShape); + this.btnChangeShape = this.btnEditShape.menu.items[1]; + this.btnEditShape.menu.items[0].on('click', _.bind(this.onShapeEditPoints, this)); + + this.btnEditChangeShape = new Common.UI.Button({ + parentEl: $('#shape-button-change-shape'), + cls: 'btn-toolbar align-left', + caption: this.textEditShape, + iconCls: 'toolbar__icon btn-menu-shape', + style: "width:100%;", + menu: new Common.UI.Menu({ + menuAlign: 'tr-br', + cls: 'menu-shapes menu-change-shape', + items: [] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnEditChangeShape); + + this.btnShadowShape = new Common.UI.Button({ + parentEl: $('#shape-button-shadow-shape'), + cls: 'btn-toolbar align-left', + caption: this.textShadow, + iconCls: 'toolbar__icon btn-shadow', + style: "width:100%;", + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnShadowShape); + + this.btnShadowShape.setMenu( + new Common.UI.Menu({ + cls: 'shifted-right', + style: 'min-width: 168px', + items: [ + {template: _.template('')}, + { + caption: this.textNoShadow, + checkable: true, + value: 1, + }, + { caption: '--'}, + this.mnuShadowShapeColor = new Common.UI.MenuItem({ + caption: this.strColor, + menu : new Common.UI.Menu({ + cls: 'color-menu shifted-right', + menuAlign: 'tl-tr', + items: [ + { template: _.template('
'), stopPropagation: true }, + { caption: '--'}, + // { + // caption: this.textEyedropper, + // iconCls: 'menu__icon btn-eyedropper', + // value: 1 + // }, + { + caption: this.textMoreColors, + value: 2 + }, + ] + }), + value: 2, + }), + { + caption: this.textAdjustShadow, + value: 3, + }, + ] + }) + ); + this.btnShadowShape.menu.on('item:click', _.bind(this.onSelectShadowMenu, this)); + this.mnuShadowShapeColor.menu.on('item:click', _.bind(this.onSelectShadowColorMenu, this)); + this.btnShadowShape.menu.on('show:before', function() { + if(me._state.ShadowPreset) { + me.viewShadowShapePresets.selectRecord(me._state.ShadowPreset); + } else { + me.viewShadowShapePresets.deselectAll(); + } + }); + this.mnuShadowShapeColor.menu.on('show:before', function() { + if(me._state.ShadowColor) { + me.mnuShadowShapeColorPicker.select(me._state.ShadowColor,true); + } + }); + + this.viewShadowShapePresets = new Common.UI.DataView({ + el: $('#shape-button-shadow-shape-menu'), + parentMenu: this.btnShadowShape.menu, + outerMenu: {menu: this.btnShadowShape.menu, index: 0}, + allowScrollbar: false, + delayRenderTips: true, + store: new Common.UI.DataViewStore([ + {value:"tl", offsetX: 6, offsetY: 6, spread: 0}, + {value:"t", offsetX: 0, offsetY: 6, spread: 0}, + {value:"tr", offsetX: -6, offsetY: 6, spread: 0}, + + {value:"l", offsetX: 6, offsetY: 0, spread: 0}, + {value:"ctr",offsetX: 0, offsetY: 0, spread: 3}, + {value:"r", offsetX: -6, offsetY: 0, spread: 0}, + + {value:"bl", offsetX: 6, offsetY: -6, spread: 0}, + {value:"b", offsetX: 0, offsetY: -6, spread: 0}, + {value:"br", offsetX: -6, offsetY: -6, spread: 0}, + ]), + itemTemplate: _.template( + '
' + + '
' + + '
' + + '
') + }); + this.viewShadowShapePresets.on('item:click', _.bind(this.onSelectShadowPreset, this)); + this.btnShadowShape.menu.setInnerMenu([{menu: this.viewShadowShapePresets, index: 0}]); + + var config = Common.define.simpleColorsConfig; + this.mnuShadowShapeColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#shape-button-shadow-shape-menu-picker'), + outerMenu: {menu: this.mnuShadowShapeColor.menu, index: 0}, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + cls: config.cls + }); + this.mnuShadowShapeColor.menu.setInnerMenu([{menu: this.mnuShadowShapeColorPicker, index: 0}]); + // this.mnuShadowShapeColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()) + this.mnuShadowShapeColorPicker.on('select', _.bind(this.onSelectShadowColor, this)); + + this.linkAdvanced = $('#shape-advanced-link'); + $(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + + createDelayedElements: function() { + this._initSettings = false; + this.createDelayedControls(); + + var global_hatch_menu_map = [ + 0,1,3,2,4, + 53,5,6,7,8, + 9,10,11,12,13, + 14,15,16,17,18, + 19,20,22,23,24, + 25,27,28,29,30, + 31,32,33,34,35, + 36,37,38,39,40, + 41,42,43,44,45, + 46,49,50,51,52 + ]; + + this.patternViewData = []; + for (var i=0; i<13; i++) { + for (var j=0; j<4; j++) { + var num = i*4+j; + this.patternViewData[num] = {offsetx: j*28, offsety: i*28, type: global_hatch_menu_map[num]}; + } + } + this.patternViewData.splice(this.patternViewData.length-2, 2); + + for ( var i=0; i 0) { + this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),true); + this.PatternFillType = this.patternViewData[0].type; + } + + this.onInitStandartTextures(); + this.onApiAutoShapes(this.btnEditShape.menu.items[1]); + this.onApiAutoShapes(this.btnEditChangeShape); + this.UpdateThemeColors(); + }, + + onInitStandartTextures: function(texture) { + var me = this; + if ((!texture || texture.length<1) && (!me._texturearray || me._texturearray.length<1)) { + texture = PDFE.getController('Toolbar')._textureTemp; + } + if (texture && texture.length>0){ + me._texturearray = []; + _.each(texture, function(item){ + me._texturearray.push({ + imageUrl: item.get_image(), + name : me.textureNames[item.get_id()], + type : item.get_id(), +// allowSelected : false, + selected: false + }); + }); + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-texture'), + template: _.template([ + '' + ].join('')) + }); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
') } + ] + }); + this.textureMenu.render($('#shape-combo-fill-texture')); + this.fillControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-shape-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); + } + }, + + onSelectTexture: function(picker, view, record){ + this._fromTextureCmb = true; + this.cmbFillType.setValue(this._arrFillType[1].value); + this._fromTextureCmb = false; + + if (this.api) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(record.get('type')); + props.put_fill(fill); + this.api.ShapeApply(props); + } + $(this.btnTexture.el).find('.form-control').prop('innerHTML', record.get('name')); + this.fireEvent('editcomplete', this); + }, + + onSelectShadowPreset: function(picker, itemView, record) { + if (this.api) { + var shapeProps = new Asc.asc_CShapeProperty(), + shadowProps = new Asc.asc_CShadowProperty(); + + shadowProps.putPreset(record.get('value')); + shapeProps.asc_putShadow(shadowProps); + this.api.ShapeApply(shapeProps); + } + this.fireEvent('editcomplete', this); + }, + + onSelectShadowMenu: function(menu, item) { + //Checkbox on/off shadow + if(item.value == 1) { + if (this.api) { + var shapeProps = new Asc.asc_CShapeProperty(); + + if(item.checked) { + shapeProps.asc_putShadow(null); + } else { + var shadowProps = new Asc.asc_CShadowProperty(); + shadowProps.putPreset('t'); + shapeProps.asc_putShadow(shadowProps); + } + this.api.ShapeApply(shapeProps); + } + this.fireEvent('editcomplete', this); + } + //Adjust shadow + else if(item.value == 3) { + var me = this; + (new Common.Views.ShapeShadowDialog({ + api : this.api, + shadowProps : this._originalProps.asc_getShadow(), + methodApplySettings: function(shapeProps) { + me.api.ShapeApply(shapeProps); + }, + handler: function(result) { + me.fireEvent('editcomplete', this); + }, + })).show(); + } + }, + + onSelectShadowColorMenu: function(menu, item) { + var me = this; + //Eyedroppper + if(item.value == 1) { + this.api.asc_startEyedropper(function(r, g, b) { + if (r === undefined) return; + var color = Common.Utils.ThemeColor.getHexColor(r, g, b); + me.mnuShadowShapeColorPicker.setCustomColor('#' + color); + me.onSelectShadowColor(null, color); + }); + } + //More colors + else if(item.value == 2) { + this.mnuShadowShapeColorPicker.addNewColor(); + } + }, + + onSelectShadowColor: function (picker, color) { + var shapeProps = new Asc.asc_CShapeProperty(), + shadowProps = this._originalProps.asc_getShadow(); + + if(!shadowProps) { + shadowProps = new Asc.asc_CShadowProperty(); + shadowProps.putPreset('t'); + } + + shadowProps.putColor(Common.Utils.ThemeColor.getRgbColor(color)); + shapeProps.asc_putShadow(shadowProps); + this.api.ShapeApply(shapeProps); + this.fireEvent('editcomplete', this); + }, + + onApiAutoShapes: function(btnChangeShape) { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + btnChangeShape.menu.on('show:before', onShowBefore); + }, + + fillAutoShapes: function() { + var me = this, + recents = Common.localStorage.getItem('pdfe-recent-shapes'), + menuitemId = me.canEditPoint ? 'id-edit-shape-menu' : 'id-change-shape-menu'; + + var menuitem = new Common.UI.MenuItem({ + template: _.template('') + }); + me.btnChangeShape.menu.addItem(menuitem); + + me.btnChangeShape.shapePicker = new Common.UI.DataViewShape({ + el: $('#' + menuitemId), + itemTemplate: _.template('
\">
'), + groups: me.application.getCollection('ShapeGroups'), + parentMenu: me.btnChangeShape.menu, + restoreHeight: me.shapeRestoreHeight, + textRecentlyUsed: me.textRecentlyUsed, + recentShapes: recents ? JSON.parse(recents) : null, + hideTextRect: me._state.isFromImage || me._state.isFromSmartArtInternal, + hideLines: true + }); + me.btnChangeShape.shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + PDFE.getController('InsTab').view.cmbInsertShape.updateComboView(record); + me.api.ChangeShapeType(record.get('data').shapeType); + me.fireEvent('editcomplete', me); + } + if (e.type !== 'click') { + var menu = me.canEditPoint ? me.btnEditShape.menu : me.btnEditChangeShape.menu; + menu.hide(); + } + }); + }, + + UpdateThemeColors: function() { + if (this._initSettings) return; + + var config = Common.define.simpleColorsConfig; + if (!this.btnBackColor) { + this.btnBackColor = new Common.UI.ColorButton({ + parentEl: $('#shape-back-color-btn'), + transparent: true, + color: 'transparent', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.btnBackColor); + this.colorsBack = this.btnBackColor.getPicker(); + this.btnBackColor.on('color:select', _.bind(this.onColorsBackSelect, this)); + this.btnBackColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBackColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnFGColor = new Common.UI.ColorButton({ + parentEl: $('#shape-foreground-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.btnFGColor); + this.colorsFG = this.btnFGColor.getPicker(); + this.btnFGColor.on('color:select', _.bind(this.onColorsFGSelect, this)); + this.btnFGColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnFGColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnBGColor = new Common.UI.ColorButton({ + parentEl: $('#shape-background-color-btn'), + color: 'ffffff', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.btnBGColor); + this.colorsBG = this.btnBGColor.getPicker(); + this.btnBGColor.on('color:select', _.bind(this.onColorsBGSelect, this)); + this.btnBGColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBGColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnGradColor = new Common.UI.ColorButton({ + parentEl: $('#shape-gradient-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.fillControls.push(this.btnGradColor); + this.colorsGrad = this.btnGradColor.getPicker(); + this.btnGradColor.on('color:select', _.bind(this.onColorsGradientSelect, this)); + this.btnGradColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnGradColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnBorderColor = new Common.UI.ColorButton({ + parentEl: $('#shape-border-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBorderColor); + this.colorsBorder = this.btnBorderColor.getPicker(); + this.btnBorderColor.on('color:select', _.bind(this.onColorsBorderSelect, this)); + this.btnBorderColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBorderColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + } + + // this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + }, + + onBtnRotateClick: function(btn) { + var properties = new Asc.asc_CShapeProperty(); + properties.asc_putRotAdd((btn.options.value==1 ? 90 : 270) * 3.14159265358979 / 180); + this.api.ShapeApply(properties); + this.fireEvent('editcomplete', this); + }, + + onBtnFlipClick: function(btn) { + var properties = new Asc.asc_CShapeProperty(); + if (btn.options.value==1) + properties.asc_putFlipHInvert(true); + else + properties.asc_putFlipVInvert(true); + this.api.ShapeApply(properties); + this.fireEvent('editcomplete', this); + }, + + toggleBtnEditShape: function() + { + this.EditShapeContainer.toggleClass('settings-hidden', !this.canEditPoint); + this.EditChangeShapeContainer.toggleClass('settings-hidden', this.canEditPoint); + this.btnChangeShape = this.canEditPoint ? this.btnEditShape.menu.items[1] : this.btnEditChangeShape; + }, + + onShapeEditPoints: function (){ + this.api && this.api.asc_editPointsGeometry(); + }, + + _pt2mm: function(value) { + return (value * 25.4 / 72.0); + }, + + _mm2pt: function(value) { + return (value * 72.0 / 25.4); + }, + + disableFillPanels: function(disable) { + if (this._state.DisabledFillPanels!==disable) { + this._state.DisabledFillPanels = disable; + _.each(this.fillControls, function(item) { + item.setDisabled(disable); + }); + this.lblTransparencyStart.toggleClass('disabled', disable); + this.lblTransparencyEnd.toggleClass('disabled', disable); + this.numGradientAngle.setDisabled(disable || this.GradFillType !== Asc.c_oAscFillGradType.GRAD_LINEAR); + } + }, + + ShowHideElem: function(value) { + this.FillColorContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_SOLID); + this.FillImageContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_BLIP); + this.FillPatternContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_PATT); + this.FillGradientContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_GRAD); + this.TransparencyContainer.toggleClass('settings-hidden', (value === Asc.c_oAscFill.FILL_TYPE_NOFILL || value === null)); + this.fireEvent('updatescroller', this); + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable, disableFill) { + if (this._initSettings) return; + + this.disableFillPanels(disable || disableFill); + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced.toggleClass('disabled', disable); + this.lblLineTransparencyStart.toggleClass('disabled', disable); + this.lblLineTransparencyEnd.toggleClass('disabled', disable); + } + this.btnFlipV.setDisabled(disable || this._state.isFromSmartArtInternal); + this.btnFlipH.setDisabled(disable || this._state.isFromSmartArtInternal); + }, + + hideShapeOnlySettings: function(value) { + if (this._state.HideShapeOnlySettings !== value) { + this._state.HideShapeOnlySettings = value; + this.ShapeOnlySettings.toggleClass('hidden', value==true); + } + }, + + hideChangeTypeSettings: function(value) { + if (this._state.HideChangeTypeSettings !== value) { + this._state.HideChangeTypeSettings = value; + this.CanChangeType.toggleClass('hidden', value==true); + } + }, + + hideRotationSettings: function(value) { + if (this._state.HideRotationSettings !== value) { + this._state.HideRotationSettings = value; + this.RotationSettings.toggleClass('hidden', value==true); + } + }, + + onPositionChange: function(btn) { + var pos = btn.getNumberValue(); + if (Common.UI.isRTL()) { + pos = this.sldrGradient.maxValue - pos; + } + var minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; + if (this.api) { + this.GradColor.values[this.GradColor.currentIdx] = pos; + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + props.put_fill(fill); + this.api.ShapeApply(props); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } + } + }, + + onAddGradientStep: function() { + if (this.GradColor.colors.length > 9) return; + var curIndex = this.GradColor.currentIdx; + var pos = (this.GradColor.values[curIndex] + this.GradColor.values[curIndex < this.GradColor.colors.length - 1 ? curIndex + 1 : curIndex - 1]) / 2; + + this.GradColor.colors[this.GradColor.colors.length] = this.GradColor.colors[curIndex]; + this.GradColor.currentIdx = this.GradColor.colors.length - 1; + var color = this.sldrGradient.addNewThumb(undefined, pos, curIndex); + this.GradColor.colors[this.GradColor.currentIdx] = color; + + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + }, + + onRemoveGradientStep: function() { + if (this.GradColor.values.length < 3) return; + var index = this.GradColor.currentIdx; + this.GradColor.values.splice(this.GradColor.currentIdx, 1); + this.sldrGradient.removeThumb(this.GradColor.currentIdx); + if (_.isUndefined(this.GradColor.currentIdx) || this.GradColor.currentIdx >= this.GradColor.colors.length) { + var newIndex = index > 0 ? index - 1 : index; + newIndex = (newIndex === 0 && this.GradColor.values.length > 2) ? this.GradColor.values.length - 2 : newIndex; + this.GradColor.currentIdx = newIndex; + } + this.sldrGradient.setActiveThumb(this.GradColor.currentIdx); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + }, + + onGradientAngleChange: function(field, newValue, oldValue, eOpts) { + if (this.api && !this._noApply) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + fill.get_fill().put_linear_angle(field.getNumberValue() * 60000); + fill.get_fill().put_linear_scale(true); + props.put_fill(fill); + this.api.ShapeApply(props); + } + }, + + onEyedropperStart: function (btn) { + this.api.asc_startEyedropper(_.bind(btn.eyedropperEnd, btn)); + this.fireEvent('eyedropper', true); + }, + + onEyedropperEnd: function () { + this.fireEvent('eyedropper', false); + }, + + txtNoBorders : 'No Line', + strStroke : 'Stroke', + strColor : 'Color', + strSize : 'Size', + strChange : 'Change Autoshape', + strFill : 'Fill', + textColor : 'Color Fill', + textImageTexture : 'Picture or Texture', + textTexture : 'From Texture', + textFromUrl : 'From URL', + textFromFile : 'From File', + textStretch : 'Stretch', + textTile : 'Tile', + txtCanvas : 'Canvas', + txtCarton : 'Carton', + txtDarkFabric : 'Dark Fabric', + txtGrain : 'Grain', + txtGranite : 'Granite', + txtGreyPaper : 'Grey Paper', + txtKnit : 'Knit', + txtLeather : 'Leather', + txtBrownPaper : 'Brown Paper', + txtPapyrus : 'Papyrus', + txtWood : 'Wood', + textAdvanced : 'Show advanced settings', + strTransparency : 'Opacity', + textNoFill : 'No Fill', + textSelectTexture : 'Select', + textGradientFill: 'Gradient Fill', + textPatternFill: 'Pattern', + strBackground: 'Background color', + strForeground: 'Foreground color', + strPattern: 'Pattern', + textEmptyPattern: 'No Pattern', + textLinear: 'Linear', + textRadial: 'Radial', + textDirection: 'Direction', + textStyle: 'Style', + textGradient: 'Gradient Points', + textBorderSizeErr: 'The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.', + strType: 'Type', + textRotation: 'Rotation', + textRotate90: 'Rotate 90°', + textFlip: 'Flip', + textHint270: 'Rotate 90° Counterclockwise', + textHint90: 'Rotate 90° Clockwise', + textHintFlipV: 'Flip Vertically', + textHintFlipH: 'Flip Horizontally', + strShadow: 'Show shadow', + textFromStorage: 'From Storage', + textSelectImage: 'Select Picture', + textPosition: 'Position', + tipAddGradientPoint: 'Add gradient point', + tipRemoveGradientPoint: 'Remove gradient point', + textAngle: 'Angle', + textRecentlyUsed: 'Recently Used', + textEditShape: 'Edit shape', + textShadow: 'Shadow', + textNoShadow: 'No Shadow', + textAdjustShadow: 'Adjust Shadow', + textMoreColors: 'More colors', + textEyedropper: 'Eyedropper', + textEditPoints: 'Edit points' + }, PDFE.Views.ShapeSettings || {})); +}); diff --git a/apps/pdfeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/pdfeditor/main/app/view/ShapeSettingsAdvanced.js new file mode 100644 index 0000000000..b4c451543f --- /dev/null +++ b/apps/pdfeditor/main/app/view/ShapeSettingsAdvanced.js @@ -0,0 +1,954 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ShapeSettingsAdvanced.js + * + * Created by Julia Radzhabova on 4/15/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!pdfeditor/main/app/template/ShapeSettingsAdvanced.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/MetricSpinner', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/ComboBoxDataView' +], function (contentTemplate) { + 'use strict'; + + PDFE.Views.ShapeSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 300, + contentHeight: 257, + toggleGroup: 'shape-adv-settings-group', + sizeOriginal: {width: 0, height: 0}, + sizeMax: {width: 55.88, height: 55.88}, + properties: null, + storageName: 'pdfe-shape-settings-adv-category' + }, + + initialize : function(options) { + _.extend(this.options, { + title: this.textTitle, + items: [ + {panelId: 'id-adv-shape-general', panelCaption: this.textGeneral}, + {panelId: 'id-adv-shape-width', panelCaption: this.textPlacement}, + {panelId: 'id-adv-shape-rotate', panelCaption: this.textRotation}, + {panelId: 'id-adv-shape-shape', panelCaption: this.textWeightArrows}, + {panelId: 'id-adv-shape-margins', panelCaption: this.textTextBox}, + {panelId: 'id-adv-shape-columns', panelCaption: this.strColumns}, + {panelId: 'id-adv-shape-alttext', panelCaption: this.textAlt} + ], + contentTemplate: _.template(contentTemplate)({ + scope: this + }) + }, options); + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + + this.spinners = []; + + this.Margins = undefined; + this._nRatio = 1; + + this._originalProps = this.options.shapeProps; + this.slideSize = this.options.slideSize; + this._changedProps = null; + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + + // General + this.inputShapeName = new Common.UI.InputField({ + el : $('#shape-general-object-name'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isShapeNameChanged = true; + }); + + // Placement + this.spnWidth = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-width'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this.btnRatio.pressed) { + var w = field.getNumberValue(); + var h = w/this._nRatio; + if (h>this.sizeMax.height) { + h = this.sizeMax.height; + w = h * this._nRatio; + this.spnWidth.setValue(w, true); + } + this.spnHeight.setValue(h, true); + } + if (this._changedProps) { + this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnWidth); + + this.spnHeight = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-height'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = null; + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.sizeMax.width) { + w = this.sizeMax.width; + h = w/this._nRatio; + this.spnHeight.setValue(h, true); + } + this.spnWidth.setValue(w, true); + } + if (this._changedProps) { + this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnHeight); + + this.btnRatio = new Common.UI.Button({ + parentEl: $('#shape-advanced-button-ratio'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-advanced-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.spnHeight.getNumberValue()>0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + if (this._changedProps) { + this._changedProps.asc_putLockAspect(btn.pressed); + } + }, this)); + + this.spnX = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-x'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnX); + + this.spnY = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-y'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnY); + + this.cmbFromX = new Common.UI.ComboBox({ + el: $('#shape-advanced-combo-from-x'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + this.cmbFromY = new Common.UI.ComboBox({ + el: $('#shape-advanced-combo-from-y'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + // Margins + this.spnMarginTop = new Common.UI.MetricSpinner({ + el: $('#shape-margin-top'), + step: .1, + width: 100, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginTop.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_paddings()===null || this._changedProps.get_paddings()===undefined) + this._changedProps.put_paddings(new Asc.asc_CPaddings()); + this._changedProps.get_paddings().put_Top(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnMarginTop); + + this.spnMarginBottom = new Common.UI.MetricSpinner({ + el: $('#shape-margin-bottom'), + step: .1, + width: 100, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginBottom.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_paddings()===null || this._changedProps.get_paddings()===undefined) + this._changedProps.put_paddings(new Asc.asc_CPaddings()); + this._changedProps.get_paddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnMarginBottom); + + this.spnMarginLeft = new Common.UI.MetricSpinner({ + el: $('#shape-margin-left'), + step: .1, + width: 100, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_paddings()===null || this._changedProps.get_paddings()===undefined) + this._changedProps.put_paddings(new Asc.asc_CPaddings()); + this._changedProps.get_paddings().put_Left(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnMarginLeft); + + this.spnMarginRight = new Common.UI.MetricSpinner({ + el: $('#shape-margin-right'), + step: .1, + width: 100, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_paddings()===null || this._changedProps.get_paddings()===undefined) + this._changedProps.put_paddings(new Asc.asc_CPaddings()); + this._changedProps.get_paddings().put_Right(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + } + }, this)); + this.spinners.push(this.spnMarginRight); + + this.radioNofit = new Common.UI.RadioBox({ + el: $('#shape-radio-nofit'), + name: 'asc-radio-fit', + labelText: this.textNofit, + value: AscFormat.text_fit_No + }); + this.radioNofit.on('change', _.bind(this.onRadioFitChange, this)); + + this.radioShrink = new Common.UI.RadioBox({ + el: $('#shape-radio-shrink'), + name: 'asc-radio-fit', + labelText: this.textShrink, + value: AscFormat.text_fit_NormAuto + }); + this.radioShrink.on('change', _.bind(this.onRadioFitChange, this)); + + this.radioFit = new Common.UI.RadioBox({ + el: $('#shape-radio-fit'), + name: 'asc-radio-fit', + labelText: this.textResizeFit, + value: AscFormat.text_fit_Auto + }); + this.radioFit.on('change', _.bind(this.onRadioFitChange, this)); + + // Rotation + this.spnAngle = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-angle'), + step: 1, + width: 80, + defaultUnit : "°", + value: '0 °', + maxValue: 3600, + minValue: -3600 + }); + + this.chFlipHor = new Common.UI.CheckBox({ + el: $('#shape-advanced-checkbox-hor'), + labelText: this.textHorizontally + }); + + this.chFlipVert = new Common.UI.CheckBox({ + el: $('#shape-advanced-checkbox-vert'), + labelText: this.textVertically + }); + + // Shape + this._arrCapType = [ + {displayValue: this.textFlat, value: Asc.c_oAscLineCapType.Flat}, + {displayValue: this.textRound, value: Asc.c_oAscLineCapType.Round}, + {displayValue: this.textSquare, value: Asc.c_oAscLineCapType.Square} + ]; + + this.cmbCapType = new Common.UI.ComboBox({ + el: $('#shape-advanced-cap-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: this._arrCapType, + takeFocusOnClose: true + }); + this.cmbCapType.setValue(Asc.c_oAscLineCapType.Flat); + this.cmbCapType.on('selected', _.bind(function(combo, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_linecap(record.value); + } + }, this)); + + this._arrJoinType = [ + {displayValue: this.textRound, value: Asc.c_oAscLineJoinType.Round}, + {displayValue: this.textBevel, value: Asc.c_oAscLineJoinType.Bevel}, + {displayValue: this.textMiter, value: Asc.c_oAscLineJoinType.Miter} + ]; + this.cmbJoinType = new Common.UI.ComboBox({ + el: $('#shape-advanced-join-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 100px;', + editable: false, + data: this._arrJoinType, + takeFocusOnClose: true + }); + this.cmbJoinType.setValue(Asc.c_oAscLineJoinType.Round); + this.cmbJoinType.on('selected', _.bind(function(combo, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_linejoin(record.value); + } + }, this)); + + + var _arrStyles = [], _arrSize = []; + _arrStyles.push({type: Asc.c_oAscLineBeginType.None, idsvg: 'no-'}); + _arrStyles.push({type: Asc.c_oAscLineBeginType.Triangle, idsvg: ''}); + _arrStyles.push({type: Asc.c_oAscLineBeginType.Arrow, idsvg: 'open-'}); + _arrStyles.push({type: Asc.c_oAscLineBeginType.Stealth, idsvg: 'stealth-'}); + _arrStyles.push({type: Asc.c_oAscLineBeginType.Diamond, idsvg: 'dimond-'}); + _arrStyles.push({type: Asc.c_oAscLineBeginType.Oval, idsvg: 'oval-'}); + + for ( var i=0; i<6; i++ ) + _arrStyles[i].value = i; + + for ( i=0; i<9; i++ ) + _arrSize.push({value: i, typearrow:''}); + + _arrSize[0].type = Asc.c_oAscLineBeginSize.small_small; + _arrSize[1].type = Asc.c_oAscLineBeginSize.small_mid; + _arrSize[2].type = Asc.c_oAscLineBeginSize.small_large; + _arrSize[3].type = Asc.c_oAscLineBeginSize.mid_small; + _arrSize[4].type = Asc.c_oAscLineBeginSize.mid_mid; + _arrSize[5].type = Asc.c_oAscLineBeginSize.mid_large; + _arrSize[6].type = Asc.c_oAscLineBeginSize.large_small; + _arrSize[7].type = Asc.c_oAscLineBeginSize.large_mid; + _arrSize[8].type = Asc.c_oAscLineBeginSize.large_large; + + this.btnBeginStyle = new Common.UI.ComboBoxDataView({ + el: $('#shape-advanced-begin-style'), + additionalAlign: this.menuAddAlign, + cls: 'combo-arrow-style move-focus', + menuStyle: 'min-width: 105px;', + dataViewStyle: 'width: 105px; margin: 0 5px;', + store: new Common.UI.DataViewStore(_arrStyles), + formTemplate: _.template([ + '
', + '', + '
' + ].join('')), + itemTemplate: _.template('
' + + '
'), + takeFocusOnClose: true, + updateFormControl: this.updateFormControl + }); + this.btnBeginStyle.on('item:click', _.bind(this.onSelectBeginStyle, this)); + this.mnuBeginStylePicker = this.btnBeginStyle.getPicker(); + this.btnBeginStyle.updateFormControl(); + + this.btnBeginSize = new Common.UI.ComboBoxDataView({ + el: $('#shape-advanced-begin-size'), + additionalAlign: this.menuAddAlign, + cls: 'combo-arrow-style move-focus', + menuStyle: 'min-width: 105px;', + dataViewStyle: 'width: 160px; margin: 0 5px;', + store: new Common.UI.DataViewStore(_arrSize), + formTemplate: _.template([ + '
', + '', + '
' + ].join('')), + itemTemplate: _.template('
' + + '
'), + takeFocusOnClose: true, + updateFormControl: this.updateFormControl + }); + this.btnBeginSize.on('item:click', _.bind(this.onSelectBeginSize, this)); + this.mnuBeginSizePicker = this.btnBeginSize.getPicker(); + this.btnBeginSize.updateFormControl(); + + for ( i=0; i<_arrStyles.length; i++ ) + _arrStyles[i].offsety += 200; + + for ( i=0; i<_arrSize.length; i++ ) + _arrSize[i].offsety += 200; + + this.btnEndStyle = new Common.UI.ComboBoxDataView({ + el: $('#shape-advanced-end-style'), + additionalAlign: this.menuAddAlign, + cls: 'combo-arrow-style move-focus', + menuStyle: 'min-width: 105px;', + dataViewStyle: 'width: 105px; margin: 0 5px;', + store: new Common.UI.DataViewStore(_arrStyles), + formTemplate: _.template([ + '
', + '', + '
' + ].join('')), + itemTemplate: _.template('
' + + '
'), + takeFocusOnClose: true, + updateFormControl: this.updateFormControl + }); + this.btnEndStyle.on('item:click', _.bind(this.onSelectEndStyle, this)); + this.mnuEndStylePicker = this.btnEndStyle.getPicker(); + this.btnEndStyle.updateFormControl(); + + this.btnEndSize = new Common.UI.ComboBoxDataView({ + el: $('#shape-advanced-end-size'), + additionalAlign: this.menuAddAlign, + cls: 'combo-arrow-style move-focus', + menuStyle: 'min-width: 105px;', + dataViewStyle: 'width: 160px; margin: 0 5px;', + store: new Common.UI.DataViewStore(_arrSize), + formTemplate: _.template([ + '
', + '', + '
' + ].join('')), + itemTemplate: _.template('
' + + '
'), + takeFocusOnClose: true, + updateFormControl: this.updateFormControl + }); + this.btnEndSize.on('item:click', _.bind(this.onSelectEndSize, this)); + this.mnuEndSizePicker = this.btnEndSize.getPicker(); + this.btnEndSize.updateFormControl(); + + // Columns + + this.spnColumns = new Common.UI.MetricSpinner({ + el: $('#shape-columns-number'), + step: 1, + allowDecimal: false, + width: 100, + defaultUnit : "", + value: '1', + maxValue: 16, + minValue: 1 + }); + this.spnColumns.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) + this._changedProps.asc_putColumnNumber(field.getNumberValue()); + }, this)); + + this.spnSpacing = new Common.UI.MetricSpinner({ + el: $('#shape-columns-spacing'), + step: .1, + width: 100, + defaultUnit : "cm", + value: '0 cm', + maxValue: 40.64, + minValue: 0 + }); + this.spnSpacing.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) + this._changedProps.asc_putColumnSpace(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + }, this)); + this.spinners.push(this.spnSpacing); + + // Alt Text + + this.inputAltTitle = new Common.UI.InputField({ + el : $('#shape-advanced-alt-title'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isAltTitleChanged = true; + }); + + this.textareaAltDescription = this.$window.find('textarea'); + this.textareaAltDescription.keydown(function (event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + event.stopPropagation(); + } + me.isAltDescChanged = true; + }); + + this.afterRender(); + }, + + getFocusedComponents: function() { + return this.btnsCategory.concat([ + this.inputShapeName,// 0 tab + this.spnWidth, this.btnRatio, this.spnHeight, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY, // 1 tab + this.spnAngle, this.chFlipHor, this.chFlipVert, // 2 tab + this.cmbCapType, this.cmbJoinType, this.btnBeginStyle, this.btnEndStyle, this.btnBeginSize, this.btnEndSize, // 3 tab + this.radioNofit, this.radioShrink, this.radioFit, this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight, // 4 tab + this.spnColumns, this.spnSpacing, // 5 tab + this.inputAltTitle, this.textareaAltDescription // 6 tab + ]).concat(this.getFooterButtons()); + }, + + onCategoryClick: function(btn, index) { + Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index); + + var me = this; + setTimeout(function(){ + switch (index) { + case 0: + me.inputShapeName.focus(); + break; + case 1: + me.spnWidth.focus(); + break; + case 2: + me.spnAngle.focus(); + break; + case 3: + me.cmbCapType.focus(); + break; + case 4: + me.spnMarginTop.focus(); + break; + case 5: + me.spnColumns.focus(); + break; + case 6: + me.inputAltTitle.focus(); + break; + } + }, 10); + }, + + afterRender: function() { + this.updateMetricUnit(); + this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } + }, + + _setDefaults: function(props) { + if (props ){ + if (props.get_FromSmartArt()) { + this.btnsCategory[2].setDisabled(true); + } + if (props.get_FromSmartArtInternal()) { + this.radioNofit.setDisabled(true); + this.radioShrink.setDisabled(true); + this.radioFit.setDisabled(true); + this.chFlipHor.setDisabled(true); + this.chFlipVert.setDisabled(true); + this.btnsCategory[1].setDisabled(true); + } + + var value = props.asc_getName(); + this.inputShapeName.setValue(value ? value : ''); + + this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getWidth()).toFixed(2), true); + this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getHeight()).toFixed(2), true); + + if (props.asc_getHeight()>0) + this._nRatio = props.asc_getWidth()/props.asc_getHeight(); + + value = props.asc_getLockAspect(); + this.btnRatio.toggle(value || props.get_FromSmartArt()); + this.btnRatio.setDisabled(!!props.get_FromSmartArt()); // can resize smart art only proportionately + + this.cmbFromX.setValue('left'); + this.cmbFromY.setValue('left'); + + if (props.asc_getPosition()) { + var Position = {X: props.asc_getPosition().get_X(), Y: props.asc_getPosition().get_Y()}; + this.spnX.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true); + this.spnY.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true); + } else { + this.spnX.setValue('', true); + this.spnY.setValue('', true); + } + + this._setShapeDefaults(props); + + var margins = props.get_paddings(); + if (margins) { + var val = margins.get_Left(); + this.spnMarginLeft.setValue((null !== val && undefined !== val) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true); + val = margins.get_Top(); + this.spnMarginTop.setValue((null !== val && undefined !== val) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true); + val = margins.get_Right(); + this.spnMarginRight.setValue((null !== val && undefined !== val) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true); + val = margins.get_Bottom(); + this.spnMarginBottom.setValue((null !== val && undefined !== val) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true); + } + value = props.asc_getTextFitType(); + switch (value) { + case AscFormat.text_fit_No: + this.radioNofit.setValue(true, true); + break; + case AscFormat.text_fit_Auto: + this.radioFit.setValue(true, true); + break; + case AscFormat.text_fit_NormAuto: + this.radioShrink.setValue(true, true); + break; + } + this.btnsCategory[4].setDisabled(null === margins); // Margins + + var shapetype = props.asc_getType(); + this.btnsCategory[5].setDisabled(props.get_FromSmartArtInternal() + || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1'); + + value = props.asc_getColumnNumber(); + this.spnColumns.setValue((null !== value && undefined !== value) ? value : '', true); + + value = props.asc_getColumnSpace(); + this.spnSpacing.setValue((null !== value && undefined !== value) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + + value = props.asc_getTitle(); + this.inputAltTitle.setValue(value ? value : ''); + + value = props.asc_getDescription(); + this.textareaAltDescription.val(value ? value : ''); + + value = props.asc_getRot(); + this.spnAngle.setValue((value==undefined || value===null) ? '' : Math.floor(value*180/3.14159265358979+0.5), true); + value = props.asc_getFlipH(); + this.chFlipHor.setValue((value==undefined || value===null) ? 'indeterminate' : value); + value = props.asc_getFlipV(); + this.chFlipVert.setValue((value==undefined || value===null) ? 'indeterminate' : value); + + this._changedProps = new Asc.asc_CShapeProperty(); + } + }, + + getSettings: function() { + if (this.isShapeNameChanged) + this._changedProps.asc_putName(this.inputShapeName.getValue()); + + var Position = new Asc.CPosition(); + if (this.spnX.getValue() !== '') { + var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()); + if (this.cmbFromX.getValue() === 'center') { + x = (this.slideSize.width/36000)/2 + x; + } + Position.put_X(x); + } + if (this.spnY.getValue() !== '') { + var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue()); + if (this.cmbFromY.getValue() === 'center') { + y = (this.slideSize.height/36000)/2 + y; + } + Position.put_Y(y); + } + this._changedProps.asc_putPosition(Position); + + if (this.isAltTitleChanged) + this._changedProps.asc_putTitle(this.inputAltTitle.getValue()); + + if (this.isAltDescChanged) + this._changedProps.asc_putDescription(this.textareaAltDescription.val()); + + this._changedProps.asc_putRot(this.spnAngle.getNumberValue() * 3.14159265358979 / 180); + if (this.chFlipHor.getValue()!=='indeterminate') + this._changedProps.asc_putFlipH(this.chFlipHor.getValue()==='checked'); + if (this.chFlipVert.getValue()!=='indeterminate') + this._changedProps.asc_putFlipV(this.chFlipVert.getValue()==='checked'); + + Common.localStorage.setItem("pdfe-settings-shaperatio", (this.btnRatio.pressed) ? 1 : 0); + return { shapeProps: this._changedProps} ; + }, + + _setShapeDefaults: function(props) { + if (props ){ + var stroke = props.get_stroke(); + if (stroke) { + this.btnsCategory[3].setDisabled(stroke.get_type() == Asc.c_oAscStrokeType.STROKE_NONE); // Weights & Arrows + + var value = stroke.get_linejoin(); + for (var i=0; i0) { + picker.store.each( function(rec){ + rec.set({typearrow: record.get('idsvg')}); + }, this); + combo.setDisabled(false); + combo.selectRecord(sizeidx !== null ? picker.store.at(sizeidx) : null); + } else { + combo.updateFormControl(); + combo.setDisabled(true); + } + }, + + updateFormControl: function(record) { + var formcontrol = $(this.el).find('.form-control > .img-arrows use'); + if(formcontrol.length) { + var str = ''; + if(record){ + var styleId = record.get('idsvg'); + str = (styleId !== undefined) ? styleId + 'arrow-5' : record.get('typearrow') + 'arrow-' + (record.get('value')+1); + } + formcontrol[0].setAttribute('xlink:href', '#' + str); + } + }, + + onSelectBeginStyle: function(combo, picker, view, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_linebeginstyle(record.get('type')); + } + if (this._beginSizeIdx===null || this._beginSizeIdx===undefined) + this._beginSizeIdx = 4; + this._updateSizeArr(this.btnBeginSize, this.mnuBeginSizePicker, record, this._beginSizeIdx); + }, + + onSelectBeginSize: function(combo, picker, view, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_linebeginsize(record.get('type')); + } + this._beginSizeIdx = record.get('value'); + }, + + onSelectEndStyle: function(combo, picker, view, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_lineendstyle(record.get('type')); + } + if (this._endSizeIdx===null || this._endSizeIdx===undefined) + this._endSizeIdx = 4; + this._updateSizeArr(this.btnEndSize, this.mnuEndSizePicker, record, this._endSizeIdx); + }, + + onSelectEndSize: function(combo, picker, view, record){ + if (this._changedProps) { + if (this._changedProps.get_stroke()===null) + this._changedProps.put_stroke(new Asc.asc_CStroke()); + + this._changedProps.get_stroke().put_lineendsize(record.get('type')); + } + this._endSizeIdx = record.get('value'); + }, + + onRadioFitChange: function(field, newValue, eOpts) { + if (newValue && this._changedProps) { + this._changedProps.asc_putTextFitType(field.options.value); + } + }, + + textRound: 'Round', + textMiter: 'Miter', + textSquare: 'Square', + textFlat: 'Flat', + textBevel: 'Bevel', + textTitle: 'Shape - Advanced Settings', + txtNone: 'None', + textWeightArrows: 'Weights & Arrows', + textArrows: 'Arrows', + textLineStyle: 'Line Style', + textCapType: 'Cap Type', + textJoinType: 'Join Type', + textBeginStyle: 'Begin Style', + textBeginSize: 'Begin Size', + textEndStyle: 'End Style', + textEndSize: 'End Size', + textSize: 'Size', + textWidth: 'Width', + textHeight: 'Height', + textKeepRatio: 'Constant Proportions', + textTop: 'Top', + textLeft: 'Left', + textBottom: 'Bottom', + textRight: 'Right', + strMargins: 'Text Padding', + textAlt: 'Alternative Text', + textAltTitle: 'Title', + textAltDescription: 'Description', + textAltTip: 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.', + strColumns: 'Columns', + textSpacing: 'Spacing between columns', + textColNumber: 'Number of columns', + textRotation: 'Rotation', + textAngle: 'Angle', + textFlipped: 'Flipped', + textHorizontally: 'Horizontally', + textVertically: 'Vertically', + textTextBox: 'Text Box', + textAutofit: 'AutoFit', + textNofit: 'Do not Autofit', + textShrink: 'Shrink text on overflow', + textResizeFit: 'Resize shape to fit text', + textPlacement: 'Placement', + textPosition: 'Position', + textHorizontal: 'Horizontal', + textFrom: 'From', + textVertical: 'Vertical', + textTopLeftCorner: 'Top Left Corner', + textCenter: 'Center', + textGeneral: 'General', + textShapeName: 'Shape name' + + }, PDFE.Views.ShapeSettingsAdvanced || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/TableSettings.js b/apps/pdfeditor/main/app/view/TableSettings.js new file mode 100644 index 0000000000..6d44f87656 --- /dev/null +++ b/apps/pdfeditor/main/app/view/TableSettings.js @@ -0,0 +1,968 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * TableSettings.js + * + * Created by Julia Radzhabova on 4/11/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'text!pdfeditor/main/app/template/TableSettings.template', + 'jquery', + 'underscore', + 'backbone', + 'common/main/lib/component/Button', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/ThemeColorPalette', + 'common/main/lib/component/ColorButton', + 'common/main/lib/component/ComboBorderSize', + 'common/main/lib/component/ComboDataView', + 'common/main/lib/view/InsertTableDialog', + 'pdfeditor/main/app/view/TableSettingsAdvanced' +], function (menuTemplate, $, _, Backbone) { + 'use strict'; + + PDFE.Views.TableSettings = Backbone.View.extend(_.extend({ + el: '#id-table-settings', + + // Compile our stats template + template: _.template(menuTemplate), + + // Delegated events for creating new items, and clearing completed ones. + events: { + }, + + options: { + alias: 'TableSettings' + }, + + initialize: function () { + this._initSettings = true; + + this._state = { + TemplateId: undefined, + CheckHeader: false, + CheckTotal: false, + CheckBanded: false, + CheckFirst: false, + CheckLast: false, + CheckColBanded: false, + BackColor: '#000000', + DisabledControls: false, + Width: null, + Height: null, + beginPreviewStyles: true, + previewStylesCount: -1, + currentStyleFound: false + }; + this.spinners = []; + this.lockedControls = []; + this._locked = false; + this._originalLook = new Asc.CTablePropLook(); + + this._originalProps = null; + this.CellBorders = {}; + this.CellColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным + this.BorderSize = 1; + this._noApply = false; + + this.render(); + }, + + onCheckTemplateChange: function(type, field, newValue, oldValue, eOpts) { + if (this.api) { + var properties = new Asc.CTableProp(); + var look = (this._originalLook) ? this._originalLook : new Asc.CTablePropLook(); + switch (type) { + case 0: + look.put_FirstRow(field.getValue()=='checked'); + break; + case 1: + look.put_LastRow(field.getValue()=='checked'); + break; + case 2: + look.put_BandHor(field.getValue()=='checked'); + break; + case 3: + look.put_FirstCol(field.getValue()=='checked'); + break; + case 4: + look.put_LastCol(field.getValue()=='checked'); + break; + case 5: + look.put_BandVer(field.getValue()=='checked'); + break; + } + properties.put_TableLook(look); + this.api.tblApply(properties); + } + this.fireEvent('editcomplete', this); + }, + + onTableTemplateSelect: function(btn, picker, itemView, record){ + if (this.api && !this._noApply) { + var properties = new Asc.CTableProp(); + properties.put_TableStyle(record.get('templateId')); + this.api.tblApply(properties); + } + this.fireEvent('editcomplete', this); + }, + + onColorsBackSelect: function(btn, color) { + this.CellColor = {Value: 1, Color: color}; + + if (this.api) { + var properties = new Asc.CTableProp(); + var background = new Asc.CBackground(); + properties.put_CellsBackground(background); + + if (this.CellColor.Color=='transparent') { + background.put_Value(1); + } else { + background.put_Value(0); + background.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color)); + } + properties.put_CellSelect(true); + this.api.tblApply(properties); + } + + this.fireEvent('editcomplete', this); + }, + + onBtnBordersClick: function(btn, eOpts){ + this._UpdateBordersStyle(btn.options.strId, true); + if (this.api) { + var properties = new Asc.CTableProp(); + properties.put_CellBorders(this.CellBorders); + properties.put_CellSelect(true); + this.api.tblApply(properties); + } + this.fireEvent('editcomplete', this); + }, + + onBorderSizeSelect: function(combo, record) { + this.BorderSize = record.value; + }, + + onEditClick: function(menu, item, e) { + if (this.api) { + switch (item.value) { + case 0: this.api.selectRow(); break; + case 1: this.api.selectColumn(); break; + case 2: this.api.selectCell(); break; + case 3: this.api.selectTable(); break; + case 4: this.api.addRowAbove(); break; + case 5: this.api.addRowBelow(); break; + case 6: this.api.addColumnLeft(); break; + case 7: this.api.addColumnRight(); break; + case 8: this.api.remRow(); break; + case 9: this.api.remColumn(); break; + case 10: this.api.remTable(); break; + case 11: this.api.MergeCells(); break; + case 12: this.splitCells(menu, item, e); break; + } + } + this.fireEvent('editcomplete', this); + }, + + splitCells: function(menu, item, e) { + var me = this; + (new Common.Views.InsertTableDialog({ + split: true, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.SplitCell(value.columns, value.rows); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + }, + + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + }, + + setApi: function(o) { + this.api = o; + if (o) { + this.api.asc_registerCallback('asc_onInitTableTemplates', _.bind(this.onInitTableTemplates, this)); + this.api.asc_registerCallback('asc_onBeginTableStylesPreview', _.bind(this.onBeginTableStylesPreview, this)); + this.api.asc_registerCallback('asc_onAddTableStylesPreview', _.bind(this.onAddTableStylesPreview, this)); + this.api.asc_registerCallback('asc_onEndTableStylesPreview', _.bind(this.onEndTableStylesPreview, this)); + } + return this; + }, + + createDelayedControls: function() { + var me = this; + + this._tableTemplates && this._onInitTemplates(); + + this.chHeader = new Common.UI.CheckBox({ + el: $('#table-checkbox-header'), + labelText: this.textHeader, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chHeader); + + this.chTotal = new Common.UI.CheckBox({ + el: $('#table-checkbox-total'), + labelText: this.textTotal, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chTotal); + + this.chBanded = new Common.UI.CheckBox({ + el: $('#table-checkbox-banded'), + labelText: this.textBanded, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chBanded); + + this.chFirst = new Common.UI.CheckBox({ + el: $('#table-checkbox-first'), + labelText: this.textFirst, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chFirst); + + this.chLast = new Common.UI.CheckBox({ + el: $('#table-checkbox-last'), + labelText: this.textLast, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chLast); + + this.chColBanded = new Common.UI.CheckBox({ + el: $('#table-checkbox-col-banded'), + labelText: this.textBanded, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chColBanded); + + this.chHeader.on('change', _.bind(this.onCheckTemplateChange, this, 0)); + this.chTotal.on('change', _.bind(this.onCheckTemplateChange, this, 1)); + this.chBanded.on('change', _.bind(this.onCheckTemplateChange, this, 2)); + this.chFirst.on('change', _.bind(this.onCheckTemplateChange, this, 3)); + this.chLast.on('change', _.bind(this.onCheckTemplateChange, this, 4)); + this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); + + var _arrBorderPosition = [ + ['l', 'toolbar__icon btn-border-left', 'table-button-border-left', this.tipLeft, 'bottom'], + ['c', 'toolbar__icon btn-border-insidevert', 'table-button-border-inner-vert', this.tipInnerVert, 'bottom'], + ['r', 'toolbar__icon btn-border-right', 'table-button-border-right', this.tipRight, 'bottom'], + ['t', 'toolbar__icon btn-border-top', 'table-button-border-top', this.tipTop, 'bottom'], + ['m', 'toolbar__icon btn-border-insidehor', 'table-button-border-inner-hor', this.tipInnerHor, 'bottom'], + ['b', 'toolbar__icon btn-border-bottom', 'table-button-border-bottom', this.tipBottom, 'bottom'], + ['cm', 'toolbar__icon btn-border-inside', 'table-button-border-inner', this.tipInner, 'top'], + ['lrtb', 'toolbar__icon btn-border-out', 'table-button-border-outer', this.tipOuter, 'top'], + ['lrtbcm', 'toolbar__icon btn-border-all', 'table-button-border-all', this.tipAll, 'top'], + ['', 'toolbar__icon btn-border-no', 'table-button-border-none', this.tipNone, 'top'] + ]; + + this._btnsBorderPosition = []; + _.each(_arrBorderPosition, function(item, index, list){ + var _btn = new Common.UI.Button({ + parentEl: $('#'+item[2]), + cls: 'btn-toolbar borders--small', + iconCls: item[1], + strId :item[0], + hint: item[3], + dataHint: '1', + dataHintDirection: item[4], + dataHintOffset: 'small' + }); + _btn.on('click', _.bind(this.onBtnBordersClick, this)); + this._btnsBorderPosition.push( _btn ); + this.lockedControls.push(_btn); + }, this); + + this.cmbBorderSize = new Common.UI.ComboBorderSize({ + el: $('#table-combo-border-size'), + style: "width: 93px;", + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.cmbBorderSize.on('selected', _.bind(this.onBorderSizeSelect, this)); + this.lockedControls.push(this.cmbBorderSize); + + this.btnEdit = new Common.UI.Button({ + parentEl: $('#table-btn-edit'), + cls : 'btn-toolbar align-left', + iconCls : 'toolbar__icon btn-rows-and-columns', + caption : this.textEdit, + style : 'width: 100%;', + menu: new Common.UI.Menu({ + menuAlign: 'tr-br', + items: [ + { caption: this.selectRowText, value: 0 }, + { caption: this.selectColumnText, value: 1 }, + { caption: this.selectCellText, value: 2 }, + { caption: this.selectTableText, value: 3 }, + { caption: '--' }, + { caption: this.insertRowAboveText, value: 4 }, + { caption: this.insertRowBelowText, value: 5 }, + { caption: this.insertColumnLeftText, value: 6 }, + { caption: this.insertColumnRightText, value: 7 }, + { caption: '--' }, + { caption: this.deleteRowText, value: 8 }, + { caption: this.deleteColumnText, value: 9 }, + { caption: this.deleteTableText, value: 10 }, + { caption: '--' }, + { caption: this.mergeCellsText, value: 11 }, + { caption: this.splitCellsText, value: 12 } + ] + }), + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.mnuMerge = this.btnEdit.menu.items[this.btnEdit.menu.items.length-2]; + this.mnuSplit = this.btnEdit.menu.items[this.btnEdit.menu.items.length-1]; + + this.btnEdit.menu.on('show:after', _.bind( function(){ + if (this.api) { + this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()); + this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()); + } + }, this)); + this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); + this.lockedControls.push(this.btnEdit); + + this.numHeight = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-height'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.numHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.numHeight); + this.spinners.push(this.numHeight); + + this.numWidth = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-width'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.numWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.numWidth); + this.spinners.push(this.numWidth); + + this.btnDistributeRows = new Common.UI.Button({ + el: $('#table-btn-distrub-rows') + }); + this.lockedControls.push(this.btnDistributeRows); + this.btnDistributeRows.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(false); + }, this)); + + this.btnDistributeCols = new Common.UI.Button({ + el: $('#table-btn-distrub-cols') + }); + this.lockedControls.push(this.btnDistributeCols); + this.btnDistributeCols.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(true); + }, this)); + + this.linkAdvanced = $('#table-advanced-link'); + $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + + this.disableControls(this._locked); // need to update combodataview after disabled state + + if (props ) + { + this._originalProps = new Asc.CTableProp(props); + this._originalProps.put_CellSelect(true); + + var value = props.get_ColumnWidth(); + if ((this._state.Width === undefined || value === undefined)&&(this._state.Width!==value) || + Math.abs(this._state.Width-value)>0.001) { + this.numWidth.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Width=value; + } + value = props.get_RowHeight(); + if ((this._state.Height === undefined || value === undefined)&&(this._state.Height!==value) || + Math.abs(this._state.Height-value)>0.001) { + this.numHeight.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height=value; + } + + //for table-template + value = props.get_TableStyle(); + if (this._state.TemplateId!==value || this._isTemplatesChanged) { + this._state.TemplateId = value; + var template = this.api.asc_getTableStylesPreviews(false, [this._state.TemplateId]); + if (template && template.length>0) + this.$el.find('.icon-template-table').css({'background-image': 'url(' + template[0].asc_getImage() + ')', 'height': '52px', 'width': '72px', 'background-position': 'center', 'background-size': 'auto 52px'}); + this._state.currentStyleFound = false; + this.selectCurrentTableStyle(); + } + this._isTemplatesChanged = false; + + var look = props.get_TableLook(); + if (look) { + value = look.get_FirstRow(); + if (this._state.CheckHeader!==value) { + this.chHeader.setValue(value, true); + this._state.CheckHeader=value; + this._originalLook.put_FirstRow(value); + } + + value = look.get_LastRow(); + if (this._state.CheckTotal!==value) { + this.chTotal.setValue(value, true); + this._state.CheckTotal=value; + this._originalLook.put_LastRow(value); + } + + value = look.get_BandHor(); + if (this._state.CheckBanded!==value) { + this.chBanded.setValue(value, true); + this._state.CheckBanded=value; + this._originalLook.put_BandHor(value); + } + + value = look.get_FirstCol(); + if (this._state.CheckFirst!==value) { + this.chFirst.setValue(value, true); + this._state.CheckFirst=value; + this._originalLook.put_FirstCol(value); + } + + value = look.get_LastCol(); + if (this._state.CheckLast!==value) { + this.chLast.setValue(value, true); + this._state.CheckLast=value; + this._originalLook.put_LastCol(value); + } + + value = look.get_BandVer(); + if (this._state.CheckColBanded!==value) { + this.chColBanded.setValue(value, true); + this._state.CheckColBanded=value; + this._originalLook.put_BandVer(value); + } + } + + // background colors + var background = props.get_CellsBackground(); + if (background) { + if (background.get_Value()==0) { + var color = background.get_Color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.CellColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.CellColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + } else + this.CellColor = {Value: 1, Color: 'transparent'}; + } else + this.CellColor = {Value: 1, Color: 'transparent'}; + } else + this.CellColor = {Value: 0, Color: 'transparent'}; + + var type1 = typeof(this.CellColor.Color), + type2 = typeof(this._state.BackColor); + if ( (type1 !== type2) || (type1=='object' && + (this.CellColor.Color.effectValue!==this._state.BackColor.effectValue || this._state.BackColor.color.indexOf(this.CellColor.Color.color)<0)) || + (type1!='object' && this._state.BackColor.indexOf(this.CellColor.Color)<0 )) { + + this.btnBackColor.setColor(this.CellColor.Color); + if ( typeof(this.CellColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.CellColor.Color.effectValue ) { + this.colorsBack.select(this.CellColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBack.clearSelection(); + } else + this.colorsBack.select(this.CellColor.Color,true); + + this._state.BackColor = this.CellColor.Color; + } + } + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i -1 || !visible) { + if (updateBorders.get_Left()===null || updateBorders.get_Left()===undefined) + updateBorders.put_Left(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_Left(), visible); + } + if (border.indexOf('t') > -1 || !visible) { + if (updateBorders.get_Top()===null || updateBorders.get_Top()===undefined) + updateBorders.put_Top(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_Top(), visible); + } + if (border.indexOf('r') > -1 || !visible) { + if (updateBorders.get_Right()===null || updateBorders.get_Right()===undefined) + updateBorders.put_Right(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_Right(), visible); + } + if (border.indexOf('b') > -1 || !visible) { + if (updateBorders.get_Bottom()===null || updateBorders.get_Bottom()===undefined) + updateBorders.put_Bottom(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_Bottom(), visible); + } + if (border.indexOf('c') > -1 || !visible) { + if (updateBorders.get_InsideV()===null || updateBorders.get_InsideV()===undefined) + updateBorders.put_InsideV(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_InsideV(), visible); + } + if (border.indexOf('m') > -1 || !visible) { + if (updateBorders.get_InsideH()===null || updateBorders.get_InsideH()===undefined) + updateBorders.put_InsideH(new Asc.asc_CTextBorder()); + this._UpdateBorderStyle (updateBorders.get_InsideH(), visible); + } + }, + + _UpdateBorderStyle: function(border, visible) { + if (null == border) + border = new Asc.asc_CTextBorder(); + + if (visible && this.BorderSize > 0){ + var size = parseFloat(this.BorderSize); + border.put_Value(1); + border.put_Size(size * 25.4 / 72.0); + var color = Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color); + border.put_Color(color); + } + else { + border.put_Value(0); + } + }, + + createDelayedElements: function() { + this._initSettings = false; + this.createDelayedControls(); + this.UpdateThemeColors(); + this.updateMetricUnit(); + }, + + UpdateThemeColors: function() { + if (this._initSettings) return; + if (!this.btnBackColor) { + var config = Common.define.simpleColorsConfig; + this.btnBorderColor = new Common.UI.ColorButton({ + parentEl: $('#table-border-color-btn'), + color: 'auto', + auto: true, + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBorderColor); + this.borderColor = this.btnBorderColor.getPicker(); + this.btnBorderColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBorderColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnBackColor = new Common.UI.ColorButton({ + parentEl: $('#table-back-color-btn'), + transparent: true, + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBackColor); + this.colorsBack = this.btnBackColor.getPicker(); + this.btnBackColor.on('color:select', _.bind(this.onColorsBackSelect, this)); + this.btnBackColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBackColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + } + // this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + !this.btnBorderColor.isAutoColor() && this.btnBorderColor.setColor(this.borderColor.getColor()); + }, + + selectCurrentTableStyle: function() { + if (!this.mnuTableTemplatePicker || this._state.beginPreviewStyles) return; + + var rec = this.mnuTableTemplatePicker.store.findWhere({ + templateId: this._state.TemplateId + }); + if (!rec && this._state.previewStylesCount===this.mnuTableTemplatePicker.store.length) { + rec = this.mnuTableTemplatePicker.store.at(0); + } + if (rec) { + this._state.currentStyleFound = true; + this.btnTableTemplate.suspendEvents(); + this.mnuTableTemplatePicker.selectRecord(rec, true); + this.btnTableTemplate.resumeEvents(); + this.$el.find('.icon-template-table').css({'background-image': 'url(' + rec.get("imageUrl") + ')', 'height': '52px', 'width': '72px', 'background-position': 'center', 'background-size': 'auto 52px'}); + } + }, + + onBeginTableStylesPreview: function(count){ + this._state.beginPreviewStyles = true; + this._state.currentStyleFound = false; + this._state.previewStylesCount = count; + this._state.groups = { + 'menu-table-group-custom': {id: 'menu-table-group-custom', caption: this.txtGroupTable_Custom, index: 0, templateCount: 0}, + 'menu-table-group-optimal': {id: 'menu-table-group-optimal', caption: this.txtGroupTable_Optimal, index: 1, templateCount: 0}, + 'menu-table-group-light': {id: 'menu-table-group-light', caption: this.txtGroupTable_Light, index: 2, templateCount: 0}, + 'menu-table-group-medium': {id: 'menu-table-group-medium', caption: this.txtGroupTable_Medium, index: 3, templateCount: 0}, + 'menu-table-group-dark': {id: 'menu-table-group-dark', caption: this.txtGroupTable_Dark, index: 4, templateCount: 0}, + 'menu-table-group-no-name': {id: 'menu-table-group-no-name', caption: ' ', index: 5, templateCount: 0}, + }; + }, + + onEndTableStylesPreview: function(){ + !this._state.currentStyleFound && this.selectCurrentTableStyle(); + if (this.mnuTableTemplatePicker) { + this.mnuTableTemplatePicker.scroller.update({alwaysVisibleY: true}); + if (this.mnuTableTemplatePicker.isVisible()) + this.mnuTableTemplatePicker.scrollToRecord(this.mnuTableTemplatePicker.getSelectedRec()); + } + }, + + onAddTableStylesPreview: function(Templates){ + var self = this; + + _.each(Templates, function(template){ + var tip = template.asc_getDisplayName(); + var groupItem = ''; + + if (template.asc_getType()==0) { + var arr = tip.split(' '); + + if(new RegExp('No Style|Themed Style', 'i').test(tip)){ + groupItem = 'menu-table-group-optimal'; + } + else{ + if(arr[0]){ + groupItem = 'menu-table-group-' + arr[0].toLowerCase(); + } + if(self._state.groups.hasOwnProperty(groupItem) == false) { + groupItem = 'menu-table-group-no-name'; + } + } + + ['No Style', 'No Grid', 'Table Grid', 'Themed Style', 'Light Style', 'Medium Style', 'Dark Style', 'Accent'].forEach(function(item){ + var str = 'txtTable_' + item.replace(' ', ''); + if (self[str]) + tip = tip.replace(new RegExp(item, 'g'), self[str]); + }); + } + else { + groupItem = 'menu-table-group-custom' + } + + var templateObj = { + imageUrl: template.asc_getImage(), + id : Common.UI.getId(), + templateId: template.asc_getId(), + group : groupItem, + tip : tip + }; + var templateIndex = 0; + + for(var group in self._state.groups) { + if(self._state.groups[group].index <= self._state.groups[groupItem].index) { + templateIndex += self._state.groups[group].templateCount; + } + } + + if (self._state.beginPreviewStyles) { + self._state.beginPreviewStyles = false; + self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.reset(self._state.groups[groupItem]); + self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.reset(templateObj); + self.mnuTableTemplatePicker.groups.comparator = function(item) { + return item.get('index'); + }; + } + else { + if(self._state.groups[groupItem].templateCount == 0) { + self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.groups.add(self._state.groups[groupItem]); + } + self.mnuTableTemplatePicker && self.mnuTableTemplatePicker.store.add(templateObj, {at: templateIndex}); + } + + self._state.groups[groupItem].templateCount += 1; + }); + !this._state.currentStyleFound && this.selectCurrentTableStyle(); + }, + + onInitTableTemplates: function(){ + if (this._initSettings) { + this._tableTemplates = true; + return; + } + this._onInitTemplates(); + }, + + _onInitTemplates: function(){ + var self = this; + this._isTemplatesChanged = true; + + if (!this.btnTableTemplate) { + this.btnTableTemplate = new Common.UI.Button({ + cls : 'btn-large-dataview template-table', + scaling : false, + iconCls : 'icon-template-table', + menu : new Common.UI.Menu({ + style: 'width: 588px;', + items: [ + { template: _.template('') } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.btnTableTemplate.on('render:after', function(btn) { + self.mnuTableTemplatePicker = new Common.UI.DataView({ + el: $('#id-table-menu-template'), + parentMenu: btn.menu, + restoreHeight: 350, + groups: new Common.UI.DataViewGroupStore(), + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
'), + style: 'max-height: 350px;', + cls: 'classic', + delayRenderTips: true + }); + }); + this.btnTableTemplate.render($('#table-btn-template')); + this.btnTableTemplate.cmpEl.find('.icon-template-table').css({'height': '52px', 'width': '72px', 'background-position': 'center', 'background-size': 'auto 52px'}); + this.lockedControls.push(this.btnTableTemplate); + this.mnuTableTemplatePicker.on('item:click', _.bind(this.onTableTemplateSelect, this, this.btnTableTemplate)); + } + this.api.asc_generateTableStylesPreviews(); + }, + + openAdvancedSettings: function(e) { + if (this.linkAdvanced.hasClass('disabled')) return; + + var me = this; + if (me.api && !this._locked){ + 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.Table == elType) { + (new PDFE.Views.TableSettingsAdvanced( + { + tableProps: elValue, + slideSize: {width: me.api.get_PageWidth(), height: me.api.get_PageHeight()}, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.tblApply(value.tableProps); + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + break; + } + } + } + } + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.linkAdvanced && this.linkAdvanced.toggleClass('disabled', disable); + } + }, + + onEyedropperStart: function (btn) { + this.api.asc_startEyedropper(_.bind(btn.eyedropperEnd, btn)); + this.fireEvent('eyedropper', true); + }, + + onEyedropperEnd: function () { + this.fireEvent('eyedropper', false); + }, + + textBorders: 'Border\'s Style', + textBorderColor: 'Color', + textBackColor: 'Background color', + textEdit: 'Rows & Columns', + selectRowText : 'Select Row', + selectColumnText : 'Select Column', + selectCellText : 'Select Cell', + selectTableText : 'Select Table', + insertRowAboveText : 'Insert Row Above', + insertRowBelowText : 'Insert Row Below', + insertColumnLeftText : 'Insert Column Left', + insertColumnRightText : 'Insert Column Right', + deleteRowText : 'Delete Row', + deleteColumnText : 'Delete Column', + deleteTableText : 'Delete Table', + mergeCellsText : 'Merge Cells', + splitCellsText : 'Split Cell...', + splitCellTitleText : 'Split Cell', + textSelectBorders : 'Select borders that you want to change', + textAdvanced : 'Show advanced settings', + txtNoBorders : 'No borders', + textTemplate : 'Select From Template', + textRows : 'Rows', + textColumns : 'Columns', + textHeader : 'Header', + textTotal : 'Total', + textBanded : 'Banded', + textFirst : 'First', + textLast : 'Last', + textEmptyTemplate : 'No templates', + tipTop: 'Set Outer Top Border Only', + tipLeft: 'Set Outer Left Border Only', + tipBottom: 'Set Outer Bottom Border Only', + tipRight: 'Set Outer Right Border Only', + tipAll: 'Set Outer Border and All Inner Lines', + tipNone: 'Set No Borders', + tipInner: 'Set Inner Lines Only', + tipInnerVert: 'Set Vertical Inner Lines Only', + tipInnerHor: 'Set Horizontal Inner Lines Only', + tipOuter: 'Set Outer Border Only', + textCellSize: 'Cell Size', + textHeight: 'Height', + textWidth: 'Width', + textDistributeRows: 'Distribute rows', + textDistributeCols: 'Distribute columns', + txtTable_NoStyle: 'No Style', + txtTable_NoGrid: 'No Grid', + txtTable_TableGrid: 'Table Grid', + txtTable_ThemedStyle: 'Themed Style', + txtTable_LightStyle: 'Light Style', + txtTable_MediumStyle: 'Medium Style', + txtTable_DarkStyle: 'Dark Style', + txtTable_Accent: 'Accent', + txtGroupTable_Custom: 'Custom', + txtGroupTable_Optimal: 'Best Match for Document', + txtGroupTable_Light: 'Light', + txtGroupTable_Medium: 'Medium', + txtGroupTable_Dark: 'Dark', + +}, PDFE.Views.TableSettings || {})); +}); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/TableSettingsAdvanced.js b/apps/pdfeditor/main/app/view/TableSettingsAdvanced.js new file mode 100644 index 0000000000..75db67f35f --- /dev/null +++ b/apps/pdfeditor/main/app/view/TableSettingsAdvanced.js @@ -0,0 +1,656 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * TableSettingsAdvanced.js + * + * Created by Julia Radzhabova on 4/15/14 + * Copyright (c) 2018 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!pdfeditor/main/app/template/TableSettingsAdvanced.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/MetricSpinner' +], function (contentTemplate) { + 'use strict'; + + PDFE.Views.TableSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + alias: 'TableSettingsAdvanced', + contentWidth: 280, + contentHeight: 300, + storageName: 'pdfe-table-settings-adv-category', + sizeMax: {width: 55.88, height: 55.88}, + }, + + initialize : function(options) { + _.extend(this.options, { + title: this.textTitle, + items: [ + {panelId: 'id-adv-table-general', panelCaption: this.textGeneral}, + {panelId: 'id-adv-table-placement', panelCaption: this.textPlacement}, + {panelId: 'id-adv-table-cell-props', panelCaption: this.textWidthSpaces}, + {panelId: 'id-adv-table-alttext', panelCaption: this.textAlt} + ], + contentTemplate: _.template(contentTemplate)({ + scope: this + }) + }, options); + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + + this.spinners = []; + + this._changedProps = null; + this._allTable = false; + this.TableMargins = { + Left : 0.19, + Right : 0.19, + Top : 0, + Bottom : 0 + }; + this.CellMargins = { + Left : 0.19, + Right : 0.19, + Top : null, + Bottom : null, + Flag : 0 // 0(checked) - как в таблице, 1(indeterminate) - разные значения, не определено, 2 (unchecked) - собственные + }; + + this._initialMarginsDefault = false; // если для всех выделенных ячеек пришло одинаковое значение Flag=0 (Use Default Margins) + this._originalProps = new Asc.CTableProp(this.options.tableProps); + this.slideSize = this.options.slideSize; + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + var me = this; + // General + this.inputTableName = new Common.UI.InputField({ + el : $('#tableadv-name'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isTableNameChanged = true; + }); + + // Placement + this.spnWidth = new Common.UI.MetricSpinner({ + el: $('#tableadv-spin-width'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnWidth.on('change', _.bind(function(field){ + if (this.btnRatio.pressed) { + var w = field.getNumberValue(); + var h = w/this._nRatio; + if (h>this.sizeMax.height) { + h = this.sizeMax.height; + w = h * this._nRatio; + this.spnWidth.setValue(w, true); + } + this.spnHeight.setValue(h, true); + } + }, this)); + this.spinners.push(this.spnWidth); + + this.spnHeight = new Common.UI.MetricSpinner({ + el: $('#tableadv-spin-height'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = null; + if (this.btnRatio.pressed) { + w = h * this._nRatio; + if (w>this.sizeMax.width) { + w = this.sizeMax.width; + h = w/this._nRatio; + this.spnHeight.setValue(h, true); + } + this.spnWidth.setValue(w, true); + } + }, this)); + this.spinners.push(this.spnHeight); + + this.btnRatio = new Common.UI.Button({ + parentEl: $('#tableadv-button-ratio'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-advanced-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.spnHeight.getNumberValue()>0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + }, this)); + + this.spnX = new Common.UI.MetricSpinner({ + el: $('#tableadv-spin-x'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnX); + + this.spnY = new Common.UI.MetricSpinner({ + el: $('#tableadv-spin-y'), + step: .1, + width: 85, + defaultUnit : "cm", + defaultValue : 0, + value: '0 cm', + maxValue: 55.87, + minValue: -55.87 + }); + this.spinners.push(this.spnY); + + this.cmbFromX = new Common.UI.ComboBox({ + el: $('#tableadv-combo-from-x'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + this.cmbFromY = new Common.UI.ComboBox({ + el: $('#tableadv-combo-from-y'), + cls: 'input-group-nr', + style: "width: 125px;", + menuStyle: 'min-width: 125px;', + data: [ + { value: 'left', displayValue: this.textTopLeftCorner }, + { value: 'center', displayValue: this.textCenter } + ], + editable: false, + takeFocusOnClose: true + }); + + this._marginsChange = function(field, newValue, oldValue, eOpts, source, property){ + if (source=='table') + this.TableMargins[property] = field.getNumberValue(); + else + this.CellMargins[property] = field.getNumberValue(); + }; + + // Margins + this.spnTableMarginTop = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-table-top'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnTableMarginTop.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'table', 'Top'); + if (this._changedProps) { + if (this._changedProps.get_DefaultMargins()===undefined) + this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings()); + this._changedProps.get_DefaultMargins().put_Top((this.TableMargins.Top!==null) ? Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Top) : null); + this.TableMargins.isChanged = true; + } + }, this)); + this.spinners.push(this.spnTableMarginTop); + + this.spnTableMarginBottom = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-table-bottom'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnTableMarginBottom.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'table', 'Bottom'); + if (this._changedProps) { + if (this._changedProps.get_DefaultMargins()===undefined) + this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings()); + this._changedProps.get_DefaultMargins().put_Bottom((this.TableMargins.Bottom!==null) ? Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Bottom) : null); + this.TableMargins.isChanged = true; + } + }, this)); + this.spinners.push(this.spnTableMarginBottom); + + this.spnTableMarginLeft = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-table-left'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnTableMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'table', 'Left'); + if (this._changedProps) { + if (this._changedProps.get_DefaultMargins()===undefined) + this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings()); + this._changedProps.get_DefaultMargins().put_Left((this.TableMargins.Left!==null) ? Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Left) : null); + this.TableMargins.isChanged = true; + } + }, this)); + this.spinners.push(this.spnTableMarginLeft); + + this.spnTableMarginRight = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-table-right'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnTableMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'table', 'Right'); + if (this._changedProps) { + if (this._changedProps.get_DefaultMargins()===undefined) + this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings()); + this._changedProps.get_DefaultMargins().put_Right((this.TableMargins.Right!==null) ? Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Right) : null); + this.TableMargins.isChanged = true; + } + }, this)); + this.spinners.push(this.spnTableMarginRight); + + // Cell Margins + var setCellFlag = function() { + if (me.CellMargins.Flag=='indeterminate') + me._changedProps.get_CellMargins().put_Flag(1); + else if (me.CellMargins.Flag=='checked') + me._changedProps.get_CellMargins().put_Flag(0); + else + me._changedProps.get_CellMargins().put_Flag(2); + }; + + this.chCellMargins = new Common.UI.CheckBox({ + el: $('#tableadv-checkbox-margins'), + value: true, + labelText: this.textCheckMargins + }); + this.chCellMargins.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if ( oldValue=='checked' && this._originalProps && this._originalProps.get_CellMargins().get_Flag()==1 ) { // позволяем выставлять значение indeterminate только если исходные значения не совпадали + field.setValue('indeterminate', true); + } + this.fillMargins.call( this, field.getValue()); + this.CellMargins.Flag = field.getValue(); + if (this._changedProps) { + if (this._changedProps.get_CellMargins()===undefined) + this._changedProps.put_CellMargins(new Asc.CMargins()); + this._changedProps.get_CellMargins().put_Left( ( this.CellMargins.Left!== null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left) : null); + this._changedProps.get_CellMargins().put_Top((this.CellMargins.Top!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top) : null); + this._changedProps.get_CellMargins().put_Bottom((this.CellMargins.Bottom!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom) : null); + this._changedProps.get_CellMargins().put_Right((this.CellMargins.Right!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right) : null); + setCellFlag(); + } + }, this)); + + this.spnMarginTop = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-top'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginTop.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'cell', 'Top'); + if (this._changedProps) { + if (this._changedProps.get_CellMargins()===undefined) + this._changedProps.put_CellMargins(new Asc.CMargins()); + this._changedProps.get_CellMargins().put_Top((this.CellMargins.Top!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top) : null); + setCellFlag(); + } + }, this)); + this.spinners.push(this.spnMarginTop); + + this.spnMarginBottom = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-bottom'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginBottom.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'cell', 'Bottom'); + if (this._changedProps) { + if (this._changedProps.get_CellMargins()===undefined) + this._changedProps.put_CellMargins(new Asc.CMargins()); + this._changedProps.get_CellMargins().put_Bottom((this.CellMargins.Bottom!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom) : null); + setCellFlag(); + } + }, this)); + this.spinners.push(this.spnMarginBottom); + + this.spnMarginLeft = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-left'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'cell', 'Left'); + if (this._changedProps) { + if (this._changedProps.get_CellMargins()===undefined) + this._changedProps.put_CellMargins(new Asc.CMargins()); + this._changedProps.get_CellMargins().put_Left((this.CellMargins.Left!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left) : null); + setCellFlag(); + } + }, this)); + this.spinners.push(this.spnMarginLeft); + + this.spnMarginRight = new Common.UI.MetricSpinner({ + el: $('#tableadv-number-margin-right'), + step: .1, + width: 85, + defaultUnit : "cm", + value: '0.19 cm', + maxValue: 55.87, + minValue: 0 + }); + this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + this._marginsChange( field, newValue, oldValue, eOpts, 'cell', 'Right'); + if (this._changedProps) { + if (this._changedProps.get_CellMargins()===undefined) + this._changedProps.put_CellMargins(new Asc.CMargins()); + this._changedProps.get_CellMargins().put_Right((this.CellMargins.Right!==null) ? Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right) : null); + setCellFlag(); + } + }, this)); + this.spinners.push(this.spnMarginRight); + + // Alt Text + + this.inputAltTitle = new Common.UI.InputField({ + el : $('#tableadv-alt-title'), + allowBlank : true, + validateOnBlur: false, + style : 'width: 100%;' + }).on('changed:after', function() { + me.isAltTitleChanged = true; + }); + + this.textareaAltDescription = this.$window.find('textarea'); + this.textareaAltDescription.keydown(function (event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + event.stopPropagation(); + } + me.isAltDescChanged = true; + }); + + this.afterRender(); + }, + + getFocusedComponents: function() { + return this.btnsCategory.concat([ + this.inputTableName, // 0 tab + this.spnWidth, this.btnRatio, this.spnHeight, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY, // 1 tab + this.chCellMargins, this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight, + this.spnTableMarginTop, this.spnTableMarginLeft, this.spnTableMarginBottom, this.spnTableMarginRight, // 2 tab + this.inputAltTitle, this.textareaAltDescription // 3 tab + ]).concat(this.getFooterButtons()); + }, + + onCategoryClick: function(btn, index) { + Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index); + + var me = this; + setTimeout(function(){ + switch (index) { + case 0: + me.inputTableName.focus(); + break; + case 1: + me.spnWidth.focus(); + break; + case 2: + if (!me.spnMarginTop.isDisabled()) + me.spnMarginTop.focus(); + else + me.spnTableMarginTop.focus(); + break; + case 3: + me.inputAltTitle.focus(); + break; + } + }, 10); + }, + + afterRender: function() { + this.updateMetricUnit(); + this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } + }, + + getSettings: function() { + if (this.isTableNameChanged) + this._changedProps.put_TableName(this.inputTableName.getValue()); + + if (this.spnHeight.getValue()!=='') + this._changedProps.put_FrameHeight(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())); + if (this.spnWidth.getValue()!=='') + this._changedProps.put_FrameWidth(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())); + this._changedProps.put_FrameLockAspect(this.btnRatio.pressed); + + if (this.spnX.getValue() !== '') { + var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()); + if (this.cmbFromX.getValue() === 'center') { + x = (this.slideSize.width/36000)/2 + x; + } + this._changedProps.put_FrameX(x); + } + if (this.spnY.getValue() !== '') { + var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue()); + if (this.cmbFromY.getValue() === 'center') { + y = (this.slideSize.height/36000)/2 + y; + } + this._changedProps.put_FrameY(y); + } + + if (this.isAltTitleChanged) + this._changedProps.put_TableCaption(this.inputAltTitle.getValue()); + + if (this.isAltDescChanged) + this._changedProps.put_TableDescription(this.textareaAltDescription.val()); + + return { tableProps: this._changedProps }; + }, + + _setDefaults: function(props) { + if (props ){ + this._allTable = !props.get_CellSelect(); + + // general + var value = props.get_TableName(); + this.inputTableName.setValue(value ? value : ''); + + // placement + this.spnWidth.setMaxValue(this.sizeMax.width); + this.spnHeight.setMaxValue(this.sizeMax.height); + this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_FrameWidth()).toFixed(2), true); + this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_FrameHeight()).toFixed(2), true); + + value = props.get_FrameLockAspect(); + this.btnRatio.toggle(value); + if (props.get_FrameHeight()>0) + this._nRatio = props.get_FrameWidth()/props.get_FrameHeight(); + + this.cmbFromX.setValue('left'); + this.cmbFromY.setValue('left'); + + var position = {x: props.get_FrameX(), y: props.get_FrameY()}; + this.spnX.setValue((position.x !== null && position.x !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(position.x) : '', true); + this.spnY.setValue((position.y !== null && position.y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(position.y) : '', true); + + // margins + var margins = props.get_DefaultMargins(); + if (margins) { + this.TableMargins = { + Left : (margins.get_Left() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Left()) : null, + Right : (margins.get_Right() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Right()) : null, + Top : (margins.get_Top() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Top()) : null, + Bottom : (margins.get_Bottom() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Bottom()) : null + }; + } + + margins = props.get_CellMargins(); + var flag = undefined; + if (margins) { + this.CellMargins = { + Left : (margins.get_Left() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Left()) : null, + Right : (margins.get_Right() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Right()) : null, + Top : (margins.get_Top() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Top()) : null, + Bottom : (margins.get_Bottom() !==null) ? Common.Utils.Metric.fnRecalcFromMM(margins.get_Bottom()) : null + }; + flag = margins.get_Flag(); + this.CellMargins.Flag = (flag==1) ? 'indeterminate' : ((flag==0) ? 'checked' : 'unchecked'); + this.chCellMargins.setValue( this.CellMargins.Flag, true); + } + + if ( flag===0 ) { + // Если для всех выделенных ячеек пришло одинаковое значение Flag=0 (Use Default Margins), выставим в поля для Cell Margins значения DefaultMargins + if (this.CellMargins.Left=== null) this.CellMargins.Left = this.TableMargins.Left; + if (this.CellMargins.Top=== null) this.CellMargins.Top = this.TableMargins.Top; + if (this.CellMargins.Right=== null) this.CellMargins.Right = this.TableMargins.Right; + if (this.CellMargins.Bottom=== null) this.CellMargins.Bottom = this.TableMargins.Bottom; + } + + this.fillMargins(this.CellMargins.Flag); + + value = props.get_TableCaption(); + this.inputAltTitle.setValue(value ? value : ''); + + value = props.get_TableDescription(); + this.textareaAltDescription.val(value ? value : ''); + + this._changedProps = new Asc.CTableProp(); + } + }, + + fillMargins : function (checkMarginsState) { + if ( this._initialMarginsDefault && checkMarginsState=='unchecked' ) { + // изначально для всех ячеек использовали DefaultMargins, а теперь снимаем галку -> выставим в поля для маргинов 0, а не пустые значения + if (this.CellMargins.Left=== null) this.CellMargins.Left = 0; + if (this.CellMargins.Top=== null) this.CellMargins.Top = 0; + if (this.CellMargins.Right=== null) this.CellMargins.Right = 0; + if (this.CellMargins.Bottom=== null) this.CellMargins.Bottom = 0; + } + + this.spnMarginLeft.setValue((this.CellMargins.Left!== null) ? this.CellMargins.Left : '', true); + this.spnMarginTop.setValue((this.CellMargins.Top!== null) ? this.CellMargins.Top : '', true); + this.spnMarginRight.setValue((this.CellMargins.Right!== null) ? this.CellMargins.Right : '', true); + this.spnMarginBottom.setValue((this.CellMargins.Bottom!== null) ? this.CellMargins.Bottom : '', true); + var disabled = (checkMarginsState=='checked'); + this.spnMarginTop.setDisabled(disabled); + this.spnMarginBottom.setDisabled(disabled); + this.spnMarginLeft.setDisabled(disabled); + this.spnMarginRight.setDisabled(disabled); + this.spnTableMarginLeft.setValue((this.TableMargins.Left!== null) ? this.TableMargins.Left : '', true); + this.spnTableMarginTop.setValue((this.TableMargins.Top!== null) ? this.TableMargins.Top : '', true); + this.spnTableMarginRight.setValue((this.TableMargins.Right!== null) ? this.TableMargins.Right : '', true); + this.spnTableMarginBottom.setValue((this.TableMargins.Bottom!== null) ? this.TableMargins.Bottom : '', true); + }, + + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i=0) + this.typeGradient = this._viewDataRadial[this.GradRadialDirectionIdx].type; + else + this.typeGradient= -1; + this.numGradientAngle.setValue(0, true); + this.numGradientAngle.setDisabled(true); + } + + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + + this.fireEvent('editcomplete', this); + }, + + onSelectGradient: function(btn, picker, itemView, record) { + if (this._noApply) return; + + var rawData = {}, + isPickerSelect = _.isFunction(record.toJSON); + + if (isPickerSelect){ + if (record.get('selected')) { + rawData = record.toJSON(); + } else { + // record deselected + return; + } + } else { + rawData = record; + } + + if (this.GradFillType === Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.GradLinearDirectionType = rawData.type; + this.typeGradient = rawData.type + 90; + } else { + this.GradRadialDirectionIdx = 0; + this.typeGradient = rawData.type; + } + (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; + if (this.api) { + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.numGradientAngle.setValue(rawData.type, true); + + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + fill.get_fill().put_linear_angle(rawData.type * 60000); + fill.get_fill().put_linear_scale(true); + + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + } + + this.fireEvent('editcomplete', this); + }, + + onColorsGradientSelect: function(btn, color) { + this.GradColor.colors[this.GradColor.currentIdx] = color; + this.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(color) == 'object') ? color.color : color)); + + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + } + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + onGradientChange: function(slider, newValue, oldValue){ + this.GradColor.values = slider.getValues(); + var curValue = this.GradColor.values[this.GradColor.currentIdx]; + this.spnGradPosition.setValue(Common.UI.isRTL() ? this.sldrGradient.maxValue - curValue : curValue, true); + this._sliderChanged = true; + if (this.api && !this._noApply) { + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._gradientApplyFunc, this), 100); + } + } + }, + + onGradientChangeComplete: function(slider, newValue, oldValue){ + clearInterval(this.updateslider); + this._sliderChanged = true; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._gradientApplyFunc(); + } + + var arrGrCollors=[]; + var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7; + for (var index=0; index < slider.thumbs.length; index++) { + arrGrCollors.push(slider.getColorValue(index)+ ' '+ slider.getValue(index)*scale +'%'); + } + + this.btnDirectionRedraw(slider, arrGrCollors.join(', ')); + this._sendUndoPoint = true; + }, + + _gradientApplyFunc: function() { + if (this._sliderChanged) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + + if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); + } + arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + } + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + this._sliderChanged = false; + } + }, + + applyBorderSize: function(value) { + value = Common.Utils.String.parseFloat(value); + value = isNaN(value) ? 0 : Math.max(0, Math.min(1584, value)); + + this.BorderSize = value; + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + this._state.StrokeType = this._state.StrokeWidth = -1; + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + if (this.BorderColor.Color == 'transparent' || this.BorderColor.Color.color == 'transparent') + stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29})); + else if (this._state.StrokeType == Asc.c_oAscStrokeType.STROKE_NONE || this._state.StrokeType === null) + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.put_transparent(this._state.LineTransparency); + } + props.asc_putLine(stroke); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + onComboBlur: function() { + this.fireEvent('editcomplete', this); + }, + + onBorderSizeChanged: function(before, combo, record, e) { + var me = this; + if (before) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { + this._state.StrokeType = this._state.StrokeWidth = -1; + setTimeout( function() { + Common.UI.error({ + msg: me.textBorderSizeErr, + callback: function() { + _.defer(function(btn) { + me.fireEvent('editcomplete', me); + }) + } + }); + }, 10); + } + } else + this.applyBorderSize(record.value); + }, + + onBorderSizeSelect: function(combo, record) { + this.applyBorderSize(record.value); + }, + + onBorderTypeSelect: function(combo, record) { + this.BorderType = record.value; + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_transparent(this._state.LineTransparency); + } + props.asc_putLine(stroke); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + onColorsBorderSelect: function(btn, color) { + this.BorderColor = {Value: 1, Color: color}; + if (this.api && this.BorderSize>0 && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var stroke = new Asc.asc_CStroke(); + if (this.BorderSize<0.00001) { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_NONE); + } else { + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + stroke.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)); + stroke.put_width(this._pt2mm(this.BorderSize)); + stroke.asc_putPrstDash(this.BorderType); + stroke.put_transparent(this._state.LineTransparency); + } + props.asc_putLine(stroke); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + onNumLineTransparencyChange: function(field, newValue, oldValue, eOpts){ + this.sldrLineTransparency.setValue(field.getNumberValue(), true); + this._state.LineTransparency = field.getNumberValue() * 2.55; + if (this.api && this.BorderSize>0 && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var stroke = new Asc.asc_CStroke(); + stroke.put_transparent(this._state.LineTransparency); + props.asc_putLine(stroke); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + onLineTransparencyChange: function(field, newValue, oldValue){ + this._sliderChangedLine = newValue; + this.numLineTransparency.setValue(newValue, true); + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updatesliderline = setInterval(_.bind(this._transparencyLineApplyFunc, this), 100); + } + }, + + onLineTransparencyChangeComplete: function(field, newValue, oldValue){ + clearInterval(this.updatesliderline); + this._sliderChangedLine = newValue; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._transparencyLineApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _transparencyLineApplyFunc: function() { + if (this._sliderChangedLine!==undefined) { + this._state.LineTransparency = this._sliderChangedLine * 2.55; + var props = new Asc.asc_TextArtProperties(); + var stroke = new Asc.asc_CStroke(); + stroke.put_transparent(this._state.LineTransparency); + props.asc_putLine(stroke); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + this._sliderChangedLine = undefined; + } + this.fireEvent('editcomplete', this); + }, + + insertFromUrl: function() { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + if (me.BlipFillType !== null) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(me.BlipFillType); + fill.get_fill().put_url(checkUrl); + + props.asc_putFill(fill); + me.shapeprops.put_TextArtProperties(props); + me.api.ShapeApply(me.shapeprops); + } + } + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + }, + + ChangeSettings: function(props) { + if (this.shapeprops==null) { + this.shapeprops = new Asc.asc_CShapeProperty(); + } + + if (this._initSettings) + this.createDelayedElements(); + + this._state.isFromSmartArtInternal = props.get_FromSmartArtInternal(); + this.hideTransformSettings(this._state.isFromSmartArtInternal); + + if (props && props.get_TextArtProperties()) + { + var shapeprops = props.get_TextArtProperties(); + this._noApply = true; + + this.disableControls(this._locked); + + // background colors + var rec = null, + fill = shapeprops.asc_getFill(), + fill_type = (fill) ? fill.get_type() : null, + color = null; + + if (fill) { + var transparency = fill.get_transparent(); + if ( Math.abs(this._state.Transparency-transparency)>0.001 || Math.abs(this.numTransparency.getNumberValue()-transparency)>0.001 || + (this._state.Transparency===null || transparency===null)&&(this._state.Transparency!==transparency || this.numTransparency.getNumberValue()!==transparency)) { + + if (transparency !== undefined) { + this.sldrTransparency.setValue((transparency===null) ? 100 : transparency/255*100, true); + this.numTransparency.setValue(this.sldrTransparency.getValue(), true); + } + this._state.Transparency=transparency; + } + } + + if (fill===null || fill===undefined || fill_type===null) { // заливка не совпадает у неск. фигур + this.OriginalFillType = null; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_NOFILL) { // заливки нет + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_NOFILL; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_SOLID) { + fill = fill.get_fill(); + color = fill.get_color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.ShapeColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.ShapeColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + + } else + this.ShapeColor = {Value: 0, Color: 'transparent'}; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; + this.FGColor = (this.ShapeColor.Color!=='transparent') ? {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)} : {Value: 1, Color: '000000'}; + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.GradColor.colors[0] = (this.ShapeColor.Color!=='transparent') ? Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color) : '000000'; + this.GradColor.colors[this.GradColor.colors.length-1] = 'ffffff'; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_BLIP) { + fill = fill.get_fill(); + this.BlipFillType = fill.get_type(); // null - не совпадают у нескольких фигур + if (this._state.BlipFillType !== this.BlipFillType) { + if (this.BlipFillType == Asc.c_oAscFillBlipType.STRETCH || this.BlipFillType == Asc.c_oAscFillBlipType.TILE) { + this.cmbFillType.setValue(this.BlipFillType); + } else + this.cmbFillType.setValue(''); + this._state.BlipFillType = this.BlipFillType; + } + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_BLIP; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_PATT) { + fill = fill.get_fill(); + this.PatternFillType = fill.get_pattern_type(); // null - не совпадают у нескольких фигур + if (this._state.PatternFillType !== this.PatternFillType) { + this.cmbPattern.suspendEvents(); + var rec = this.cmbPattern.menuPicker.store.findWhere({ + type: this.PatternFillType + }); + this.cmbPattern.menuPicker.selectRecord(rec); + this.cmbPattern.resumeEvents(); + this._state.PatternFillType = this.PatternFillType; + } + + color = fill.get_color_fg(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.FGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.FGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + } else + this.FGColor = {Value: 1, Color: '000000'}; + + color = fill.get_color_bg(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } else { + this.BGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + } else + this.BGColor = {Value: 1, Color: 'ffffff'}; + + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_PATT; + this.ShapeColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)}; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color); + this.GradColor.colors[this.GradColor.colors.length-1] = 'ffffff'; + } else if (fill_type==Asc.c_oAscFill.FILL_TYPE_GRAD) { + fill = fill.get_fill(); + var gradfilltype = fill.get_grad_type(); // null - не совпадают у нескольких фигур + if (this._state.GradFillType !== gradfilltype || this.GradFillType !== gradfilltype) { + this.GradFillType = gradfilltype; + rec = undefined; + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR || this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { + this.cmbGradType.setValue(this.GradFillType); + rec = this.cmbGradType.store.findWhere({value: this.GradFillType}); + this.onGradTypeSelect(this.cmbGradType, rec.attributes); + } else { + this.cmbGradType.setValue(''); + this.typeGradient = -1; + } + this._state.GradFillType = this.GradFillType; + } + + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR ) { + var value = Math.floor(fill.get_linear_angle()/60000); + if (Math.abs(this.GradLinearDirectionType-value)>0.001) { + this.GradLinearDirectionType=value; + var record = this.mnuDirectionPicker.store.findWhere({type: value}); + this.mnuDirectionPicker.selectRecord(record, true); + this.typeGradient = (record)? value + 90 : -1; + this.numGradientAngle.setValue(value, true); + } + } else + this.numGradientAngle.setValue(0, true); + + var me = this; + var colors = fill.get_colors(), + positions = fill.get_positions(), + length = colors ? colors.length : this.GradColor.colors.length; + this.sldrGradient.setThumbs(length); + if (this.GradColor.colors.length>length) { + this.GradColor.colors.splice(length, this.GradColor.colors.length - length); + this.GradColor.values.splice(length, this.GradColor.colors.length - length); + this.GradColor.currentIdx = 0; + } + colors && colors.forEach(function(color, index) { + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + me.GradColor.colors[index] = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value()}; + Common.Utils.ThemeColor.colorValue2EffectId(me.GradColor.colors[index]); + } else { + me.GradColor.colors[index] = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()); + } + } else + me.GradColor.colors[index] = '000000'; + + var position = positions[index]; + if (position!==null) { + position = position/1000; + me.GradColor.values[index] = position; + } + }); + var arrGrCollors=[]; + var scale=(this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR)?1:0.7; + + for (var index=0; index= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); + var curValue = me.GradColor.values[me.GradColor.currentIdx]; + this.spnGradPosition.setValue(Common.UI.isRTL() ? me.sldrGradient.maxValue - curValue : curValue); + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; + this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.ShapeColor = {Value: 1, Color: this.GradColor.colors[0]}; + } + + if ( this._state.FillType!==this.OriginalFillType ) { + this.cmbFillSrc.setValue((this.OriginalFillType===null) ? '' : this.OriginalFillType); + this._state.FillType=this.OriginalFillType; + this.ShowHideElem(this.OriginalFillType); + } + + this.btnTexture && $(this.btnTexture.el).find('.form-control').prop('innerHTML', this.textSelectTexture); + + var type1 = typeof(this.ShapeColor.Color), + type2 = typeof(this._state.ShapeColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue || this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)) || + (type1!='object' && this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0 )) { + + this.btnBackColor.setColor(this.ShapeColor.Color); + if ( typeof(this.ShapeColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.ShapeColor.Color.effectValue ) { + this.colorsBack.select(this.ShapeColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBack.clearSelection(); + } else + this.colorsBack.select(this.ShapeColor.Color,true); + + this._state.ShapeColor = this.ShapeColor.Color; + } + + // border colors + var stroke = shapeprops.asc_getLine(), + strokeType = (stroke) ? stroke.get_type() : null, + borderType, + update = (this._state.StrokeColor == 'transparent' && this.BorderColor.Color !== 'transparent'); // border color was changed for shape without line and then shape was reselected (or apply other settings) + + if (stroke) { + var transparency = stroke.get_transparent(); + if ( Math.abs(this._state.LineTransparency-transparency)>0.001 || Math.abs(this.numLineTransparency.getNumberValue()-transparency)>0.001 || + (this._state.LineTransparency===null || transparency===null)&&(this._state.LineTransparency!==transparency || this.numLineTransparency.getNumberValue()!==transparency)) { + + if (transparency !== undefined) { + this.sldrLineTransparency.setValue((transparency===null) ? 100 : transparency/255*100, true); + this.numLineTransparency.setValue(this.sldrLineTransparency.getValue(), true); + } + this._state.LineTransparency=transparency; + } + + if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { + color = stroke.get_color(); + if (color) { + if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BorderColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }}; + } + else + this.BorderColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b())}; + } + else + this.BorderColor = {Value: 1, Color: 'transparent'}; + } else { + this.BorderColor = {Value: 1, Color: 'transparent'}; + } + borderType = stroke.asc_getPrstDash(); + } else { // no stroke + this.BorderColor = {Value: 0, Color: 'transparent'}; + } + + type1 = typeof(this.BorderColor.Color); + type2 = typeof(this._state.StrokeColor); + + if ( update || (type1 !== type2) || (type1=='object' && + (this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue || this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)) || + (type1!='object' && (this._state.StrokeColor.indexOf(this.BorderColor.Color)<0 || typeof(this.btnBorderColor.color)=='object'))) { + + this.btnBorderColor.setColor(this.BorderColor.Color); + if ( typeof(this.BorderColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.BorderColor.Color.effectValue ) { + this.colorsBorder.select(this.BorderColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBorder.clearSelection(); + } else + this.colorsBorder.select(this.BorderColor.Color,true); + + this._state.StrokeColor = this.BorderColor.Color; + } + + if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { + if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { + var w = stroke.get_width(); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.00001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); + if ( Math.abs(this._state.StrokeWidth-w)>0.00001 || check_value || + (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { + this._state.StrokeWidth = w; + + if (w!==null) w = this._mm2pt(w); + var _selectedItem = (w===null) ? w : _.find(this.cmbBorderSize.store.models, function(item) { + if ( witem.attributes.value-0.0001) { + return true; + } + }); + if (_selectedItem) + this.cmbBorderSize.selectRecord(_selectedItem); + else { + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); + } + this.BorderSize = w; + } + } else if (strokeType == Asc.c_oAscStrokeType.STROKE_NONE) { + this._state.StrokeWidth = 0; + this.BorderSize = this.cmbBorderSize.store.at(0).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + } else { + this._state.StrokeWidth = null; + this.BorderSize = -1; + this.cmbBorderSize.setValue(null); + } + this._state.StrokeType = strokeType; + } + + if (this._state.StrokeBorderType !== borderType) { + this.BorderType = this._state.StrokeBorderType = borderType; + this.cmbBorderType.setValue(borderType); + } + + // pattern colors + type1 = typeof(this.FGColor.Color); + type2 = typeof(this._state.FGColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.FGColor.Color.effectValue!==this._state.FGColor.effectValue || this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)) || + (type1!='object' && this._state.FGColor.indexOf(this.FGColor.Color)<0 )) { + + this.btnFGColor.setColor(this.FGColor.Color); + if ( typeof(this.FGColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.FGColor.Color.effectValue ) { + this.colorsFG.select(this.FGColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsFG.clearSelection(); + } else + this.colorsFG.select(this.FGColor.Color,true); + + this._state.FGColor = this.FGColor.Color; + } + + type1 = typeof(this.BGColor.Color); + type2 = typeof(this._state.BGColor); + + if ( (type1 !== type2) || (type1=='object' && + (this.BGColor.Color.effectValue!==this._state.BGColor.effectValue || this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)) || + (type1!='object' && this._state.BGColor.indexOf(this.BGColor.Color)<0 )) { + + this.btnBGColor.setColor(this.BGColor.Color); + if ( typeof(this.BGColor.Color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == this.BGColor.Color.effectValue ) { + this.colorsBG.select(this.BGColor.Color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBG.clearSelection(); + } else + this.colorsBG.select(this.BGColor.Color,true); + + this._state.BGColor = this.BGColor.Color; + } + + color = this.GradColor.colors[this.GradColor.currentIdx]; + type1 = typeof(color); + type2 = typeof(this._state.GradColor); + + if ( (type1 !== type2) || (type1=='object' && + (color.effectValue!==this._state.GradColor.effectValue || this._state.GradColor.color.indexOf(color.color)<0)) || + (type1!='object' && this._state.GradColor.indexOf(color)<0 )) { + + this.btnGradColor.setColor(color); + if ( typeof(color) == 'object' ) { + var isselected = false; + for (var i=0; i<10; i++) { + if ( Common.Utils.ThemeColor.ThemeValues[i] == color.effectValue ) { + this.colorsGrad.select(color,true); + isselected = true; + break; + } + } + if (!isselected) this.colorsGrad.clearSelection(); + } else + this.colorsGrad.select(color,true); + + this._state.GradColor = color; + } + + var form = shapeprops.asc_getForm(); + if (this._state.FormId!==form) { + this.cmbTransform.suspendEvents(); + var rec = this.cmbTransform.menuPicker.store.findWhere({ + type: form + }); + this.cmbTransform.menuPicker.selectRecord(rec); + this.cmbTransform.resumeEvents(); + this._state.FormId=form; + } + + this._noApply = false; + } + }, + + btnDirectionRedraw: function(slider, gradientColorsStr) { + this.gradientColorsStr = gradientColorsStr; + _.each(this._viewDataLinear, function(item){ + item.gradientColorsStr = gradientColorsStr; + }); + this._viewDataRadial.gradientColorsStr = this.gradientColorsStr; + this.mnuDirectionPicker.store.each(function(item){ + item.set('gradientColorsStr', gradientColorsStr); + }, this); + + if (this.typeGradient == -1) + this.btnDirection.$icon.css({'background': 'none'}); + else if (this.typeGradient == 2) + this.btnDirection.$icon.css({'background': ('radial-gradient(' + gradientColorsStr + ')')}); + else + this.btnDirection.$icon.css({ + 'background': ('linear-gradient(' + this.typeGradient + 'deg, ' + gradientColorsStr + ')') + }); + }, + + createDelayedControls: function() { + var me = this; + + this._arrFillSrc = [ + {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, + {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, + {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, + {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, + {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} + ]; + + this.cmbFillSrc = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-src'), + cls: 'input-group-nr', + style: 'width: 100%;', + menuStyle: 'min-width: 100%;', + editable: false, + data: this._arrFillSrc, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbFillSrc.setValue(this._arrFillSrc[0].value); + this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); + this.lockedControls.push(this.cmbFillSrc); + + var itemWidth = 28, + itemHeight = 28; + this.cmbPattern = new Common.UI.ComboDataView({ + itemWidth: itemWidth, + itemHeight: itemHeight, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-pattern', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big', + itemTemplate: _.template([ + '
', + '', + '
' + ].join('')) + }); + this.cmbPattern.render($('#textart-combo-pattern')); + this.cmbPattern.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); + this.cmbPattern.openButton.menu.on('show:after', function () { + me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + + this.lockedControls.push(this.cmbPattern); + + this.btnInsertFromFile = new Common.UI.Button({ + el: $('#textart-button-from-file') + }); + this.lockedControls.push(this.btnInsertFromFile); + + this.btnInsertFromUrl = new Common.UI.Button({ + el: $('#textart-button-from-url') + }); + this.lockedControls.push(this.btnInsertFromUrl); + + this.btnInsertFromFile.on('click', _.bind(function(btn){ + if (this.api) this.api.ChangeArtImageFromFile(this.BlipFillType); + this.fireEvent('editcomplete', this); + }, this)); + this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this)); + + this._arrFillType = [ + {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, + {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} + ]; + + this.cmbFillType = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrFillType, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbFillType.setValue(this._arrFillType[0].value); + this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); + this.lockedControls.push(this.cmbFillType); + + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#textart-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#textart-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#textart-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#textart-lbl-transparency-end'); + + this._arrGradType = [ + {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, + {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} + ]; + + this.cmbGradType = new Common.UI.ComboBox({ + el: $('#textart-combo-grad-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 100%;', + editable: false, + data: this._arrGradType, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbGradType.setValue(this._arrGradType[0].value); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.lockedControls.push(this.cmbGradType); + + this._viewDataLinear = [ + { type:45, subtype:-1}, + { type:90, subtype:4}, + { type:135, subtype:5}, + { type:0, subtype:6, cls: 'item-gradient-separator', selected: true}, + { type:180, subtype:1}, + { type:315, subtype:2}, + { type:270, subtype:3}, + { type:225, subtype:7} + ]; + _.each(this._viewDataLinear, function(item){ + item.gradientColorsStr = me.gradientColorsStr; + }); + + this._viewDataRadial = [ + { type:2, subtype:5, gradientColorsStr: this.gradientColorsStr} + ]; + + this.btnDirection = new Common.UI.Button({ + cls : 'btn-large-dataview', + scaling : false, + iconCls : 'item-gradient gradient-left', + menu : new Common.UI.Menu({ + style: 'min-width: 60px;', + menuAlign: 'tr-br', + items: [ + { template: _.template('
') } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.btnDirection.on('render:after', function(btn) { + me.mnuDirectionPicker = new Common.UI.DataView({ + el: $('#id-textart-menu-direction'), + parentMenu: btn.menu, + restoreHeight: 174, + store: new Common.UI.DataViewStore(me._viewDataLinear), + itemTemplate: _.template('
') + }); + }); + this.btnDirection.render($('#textart-button-direction')); + this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.lockedControls.push(this.btnDirection); + + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#textart-slider-gradient'), + width: 192, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + var pos = me.GradColor.values[me.GradColor.currentIdx]; + me.spnGradPosition.setValue(Common.UI.isRTL() ? me.sldrGradient.maxValue - pos : pos, true); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){ + var colors = [], + currentIdx; + _.each (recalc_indexes, function(recalc_index, index) { + colors.push(me.GradColor.colors[recalc_index]); + if (me.GradColor.currentIdx == recalc_index) + currentIdx = index; + }); + me.OriginalFillType = null; + me.GradColor.colors = colors; + me.GradColor.currentIdx = currentIdx; + }); + this.sldrGradient.on('addthumb', function(cmp, index, pos){ + me.GradColor.colors[index] = me.GradColor.colors[me.GradColor.currentIdx]; + me.GradColor.currentIdx = index; + var color = me.sldrGradient.addNewThumb(index, pos); + me.GradColor.colors[me.GradColor.currentIdx] = color; + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= me.GradColor.colors.length) { + var newIndex = index > 0 ? index - 1 : index; + newIndex = (newIndex === 0 && me.GradColor.values.length > 2) ? me.GradColor.values.length - 2 : newIndex; + me.GradColor.currentIdx = newIndex; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); + }); + this.lockedControls.push(this.sldrGradient); + + this.spnGradPosition = new Common.UI.MetricSpinner({ + el: $('#textart-gradient-position'), + step: 1, + width: 60, + defaultUnit : "%", + value: '50 %', + allowDecimal: false, + maxValue: 100, + minValue: 0, + disabled: this._locked, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.spnGradPosition); + this.spnGradPosition.on('change', _.bind(this.onPositionChange, this)); + this.spnGradPosition.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.btnAddGradientStep = new Common.UI.Button({ + parentEl: $('#textart-gradient-add-step'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-add-breakpoint', + disabled: this._locked, + hint: this.tipAddGradientPoint, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnAddGradientStep.on('click', _.bind(this.onAddGradientStep, this)); + this.lockedControls.push(this.btnAddGradientStep); + + this.btnRemoveGradientStep = new Common.UI.Button({ + parentEl: $('#textart-gradient-remove-step'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-remove-breakpoint', + disabled: this._locked, + hint: this.tipRemoveGradientPoint, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.btnRemoveGradientStep.on('click', _.bind(this.onRemoveGradientStep, this)); + this.lockedControls.push(this.btnRemoveGradientStep); + + this.numGradientAngle = new Common.UI.MetricSpinner({ + el: $('#textart-spin-gradient-angle'), + step: 10, + width: 60, + defaultUnit : "°", + value: '0 °', + allowDecimal: true, + maxValue: 359.9, + minValue: 0, + disabled: this._locked, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.numGradientAngle); + this.numGradientAngle.on('change', _.bind(this.onGradientAngleChange, this)); + this.numGradientAngle.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ + el: $('#textart-combo-border-size'), + style: "width: 93px;", + txtNoBorders: this.txtNoBorders, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }) + .on('selected', _.bind(this.onBorderSizeSelect, this)) + .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) + .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.lockedControls.push(this.cmbBorderSize); + + this.cmbBorderType = new Common.UI.ComboBorderType({ + el: $('#textart-combo-border-type'), + style: "width: 93px;", + menuStyle: 'min-width: 93px;', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }).on('selected', _.bind(this.onBorderTypeSelect, this)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderType = Asc.c_oDashType.solid; + this.cmbBorderType.setValue(this.BorderType); + this.lockedControls.push(this.cmbBorderType); + + + this.numLineTransparency = new Common.UI.MetricSpinner({ + el: $('#textart-line-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.numLineTransparency.on('change', _.bind(this.onNumLineTransparencyChange, this)); + this.numLineTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.numLineTransparency); + + this.sldrLineTransparency = new Common.UI.SingleSlider({ + el: $('#textart-line-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrLineTransparency.on('change', _.bind(this.onLineTransparencyChange, this)); + this.sldrLineTransparency.on('changecomplete', _.bind(this.onLineTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrLineTransparency); + + this.lblLineTransparencyStart = $(this.el).find('#textart-line-lbl-transparency-start'); + this.lblLineTransparencyEnd = $(this.el).find('#textart-line-lbl-transparency-end'); + + this.cmbTransform = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-textart', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbTransform.render($('#textart-combo-transform')); + this.cmbTransform.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbTransform.on('click', _.bind(this.onTransformSelect, this)); + this.cmbTransform.openButton.menu.on('show:after', function () { + me.cmbTransform.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbTransform); + + }, + + createDelayedElements: function() { + this._initSettings = false; + this.createDelayedControls(); + + var global_hatch_menu_map = [ + 0,1,3,2,4, + 53,5,6,7,8, + 9,10,11,12,13, + 14,15,16,17,18, + 19,20,22,23,24, + 25,27,28,29,30, + 31,32,33,34,35, + 36,37,38,39,40, + 41,42,43,44,45, + 46,49,50,51,52 + ]; + + this.patternViewData = []; + for (var i=0; i<13; i++) { + for (var j=0; j<4; j++) { + var num = i*4+j; + this.patternViewData[num] = {offsetx: j*28, offsety: i*28, type: global_hatch_menu_map[num]}; + } + } + this.patternViewData.splice(this.patternViewData.length-2, 2); + + for ( var i=0; i 0) { + this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),true); + this.PatternFillType = this.patternViewData[0].type; + } + this.UpdateThemeColors(); + this.onInitStandartTextures(); + this.fillTextArt(); + this.fillTransform(this.api.asc_getPropertyEditorTextArts()); + }, + + onInitStandartTextures: function(texture) { + var me = this; + if ((!texture || texture.length<1) && (!me._texturearray || me._texturearray.length<1)) { + texture = PDFE.getController('Toolbar')._textureTemp; + } + if (texture && texture.length>0){ + me._texturearray = []; + _.each(texture, function(item){ + me._texturearray.push({ + imageUrl: item.get_image(), + name : me.textureNames[item.get_id()], + type : item.get_id(), +// allowSelected : false, + selected: false + }); + }); + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-texture'), + template: _.template([ + '' + ].join('')) + }); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
') } + ] + }); + this.textureMenu.render($('#textart-combo-fill-texture')); + this.lockedControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-textart-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); + } + }, + + onSelectTexture: function(picker, view, record){ + this._fromTextureCmb = true; + this.cmbFillType.setValue(this._arrFillType[1].value); + this._fromTextureCmb = false; + + if (this.api) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(Asc.c_oAscFillBlipType.TILE); + fill.get_fill().put_texture_id(record.get('type')); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + $(this.btnTexture.el).find('.form-control').prop('innerHTML', record.get('name')); + this.fireEvent('editcomplete', this); + }, + + fillTextArt: function() { + if (this._initSettings) return; + var me = this; + if (!this.cmbTextArt) { + this.cmbTextArt = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 300, + enableKeyEvents: true, + showLast: false, + cls: 'combo-textart', + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbTextArt.render($('#textart-combo-template')); + this.cmbTextArt.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbTextArt.on('click', _.bind(this.onTextArtSelect, this)); + this.cmbTextArt.openButton.menu.on('show:after', function () { + me.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbTextArt); + } + + var models = this.application.getCollection('Common.Collections.TextArt').models, + count = this.cmbTextArt.menuPicker.store.length; + if (models.length<1) { + PDFE.getController('Main').fillTextArt(this.api.asc_getTextArtPreviews()); + return; + } + if (count>0 && count==models.length) { + var data = this.cmbTextArt.menuPicker.store.models; + _.each(models, function(template, index){ + data[index].set('imageUrl', template.get('imageUrl')); + }); + } else { + this.cmbTextArt.menuPicker.store.reset(models); + if (this.cmbTextArt.menuPicker.store.length > 0) + this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0)); + } + }, + + onTextArtSelect: function(combo, record){ + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + props.asc_putStyle(record.get('data')); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + fillTransform: function(transforms) { + if (transforms){ + var artStore = []; + for (var i=0; i 0) { + this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),true); + } + } + }, + + onTransformSelect: function(combo, record){ + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + props.asc_putForm(record.get('type')); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + this.fireEvent('editcomplete', this); + }, + + UpdateThemeColors: function() { + if (this._initSettings) return; + if (!this.btnBackColor) { + var config = Common.define.simpleColorsConfig; + this.btnBackColor = new Common.UI.ColorButton({ + parentEl: $('#textart-back-color-btn'), + transparent: true, + color: 'transparent', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBackColor); + this.colorsBack = this.btnBackColor.getPicker(); + this.btnBackColor.on('color:select', _.bind(this.onColorsBackSelect, this)); + this.btnBackColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBackColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnFGColor = new Common.UI.ColorButton({ + parentEl: $('#textart-foreground-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnFGColor); + this.colorsFG = this.btnFGColor.getPicker(); + this.btnFGColor.on('color:select', _.bind(this.onColorsFGSelect, this)); + this.btnFGColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnFGColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnBGColor = new Common.UI.ColorButton({ + parentEl: $('#textart-background-color-btn'), + color: 'ffffff', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBGColor); + this.colorsBG = this.btnBGColor.getPicker(); + this.btnBGColor.on('color:select', _.bind(this.onColorsBGSelect, this)); + this.btnBGColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBGColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnGradColor = new Common.UI.ColorButton({ + parentEl: $('#textart-gradient-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnGradColor); + this.colorsGrad = this.btnGradColor.getPicker(); + this.btnGradColor.on('color:select', _.bind(this.onColorsGradientSelect, this)); + this.btnGradColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnGradColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + + this.btnBorderColor = new Common.UI.ColorButton({ + parentEl: $('#textart-border-color-btn'), + color: '000000', + // eyeDropper: true, + colors: config.colors, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + paletteCls: config.cls, + paletteWidth: config.paletteWidth, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.lockedControls.push(this.btnBorderColor); + this.colorsBorder = this.btnBorderColor.getPicker(); + this.btnBorderColor.on('color:select', _.bind(this.onColorsBorderSelect, this)); + this.btnBorderColor.on('eyedropper:start', _.bind(this.onEyedropperStart, this)); + this.btnBorderColor.on('eyedropper:end', _.bind(this.onEyedropperEnd, this)); + } + + // this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + // this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + }, + + _pt2mm: function(value) { + return (value * 25.4 / 72.0); + }, + + _mm2pt: function(value) { + return (value * 72.0 / 25.4); + }, + + ShowHideElem: function(value) { + this.FillColorContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_SOLID); + this.FillImageContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_BLIP); + this.FillPatternContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_PATT); + this.FillGradientContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_GRAD); + this.TransparencyContainer.toggleClass('settings-hidden', (value === Asc.c_oAscFill.FILL_TYPE_NOFILL || value === null)); + this.fireEvent('updatescroller', this); + }, + + setLocked: function (locked) { + this._locked = locked; + }, + + disableControls: function(disable) { + if (this._initSettings) return; + + if (this._state.DisabledControls!==disable) { + this._state.DisabledControls = disable; + _.each(this.lockedControls, function(item) { + item.setDisabled(disable); + }); + this.numGradientAngle.setDisabled(disable || this.GradFillType !== Asc.c_oAscFillGradType.GRAD_LINEAR); + this.lblLineTransparencyStart.toggleClass('disabled', disable); + this.lblLineTransparencyEnd.toggleClass('disabled', disable); + } + }, + + onPositionChange: function(btn) { + var pos = btn.getNumberValue(); + if (Common.UI.isRTL()) { + pos = this.sldrGradient.maxValue - pos; + } + var minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], + maxValue = (this.GradColor.currentIdx+1 maxValue; + if (this.api) { + this.GradColor.values[this.GradColor.currentIdx] = pos; + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + var arr = []; + this.GradColor.values.forEach(function(item){ + arr.push(item*1000); + }); + fill.get_fill().put_positions(arr); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + + if (needSort) { + this.sldrGradient.sortThumbs(); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + } + } + }, + + onAddGradientStep: function() { + if (this.GradColor.colors.length > 9) return; + var curIndex = this.GradColor.currentIdx; + var pos = (this.GradColor.values[curIndex] + this.GradColor.values[curIndex < this.GradColor.colors.length - 1 ? curIndex + 1 : curIndex - 1]) / 2; + + this.GradColor.colors[this.GradColor.colors.length] = this.GradColor.colors[curIndex]; + this.GradColor.currentIdx = this.GradColor.colors.length - 1; + var color = this.sldrGradient.addNewThumb(undefined, pos, curIndex); + this.GradColor.colors[this.GradColor.currentIdx] = color; + + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + }, + + onRemoveGradientStep: function() { + if (this.GradColor.values.length < 3) return; + var index = this.GradColor.currentIdx; + this.GradColor.values.splice(this.GradColor.currentIdx, 1); + this.sldrGradient.removeThumb(this.GradColor.currentIdx); + if (_.isUndefined(this.GradColor.currentIdx) || this.GradColor.currentIdx >= this.GradColor.colors.length) { + var newIndex = index > 0 ? index - 1 : index; + newIndex = (newIndex === 0 && this.GradColor.values.length > 2) ? this.GradColor.values.length - 2 : newIndex; + this.GradColor.currentIdx = newIndex; + } + this.sldrGradient.setActiveThumb(this.GradColor.currentIdx); + this.sldrGradient.trigger('change', this.sldrGradient); + this.sldrGradient.trigger('changecomplete', this.sldrGradient); + }, + + onGradientAngleChange: function(field, newValue, oldValue, eOpts) { + if (this.api && !this._noApply) { + var props = new Asc.asc_TextArtProperties(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD); + fill.put_fill( new Asc.asc_CFillGrad()); + fill.get_fill().put_grad_type(this.GradFillType); + fill.get_fill().put_linear_angle(field.getNumberValue() * 60000); + fill.get_fill().put_linear_scale(true); + props.asc_putFill(fill); + this.shapeprops.put_TextArtProperties(props); + this.api.ShapeApply(this.shapeprops); + } + }, + + onWindowResize: function() { + if (!this._initSettings && this._state.applicationPixelRatio !== Common.Utils.applicationPixelRatio()) + this.fillTransform(this.api.asc_getPropertyEditorTextArts()); + + this._state.applicationPixelRatio = Common.Utils.applicationPixelRatio(); + }, + + hideTransformSettings: function(value) { + if (this._state.HideTransformSettings !== value) { + this._state.HideTransformSettings = value; + this.TransformSettings.toggleClass('hidden', value === true); + } + }, + + onEyedropperStart: function (btn) { + this.api.asc_startEyedropper(_.bind(btn.eyedropperEnd, btn)); + this.fireEvent('eyedropper', true); + }, + + onEyedropperEnd: function () { + this.fireEvent('eyedropper', false); + }, + + txtNoBorders : 'No Line', + strStroke : 'Stroke', + strColor : 'Color', + strSize : 'Size', + strFill : 'Fill', + textColor : 'Color Fill', + textImageTexture : 'Picture or Texture', + textTexture : 'From Texture', + textFromUrl : 'From URL', + textFromFile : 'From File', + textStretch : 'Stretch', + textTile : 'Tile', + txtCanvas : 'Canvas', + txtCarton : 'Carton', + txtDarkFabric : 'Dark Fabric', + txtGrain : 'Grain', + txtGranite : 'Granite', + txtGreyPaper : 'Grey Paper', + txtKnit : 'Knit', + txtLeather : 'Leather', + txtBrownPaper : 'Brown Paper', + txtPapyrus : 'Papyrus', + txtWood : 'Wood', + strTransparency : 'Opacity', + textNoFill : 'No Fill', + textSelectTexture : 'Select', + textGradientFill: 'Gradient Fill', + textPatternFill: 'Pattern', + strBackground: 'Background color', + strForeground: 'Foreground color', + strPattern: 'Pattern', + textEmptyPattern: 'No Pattern', + textLinear: 'Linear', + textRadial: 'Radial', + textDirection: 'Direction', + textStyle: 'Style', + textGradient: 'Gradient Points', + textBorderSizeErr: 'The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.', + textTransform: 'Transform', + textTemplate: 'Template', + strType: 'Type', + textPosition: 'Position', + tipAddGradientPoint: 'Add gradient point', + tipRemoveGradientPoint: 'Remove gradient point', + textAngle: 'Angle' + }, PDFE.Views.TextArtSettings || {})); +}); diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index f006de7ada..921edf4703 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -57,9 +57,10 @@ define([ 'common/main/lib/component/Menu', 'common/main/lib/component/Window', 'common/main/lib/component/ComboBoxFonts', - 'common/main/lib/component/ComboDataView' - ,'common/main/lib/component/SynchronizeTip' - ,'common/main/lib/component/Mixtbar' + 'common/main/lib/component/ComboDataView', + 'common/main/lib/component/SynchronizeTip', + 'common/main/lib/component/Mixtbar', + 'common/main/lib/component/ComboDataViewShape' ], function ($, _, Backbone, template, template_view) { 'use strict'; @@ -73,6 +74,7 @@ define([ cutLock: 'can-cut', inLightTheme: 'light-theme', noParagraphSelected: 'no-paragraph', + noTextSelected: 'no-text', cantPrint: 'cant-print', lostConnect: 'disconnect', disableOnStart: 'on-start', @@ -80,7 +82,19 @@ define([ lastPage: 'last-page', requiredNotFilled: 'required-not-filled', submit: 'submit', - fileMenuOpened: 'file-menu-opened' + fileMenuOpened: 'file-menu-opened', + paragraphLock: 'para-lock', + shapeLock: 'shape-lock', + incIndentLock: 'can-inc-indent', + decIndentLock: 'can-dec-indent', + hyperlinkLock: 'can-hyperlink', + noObjectSelected: 'no-object', // no objects in stack from asc_onFocusObject event + noDrawingObjects: 'no-drawing-object', // asc_getSelectedDrawingObjectsCount<1 (2 selected tables: noObjectSelected=true, noDrawingObjects = false) + noColumns: 'no-columns', + inSmartart: 'in-smartart', + inSmartartInternal: 'in-smartart-internal', + inEquation: 'in-equation', + inAnnotation: 'in-annotation' }; for (var key in enumLock) { if (enumLock.hasOwnProperty(key)) { @@ -110,14 +124,612 @@ define([ this.paragraphControls = []; this.toolbarControls = []; + this.shapeControls = []; this._state = { hasCollaborativeChanges: undefined }; - Common.NotificationCenter.on('app:ready', me.onAppReady.bind(this)); return this; }, + applyLayoutPDFEdit: function(config) { + if (!config.isPDFEdit) return; + + var _set = Common.enumLock, + arr = [] + // tab Edit + this.btnEditText = new Common.UI.Button({ + id: 'id-toolbar-btn-edittext', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-edit-text', + lock: [_set.lostConnect, _set.disableOnStart], + caption: this.capBtnEditText, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnEditText); + arr.push(this.btnEditText); + + this.cmbFontName = new Common.UI.ComboBoxFonts({ + cls: 'input-group-nr', + menuCls: 'scrollable-menu', + menuStyle: 'min-width: 325px;', + hint: this.tipFontName, + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + store: new Common.Collections.Fonts(), + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.cmbFontName); + arr.push(this.cmbFontName); + + this.cmbFontSize = new Common.UI.ComboBox({ + cls: 'input-group-nr', + menuStyle: 'min-width: 55px;', + hint: this.tipFontSize, + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + data: [ + {value: 8, displayValue: "8"}, + {value: 9, displayValue: "9"}, + {value: 10, displayValue: "10"}, + {value: 11, displayValue: "11"}, + {value: 12, displayValue: "12"}, + {value: 14, displayValue: "14"}, + {value: 16, displayValue: "16"}, + {value: 18, displayValue: "18"}, + {value: 20, displayValue: "20"}, + {value: 22, displayValue: "22"}, + {value: 24, displayValue: "24"}, + {value: 26, displayValue: "26"}, + {value: 28, displayValue: "28"}, + {value: 36, displayValue: "36"}, + {value: 48, displayValue: "48"}, + {value: 72, displayValue: "72"}, + {value: 96, displayValue: "96"} + ], + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.cmbFontSize); + arr.push(this.cmbFontSize); + + this.btnIncFontSize = new Common.UI.Button({ + id: 'id-toolbar-btn-incfont', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-incfont', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.btnIncFontSize); + arr.push(this.btnIncFontSize); + + this.btnDecFontSize = new Common.UI.Button({ + id: 'id-toolbar-btn-decfont', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-decfont', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.btnDecFontSize); + arr.push(this.btnDecFontSize); + + this.btnBold = new Common.UI.Button({ + id: 'id-toolbar-btn-bold', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-bold', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnBold); + arr.push(this.btnBold); + + this.btnItalic = new Common.UI.Button({ + id: 'id-toolbar-btn-italic', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-italic', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnItalic); + arr.push(this.btnItalic); + + this.btnTextUnderline = new Common.UI.Button({ + id: 'id-toolbar-btn-underline', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-underline', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnTextUnderline); + arr.push(this.btnTextUnderline); + + this.btnTextStrikeout = new Common.UI.Button({ + id: 'id-toolbar-btn-strikeout', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-strikeout', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnTextStrikeout); + arr.push(this.btnTextStrikeout); + + this.btnSuperscript = new Common.UI.Button({ + id: 'id-toolbar-btn-superscript', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-superscript', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart, _set.inEquation], + enableToggle: true, + toggleGroup: 'superscriptGroup', + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnSuperscript); + arr.push(this.btnSuperscript); + + this.btnSubscript = new Common.UI.Button({ + id: 'id-toolbar-btn-subscript', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-subscript', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart, _set.inEquation], + enableToggle: true, + toggleGroup: 'superscriptGroup', + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnSubscript); + arr.push(this.btnSubscript); + + this.btnTextHighlightColor = new Common.UI.ButtonColored({ + id: 'id-toolbar-btn-text-highlight', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-highlight', + enableToggle: true, + allowDepress: true, + split: true, + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart, _set.inAnnotation], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -16', + menu: new Common.UI.Menu({ + style: 'min-width: 100px;', + items: [ + {template: _.template('
')}, + {caption: '--'}, + this.mnuTextHighlightTransparent = new Common.UI.MenuItem({ + caption: this.strMenuNoFill, + checkable: true + }) + ] + }) + }); + this.paragraphControls.push(this.btnTextHighlightColor); + arr.push(this.btnTextHighlightColor); + + this.btnFontColor = new Common.UI.ButtonColored({ + id: 'id-toolbar-btn-fontcolor', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-fontcolor', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + split: true, + menu: true, + eyeDropper: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -16', + penOptions: {color: '000000'} + }); + this.paragraphControls.push(this.btnFontColor); + arr.push(this.btnFontColor); + + this.btnChangeCase = new Common.UI.Button({ + id: 'id-toolbar-btn-case', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-change-case', + lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart], + menu: new Common.UI.Menu({ + items: [ + {caption: this.mniSentenceCase, value: Asc.c_oAscChangeTextCaseType.SentenceCase}, + {caption: this.mniLowerCase, value: Asc.c_oAscChangeTextCaseType.LowerCase}, + {caption: this.mniUpperCase, value: Asc.c_oAscChangeTextCaseType.UpperCase}, + {caption: this.mniCapitalizeWords, value: Asc.c_oAscChangeTextCaseType.CapitalizeWords}, + {caption: this.mniToggleCase, value: Asc.c_oAscChangeTextCaseType.ToggleCase} + ] + }), + dataHint: '1', + dataHintDirection: 'top', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnChangeCase); + arr.push(this.btnChangeCase); + this.mnuChangeCase = this.btnChangeCase.menu; + + this.btnClearStyle = new Common.UI.Button({ + id: 'id-toolbar-btn-clearstyle', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-clearstyle', + lock: [ _set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.paragraphControls.push(this.btnClearStyle); + arr.push(this.btnClearStyle); + + this.btnMarkers = new Common.UI.Button({ + id: 'id-toolbar-btn-markers', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon ' + (!Common.UI.isRTL() ? 'btn-setmarkers' : 'btn-setmarkers-rtl'), + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.inSmartart, _set.inSmartartInternal, _set.disableOnStart, _set.inAnnotation], + enableToggle: true, + toggleGroup: 'markersGroup', + split: true, + menu: true, + dataHint: '1', + dataHintDirection: 'top', + dataHintOffset: '0, -16' + }); + this.paragraphControls.push(this.btnMarkers); + arr.push(this.btnMarkers); + + this.btnNumbers = new Common.UI.Button({ + id: 'id-toolbar-btn-numbering', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon ' + (!Common.UI.isRTL() ? 'btn-numbering' : 'btn-numbering-rtl'), + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.inSmartart, _set.inSmartartInternal, _set.disableOnStart, _set.inAnnotation], + enableToggle: true, + toggleGroup: 'markersGroup', + split: true, + menu: true, + dataHint: '1', + dataHintDirection: 'top', + dataHintOffset: '0, -16' + }); + this.paragraphControls.push(this.btnNumbers); + arr.push(this.btnNumbers); + + var clone = function (source) { + var obj = {}; + for (var prop in source) + obj[prop] = (typeof(source[prop]) == 'object') ? clone(source[prop]) : source[prop]; + return obj; + }; + + this.mnuMarkersPicker = { + conf: {index: 0}, + selectByIndex: function (idx) { + this.conf.index = idx; + } + }; + this.mnuNumbersPicker = clone(this.mnuMarkersPicker); + + this.btnHorizontalAlign = new Common.UI.Button({ + id: 'id-toolbar-btn-halign', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-align-left', + icls: 'btn-align-left', + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.disableOnStart, _set.inAnnotation], + menu: new Common.UI.Menu({ + items: [ + { + caption: this.textAlignLeft + Common.Utils.String.platformKey('Ctrl+L'), + iconCls: 'menu__icon btn-align-left', + icls: 'btn-align-left', + checkable: true, + checkmark: false, + toggleGroup: 'halignGroup', + checked: true, + value: 1 + }, + { + caption: this.textAlignCenter + Common.Utils.String.platformKey('Ctrl+E'), + iconCls: 'menu__icon btn-align-center', + icls: 'btn-align-center', + checkable: true, + checkmark: false, + toggleGroup: 'halignGroup', + value: 2 + }, + { + caption: this.textAlignRight + Common.Utils.String.platformKey('Ctrl+R'), + iconCls: 'menu__icon btn-align-right', + icls: 'btn-align-right', + checkable: true, + checkmark: false, + toggleGroup: 'halignGroup', + value: 0 + }, + { + caption: this.textAlignJust + Common.Utils.String.platformKey('Ctrl+J'), + iconCls: 'menu__icon btn-align-just', + icls: 'btn-align-just', + checkable: true, + checkmark: false, + toggleGroup: 'halignGroup', + value: 3 + } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnHorizontalAlign); + arr.push(this.btnHorizontalAlign); + + this.btnVerticalAlign = new Common.UI.Button({ + id: 'id-toolbar-btn-valign', + cls: 'btn-toolbar', + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.noObjectSelected, _set.disableOnStart, _set.inAnnotation], + iconCls: 'toolbar__icon btn-align-middle', + icls: 'btn-align-middle', + menu: new Common.UI.Menu({ + items: [ + { + caption: this.textAlignTop, + iconCls: 'menu__icon btn-align-top', + icls: 'btn-align-top', + checkable: true, + checkmark: false, + toggleGroup: 'valignGroup', + value: Asc.c_oAscVAlign.Top + }, + { + caption: this.textAlignMiddle, + iconCls: 'menu__icon btn-align-middle', + icls: 'btn-align-middle', + checkable: true, + checkmark: false, + toggleGroup: 'valignGroup', + value: Asc.c_oAscVAlign.Center, + checked: true + }, + { + caption: this.textAlignBottom, + iconCls: 'menu__icon btn-align-bottom', + icls: 'btn-align-bottom', + checkable: true, + checkmark: false, + toggleGroup: 'valignGroup', + value: Asc.c_oAscVAlign.Bottom + } + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnVerticalAlign); + arr.push(this.btnVerticalAlign); + + this.btnDecLeftOffset = new Common.UI.Button({ + id: 'id-toolbar-btn-decoffset', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-decoffset', + lock: [_set.decIndentLock, _set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.inSmartart, _set.inSmartartInternal, _set.disableOnStart, _set.inAnnotation], + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.btnDecLeftOffset); + arr.push(this.btnDecLeftOffset); + + this.btnIncLeftOffset = new Common.UI.Button({ + id: 'id-toolbar-btn-incoffset', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-incoffset', + lock: [_set.incIndentLock, _set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.inSmartart, _set.inSmartartInternal, _set.disableOnStart, _set.inAnnotation], + dataHint: '1', + dataHintDirection: 'top' + }); + this.paragraphControls.push(this.btnIncLeftOffset); + arr.push(this.btnIncLeftOffset); + + this.btnLineSpace = new Common.UI.Button({ + id: 'id-toolbar-btn-linespace', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-linespace', + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.disableOnStart, _set.inAnnotation], + menu: new Common.UI.Menu({ + style: 'min-width: 60px;', + items: [ + {caption: '1.0', value: 1.0, checkable: true, toggleGroup: 'linesize'}, + {caption: '1.15', value: 1.15, checkable: true, toggleGroup: 'linesize'}, + {caption: '1.5', value: 1.5, checkable: true, toggleGroup: 'linesize'}, + {caption: '2.0', value: 2.0, checkable: true, toggleGroup: 'linesize'}, + {caption: '2.5', value: 2.5, checkable: true, toggleGroup: 'linesize'}, + {caption: '3.0', value: 3.0, checkable: true, toggleGroup: 'linesize'} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnLineSpace); + arr.push(this.btnLineSpace); + + this.btnColumns = new Common.UI.Button({ + id: 'id-toolbar-btn-columns', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-columns-two', + lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.noColumns, _set.disableOnStart, _set.inAnnotation], + menu: new Common.UI.Menu({ + cls: 'ppm-toolbar shifted-right', + items: [ + { + caption: this.textColumnsOne, + iconCls: 'menu__icon btn-columns-one', + checkable: true, + checkmark: false, + toggleGroup: 'menuColumns', + value: 0 + }, + { + caption: this.textColumnsTwo, + iconCls: 'menu__icon btn-columns-two', + checkable: true, + checkmark: false, + toggleGroup: 'menuColumns', + value: 1 + }, + { + caption: this.textColumnsThree, + iconCls: 'menu__icon btn-columns-three', + checkable: true, + checkmark: false, + toggleGroup: 'menuColumns', + value: 2 + }, + {caption: '--'}, + {caption: this.textColumnsCustom, value: 'advanced'} + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.paragraphControls.push(this.btnColumns); + arr.push(this.btnColumns); + + this.mniAlignToSlide = new Common.UI.MenuItem({ + caption: this.txtPageAlign, + checkable: true, + toggleGroup: 'slidealign', + value: -1 + }).on('click', function (mnu) { + Common.Utils.InternalSettings.set("pdfe-align-to-slide", true); + }); + this.mniAlignObjects = new Common.UI.MenuItem({ + caption: this.txtObjectsAlign, + checkable: true, + toggleGroup: 'slidealign', + value: -1 + }).on('click', function (mnu) { + Common.Utils.InternalSettings.set("pdfe-align-to-slide", false); + }); + + this.mniDistribHor = new Common.UI.MenuItem({ + caption: this.txtDistribHor, + iconCls: 'menu__icon btn-shape-distribute-hor', + value: 6 + }); + this.mniDistribVert = new Common.UI.MenuItem({ + caption: this.txtDistribVert, + iconCls: 'menu__icon btn-shape-distribute-vert', + value: 7 + }); + + this.btnShapeAlign = new Common.UI.Button({ + id: 'id-toolbar-btn-shape-align', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-shape-align-left', + lock: [_set.shapeLock, _set.lostConnect, _set.noDrawingObjects, _set.disableOnStart], + menu: new Common.UI.Menu({ + cls: 'shifted-right', + items: [ + { + caption: this.textShapeAlignLeft, + iconCls: 'menu__icon btn-shape-align-left', + value: Asc.c_oAscAlignShapeType.ALIGN_LEFT + }, + { + caption: this.textShapeAlignCenter, + iconCls: 'menu__icon btn-shape-align-center', + value: Asc.c_oAscAlignShapeType.ALIGN_CENTER + }, + { + caption: this.textShapeAlignRight, + iconCls: 'menu__icon btn-shape-align-right', + value: Asc.c_oAscAlignShapeType.ALIGN_RIGHT + }, + { + caption: this.textShapeAlignTop, + iconCls: 'menu__icon btn-shape-align-top', + value: Asc.c_oAscAlignShapeType.ALIGN_TOP + }, + { + caption: this.textShapeAlignMiddle, + iconCls: 'menu__icon btn-shape-align-middle', + value: Asc.c_oAscAlignShapeType.ALIGN_MIDDLE + }, + { + caption: this.textShapeAlignBottom, + iconCls: 'menu__icon btn-shape-align-bottom', + value: Asc.c_oAscAlignShapeType.ALIGN_BOTTOM + }, + {caption: '--'}, + this.mniDistribHor, + this.mniDistribVert, + {caption: '--'}, + this.mniAlignToSlide, + this.mniAlignObjects + ] + }), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: '0, -6' + }); + this.shapeControls.push(this.btnShapeAlign); + arr.push(this.btnShapeAlign); + + this.btnShapeArrange = new Common.UI.Button({ + id: 'id-toolbar-btn-shape-arrange', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrange-front', + lock: [_set.lostConnect, _set.noDrawingObjects, _set.disableOnStart], + menu: new Common.UI.Menu({ + items: [ + this.mnuArrangeFront = new Common.UI.MenuItem({ + caption: this.textArrangeFront, + iconCls: 'menu__icon btn-arrange-front', + value: 1 + }), + this.mnuArrangeBack = new Common.UI.MenuItem({ + caption: this.textArrangeBack, + iconCls: 'menu__icon btn-arrange-back', + value: 2 + }), + this.mnuArrangeForward = new Common.UI.MenuItem({ + caption: this.textArrangeForward, + iconCls: 'menu__icon btn-arrange-forward', + value: 3 + }), + this.mnuArrangeBackward = new Common.UI.MenuItem({ + caption: this.textArrangeBackward, + iconCls: 'menu__icon btn-arrange-backward', + value: 4 + }), + // {caption: '--'}, + // this.mnuGroupShapes = new Common.UI.MenuItem({ + // caption: this.txtGroup, + // iconCls: 'menu__icon btn-shape-group', + // value: 5 + // }), + // this.mnuUnGroupShapes = new Common.UI.MenuItem({ + // caption: this.txtUngroup, + // iconCls: 'menu__icon btn-shape-ungroup', + // value: 6 + // }) + ] + }), + dataHint: '1', + dataHintDirection: 'top', + dataHintOffset: '0, -6' + }); + this.shapeControls.push(this.btnShapeArrange); + arr.push(this.btnShapeArrange); + + return arr; + }, + applyLayout: function (config) { var me = this; me.lockControls = []; @@ -173,6 +785,20 @@ define([ }); this.toolbarControls.push(this.btnAddComment); + this.btnTextComment = new Common.UI.Button({ + id: 'tlbtn-textcomment', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-text-comment', + lock: [_set.disableOnStart], + caption: this.capBtnTextComment, + menu: true, + split: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnTextComment); + this.chShowComments = new Common.UI.CheckBox({ lock: [_set.disableOnStart], labelText: this.capBtnShowComments, @@ -187,7 +813,7 @@ define([ id: 'id-toolbar-btn-strikeout', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-strikeout', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + lock: [_set.lostConnect, _set.disableOnStart], enableToggle: true, allowDepress: true, split: true, @@ -198,13 +824,12 @@ define([ penOptions: {color: '000000'}, type: AscPDF.ANNOTATIONS_TYPES.Strikeout }); - this.paragraphControls.push(this.btnStrikeout); this.btnUnderline = new Common.UI.ButtonColored({ id: 'id-toolbar-btn-underline', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-underline', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + lock: [_set.lostConnect, _set.disableOnStart], enableToggle: true, allowDepress: true, split: true, @@ -215,13 +840,12 @@ define([ penOptions: {color: '000000'}, type: AscPDF.ANNOTATIONS_TYPES.Underline }); - this.paragraphControls.push(this.btnUnderline); this.btnHighlight = new Common.UI.ButtonColored({ id: 'id-toolbar-btn-highlight', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-highlight', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + lock: [_set.lostConnect, _set.disableOnStart], enableToggle: true, allowDepress: true, split: true, @@ -235,8 +859,8 @@ define([ '249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000' ]} }); - this.paragraphControls.push(this.btnHighlight); + config.isPDFEdit && this.applyLayoutPDFEdit(config); } else if ( config.isRestrictedEdit ) { Common.UI.Mixtbar.prototype.initialize.call(this, { template: _.template(template), @@ -331,7 +955,7 @@ define([ id: 'id-toolbar-btn-undo', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-undo', - lock: [_set.undoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], + lock: [_set.undoLock, _set.lostConnect, _set.disableOnStart], signals: ['disabled'], dataHint: '1', dataHintDirection: 'bottom', @@ -343,7 +967,7 @@ define([ id: 'id-toolbar-btn-redo', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-redo', - lock: [_set.redoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], + lock: [_set.redoLock, _set.lostConnect, _set.disableOnStart], signals: ['disabled'], dataHint: '1', dataHintDirection: 'bottom', @@ -355,7 +979,7 @@ define([ id: 'id-toolbar-btn-copy', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-copy', - lock: [_set.copyLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + lock: [_set.copyLock, _set.lostConnect, _set.disableOnStart], dataHint: '1', dataHintDirection: 'top', dataHintTitle: 'C' @@ -366,7 +990,7 @@ define([ id: 'id-toolbar-btn-paste', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-paste', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + lock: [_set.paragraphLock, _set.lostConnect, _set.disableOnStart], dataHint: '1', dataHintDirection: 'top', dataHintTitle: 'V' @@ -377,7 +1001,7 @@ define([ id: 'id-toolbar-btn-cut', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-cut', - lock: [_set.cutLock, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.imageLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + lock: [_set.cutLock, _set.paragraphLock, _set.shapeLock, _set.lostConnect, _set.disableOnStart], dataHint: '1', dataHintDirection: 'top', dataHintTitle: 'X' @@ -388,7 +1012,7 @@ define([ id: 'id-toolbar-btn-select-all', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-select-all', - lock: [_set.viewFormMode, _set.disableOnStart], + lock: [_set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom' }); @@ -490,7 +1114,7 @@ define([ // // Disable all components before load document - this.lockControls = me.toolbarControls.concat(me.paragraphControls); + this.lockControls = me.toolbarControls.concat(me.paragraphControls).concat(me.shapeControls); this.lockToolbar(Common.enumLock.disableOnStart, true, {array: this.lockControls}); this.on('render:after', _.bind(this.onToolbarAfterRender, this)); @@ -499,7 +1123,8 @@ define([ template: _.template(template_view), tabs: [ {caption: me.textTabFile, action: 'file', layoutname: 'toolbar-file', haspanel: false, dataHintTitle: 'F'} - ] + ], + config: config } ); } @@ -517,7 +1142,7 @@ define([ me.isCompactView = mode.isCompactView; if ( mode.isEdit || mode.isRestrictedEdit) { - me.$el.html(me.rendererComponents(me.$layout)); + me.$el.html(me.rendererComponents(me.$layout, mode)); } else { me.$layout.find('.canedit').hide(); me.isCompactView && me.$layout.addClass('folded'); @@ -535,7 +1160,7 @@ define([ if ( mode.isEdit ) { /** coauthoring begin **/ - this.showSynchTip = !Common.localStorage.getBool("de-hide-synch"); + this.showSynchTip = !Common.localStorage.getBool("pdfe-hide-synch"); this.needShowSynchTip = false; /** coauthoring end **/ } @@ -566,12 +1191,64 @@ define([ me.fireEvent('home:open'); }, - rendererComponents: function (html) { - var $host = $(html); + rendererComponentsRestrictedEdit: function($host) { + var _injectComponent = function (id, cmp) { + Common.Utils.injectComponent($host.findById(id), cmp); + }; + _injectComponent('#slot-btn-form-prev', this.btnPrevForm); + _injectComponent('#slot-btn-form-next', this.btnNextForm); + _injectComponent('#slot-btn-form-submit', this.btnSubmit); + _injectComponent('#slot-btn-form-save', this.btnSaveForm); + }, + + rendererComponentsPDFEdit: function($host) { var _injectComponent = function (id, cmp) { Common.Utils.injectComponent($host.findById(id), cmp); }; + _injectComponent('#slot-btn-edittext', this.btnEditText); + _injectComponent('#slot-field-fontname', this.cmbFontName); + _injectComponent('#slot-field-fontsize', this.cmbFontSize); + _injectComponent('#slot-btn-text-underline', this.btnTextUnderline); + _injectComponent('#slot-btn-text-highlight', this.btnTextHighlightColor); + _injectComponent('#slot-btn-text-strikeout', this.btnTextStrikeout); + _injectComponent('#slot-btn-bold', this.btnBold); + _injectComponent('#slot-btn-italic', this.btnItalic); + _injectComponent('#slot-btn-superscript', this.btnSuperscript); + _injectComponent('#slot-btn-subscript', this.btnSubscript); + _injectComponent('#slot-btn-incfont', this.btnIncFontSize); + _injectComponent('#slot-btn-decfont', this.btnDecFontSize); + _injectComponent('#slot-btn-fontcolor', this.btnFontColor); + _injectComponent('#slot-btn-changecase', this.btnChangeCase); + _injectComponent('#slot-btn-clearstyle', this.btnClearStyle); + _injectComponent('#slot-btn-markers', this.btnMarkers); + _injectComponent('#slot-btn-numbering', this.btnNumbers); + _injectComponent('#slot-btn-incoffset', this.btnIncLeftOffset); + _injectComponent('#slot-btn-decoffset', this.btnDecLeftOffset); + _injectComponent('#slot-btn-halign', this.btnHorizontalAlign); + _injectComponent('#slot-btn-valign', this.btnVerticalAlign); + _injectComponent('#slot-btn-linespace', this.btnLineSpace); + _injectComponent('#slot-btn-columns', this.btnColumns); + _injectComponent('#slot-btn-arrange-shape', this.btnShapeArrange); + _injectComponent('#slot-btn-align-shape', this.btnShapeAlign); + }, + + rendererComponentsAnnotate: function($host) { + var _injectComponent = function (id, cmp) { + Common.Utils.injectComponent($host.findById(id), cmp); + }; + _injectComponent('#slot-btn-comment', this.btnAddComment); + _injectComponent('#slot-btn-strikeout', this.btnStrikeout); + _injectComponent('#slot-btn-underline', this.btnUnderline); + _injectComponent('#slot-btn-highlight', this.btnHighlight); + _injectComponent('#slot-btn-text-comment', this.btnTextComment); + // _injectComponent('#slot-btn-rotate', this.btnRotate); + }, + + rendererComponentsCommon: function($host) { + var _injectComponent = function (id, cmp) { + Common.Utils.injectComponent($host.findById(id), cmp); + }; _injectComponent('#slot-btn-print', this.btnPrint); _injectComponent('#slot-btn-save', this.btnSave); _injectComponent('#slot-btn-undo', this.btnUndo); @@ -582,11 +1259,6 @@ define([ _injectComponent('#slot-btn-select-all', this.btnSelectAll); _injectComponent('#slot-btn-select-tool', this.btnSelectTool); _injectComponent('#slot-btn-hand-tool', this.btnHandTool); - _injectComponent('#slot-btn-comment', this.btnAddComment); - _injectComponent('#slot-btn-strikeout', this.btnStrikeout); - _injectComponent('#slot-btn-underline', this.btnUnderline); - _injectComponent('#slot-btn-highlight', this.btnHighlight); - // _injectComponent('#slot-btn-rotate', this.btnRotate); _injectComponent('#slot-btn-pages', this.fieldPages); _injectComponent('#slot-btn-first-page', this.btnFirstPage); _injectComponent('#slot-btn-last-page', this.btnLastPage); @@ -594,50 +1266,57 @@ define([ _injectComponent('#slot-btn-next-page', this.btnNextPage); _injectComponent('#slot-chk-showcomment', this.chShowComments); _injectComponent('#slot-btn-form-clear', this.btnClear); - _injectComponent('#slot-btn-form-prev', this.btnPrevForm); - _injectComponent('#slot-btn-form-next', this.btnNextForm); - _injectComponent('#slot-btn-form-submit', this.btnSubmit); - _injectComponent('#slot-btn-form-save', this.btnSaveForm); - this.btnPrint.menu && this.btnPrint.$el.addClass('split'); + }, + + rendererComponents: function (html, mode) { + var $host = $(html); + this.rendererComponentsCommon($host); + if (mode.isEdit) { + this.rendererComponentsAnnotate($host); + mode.isPDFEdit && this.rendererComponentsPDFEdit($host); + $host.find(mode.isPDFEdit ? '.annotate' : '.pdfedit').addClass('hidden'); + } else if (mode.isRestrictedEdit) + this.rendererComponentsRestrictedEdit($host); + return $host; }, - createPen: function(button, id) { + createPen: function(button, id, transparent, storage) { var mnu; button.setMenu(new Common.UI.Menu({ cls: 'shifted-left', style: 'min-width: 100px;', items: [ - {template: _.template('
')}, + {template: _.template('
')}, + {caption: '--'}, { id: 'id-toolbar-menu-' + id + '-color-new', template: _.template('' + button.textNewColor + '') }, - {caption: '--', visible: false}, + {caption: '--', visible: !!transparent}, mnu = new Common.UI.MenuItem({ caption: this.strMenuNoFill, checkable: true, - visible: false, + visible: !!transparent, style: 'padding-left:20px;padding-right:20px;' }) ] }), true); button.currentColor = button.options.penOptions.color; button.setColor(button.currentColor); + var config = Common.define.simpleColorsConfig; var picker = new Common.UI.ThemeColorPalette({ el: $('#id-toolbar-menu-' + id), - colors: button.options.penOptions.colors || [ - '1755A0', 'D43230', 'F5C346', 'EA3368', '12A489', '552F8B', '9D1F87', 'BB2765', '479ED2', '67C9FA', - '3D8A44', '80CA3D', '1C19B4', '7F4B0F', 'FF7E07', 'FFFFFF', 'D3D3D4', '879397', '575757', '000000' - ], + colors: button.options.penOptions.colors || config.colors, value: button.currentColor, - dynamiccolors: 5, - themecolors: 0, - effects: 0, - columns: 5, + dynamiccolors: config.dynamiccolors, + themecolors: config.themecolors, + effects: config.effects, + columns: config.columns, + cls: config.cls, outerMenu: {menu: button.menu, index: 0, focusOnShow: true}, - storageSuffix: '-draw' + storageSuffix: storage || '' }); button.setPicker(picker); picker.on('select', _.bind(button.onColorSelect, button)); @@ -679,43 +1358,46 @@ define([ })); } if (me.btnStrikeout && me.btnStrikeout.menu) { - var arr = me.createPen(me.btnStrikeout, 'strikeout'); + var arr = me.createPen(me.btnStrikeout, 'strikeout', false, '-draw'); me.mnuStrikeoutColorPicker = arr[0]; me.mnuStrikeoutTransparent = arr[1]; } if (me.btnUnderline && me.btnUnderline.menu) { - var arr = me.createPen(me.btnUnderline, 'underline'); + var arr = me.createPen(me.btnUnderline, 'underline', false, '-draw'); me.mnuUnderlineColorPicker = arr[0]; me.mnuUnderlineTransparent = arr[1]; } if (me.btnHighlight && me.btnHighlight.menu) { - var arr = me.createPen(me.btnHighlight, 'highlight'); + var arr = me.createPen(me.btnHighlight, 'highlight', false, '-draw'); me.mnuHighlightColorPicker = arr[0]; me.mnuHighlightTransparent = arr[1]; } + + if (me.btnTextComment) { + me.btnTextComment.options.textboxType = AscPDF.FREE_TEXT_INTENT_TYPE.FreeText; + me.btnTextComment.setMenu(new Common.UI.Menu({ + items: [ + { + caption: me.tipInsertTextComment, + iconCls : 'menu__icon btn-text-comment', + value: AscPDF.FREE_TEXT_INTENT_TYPE.FreeText, + iconClsForMainBtn: 'btn-text-comment', + captionForMainBtn: me.capBtnTextComment + }, + { + caption: me.tipInsertTextCallout, + iconCls : 'menu__icon btn-text-callout', + value: AscPDF.FREE_TEXT_INTENT_TYPE.FreeTextCallout, + iconClsForMainBtn: 'btn-text-callout', + captionForMainBtn: me.capBtnTextCallout + }, + ] + })); + } }); }, - createDelayedElements: function () { - if (this.api) { - this.updateMetricUnit(); - } - - // set hints - if (this.mode.isEdit) { - this.btnSave.updateHint(this.btnSaveTip); - this.btnAddComment.updateHint(this.tipAddComment); - this.btnStrikeout.updateHint(this.textStrikeout); - this.btnUnderline.updateHint(this.textUnderline); - this.btnHighlight.updateHint(this.textHighlight); - // this.btnRotate.updateHint(this.tipRotate); - } else if (this.mode.isRestrictedEdit) { - this.btnClear.updateHint(this.textClearFields); - this.btnPrevForm.updateHint(this.tipPrevForm); - this.btnNextForm.updateHint(this.tipNextForm); - this.btnSubmit && this.btnSubmit.updateHint(this.tipSubmit); - this.btnSaveForm && this.btnSaveForm.updateHint(this.mode.canRequestSaveAs || !!this.mode.saveAsUrl ? this.tipSaveForm : this.tipDownloadForm); - } + createDelayedElementsCommon: function() { this.btnPrint.updateHint(this.tipPrint + Common.Utils.String.platformKey('Ctrl+P')); this.btnUndo.updateHint(this.tipUndo + Common.Utils.String.platformKey('Ctrl+Z')); this.btnRedo.updateHint(this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y')); @@ -731,6 +1413,196 @@ define([ this.btnNextPage.updateHint(this.tipNextPage); }, + createDelayedElementsRestrictedEdit: function() { + if (!this.mode.isRestrictedEdit) return; + + this.btnClear.updateHint(this.textClearFields); + this.btnPrevForm.updateHint(this.tipPrevForm); + this.btnNextForm.updateHint(this.tipNextForm); + this.btnSubmit && this.btnSubmit.updateHint(this.tipSubmit); + this.btnSaveForm && this.btnSaveForm.updateHint(this.mode.canRequestSaveAs || !!this.mode.saveAsUrl ? this.tipSaveForm : this.tipDownloadForm); + }, + + createDelayedElementsPDFAnnotate: function() { + if (!this.mode.isEdit) return; + + this.btnSave.updateHint(this.btnSaveTip); + this.btnAddComment.updateHint(this.tipAddComment); + this.btnStrikeout.updateHint(this.textStrikeout); + this.btnUnderline.updateHint(this.textUnderline); + this.btnHighlight.updateHint(this.textHighlight); + // this.btnTextComment.updateHint([this.tipInsertTextComment, this.tipInsertText]); + this.btnTextComment.updateHint(this.tipInsertTextComment); + // this.btnRotate.updateHint(this.tipRotate); + + }, + + createDelayedElementsPDFEdit: function() { + if (!this.mode.isPDFEdit) return; + + this.updateMetricUnit(); + this.btnEditText.updateHint(this.tipEditText); + this.btnIncFontSize.updateHint(this.tipIncFont + Common.Utils.String.platformKey('Ctrl+]')); + this.btnDecFontSize.updateHint(this.tipDecFont + Common.Utils.String.platformKey('Ctrl+[')); + this.btnBold.updateHint(this.textBold + Common.Utils.String.platformKey('Ctrl+B')); + this.btnItalic.updateHint(this.textItalic + Common.Utils.String.platformKey('Ctrl+I')); + this.btnTextUnderline.updateHint(this.textUnderline + Common.Utils.String.platformKey('Ctrl+U')); + this.btnTextStrikeout.updateHint(this.textStrikeout); + this.btnSuperscript.updateHint(this.textSuperscript); + this.btnSubscript.updateHint(this.textSubscript); + this.btnFontColor.updateHint(this.tipFontColor); + this.btnTextHighlightColor.updateHint(this.tipHighlightColor); + this.btnChangeCase.updateHint(this.tipChangeCase); + this.btnClearStyle.updateHint(this.tipClearStyle); + this.btnMarkers.updateHint(this.tipMarkers); + this.btnNumbers.updateHint(this.tipNumbers); + this.btnHorizontalAlign.updateHint(this.tipHAligh); + this.btnVerticalAlign.updateHint(this.tipVAligh); + this.btnDecLeftOffset.updateHint(this.tipDecPrLeft + Common.Utils.String.platformKey('Ctrl+Shift+M')); + this.btnIncLeftOffset.updateHint(this.tipIncPrLeft); + this.btnLineSpace.updateHint(this.tipLineSpace); + this.btnColumns.updateHint(this.tipColumns); + this.btnShapeAlign.updateHint(this.tipShapeAlign); + this.btnShapeArrange.updateHint(this.tipShapeArrange); + this.btnMarkers.setMenu( + new Common.UI.Menu({ + cls: 'shifted-left', + style: 'min-width: 145px', + items: [ + {template: _.template('')}, + this.mnuMarkerSettings = new Common.UI.MenuItem({ + caption: this.textListSettings, + value: 'settings' + }) + ] + }) + ); + + this.btnNumbers.setMenu( + new Common.UI.Menu({ + cls: 'shifted-left', + items: [ + {template: _.template('')}, + this.mnuNumberSettings = new Common.UI.MenuItem({ + caption: this.textListSettings, + value: 'settings' + }) + ] + }) + ); + + this._markersArr = [ + 'undefined', + '{"bulletTypeface":{"type":"bufont","typeface":"Symbol"},"bulletType":{"type":"char","char":"·","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Courier New"},"bulletType":{"type":"char","char":"o","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Wingdings"},"bulletType":{"type":"char","char":"§","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Wingdings"},"bulletType":{"type":"char","char":"v","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Wingdings"},"bulletType":{"type":"char","char":"Ø","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Wingdings"},"bulletType":{"type":"char","char":"ü","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Symbol"},"bulletType":{"type":"char","char":"¨","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"char","char":"–","startAt":null}}' + ]; + + var _conf = this.mnuMarkersPicker.conf; + this.mnuMarkersPicker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-markers'), + parentMenu: this.btnMarkers.menu, + outerMenu: {menu: this.btnMarkers.menu, index: 0}, + restoreHeight: 138, + allowScrollbar: false, + delayRenderTips: true, + store: new Common.UI.DataViewStore([ + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},numberingInfo: this._markersArr[0], skipRenderOnChange: true, tip: this.tipNone}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, numberingInfo: this._markersArr[1], skipRenderOnChange: true, tip: this.tipMarkersFRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, numberingInfo: this._markersArr[2], skipRenderOnChange: true, tip: this.tipMarkersHRound}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, numberingInfo: this._markersArr[3], skipRenderOnChange: true, tip: this.tipMarkersFSquare}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, numberingInfo: this._markersArr[4], skipRenderOnChange: true, tip: this.tipMarkersStar}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, numberingInfo: this._markersArr[5], skipRenderOnChange: true, tip: this.tipMarkersArrow}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, numberingInfo: this._markersArr[6], skipRenderOnChange: true, tip: this.tipMarkersCheckmark}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, numberingInfo: this._markersArr[7], skipRenderOnChange: true, tip: this.tipMarkersFRhombus}, + {id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, numberingInfo: this._markersArr[8], skipRenderOnChange: true, tip: this.tipMarkersDash} + ]), + itemTemplate: _.template('
') + }); + this.btnMarkers.menu.setInnerMenu([{menu: this.mnuMarkersPicker, index: 0}]); + _conf && this.mnuMarkersPicker.selectByIndex(_conf.index, true); + + this._numbersArr = [ + 'undefined', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"alphaUcPeriod","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"alphaLcParenR","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"alphaLcPeriod","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"arabicPeriod","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"arabicParenR","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"romanUcPeriod","startAt":null}}', + '{"bulletTypeface":{"type":"bufont","typeface":"Arial"},"bulletType":{"type":"autonum","char":null,"autoNumType":"romanLcPeriod","startAt":null}}' + ]; + + _conf = this.mnuNumbersPicker.conf; + this.mnuNumbersPicker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-numbering'), + parentMenu: this.btnNumbers.menu, + outerMenu: {menu: this.btnNumbers.menu, index: 0}, + restoreHeight: 92, + allowScrollbar: false, + delayRenderTips: true, + store: new Common.UI.DataViewStore([ + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: -1}, numberingInfo: this._numbersArr[0], skipRenderOnChange: true, tip: this.tipNone}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 4}, numberingInfo: this._numbersArr[1], skipRenderOnChange: true, tip: this.tipNumCapitalLetters}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 5}, numberingInfo: this._numbersArr[2], skipRenderOnChange: true, tip: this.tipNumLettersParentheses}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 6}, numberingInfo: this._numbersArr[3], skipRenderOnChange: true, tip: this.tipNumLettersPoints}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 1}, numberingInfo: this._numbersArr[4], skipRenderOnChange: true, tip: this.tipNumNumbersPoint}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 2}, numberingInfo: this._numbersArr[5], skipRenderOnChange: true, tip: this.tipNumNumbersParentheses}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 3}, numberingInfo: this._numbersArr[6], skipRenderOnChange: true, tip: this.tipNumRoman}, + {id: 'id-numbers-' + Common.UI.getId(), data: {type: 1, subtype: 7}, numberingInfo: this._numbersArr[7], skipRenderOnChange: true, tip: this.tipNumRomanSmall} + ]), + itemTemplate: _.template('
') + }); + this.btnNumbers.menu.setInnerMenu([{menu: this.mnuNumbersPicker, index: 0}]); + _conf && this.mnuNumbersPicker.selectByIndex(_conf.index, true); + + if (this.btnTextHighlightColor && this.btnTextHighlightColor.cmpEl) { + this.btnTextHighlightColor.currentColor = 'FFFF00'; + this.btnTextHighlightColor.setColor(this.btnTextHighlightColor.currentColor); + this.mnuTextHighlightColorPicker = new Common.UI.ThemeColorPalette({ + el: $('#id-toolbar-menu-text-highlight'), + colors: [ + 'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B', + '006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000' + ], + colorHints: [ + Common.Utils.ThemeColor.txtYellow, Common.Utils.ThemeColor.txtBrightGreen, Common.Utils.ThemeColor.txtTurquosie, Common.Utils.ThemeColor.txtPink, + Common.Utils.ThemeColor.txtBlue, Common.Utils.ThemeColor.txtRed, Common.Utils.ThemeColor.txtDarkBlue, Common.Utils.ThemeColor.txtTeal, + Common.Utils.ThemeColor.txtGreen, Common.Utils.ThemeColor.txtViolet, Common.Utils.ThemeColor.txtDarkRed, Common.Utils.ThemeColor.txtDarkYellow, + Common.Utils.ThemeColor.txtWhite, Common.Utils.ThemeColor.txtGray + '-25%', Common.Utils.ThemeColor.txtGray + '-50%', Common.Utils.ThemeColor.txtBlack + ], + value: 'FFFF00', + dynamiccolors: 0, + themecolors: 0, + effects: 0, + columns: 4, + cls: 'palette-large', + outerMenu: {menu: this.btnTextHighlightColor.menu, index: 0, focusOnShow: true} + }); + this.btnTextHighlightColor.setPicker(this.mnuTextHighlightColorPicker); + this.btnTextHighlightColor.menu.setInnerMenu([{menu: this.mnuTextHighlightColorPicker, index: 0}]); + } + if (this.btnFontColor && this.btnFontColor.menu) { + var arr = this.createPen(this.btnFontColor, 'font'); + this.mnuFontColorPicker = arr[0]; + this.mnuFontTransparent = arr[1]; + } + }, + + createDelayedElements: function () { + this.createDelayedElementsCommon(); + if (this.mode.isEdit) { + this.createDelayedElementsPDFAnnotate(); + this.mode.isPDFEdit && this.createDelayedElementsPDFEdit(); + } else if (this.mode.isRestrictedEdit) + this.createDelayedElementsRestrictedEdit(); + }, + onToolbarAfterRender: function(toolbar) { // DataView and pickers }, @@ -783,7 +1655,7 @@ define([ this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); } - this.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && !this.mode.saveAlwaysEnabled); + this.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && this.mode.canSaveToFile); Common.Gateway.collaborativeChanges(); }, @@ -797,7 +1669,7 @@ define([ this.showSynchTip = false; this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); - Common.localStorage.setItem("de-hide-synch", 1); + Common.localStorage.setItem("pdfe-hide-synch", 1); }, this); this.synchTooltip.on('closeclick', function () { this.synchTooltip.hide(); @@ -815,7 +1687,7 @@ define([ this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.btnSaveTip); - this.btnSave.setDisabled(!me.mode.forcesave && !me.mode.canSaveDocumentToBinary || !me.mode.isPDFEdit && !me.mode.isPDFAnnotate && !me.mode.saveAlwaysEnabled); + this.btnSave.setDisabled(!me.mode.forcesave && !me.mode.canSaveDocumentToBinary || !me.mode.isPDFEdit && !me.mode.isPDFAnnotate && me.mode.canSaveToFile); this._state.hasCollaborativeChanges = false; } } @@ -890,7 +1762,87 @@ define([ capBtnSaveFormDesktop: 'Save as...', tipSaveForm: 'Save a file as a fillable PDF', capBtnDownloadForm: 'Download as pdf', - tipDownloadForm: 'Download a file as a fillable PDF' + tipDownloadForm: 'Download a file as a fillable PDF', + textTabEdit: 'Edit', + textBold: 'Bold', + textItalic: 'Italic', + textSuperscript: 'Superscript', + textSubscript: 'Subscript', + tipFontName: 'Font Name', + tipFontSize: 'Font Size', + tipFontColor: 'Font color', + tipMarkers: 'Bullets', + tipNumbers: 'Numbering', + tipClearStyle: 'Clear Style', + tipHAligh: 'Horizontal Align', + tipVAligh: 'Vertical Align', + textAlignTop: 'Align text to the top', + textAlignMiddle: 'Align text to the middle', + textAlignBottom: 'Align text to the bottom', + textAlignLeft: 'Left align text', + textAlignRight: 'Right align text', + textAlignCenter: 'Center text', + textAlignJust: 'Justify', + tipDecPrLeft: 'Decrease Indent', + tipIncPrLeft: 'Increase Indent', + tipLineSpace: 'Line Spacing', + tipIncFont: 'Increment font size', + tipDecFont: 'Decrement font size', + tipColumns: 'Insert columns', + textColumnsOne: 'One Column', + textColumnsTwo: 'Two Columns', + textColumnsThree: 'Three Columns', + textColumnsCustom: 'Custom Columns', + tipChangeCase: 'Change case', + mniSentenceCase: 'Sentence case.', + mniLowerCase: 'lowercase', + mniUpperCase: 'UPPERCASE', + mniCapitalizeWords: 'Capitalize Each Word', + mniToggleCase: 'tOGGLE cASE', + tipHighlightColor: 'Highlight color', + tipNumCapitalLetters: 'A. B. C.', + tipNumLettersParentheses: 'a) b) c)', + tipNumLettersPoints: 'a. b. c.', + tipNumNumbersPoint: '1. 2. 3.', + tipNumNumbersParentheses: '1) 2) 3)', + tipNumRoman: 'I. II. III.', + tipNumRomanSmall: 'i. ii. iii.', + tipMarkersFRound: 'Filled round bullets', + tipMarkersHRound: 'Hollow round bullets', + tipMarkersFSquare: 'Filled square bullets', + tipMarkersStar: 'Star bullets', + tipMarkersArrow: 'Arrow bullets', + tipMarkersCheckmark: 'Checkmark bullets', + tipMarkersFRhombus: 'Filled rhombus bullets', + tipMarkersDash: 'Dash bullets', + tipNone: 'None', + textListSettings: 'List Settings', + textTabInsert: 'Insert', + capBtnEditText: 'Edit Text', + tipEditText: 'Edit text', + txtPageAlign: 'Align to Page', + txtObjectsAlign: 'Align Selected Objects', + tipShapeAlign: 'Align Shape', + tipShapeArrange: 'Arrange Shape', + textShapeAlignLeft: 'Align Left', + textShapeAlignRight: 'Align Right', + textShapeAlignCenter: 'Align Center', + textShapeAlignTop: 'Align Top', + textShapeAlignBottom: 'Align Bottom', + textShapeAlignMiddle: 'Align Middle', + textArrangeFront: 'Bring To Front', + textArrangeBack: 'Send To Back', + textArrangeForward: 'Bring Forward', + textArrangeBackward: 'Send Backward', + txtGroup: 'Group', + txtUngroup: 'Ungroup', + txtDistribHor: 'Distribute Horizontally', + txtDistribVert: 'Distribute Vertically', + capBtnTextComment: 'Text Comment', + capBtnTextCallout: 'Text Callout', + tipInsertTextComment: 'Insert text comment', + tipInsertTextCallout: 'Insert text callout', + tipInsertText: 'Insert text' } })(), PDFE.Views.Toolbar || {})); }); diff --git a/apps/pdfeditor/main/app/view/ViewTab.js b/apps/pdfeditor/main/app/view/ViewTab.js index 788660d859..ca4de10152 100644 --- a/apps/pdfeditor/main/app/view/ViewTab.js +++ b/apps/pdfeditor/main/app/view/ViewTab.js @@ -86,6 +86,7 @@ define([ '' + '' + '
' + + '' + '
' + '' + ''; @@ -125,6 +126,9 @@ define([ cmb.on('combo:focusin', _.bind(me.onComboOpen, this, false)); cmb.on('show:after', _.bind(me.onComboOpen, this, true)); }); + me.chRightMenu.on('change', _.bind(function (checkbox, state) { + me.fireEvent('rightmenu:hide', [me.chRightMenu, state === 'checked']); + }, me)); }, initialize: function (options) { @@ -204,7 +208,7 @@ define([ this.chStatusbar = new Common.UI.CheckBox({ lock: [_set.lostConnect, _set.disableOnStart], labelText: this.textStatusBar, - value: !Common.localStorage.getBool("de-hidden-status"), + value: !Common.localStorage.getBool("pdfe-hidden-status"), dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -223,13 +227,22 @@ define([ this.chLeftMenu = new Common.UI.CheckBox({ lock: [_set.lostConnect, _set.disableOnStart], - labelText: this.textLeftMenu, + labelText: !Common.UI.isRTL() ? this.textLeftMenu : this.textRightMenu, dataHint : '1', dataHintDirection: 'left', dataHintOffset: 'small' }); this.lockedControls.push(this.chLeftMenu); + this.chRightMenu = new Common.UI.CheckBox({ + lock: [_set.disableOnStart], + labelText: !Common.UI.isRTL() ? this.textRightMenu : this.textLeftMenu, + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chRightMenu); + Common.Utils.lockControls(_set.disableOnStart, true, {array: this.lockedControls}); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -280,6 +293,7 @@ define([ this.chStatusbar.render($host.find('#slot-chk-statusbar')); this.chToolbar.render($host.find('#slot-chk-toolbar')); this.chLeftMenu.render($host.find('#slot-chk-leftmenu')); + this.chRightMenu.render($host.find('#slot-chk-rightmenu')); if (this.toolbar && this.toolbar.$el) { this.btnsFitToPage = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-btn-ftp'), 'tlbtn-btn-ftp-', 'toolbar__icon btn-ic-zoomtopage', this.textFitToPage, @@ -312,7 +326,11 @@ define([ var value = Common.UI.LayoutManager.getInitValue('leftMenu'); value = (value!==undefined) ? !value : false; - this.chLeftMenu.setValue(!Common.localStorage.getBool("de-hidden-leftmenu", value)); + this.chLeftMenu.setValue(!Common.localStorage.getBool("pdfe-hidden-leftmenu", value)); + + value = Common.UI.LayoutManager.getInitValue('rightMenu'); + value = (value!==undefined) ? !value : false; + me.chRightMenu.setValue(!Common.localStorage.getBool("pdfe-hidden-rightmenu", value)); }, show: function () { @@ -361,7 +379,8 @@ define([ tipFitToWidth: 'Fit to width', tipInterfaceTheme: 'Interface theme', tipDarkDocument: 'Dark document', - textLeftMenu: 'Left panel' + textLeftMenu: 'Left panel', + textRightMenu: 'Right panel' } }()), PDFE.Views.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/Viewport.js b/apps/pdfeditor/main/app/view/Viewport.js index 4b6283e50f..24227d3659 100644 --- a/apps/pdfeditor/main/app/view/Viewport.js +++ b/apps/pdfeditor/main/app/view/Viewport.js @@ -60,7 +60,7 @@ define([ // Set innerHTML and get the references to the DOM elements initialize: function() { - // + this._initEditing = true; }, // Render layout @@ -115,13 +115,16 @@ define([ }}, { // sdk el: items[1], stretch: true + }, { + el: $(items[2]).hide(), + rely: true } ]; if ( Common.UI.isRTL() ) { iarray[0].resize.min = -600; iarray[0].resize.max = -300; - [iarray[0], iarray[1]] = [iarray[1], iarray[0]]; + [iarray[0], iarray[2]] = [iarray[2], iarray[0]]; } this.hlayout = new Common.UI.HBoxLayout({ @@ -132,18 +135,6 @@ define([ return this; }, - applyEditorMode: function() { - }, - - applyCommonMode: function() { - if ( Common.localStorage.getBool('pdfe-hidden-status') ) - PDFE.getController('Statusbar').getView('Statusbar').setVisible(false); - - var value = Common.UI.LayoutManager.getInitValue('leftMenu'); - value = (value!==undefined) ? !value : false; - Common.localStorage.getBool("pdfe-hidden-leftmenu", value) && PDFE.getController('LeftMenu').getView('LeftMenu').hide(); - }, - setMode: function(mode) { if (mode.isDisconnected) { /** coauthoring begin **/ diff --git a/apps/pdfeditor/main/app_dev.js b/apps/pdfeditor/main/app_dev.js index c7abd80ef4..7accf86d5d 100644 --- a/apps/pdfeditor/main/app_dev.js +++ b/apps/pdfeditor/main/app_dev.js @@ -136,11 +136,13 @@ require([ 'DocumentHolder', 'Toolbar', 'Statusbar', + 'RightMenu', 'Navigation', 'PageThumbnails', 'LeftMenu', 'Main', 'ViewTab', + 'InsTab', 'Search', 'Print', 'Common.Controllers.Fonts' @@ -148,6 +150,8 @@ require([ ,'Common.Controllers.Comments' ,'Common.Controllers.Draw' ,'Common.Controllers.Plugins' + // ,'Common.Controllers.ExternalDiagramEditor' + // ,'Common.Controllers.ExternalOleEditor' ,'Common.Controllers.Protection' ] }); @@ -165,9 +169,11 @@ require([ 'pdfeditor/main/app/controller/Navigation', 'pdfeditor/main/app/controller/PageThumbnails', 'pdfeditor/main/app/controller/Statusbar', + 'pdfeditor/main/app/controller/RightMenu', 'pdfeditor/main/app/controller/LeftMenu', 'pdfeditor/main/app/controller/Main', 'pdfeditor/main/app/controller/ViewTab', + 'pdfeditor/main/app/controller/InsTab', 'pdfeditor/main/app/controller/Search', 'pdfeditor/main/app/controller/Print', 'pdfeditor/main/app/view/FileMenuPanels', @@ -176,6 +182,8 @@ require([ 'common/main/lib/controller/Comments' ,'common/main/lib/controller/Chat' ,'common/main/lib/controller/Plugins' + // ,'common/main/lib/controller/ExternalDiagramEditor' + // ,'common/main/lib/controller/ExternalOleEditor' ,'common/main/lib/controller/Draw' ,'common/main/lib/controller/Protection' ], function() { diff --git a/apps/pdfeditor/main/index.html b/apps/pdfeditor/main/index.html index ef0c57764b..fee6493f63 100644 --- a/apps/pdfeditor/main/index.html +++ b/apps/pdfeditor/main/index.html @@ -343,6 +343,10 @@ + + + +
+ + + + +
diff --git a/apps/pdfeditor/main/index_loader.html b/apps/pdfeditor/main/index_loader.html index 738e9f61b8..d47b6f9326 100644 --- a/apps/pdfeditor/main/index_loader.html +++ b/apps/pdfeditor/main/index_loader.html @@ -272,6 +272,11 @@ + + + + +
+ + + + +
diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index 91c7939b4f..0024a80678 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -224,6 +224,8 @@ "Common.Views.Header.tipViewUsers": "View users and manage document access rights", "Common.Views.Header.txtAccessRights": "Change access rights", "Common.Views.Header.txtRename": "Rename", + "Common.Views.Header.textViewDescNoCoedit": "View or annotate", + "Common.Views.Header.textEditDescNoCoedit": "Add or edit text, shapes, images etc.", "Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:", "Common.Views.ImageFromUrlDialog.txtEmpty": "This field is required", "Common.Views.ImageFromUrlDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format", @@ -309,6 +311,515 @@ "Common.Views.UserNameDialog.textDontShow": "Don't ask me again", "Common.Views.UserNameDialog.textLabel": "Label:", "Common.Views.UserNameDialog.textLabelError": "Label must not be empty.", + "PDFE.Controllers.InsTab.txtShape_accentBorderCallout1": "Line callout 1 (Border and accent bar)", + "PDFE.Controllers.InsTab.txtShape_accentBorderCallout2": "Line callout 2 (Border and accent bar)", + "PDFE.Controllers.InsTab.txtShape_accentBorderCallout3": "Line callout 3 (Border and accent bar)", + "PDFE.Controllers.InsTab.txtShape_accentCallout1": "Line callout 1 (Accent bar)", + "PDFE.Controllers.InsTab.txtShape_accentCallout2": "Line callout 2 (Accent bar)", + "PDFE.Controllers.InsTab.txtShape_accentCallout3": "Line callout 3 (Accent bar)", + "PDFE.Controllers.InsTab.txtShape_actionButtonBackPrevious": "Back or previous button", + "PDFE.Controllers.InsTab.txtShape_actionButtonBeginning": "Beginning button", + "PDFE.Controllers.InsTab.txtShape_actionButtonBlank": "Blank button", + "PDFE.Controllers.InsTab.txtShape_actionButtonDocument": "Document Button", + "PDFE.Controllers.InsTab.txtShape_actionButtonEnd": "End button", + "PDFE.Controllers.InsTab.txtShape_actionButtonForwardNext": "Forward or next button", + "PDFE.Controllers.InsTab.txtShape_actionButtonHelp": "Help button", + "PDFE.Controllers.InsTab.txtShape_actionButtonHome": "Home button", + "PDFE.Controllers.InsTab.txtShape_actionButtonInformation": "Information button", + "PDFE.Controllers.InsTab.txtShape_actionButtonMovie": "Movie button", + "PDFE.Controllers.InsTab.txtShape_actionButtonReturn": "Return button", + "PDFE.Controllers.InsTab.txtShape_actionButtonSound": "Sound button", + "PDFE.Controllers.InsTab.txtShape_arc": "Arc", + "PDFE.Controllers.InsTab.txtShape_bentArrow": "Bent arrow", + "PDFE.Controllers.InsTab.txtShape_bentConnector5": "Elbow connector", + "PDFE.Controllers.InsTab.txtShape_bentConnector5WithArrow": "Elbow arrow connector", + "PDFE.Controllers.InsTab.txtShape_bentConnector5WithTwoArrows": "Elbow double-arrow connector", + "PDFE.Controllers.InsTab.txtShape_bentUpArrow": "Bent up arrow", + "PDFE.Controllers.InsTab.txtShape_bevel": "Bevel", + "PDFE.Controllers.InsTab.txtShape_blockArc": "Block arc", + "PDFE.Controllers.InsTab.txtShape_borderCallout1": "Line callout 1", + "PDFE.Controllers.InsTab.txtShape_borderCallout2": "Line callout 2", + "PDFE.Controllers.InsTab.txtShape_borderCallout3": "Line callout 3", + "PDFE.Controllers.InsTab.txtShape_bracePair": "Double brace", + "PDFE.Controllers.InsTab.txtShape_callout1": "Line callout 1 (No border)", + "PDFE.Controllers.InsTab.txtShape_callout2": "Line callout 2 (No border)", + "PDFE.Controllers.InsTab.txtShape_callout3": "Line Callout 3 (No border)", + "PDFE.Controllers.InsTab.txtShape_can": "Can", + "PDFE.Controllers.InsTab.txtShape_chevron": "Chevron", + "PDFE.Controllers.InsTab.txtShape_chord": "Chord", + "PDFE.Controllers.InsTab.txtShape_circularArrow": "Circular arrow", + "PDFE.Controllers.InsTab.txtShape_cloud": "Cloud", + "PDFE.Controllers.InsTab.txtShape_cloudCallout": "Cloud callout", + "PDFE.Controllers.InsTab.txtShape_corner": "Corner", + "PDFE.Controllers.InsTab.txtShape_cube": "Cube", + "PDFE.Controllers.InsTab.txtShape_curvedConnector3": "Curved connector", + "PDFE.Controllers.InsTab.txtShape_curvedConnector3WithArrow": "Curved arrow connector", + "PDFE.Controllers.InsTab.txtShape_curvedConnector3WithTwoArrows": "Curved double-arrow connector", + "PDFE.Controllers.InsTab.txtShape_curvedDownArrow": "Curved down arrow", + "PDFE.Controllers.InsTab.txtShape_curvedLeftArrow": "Curved left arrow", + "PDFE.Controllers.InsTab.txtShape_curvedRightArrow": "Curved right arrow", + "PDFE.Controllers.InsTab.txtShape_curvedUpArrow": "Curved up arrow", + "PDFE.Controllers.InsTab.txtShape_decagon": "Decagon", + "PDFE.Controllers.InsTab.txtShape_diagStripe": "Diagonal stripe", + "PDFE.Controllers.InsTab.txtShape_diamond": "Diamond", + "PDFE.Controllers.InsTab.txtShape_dodecagon": "Dodecagon", + "PDFE.Controllers.InsTab.txtShape_donut": "Donut", + "PDFE.Controllers.InsTab.txtShape_doubleWave": "Double Wave", + "PDFE.Controllers.InsTab.txtShape_downArrow": "Down Arrow", + "PDFE.Controllers.InsTab.txtShape_downArrowCallout": "Down arrow callout", + "PDFE.Controllers.InsTab.txtShape_ellipse": "Ellipse", + "PDFE.Controllers.InsTab.txtShape_ellipseRibbon": "Curved down ribbon", + "PDFE.Controllers.InsTab.txtShape_ellipseRibbon2": "Curved up ribbon", + "PDFE.Controllers.InsTab.txtShape_flowChartAlternateProcess": "Flowchart: Alternate process", + "PDFE.Controllers.InsTab.txtShape_flowChartCollate": "Flowchart: Collate", + "PDFE.Controllers.InsTab.txtShape_flowChartConnector": "Flowchart: Connector", + "PDFE.Controllers.InsTab.txtShape_flowChartDecision": "Flowchart: Decision", + "PDFE.Controllers.InsTab.txtShape_flowChartDelay": "Flowchart: Delay", + "PDFE.Controllers.InsTab.txtShape_flowChartDisplay": "Flowchart: Display", + "PDFE.Controllers.InsTab.txtShape_flowChartDocument": "Flowchart: Document", + "PDFE.Controllers.InsTab.txtShape_flowChartExtract": "Flowchart: Extract", + "PDFE.Controllers.InsTab.txtShape_flowChartInputOutput": "Flowchart: Data", + "PDFE.Controllers.InsTab.txtShape_flowChartInternalStorage": "Flowchart: Internal storage", + "PDFE.Controllers.InsTab.txtShape_flowChartMagneticDisk": "Flowchart: Magnetic disk", + "PDFE.Controllers.InsTab.txtShape_flowChartMagneticDrum": "Flowchart: Direct access storage", + "PDFE.Controllers.InsTab.txtShape_flowChartMagneticTape": "Flowchart: Sequential access storage", + "PDFE.Controllers.InsTab.txtShape_flowChartManualInput": "Flowchart: Manual input", + "PDFE.Controllers.InsTab.txtShape_flowChartManualOperation": "Flowchart: Manual operation", + "PDFE.Controllers.InsTab.txtShape_flowChartMerge": "Flowchart: Merge", + "PDFE.Controllers.InsTab.txtShape_flowChartMultidocument": "Flowchart: Multidocument ", + "PDFE.Controllers.InsTab.txtShape_flowChartOffpageConnector": "Flowchart: Off-page Connector", + "PDFE.Controllers.InsTab.txtShape_flowChartOnlineStorage": "Flowchart: Stored data", + "PDFE.Controllers.InsTab.txtShape_flowChartOr": "Flowchart: Or", + "PDFE.Controllers.InsTab.txtShape_flowChartPredefinedProcess": "Flowchart: Predefined Process", + "PDFE.Controllers.InsTab.txtShape_flowChartPreparation": "Flowchart: Preparation", + "PDFE.Controllers.InsTab.txtShape_flowChartProcess": "Flowchart: Process", + "PDFE.Controllers.InsTab.txtShape_flowChartPunchedCard": "Flowchart: Card", + "PDFE.Controllers.InsTab.txtShape_flowChartPunchedTape": "Flowchart: Punched tape", + "PDFE.Controllers.InsTab.txtShape_flowChartSort": "Flowchart: Sort", + "PDFE.Controllers.InsTab.txtShape_flowChartSummingJunction": "Flowchart: Summing junction", + "PDFE.Controllers.InsTab.txtShape_flowChartTerminator": "Flowchart: Terminator", + "PDFE.Controllers.InsTab.txtShape_foldedCorner": "Folded corner", + "PDFE.Controllers.InsTab.txtShape_frame": "Frame", + "PDFE.Controllers.InsTab.txtShape_halfFrame": "Half frame", + "PDFE.Controllers.InsTab.txtShape_heart": "Heart", + "PDFE.Controllers.InsTab.txtShape_heptagon": "Heptagon", + "PDFE.Controllers.InsTab.txtShape_hexagon": "Hexagon", + "PDFE.Controllers.InsTab.txtShape_homePlate": "Pentagon", + "PDFE.Controllers.InsTab.txtShape_horizontalScroll": "Horizontal scroll", + "PDFE.Controllers.InsTab.txtShape_irregularSeal1": "Explosion 1", + "PDFE.Controllers.InsTab.txtShape_irregularSeal2": "Explosion 2", + "PDFE.Controllers.InsTab.txtShape_leftArrow": "Left Arrow", + "PDFE.Controllers.InsTab.txtShape_leftArrowCallout": "Left Arrow Callout", + "PDFE.Controllers.InsTab.txtShape_leftBrace": "Left Brace", + "PDFE.Controllers.InsTab.txtShape_leftBracket": "Left Bracket", + "PDFE.Controllers.InsTab.txtShape_leftRightArrow": "Left right arrow", + "PDFE.Controllers.InsTab.txtShape_leftRightArrowCallout": "Left right arrow callout", + "PDFE.Controllers.InsTab.txtShape_leftRightUpArrow": "Left right up arrow", + "PDFE.Controllers.InsTab.txtShape_leftUpArrow": "Left up arrow", + "PDFE.Controllers.InsTab.txtShape_lightningBolt": "Lightning bolt", + "PDFE.Controllers.InsTab.txtShape_line": "Line", + "PDFE.Controllers.InsTab.txtShape_lineWithArrow": "Arrow", + "PDFE.Controllers.InsTab.txtShape_lineWithTwoArrows": "Double arrow", + "PDFE.Controllers.InsTab.txtShape_mathDivide": "Division", + "PDFE.Controllers.InsTab.txtShape_mathEqual": "Equal", + "PDFE.Controllers.InsTab.txtShape_mathMinus": "Minus", + "PDFE.Controllers.InsTab.txtShape_mathMultiply": "Multiply", + "PDFE.Controllers.InsTab.txtShape_mathNotEqual": "Not Equal", + "PDFE.Controllers.InsTab.txtShape_mathPlus": "Plus", + "PDFE.Controllers.InsTab.txtShape_moon": "Moon", + "PDFE.Controllers.InsTab.txtShape_noSmoking": "\"No\" Symbol", + "PDFE.Controllers.InsTab.txtShape_notchedRightArrow": "Notched right arrow", + "PDFE.Controllers.InsTab.txtShape_octagon": "Octagon", + "PDFE.Controllers.InsTab.txtShape_parallelogram": "Parallelogram", + "PDFE.Controllers.InsTab.txtShape_pentagon": "Pentagon", + "PDFE.Controllers.InsTab.txtShape_pie": "Pie", + "PDFE.Controllers.InsTab.txtShape_plaque": "Sign", + "PDFE.Controllers.InsTab.txtShape_plus": "Plus", + "PDFE.Controllers.InsTab.txtShape_polyline1": "Scribble", + "PDFE.Controllers.InsTab.txtShape_polyline2": "Freeform", + "PDFE.Controllers.InsTab.txtShape_quadArrow": "Quad arrow", + "PDFE.Controllers.InsTab.txtShape_quadArrowCallout": "Quad arrow callout", + "PDFE.Controllers.InsTab.txtShape_rect": "Rectangle", + "PDFE.Controllers.InsTab.txtShape_ribbon": "Down ribbon", + "PDFE.Controllers.InsTab.txtShape_ribbon2": "Up ribbon", + "PDFE.Controllers.InsTab.txtShape_rightArrow": "Right Arrow", + "PDFE.Controllers.InsTab.txtShape_rightArrowCallout": "Right arrow callout", + "PDFE.Controllers.InsTab.txtShape_rightBrace": "Right brace", + "PDFE.Controllers.InsTab.txtShape_rightBracket": "Right bracket", + "PDFE.Controllers.InsTab.txtShape_round1Rect": "Round single corner rectangle", + "PDFE.Controllers.InsTab.txtShape_round2DiagRect": "Round diagonal corner rectangle", + "PDFE.Controllers.InsTab.txtShape_round2SameRect": "Round same side corner rectangle", + "PDFE.Controllers.InsTab.txtShape_roundRect": "Round corner rectangle", + "PDFE.Controllers.InsTab.txtShape_rtTriangle": "Right triangle", + "PDFE.Controllers.InsTab.txtShape_smileyFace": "Smiley Face", + "PDFE.Controllers.InsTab.txtShape_snip1Rect": "Snip single corner rectangle", + "PDFE.Controllers.InsTab.txtShape_snip2DiagRect": "Snip diagonal corner rectangle", + "PDFE.Controllers.InsTab.txtShape_snip2SameRect": "Snip same side corner rectangle", + "PDFE.Controllers.InsTab.txtShape_snipRoundRect": "Snip and round single corner rectangle", + "PDFE.Controllers.InsTab.txtShape_spline": "Curve", + "PDFE.Controllers.InsTab.txtShape_star10": "10-Point Star", + "PDFE.Controllers.InsTab.txtShape_star12": "12-Point Star", + "PDFE.Controllers.InsTab.txtShape_star16": "16-Point Star", + "PDFE.Controllers.InsTab.txtShape_star24": "24-Point Star", + "PDFE.Controllers.InsTab.txtShape_star32": "32-Point Star", + "PDFE.Controllers.InsTab.txtShape_star4": "4-Point Star", + "PDFE.Controllers.InsTab.txtShape_star5": "5-Point Star", + "PDFE.Controllers.InsTab.txtShape_star6": "6-Point Star", + "PDFE.Controllers.InsTab.txtShape_star7": "7-Point Star", + "PDFE.Controllers.InsTab.txtShape_star8": "8-Point Star", + "PDFE.Controllers.InsTab.txtShape_stripedRightArrow": "Striped right arrow", + "PDFE.Controllers.InsTab.txtShape_sun": "Sun", + "PDFE.Controllers.InsTab.txtShape_teardrop": "Teardrop", + "PDFE.Controllers.InsTab.txtShape_textRect": "Text Box", + "PDFE.Controllers.InsTab.txtShape_trapezoid": "Trapezoid", + "PDFE.Controllers.InsTab.txtShape_triangle": "Triangle", + "PDFE.Controllers.InsTab.txtShape_upArrow": "Up Arrow", + "PDFE.Controllers.InsTab.txtShape_upArrowCallout": "Up arrow callout", + "PDFE.Controllers.InsTab.txtShape_upDownArrow": "Up down arrow", + "PDFE.Controllers.InsTab.txtShape_uturnArrow": "U-Turn Arrow", + "PDFE.Controllers.InsTab.txtShape_verticalScroll": "Vertical scroll", + "PDFE.Controllers.InsTab.txtShape_wave": "Wave", + "PDFE.Controllers.InsTab.txtShape_wedgeEllipseCallout": "Oval callout", + "PDFE.Controllers.InsTab.txtShape_wedgeRectCallout": "Rectangular callout", + "PDFE.Controllers.InsTab.txtShape_wedgeRoundRectCallout": "Rounded rectangular callout", + "PDFE.Controllers.InsTab.txtBasicShapes": "Basic shapes", + "PDFE.Controllers.InsTab.txtButtons": "Buttons", + "PDFE.Controllers.InsTab.txtCallouts": "Callouts", + "PDFE.Controllers.InsTab.txtCharts": "Charts", + "PDFE.Controllers.InsTab.txtFiguredArrows": "Figured arrows", + "PDFE.Controllers.InsTab.txtLines": "Lines", + "PDFE.Controllers.InsTab.txtMath": "Math", + "PDFE.Controllers.InsTab.txtRectangles": "Rectangles", + "PDFE.Controllers.InsTab.txtStarsRibbons": "Stars & Ribbons", + "PDFE.Controllers.InsTab.textShape": "Shape", + "PDFE.Controllers.InsTab.textSymbols": "Symbols", + "PDFE.Controllers.InsTab.textAccent": "Accents", + "PDFE.Controllers.InsTab.textBracket": "Brackets", + "PDFE.Controllers.InsTab.textFraction": "Fractions", + "PDFE.Controllers.InsTab.textFunction": "Functions", + "PDFE.Controllers.InsTab.textMatrix": "Matrices", + "PDFE.Controllers.InsTab.textOperator": "Operators", + "PDFE.Controllers.InsTab.textRadical": "Radicals", + "PDFE.Controllers.InsTab.textScript": "Scripts", + "PDFE.Controllers.InsTab.textIntegral": "Integrals", + "PDFE.Controllers.InsTab.textLargeOperator": "Large operators", + "PDFE.Controllers.InsTab.textLimitAndLog": "Limits and logarithms", + "PDFE.Controllers.InsTab.txtAccent_Accent": "Acute", + "PDFE.Controllers.InsTab.txtAccent_ArrowD": "Right-left arrow above", + "PDFE.Controllers.InsTab.txtAccent_ArrowL": "Leftwards arrow above", + "PDFE.Controllers.InsTab.txtAccent_ArrowR": "Rightwards arrow above", + "PDFE.Controllers.InsTab.txtAccent_Bar": "Bar", + "PDFE.Controllers.InsTab.txtAccent_BarBot": "Underbar", + "PDFE.Controllers.InsTab.txtAccent_BarTop": "Overbar", + "PDFE.Controllers.InsTab.txtAccent_BorderBox": "Boxed formula (with placeholder)", + "PDFE.Controllers.InsTab.txtAccent_BorderBoxCustom": "Boxed formula (example)", + "PDFE.Controllers.InsTab.txtAccent_Check": "Check", + "PDFE.Controllers.InsTab.txtAccent_CurveBracketBot": "Underbrace", + "PDFE.Controllers.InsTab.txtAccent_CurveBracketTop": "Overbrace", + "PDFE.Controllers.InsTab.txtAccent_Custom_1": "Vector A", + "PDFE.Controllers.InsTab.txtAccent_Custom_2": "ABC with overbar", + "PDFE.Controllers.InsTab.txtAccent_Custom_3": "x XOR y with overbar", + "PDFE.Controllers.InsTab.txtAccent_DDDot": "Triple dot", + "PDFE.Controllers.InsTab.txtAccent_DDot": "Double dot", + "PDFE.Controllers.InsTab.txtAccent_Dot": "Dot", + "PDFE.Controllers.InsTab.txtAccent_DoubleBar": "Double overbar", + "PDFE.Controllers.InsTab.txtAccent_Grave": "Grave", + "PDFE.Controllers.InsTab.txtAccent_GroupBot": "Grouping character below", + "PDFE.Controllers.InsTab.txtAccent_GroupTop": "Grouping character above", + "PDFE.Controllers.InsTab.txtAccent_HarpoonL": "Leftwards harpoon above", + "PDFE.Controllers.InsTab.txtAccent_HarpoonR": "Rightwards harpoon above", + "PDFE.Controllers.InsTab.txtAccent_Hat": "Hat", + "PDFE.Controllers.InsTab.txtAccent_Smile": "Breve", + "PDFE.Controllers.InsTab.txtAccent_Tilde": "Tilde", + "PDFE.Controllers.InsTab.txtBracket_Angle": "Angle brackets", + "PDFE.Controllers.InsTab.txtBracket_Angle_Delimiter_2": "Angle brackets with separator", + "PDFE.Controllers.InsTab.txtBracket_Angle_Delimiter_3": "Angle brackets with two separators", + "PDFE.Controllers.InsTab.txtBracket_Angle_NoneOpen": "Right angle bracket", + "PDFE.Controllers.InsTab.txtBracket_Angle_OpenNone": "Left angle bracket", + "PDFE.Controllers.InsTab.txtBracket_Curve": "Curly brackets", + "PDFE.Controllers.InsTab.txtBracket_Curve_Delimiter_2": "Curly brackets with separator", + "PDFE.Controllers.InsTab.txtBracket_Curve_NoneOpen": "Right curly bracket", + "PDFE.Controllers.InsTab.txtBracket_Curve_OpenNone": "Left curly bracket", + "PDFE.Controllers.InsTab.txtBracket_Custom_1": "Cases (two conditions)", + "PDFE.Controllers.InsTab.txtBracket_Custom_2": "Cases (three conditions)", + "PDFE.Controllers.InsTab.txtBracket_Custom_3": "Stack object", + "PDFE.Controllers.InsTab.txtBracket_Custom_4": "Stack object in parentheses", + "PDFE.Controllers.InsTab.txtBracket_Custom_5": "Cases example", + "PDFE.Controllers.InsTab.txtBracket_Custom_6": "Binomial coefficient", + "PDFE.Controllers.InsTab.txtBracket_Custom_7": "Binomial coefficient in angle brackets", + "PDFE.Controllers.InsTab.txtBracket_Line": "Vertical bars", + "PDFE.Controllers.InsTab.txtBracket_Line_NoneOpen": "Right vertical bar", + "PDFE.Controllers.InsTab.txtBracket_Line_OpenNone": "Left vertical bar", + "PDFE.Controllers.InsTab.txtBracket_LineDouble": "Double vertical bars", + "PDFE.Controllers.InsTab.txtBracket_LineDouble_NoneOpen": "Right double vertical bar", + "PDFE.Controllers.InsTab.txtBracket_LineDouble_OpenNone": "Left double vertical bar", + "PDFE.Controllers.InsTab.txtBracket_LowLim": "Floor", + "PDFE.Controllers.InsTab.txtBracket_LowLim_NoneNone": "Right floor", + "PDFE.Controllers.InsTab.txtBracket_LowLim_OpenNone": "Left floor", + "PDFE.Controllers.InsTab.txtBracket_Round": "Parentheses", + "PDFE.Controllers.InsTab.txtBracket_Round_Delimiter_2": "Parentheses with separator", + "PDFE.Controllers.InsTab.txtBracket_Round_NoneOpen": "Right parenthesis", + "PDFE.Controllers.InsTab.txtBracket_Round_OpenNone": "Left parenthesis", + "PDFE.Controllers.InsTab.txtBracket_Square": "Square brackets", + "PDFE.Controllers.InsTab.txtBracket_Square_CloseClose": "Placeholder between two right square brackets", + "PDFE.Controllers.InsTab.txtBracket_Square_CloseOpen": "Inverted square brackets", + "PDFE.Controllers.InsTab.txtBracket_Square_NoneOpen": "Right square bracket", + "PDFE.Controllers.InsTab.txtBracket_Square_OpenNone": "Left square bracket", + "PDFE.Controllers.InsTab.txtBracket_Square_OpenOpen": "Placeholder between two left square brackets", + "PDFE.Controllers.InsTab.txtBracket_SquareDouble": "Double square brackets", + "PDFE.Controllers.InsTab.txtBracket_SquareDouble_NoneOpen": "Right double square bracket", + "PDFE.Controllers.InsTab.txtBracket_SquareDouble_OpenNone": "Left double square bracket", + "PDFE.Controllers.InsTab.txtBracket_UppLim": "Ceiling", + "PDFE.Controllers.InsTab.txtBracket_UppLim_NoneOpen": "Right ceiling", + "PDFE.Controllers.InsTab.txtBracket_UppLim_OpenNone": "Left ceiling", + "PDFE.Controllers.InsTab.txtFractionDiagonal": "Skewed fraction", + "PDFE.Controllers.InsTab.txtFractionDifferential_1": "dx over dy", + "PDFE.Controllers.InsTab.txtFractionDifferential_2": "cap delta y over cap delta x", + "PDFE.Controllers.InsTab.txtFractionDifferential_3": "partial y over partial x", + "PDFE.Controllers.InsTab.txtFractionDifferential_4": "delta y over delta x", + "PDFE.Controllers.InsTab.txtFractionHorizontal": "Linear fraction", + "PDFE.Controllers.InsTab.txtFractionPi_2": "Pi over 2", + "PDFE.Controllers.InsTab.txtFractionSmall": "Small fraction", + "PDFE.Controllers.InsTab.txtFractionVertical": "Stacked fraction", + "PDFE.Controllers.InsTab.txtFunction_1_Cos": "Inverse cosine function", + "PDFE.Controllers.InsTab.txtFunction_1_Cosh": "Hyperbolic inverse cosine function", + "PDFE.Controllers.InsTab.txtFunction_1_Cot": "Inverse cotangent function", + "PDFE.Controllers.InsTab.txtFunction_1_Coth": "Hyperbolic inverse cotangent function", + "PDFE.Controllers.InsTab.txtFunction_1_Csc": "Inverse cosecant function", + "PDFE.Controllers.InsTab.txtFunction_1_Csch": "Hyperbolic inverse cosecant function", + "PDFE.Controllers.InsTab.txtFunction_1_Sec": "Inverse secant function", + "PDFE.Controllers.InsTab.txtFunction_1_Sech": "Hyperbolic inverse secant function", + "PDFE.Controllers.InsTab.txtFunction_1_Sin": "Inverse sine function", + "PDFE.Controllers.InsTab.txtFunction_1_Sinh": "Hyperbolic inverse sine function", + "PDFE.Controllers.InsTab.txtFunction_1_Tan": "Inverse tangent function", + "PDFE.Controllers.InsTab.txtFunction_1_Tanh": "Hyperbolic inverse tangent function", + "PDFE.Controllers.InsTab.txtFunction_Cos": "Cosine function", + "PDFE.Controllers.InsTab.txtFunction_Cosh": "Hyperbolic cosine function", + "PDFE.Controllers.InsTab.txtFunction_Cot": "Cotangent function", + "PDFE.Controllers.InsTab.txtFunction_Coth": "Hyperbolic cotangent function", + "PDFE.Controllers.InsTab.txtFunction_Csc": "Cosecant function", + "PDFE.Controllers.InsTab.txtFunction_Csch": "Hyperbolic cosecant function", + "PDFE.Controllers.InsTab.txtFunction_Custom_1": "Sine theta", + "PDFE.Controllers.InsTab.txtFunction_Custom_2": "Cos 2x", + "PDFE.Controllers.InsTab.txtFunction_Custom_3": "Tangent formula", + "PDFE.Controllers.InsTab.txtFunction_Sec": "Secant function", + "PDFE.Controllers.InsTab.txtFunction_Sech": "Hyperbolic secant function", + "PDFE.Controllers.InsTab.txtFunction_Sin": "Sine function", + "PDFE.Controllers.InsTab.txtFunction_Sinh": "Hyperbolic sine function", + "PDFE.Controllers.InsTab.txtFunction_Tan": "Tangent function", + "PDFE.Controllers.InsTab.txtFunction_Tanh": "Hyperbolic tangent function", + "PDFE.Controllers.InsTab.txtIntegral": "Integral", + "PDFE.Controllers.InsTab.txtIntegral_dtheta": "Differential theta", + "PDFE.Controllers.InsTab.txtIntegral_dx": "Differential x", + "PDFE.Controllers.InsTab.txtIntegral_dy": "Differential y", + "PDFE.Controllers.InsTab.txtIntegralCenterSubSup": "Integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralDouble": "Double integral", + "PDFE.Controllers.InsTab.txtIntegralDoubleCenterSubSup": "Double integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralDoubleSubSup": "Double integral with limits", + "PDFE.Controllers.InsTab.txtIntegralOriented": "Contour integral", + "PDFE.Controllers.InsTab.txtIntegralOrientedCenterSubSup": "Contour integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralOrientedDouble": "Surface integral", + "PDFE.Controllers.InsTab.txtIntegralOrientedDoubleCenterSubSup": "Surface integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralOrientedDoubleSubSup": "Surface integral with limits", + "PDFE.Controllers.InsTab.txtIntegralOrientedSubSup": "Contour integral with limits", + "PDFE.Controllers.InsTab.txtIntegralOrientedTriple": "Volume integral", + "PDFE.Controllers.InsTab.txtIntegralOrientedTripleCenterSubSup": "Volume integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralOrientedTripleSubSup": "Volume integral with limits", + "PDFE.Controllers.InsTab.txtIntegralSubSup": "Integral with limits", + "PDFE.Controllers.InsTab.txtIntegralTriple": "Triple integral", + "PDFE.Controllers.InsTab.txtIntegralTripleCenterSubSup": "Triple integral with stacked limits", + "PDFE.Controllers.InsTab.txtIntegralTripleSubSup": "Triple integral with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Conjunction": "Logical And", + "PDFE.Controllers.InsTab.txtLargeOperator_Conjunction_CenterSub": "Logical And with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Conjunction_CenterSubSup": "Logical And with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Conjunction_Sub": "Logical And with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Conjunction_SubSup": "Logical And with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_CoProd": "Co-product", + "PDFE.Controllers.InsTab.txtLargeOperator_CoProd_CenterSub": "Co-product with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_CoProd_CenterSubSup": "Co-product with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_CoProd_Sub": "Co-product with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_CoProd_SubSup": "Co-product with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Custom_1": "Summation over k of n choose k", + "PDFE.Controllers.InsTab.txtLargeOperator_Custom_2": "Summation from i equal zero to n", + "PDFE.Controllers.InsTab.txtLargeOperator_Custom_3": "Summation example using two indices", + "PDFE.Controllers.InsTab.txtLargeOperator_Custom_4": "Product example", + "PDFE.Controllers.InsTab.txtLargeOperator_Custom_5": "Union example", + "PDFE.Controllers.InsTab.txtLargeOperator_Disjunction": "Logical Or", + "PDFE.Controllers.InsTab.txtLargeOperator_Disjunction_CenterSub": "Logical Or with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Disjunction_CenterSubSup": "Logical Or with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Disjunction_Sub": "Logical Or with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Disjunction_SubSup": "Logical Or with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Intersection": "Intersection", + "PDFE.Controllers.InsTab.txtLargeOperator_Intersection_CenterSub": "Intersection with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Intersection_CenterSubSup": "Intersection with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Intersection_Sub": "Intersection with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Intersection_SubSup": "Intersection with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Prod": "Product", + "PDFE.Controllers.InsTab.txtLargeOperator_Prod_CenterSub": "Product with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Prod_CenterSubSup": "Product with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Prod_Sub": "Product with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Prod_SubSup": "Product with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Sum": "Summation", + "PDFE.Controllers.InsTab.txtLargeOperator_Sum_CenterSub": "Summation with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Sum_CenterSubSup": "Summation with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Sum_Sub": "Summation with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Sum_SubSup": "Summation with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Union": "Union", + "PDFE.Controllers.InsTab.txtLargeOperator_Union_CenterSub": "Union with lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Union_CenterSubSup": "Union with limits", + "PDFE.Controllers.InsTab.txtLargeOperator_Union_Sub": "Union with subscript lower limit", + "PDFE.Controllers.InsTab.txtLargeOperator_Union_SubSup": "Union with subscript/superscript limits", + "PDFE.Controllers.InsTab.txtLimitLog_Custom_1": "Limit example", + "PDFE.Controllers.InsTab.txtLimitLog_Custom_2": "Maximum example", + "PDFE.Controllers.InsTab.txtLimitLog_Lim": "Limit", + "PDFE.Controllers.InsTab.txtLimitLog_Ln": "Natural logarithm", + "PDFE.Controllers.InsTab.txtLimitLog_Log": "Logarithm", + "PDFE.Controllers.InsTab.txtLimitLog_LogBase": "Logarithm", + "PDFE.Controllers.InsTab.txtLimitLog_Max": "Maximum", + "PDFE.Controllers.InsTab.txtLimitLog_Min": "Minimum", + "PDFE.Controllers.InsTab.txtMatrix_1_2": "1x2 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_1_3": "1x3 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_2_1": "2x1 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_2_2": "2x2 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_2_2_DLineBracket": "Empty 2 by 2 matrix in double vertical bars", + "PDFE.Controllers.InsTab.txtMatrix_2_2_LineBracket": "Empty 2 by 2 determinant", + "PDFE.Controllers.InsTab.txtMatrix_2_2_RoundBracket": "Empty 2 by 2 matrix in parentheses", + "PDFE.Controllers.InsTab.txtMatrix_2_2_SquareBracket": "Empty 2 by 2 matrix in brackets", + "PDFE.Controllers.InsTab.txtMatrix_2_3": "2x3 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_3_1": "3x1 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_3_2": "3x2 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_3_3": "3x3 empty matrix", + "PDFE.Controllers.InsTab.txtMatrix_Dots_Baseline": "Baseline dots", + "PDFE.Controllers.InsTab.txtMatrix_Dots_Center": "Midline dots", + "PDFE.Controllers.InsTab.txtMatrix_Dots_Diagonal": "Diagonal dots", + "PDFE.Controllers.InsTab.txtMatrix_Dots_Vertical": "Vertical dots", + "PDFE.Controllers.InsTab.txtMatrix_Flat_Round": "Sparse matrix in parentheses", + "PDFE.Controllers.InsTab.txtMatrix_Flat_Square": "Sparse matrix in brackets", + "PDFE.Controllers.InsTab.txtMatrix_Identity_2": "2x2 identity matrix with zeros", + "PDFE.Controllers.InsTab.txtMatrix_Identity_2_NoZeros": "2x2 identity matrix with blank off-diagonal cells", + "PDFE.Controllers.InsTab.txtMatrix_Identity_3": "3x3 identity matrix with zeros", + "PDFE.Controllers.InsTab.txtMatrix_Identity_3_NoZeros": "3x3 identity matrix with blank off-diagonal cells", + "PDFE.Controllers.InsTab.txtOperator_ArrowD_Bot": "Right-left arrow below", + "PDFE.Controllers.InsTab.txtOperator_ArrowD_Top": "Right-left arrow above", + "PDFE.Controllers.InsTab.txtOperator_ArrowL_Bot": "Leftwards arrow below", + "PDFE.Controllers.InsTab.txtOperator_ArrowL_Top": "Leftwards arrow above", + "PDFE.Controllers.InsTab.txtOperator_ArrowR_Bot": "Rightwards arrow below", + "PDFE.Controllers.InsTab.txtOperator_ArrowR_Top": "Rightwards arrow above", + "PDFE.Controllers.InsTab.txtOperator_ColonEquals": "Colon equal", + "PDFE.Controllers.InsTab.txtOperator_Custom_1": "Yields", + "PDFE.Controllers.InsTab.txtOperator_Custom_2": "Delta yields", + "PDFE.Controllers.InsTab.txtOperator_Definition": "Equal to by definition", + "PDFE.Controllers.InsTab.txtOperator_DeltaEquals": "Delta equal to", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowD_Bot": "Right-left double arrow below", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowD_Top": "Right-left double arrow above", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowL_Bot": "Leftwards arrow below", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowL_Top": "Leftwards arrow above", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowR_Bot": "Rightwards arrow below", + "PDFE.Controllers.InsTab.txtOperator_DoubleArrowR_Top": "Rightwards arrow above", + "PDFE.Controllers.InsTab.txtOperator_EqualsEquals": "Equal equal", + "PDFE.Controllers.InsTab.txtOperator_MinusEquals": "Minus equal", + "PDFE.Controllers.InsTab.txtOperator_PlusEquals": "Plus equal", + "PDFE.Controllers.InsTab.txtOperator_UnitOfMeasure": "Measured by", + "PDFE.Controllers.InsTab.txtRadicalCustom_1": "Right hand side of quadratic formula", + "PDFE.Controllers.InsTab.txtRadicalCustom_2": "Square root of a squared plus b squared", + "PDFE.Controllers.InsTab.txtRadicalRoot_2": "Square root with degree", + "PDFE.Controllers.InsTab.txtRadicalRoot_3": "Cubic root", + "PDFE.Controllers.InsTab.txtRadicalRoot_n": "Radical with degree", + "PDFE.Controllers.InsTab.txtRadicalSqrt": "Square root", + "PDFE.Controllers.InsTab.txtScriptCustom_1": "x subscript y squared", + "PDFE.Controllers.InsTab.txtScriptCustom_2": "e to the minus i omega t", + "PDFE.Controllers.InsTab.txtScriptCustom_3": "x squared", + "PDFE.Controllers.InsTab.txtScriptCustom_4": "Y left superscript n left subscript one", + "PDFE.Controllers.InsTab.txtScriptSub": "Subscript", + "PDFE.Controllers.InsTab.txtScriptSubSup": "Subscript-superscript", + "PDFE.Controllers.InsTab.txtScriptSubSupLeft": "Left subscript-superscript", + "PDFE.Controllers.InsTab.txtScriptSup": "Superscript", + "PDFE.Controllers.InsTab.txtSymbol_about": "Approximately", + "PDFE.Controllers.InsTab.txtSymbol_additional": "Complement", + "PDFE.Controllers.InsTab.txtSymbol_aleph": "Alef", + "PDFE.Controllers.InsTab.txtSymbol_alpha": "Alpha", + "PDFE.Controllers.InsTab.txtSymbol_approx": "Almost equal to", + "PDFE.Controllers.InsTab.txtSymbol_ast": "Asterisk operator", + "PDFE.Controllers.InsTab.txtSymbol_beta": "Beta", + "PDFE.Controllers.InsTab.txtSymbol_beth": "Bet", + "PDFE.Controllers.InsTab.txtSymbol_bullet": "Bullet operator", + "PDFE.Controllers.InsTab.txtSymbol_cap": "Intersection", + "PDFE.Controllers.InsTab.txtSymbol_cbrt": "Cube root", + "PDFE.Controllers.InsTab.txtSymbol_cdots": "Midline horizontal ellipsis", + "PDFE.Controllers.InsTab.txtSymbol_celsius": "Degrees Celsius", + "PDFE.Controllers.InsTab.txtSymbol_chi": "Chi", + "PDFE.Controllers.InsTab.txtSymbol_cong": "Approximately equal to", + "PDFE.Controllers.InsTab.txtSymbol_cup": "Union", + "PDFE.Controllers.InsTab.txtSymbol_ddots": "Down right diagonal ellipsis", + "PDFE.Controllers.InsTab.txtSymbol_degree": "Degrees", + "PDFE.Controllers.InsTab.txtSymbol_delta": "Delta", + "PDFE.Controllers.InsTab.txtSymbol_div": "Division sign", + "PDFE.Controllers.InsTab.txtSymbol_downarrow": "Down arrow", + "PDFE.Controllers.InsTab.txtSymbol_emptyset": "Empty set", + "PDFE.Controllers.InsTab.txtSymbol_epsilon": "Epsilon", + "PDFE.Controllers.InsTab.txtSymbol_equals": "Equal", + "PDFE.Controllers.InsTab.txtSymbol_equiv": "Identical to", + "PDFE.Controllers.InsTab.txtSymbol_eta": "Eta", + "PDFE.Controllers.InsTab.txtSymbol_exists": "There exist", + "PDFE.Controllers.InsTab.txtSymbol_factorial": "Factorial", + "PDFE.Controllers.InsTab.txtSymbol_fahrenheit": "Degrees Fahrenheit", + "PDFE.Controllers.InsTab.txtSymbol_forall": "For all", + "PDFE.Controllers.InsTab.txtSymbol_gamma": "Gamma", + "PDFE.Controllers.InsTab.txtSymbol_geq": "Greater than or equal to", + "PDFE.Controllers.InsTab.txtSymbol_gg": "Much greater than", + "PDFE.Controllers.InsTab.txtSymbol_greater": "Greater than", + "PDFE.Controllers.InsTab.txtSymbol_in": "Element of", + "PDFE.Controllers.InsTab.txtSymbol_inc": "Increment", + "PDFE.Controllers.InsTab.txtSymbol_infinity": "Infinity", + "PDFE.Controllers.InsTab.txtSymbol_iota": "Iota", + "PDFE.Controllers.InsTab.txtSymbol_kappa": "Kappa", + "PDFE.Controllers.InsTab.txtSymbol_lambda": "Lambda", + "PDFE.Controllers.InsTab.txtSymbol_leftarrow": "Left arrow", + "PDFE.Controllers.InsTab.txtSymbol_leftrightarrow": "Left-right arrow", + "PDFE.Controllers.InsTab.txtSymbol_leq": "Less than or equal to", + "PDFE.Controllers.InsTab.txtSymbol_less": "Less than", + "PDFE.Controllers.InsTab.txtSymbol_ll": "Much less than", + "PDFE.Controllers.InsTab.txtSymbol_minus": "Minus", + "PDFE.Controllers.InsTab.txtSymbol_mp": "Minus plus", + "PDFE.Controllers.InsTab.txtSymbol_mu": "Mu", + "PDFE.Controllers.InsTab.txtSymbol_nabla": "Nabla", + "PDFE.Controllers.InsTab.txtSymbol_neq": "Not equal to", + "PDFE.Controllers.InsTab.txtSymbol_ni": "Contains as member", + "PDFE.Controllers.InsTab.txtSymbol_not": "Not sign", + "PDFE.Controllers.InsTab.txtSymbol_notexists": "There does not exist", + "PDFE.Controllers.InsTab.txtSymbol_nu": "Nu", + "PDFE.Controllers.InsTab.txtSymbol_o": "Omicron", + "PDFE.Controllers.InsTab.txtSymbol_omega": "Omega", + "PDFE.Controllers.InsTab.txtSymbol_partial": "Partial differential", + "PDFE.Controllers.InsTab.txtSymbol_percent": "Percentage", + "PDFE.Controllers.InsTab.txtSymbol_phi": "Phi", + "PDFE.Controllers.InsTab.txtSymbol_pi": "Pi", + "PDFE.Controllers.InsTab.txtSymbol_plus": "Plus", + "PDFE.Controllers.InsTab.txtSymbol_pm": "Plus minus", + "PDFE.Controllers.InsTab.txtSymbol_propto": "Proportional to", + "PDFE.Controllers.InsTab.txtSymbol_psi": "Psi", + "PDFE.Controllers.InsTab.txtSymbol_qdrt": "Fourth root", + "PDFE.Controllers.InsTab.txtSymbol_qed": "End of proof", + "PDFE.Controllers.InsTab.txtSymbol_rddots": "Up right diagonal ellipsis", + "PDFE.Controllers.InsTab.txtSymbol_rho": "Rho", + "PDFE.Controllers.InsTab.txtSymbol_rightarrow": "Right arrow", + "PDFE.Controllers.InsTab.txtSymbol_sigma": "Sigma", + "PDFE.Controllers.InsTab.txtSymbol_sqrt": "Radical sign", + "PDFE.Controllers.InsTab.txtSymbol_tau": "Tau", + "PDFE.Controllers.InsTab.txtSymbol_therefore": "Therefore", + "PDFE.Controllers.InsTab.txtSymbol_theta": "Theta", + "PDFE.Controllers.InsTab.txtSymbol_times": "Multiplication sign", + "PDFE.Controllers.InsTab.txtSymbol_uparrow": "Up arrow", + "PDFE.Controllers.InsTab.txtSymbol_upsilon": "Upsilon", + "PDFE.Controllers.InsTab.txtSymbol_varepsilon": "Epsilon variant", + "PDFE.Controllers.InsTab.txtSymbol_varphi": "Phi variant", + "PDFE.Controllers.InsTab.txtSymbol_varpi": "Pi variant", + "PDFE.Controllers.InsTab.txtSymbol_varrho": "Rho variant", + "PDFE.Controllers.InsTab.txtSymbol_varsigma": "Sigma variant", + "PDFE.Controllers.InsTab.txtSymbol_vartheta": "Theta variant", + "PDFE.Controllers.InsTab.txtSymbol_vdots": "Vertical ellipsis", + "PDFE.Controllers.InsTab.txtSymbol_xsi": "Xi", + "PDFE.Controllers.InsTab.txtSymbol_zeta": "Zeta", "PDFE.Controllers.LeftMenu.leavePageText": "All unsaved changes in this document will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "PDFE.Controllers.LeftMenu.newDocumentTitle": "Unnamed document", "PDFE.Controllers.LeftMenu.notcriticalErrorTitle": "Warning", @@ -459,6 +970,15 @@ "PDFE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "PDFE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PDFE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PDFE.Controllers.Main.textShape": "Shape", + "PDFE.Controllers.Main.splitDividerErrorText": "The number of rows must be a divisor of %1.", + "PDFE.Controllers.Main.splitMaxColsErrorText": "The number of columns must be less than %1.", + "PDFE.Controllers.Main.splitMaxRowsErrorText": "The number of rows must be less than %1.", + "PDFE.Controllers.Main.errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:
opening price, max price, min price, closing price.", + "PDFE.Controllers.Main.errorDataRange": "Incorrect data range.", + "PDFE.Controllers.Main.errorDatabaseConnection": "External error.
Database connection error. Please contact support in case the error persists.", + "PDFE.Controllers.Main.errorComboSeries": "To create a combination chart, select at least two series of data.", + "PDFE.Controllers.Navigation.txtBeginning": "Beginning of document", "PDFE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "PDFE.Controllers.Print.textMarginsLast": "Last custom", @@ -497,6 +1017,169 @@ "PDFE.Views.DocumentHolder.textRedo": "Redo", "PDFE.Views.DocumentHolder.textUndo": "Undo", "PDFE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.
Are you sure you want to continue?", + "PDFE.Views.DocumentHolder.aboveText": "Above", + "PDFE.Views.DocumentHolder.advancedChartText": "Chart advanced settings", + "PDFE.Views.DocumentHolder.advancedEquationText": "Equation settings", + "PDFE.Views.DocumentHolder.advancedImageText": "Image advanced settings", + "PDFE.Views.DocumentHolder.advancedParagraphText": "Paragraph advanced settings", + "PDFE.Views.DocumentHolder.advancedShapeText": "Shape advanced settings", + "PDFE.Views.DocumentHolder.advancedTableText": "Table advanced settings", + "PDFE.Views.DocumentHolder.alignmentText": "Alignment", + "PDFE.Views.DocumentHolder.allLinearText": "All - Linear", + "PDFE.Views.DocumentHolder.allProfText": "All - Professional", + "PDFE.Views.DocumentHolder.belowText": "Below", + "PDFE.Views.DocumentHolder.cellAlignText": "Cell vertical alignment", + "PDFE.Views.DocumentHolder.cellText": "Cell", + "PDFE.Views.DocumentHolder.centerText": "Center", + "PDFE.Views.DocumentHolder.columnText": "Column", + "PDFE.Views.DocumentHolder.currLinearText": "Current - Linear", + "PDFE.Views.DocumentHolder.currProfText": "Current - Professional", + "PDFE.Views.DocumentHolder.deleteColumnText": "Delete Column", + "PDFE.Views.DocumentHolder.deleteRowText": "Delete row", + "PDFE.Views.DocumentHolder.deleteTableText": "Delete table", + "PDFE.Views.DocumentHolder.deleteText": "Delete", + "PDFE.Views.DocumentHolder.direct270Text": "Rotate text up", + "PDFE.Views.DocumentHolder.direct90Text": "Rotate text down", + "PDFE.Views.DocumentHolder.directHText": "Horizontal", + "PDFE.Views.DocumentHolder.directionText": "Text direction", + "PDFE.Views.DocumentHolder.editChartText": "Edit data", + "PDFE.Views.DocumentHolder.editHyperlinkText": "Edit hyperlink", + "PDFE.Views.DocumentHolder.hideEqToolbar": "Hide equation toolbar", + "PDFE.Views.DocumentHolder.hyperlinkText": "Hyperlink", + "PDFE.Views.DocumentHolder.insertColumnLeftText": "Column left", + "PDFE.Views.DocumentHolder.insertColumnRightText": "Column right", + "PDFE.Views.DocumentHolder.insertColumnText": "Insert column", + "PDFE.Views.DocumentHolder.insertRowAboveText": "Row Above", + "PDFE.Views.DocumentHolder.insertRowBelowText": "Row Below", + "PDFE.Views.DocumentHolder.insertRowText": "Insert row", + "PDFE.Views.DocumentHolder.insertText": "Insert", + "PDFE.Views.DocumentHolder.latexText": "LaTeX", + "PDFE.Views.DocumentHolder.leftText": "Left", + "PDFE.Views.DocumentHolder.mergeCellsText": "Merge cells", + "PDFE.Views.DocumentHolder.originalSizeText": "Actual size", + "PDFE.Views.DocumentHolder.removeHyperlinkText": "Remove hyperlink", + "PDFE.Views.DocumentHolder.rightText": "Right", + "PDFE.Views.DocumentHolder.rowText": "Row", + "PDFE.Views.DocumentHolder.selectText": "Select", + "PDFE.Views.DocumentHolder.showEqToolbar": "Show Equation Toolbar", + "PDFE.Views.DocumentHolder.splitCellsText": "Split cell...", + "PDFE.Views.DocumentHolder.splitCellTitleText": "Split Cell", + "PDFE.Views.DocumentHolder.tableText": "Table", + "PDFE.Views.DocumentHolder.textArrangeBack": "Send to background", + "PDFE.Views.DocumentHolder.textArrangeBackward": "Send backward", + "PDFE.Views.DocumentHolder.textArrangeForward": "Bring forward", + "PDFE.Views.DocumentHolder.textArrangeFront": "Bring to foreground", + "PDFE.Views.DocumentHolder.textCm": "cm", + "PDFE.Views.DocumentHolder.textCrop": "Crop", + "PDFE.Views.DocumentHolder.textCropFill": "Fill", + "PDFE.Views.DocumentHolder.textCropFit": "Fit", + "PDFE.Views.DocumentHolder.textCustom": "Custom", + "PDFE.Views.DocumentHolder.textDistributeCols": "Distribute columns", + "PDFE.Views.DocumentHolder.textDistributeRows": "Distribute rows", + "PDFE.Views.DocumentHolder.textEditPoints": "Edit points", + "PDFE.Views.DocumentHolder.textFlipH": "Flip horizontally", + "PDFE.Views.DocumentHolder.textFlipV": "Flip vertically", + "PDFE.Views.DocumentHolder.textFromFile": "From file", + "PDFE.Views.DocumentHolder.textFromStorage": "From Storage", + "PDFE.Views.DocumentHolder.textFromUrl": "From URL", + "PDFE.Views.DocumentHolder.textReplace": "Replace image", + "PDFE.Views.DocumentHolder.textRotate": "Rotate", + "PDFE.Views.DocumentHolder.textRotate270": "Rotate 90° Counterclockwise", + "PDFE.Views.DocumentHolder.textRotate90": "Rotate 90° Clockwise", + "PDFE.Views.DocumentHolder.textSaveAsPicture": "Save as picture", + "PDFE.Views.DocumentHolder.textShapeAlignBottom": "Align Bottom", + "PDFE.Views.DocumentHolder.textShapeAlignCenter": "Align center", + "PDFE.Views.DocumentHolder.textShapeAlignLeft": "Align left", + "PDFE.Views.DocumentHolder.textShapeAlignMiddle": "Align middle", + "PDFE.Views.DocumentHolder.textShapeAlignRight": "Align right", + "PDFE.Views.DocumentHolder.textShapeAlignTop": "Align top", + "PDFE.Views.DocumentHolder.tipIsLocked": "This element is currently being edited by another user.", + "PDFE.Views.DocumentHolder.txtAddBottom": "Add bottom border", + "PDFE.Views.DocumentHolder.txtAddFractionBar": "Add fraction bar", + "PDFE.Views.DocumentHolder.txtAddHor": "Add horizontal line", + "PDFE.Views.DocumentHolder.txtAddLB": "Add left bottom line", + "PDFE.Views.DocumentHolder.txtAddLeft": "Add left border", + "PDFE.Views.DocumentHolder.txtAddLT": "Add left top line", + "PDFE.Views.DocumentHolder.txtAddRight": "Add right border", + "PDFE.Views.DocumentHolder.txtAddTop": "Add top border", + "PDFE.Views.DocumentHolder.txtAddVer": "Add vertical line", + "PDFE.Views.DocumentHolder.txtAlign": "Align", + "PDFE.Views.DocumentHolder.txtAlignToChar": "Align to character", + "PDFE.Views.DocumentHolder.txtArrange": "Arrange", + "PDFE.Views.DocumentHolder.txtBackground": "Background", + "PDFE.Views.DocumentHolder.txtBorderProps": "Border properties", + "PDFE.Views.DocumentHolder.txtBottom": "Bottom", + "PDFE.Views.DocumentHolder.txtColumnAlign": "Column alignment", + "PDFE.Views.DocumentHolder.txtDecreaseArg": "Decrease argument size", + "PDFE.Views.DocumentHolder.txtDeleteArg": "Delete argument", + "PDFE.Views.DocumentHolder.txtDeleteBreak": "Delete manual break", + "PDFE.Views.DocumentHolder.txtDeleteChars": "Delete enclosing characters", + "PDFE.Views.DocumentHolder.txtDeleteCharsAndSeparators": "Delete enclosing characters and separators", + "PDFE.Views.DocumentHolder.txtDeleteEq": "Delete equation", + "PDFE.Views.DocumentHolder.txtDeleteGroupChar": "Delete char", + "PDFE.Views.DocumentHolder.txtDeleteRadical": "Delete radical", + "PDFE.Views.DocumentHolder.txtDistribHor": "Distribute horizontally", + "PDFE.Views.DocumentHolder.txtDistribVert": "Distribute vertically", + "PDFE.Views.DocumentHolder.txtFractionLinear": "Change to linear fraction", + "PDFE.Views.DocumentHolder.txtFractionSkewed": "Change to skewed fraction", + "PDFE.Views.DocumentHolder.txtFractionStacked": "Change to stacked fraction", + "PDFE.Views.DocumentHolder.txtGroup": "Group", + "PDFE.Views.DocumentHolder.txtGroupCharOver": "Char over text", + "PDFE.Views.DocumentHolder.txtGroupCharUnder": "Char under text", + "PDFE.Views.DocumentHolder.txtHideBottom": "Hide bottom border", + "PDFE.Views.DocumentHolder.txtHideBottomLimit": "Hide bottom limit", + "PDFE.Views.DocumentHolder.txtHideCloseBracket": "Hide closing bracket", + "PDFE.Views.DocumentHolder.txtHideDegree": "Hide degree", + "PDFE.Views.DocumentHolder.txtHideHor": "Hide horizontal line", + "PDFE.Views.DocumentHolder.txtHideLB": "Hide left bottom line", + "PDFE.Views.DocumentHolder.txtHideLeft": "Hide left border", + "PDFE.Views.DocumentHolder.txtHideLT": "Hide left top line", + "PDFE.Views.DocumentHolder.txtHideOpenBracket": "Hide opening bracket", + "PDFE.Views.DocumentHolder.txtHidePlaceholder": "Hide placeholder", + "PDFE.Views.DocumentHolder.txtHideRight": "Hide right border", + "PDFE.Views.DocumentHolder.txtHideTop": "Hide top border", + "PDFE.Views.DocumentHolder.txtHideTopLimit": "Hide top limit", + "PDFE.Views.DocumentHolder.txtHideVer": "Hide vertical line", + "PDFE.Views.DocumentHolder.txtIncreaseArg": "Increase argument size", + "PDFE.Views.DocumentHolder.txtInsertArgAfter": "Insert argument after", + "PDFE.Views.DocumentHolder.txtInsertArgBefore": "Insert argument before", + "PDFE.Views.DocumentHolder.txtInsertBreak": "Insert manual break", + "PDFE.Views.DocumentHolder.txtInsertEqAfter": "Insert equation after", + "PDFE.Views.DocumentHolder.txtInsertEqBefore": "Insert equation before", + "PDFE.Views.DocumentHolder.txtLimitChange": "Change limits location", + "PDFE.Views.DocumentHolder.txtLimitOver": "Limit over text", + "PDFE.Views.DocumentHolder.txtLimitUnder": "Limit under text", + "PDFE.Views.DocumentHolder.txtMatchBrackets": "Match brackets to argument height", + "PDFE.Views.DocumentHolder.txtMatrixAlign": "Matrix alignment", + "PDFE.Views.DocumentHolder.txtOverbar": "Bar over text", + "PDFE.Views.DocumentHolder.txtPressLink": "Press {0} and click link", + "PDFE.Views.DocumentHolder.txtPrintSelection": "Print selection", + "PDFE.Views.DocumentHolder.txtRemFractionBar": "Remove fraction bar", + "PDFE.Views.DocumentHolder.txtRemLimit": "Remove limit", + "PDFE.Views.DocumentHolder.txtRemoveAccentChar": "Remove accent character", + "PDFE.Views.DocumentHolder.txtRemoveBar": "Remove bar", + "PDFE.Views.DocumentHolder.txtRemScripts": "Remove scripts", + "PDFE.Views.DocumentHolder.txtRemSubscript": "Remove subscript", + "PDFE.Views.DocumentHolder.txtRemSuperscript": "Remove superscript", + "PDFE.Views.DocumentHolder.txtScriptsAfter": "Scripts after text", + "PDFE.Views.DocumentHolder.txtScriptsBefore": "Scripts before text", + "PDFE.Views.DocumentHolder.txtSelectAll": "Select all", + "PDFE.Views.DocumentHolder.txtShowBottomLimit": "Show bottom limit", + "PDFE.Views.DocumentHolder.txtShowCloseBracket": "Show closing bracket", + "PDFE.Views.DocumentHolder.txtShowDegree": "Show degree", + "PDFE.Views.DocumentHolder.txtShowOpenBracket": "Show opening bracket", + "PDFE.Views.DocumentHolder.txtShowPlaceholder": "Show placeholder", + "PDFE.Views.DocumentHolder.txtShowTopLimit": "Show top limit", + "PDFE.Views.DocumentHolder.txtStretchBrackets": "Stretch brackets", + "PDFE.Views.DocumentHolder.txtTop": "Top", + "PDFE.Views.DocumentHolder.txtUnderbar": "Bar under text", + "PDFE.Views.DocumentHolder.txtUngroup": "Ungroup", + "PDFE.Views.DocumentHolder.unicodeText": "Unicode", + "PDFE.Views.DocumentHolder.vertAlignText": "Vertical alignment", + "PDFE.Views.DocumentHolder.txtDeletePage": "Delete page", + "PDFE.Views.DocumentHolder.txtNewPage": "Insert blank page", + "PDFE.Views.DocumentHolder.txtRotateRight": "Rotate page right", + "PDFE.Views.DocumentHolder.txtRotateLeft": "Rotate page left", "PDFE.Views.FileMenu.btnBackCaption": "Open File Location", "PDFE.Views.FileMenu.btnCloseEditor": "Close File", "PDFE.Views.FileMenu.btnCloseMenuCaption": "Close Menu", @@ -607,8 +1290,120 @@ "PDFE.Views.FileMenuPanels.Settings.txtUseOptionKey": "Use Option key to navigate the user interface using the keyboard", "PDFE.Views.FileMenuPanels.Settings.txtWin": "as Windows", "PDFE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace", + "PDFE.Views.FileMenuPanels.Settings.strUnit": "Unit of measurement", + "PDFE.Views.FileMenuPanels.Settings.txtCm": "Centimeter", + "PDFE.Views.FileMenuPanels.Settings.txtInch": "Inch", + "PDFE.Views.FileMenuPanels.Settings.txtPt": "Point", "PDFE.Views.FileMenuPanels.ViewSaveAs.textDownloadAs": "Download as", "PDFE.Views.FileMenuPanels.ViewSaveCopy.textSaveCopyAs": "Save Copy as", + "PDFE.Views.ImageSettings.textAdvanced": "Show advanced settings", + "PDFE.Views.ImageSettings.textCrop": "Crop", + "PDFE.Views.ImageSettings.textCropFill": "Fill", + "PDFE.Views.ImageSettings.textCropFit": "Fit", + "PDFE.Views.ImageSettings.textCropToShape": "Crop to shape", + "PDFE.Views.ImageSettings.textEdit": "Edit", + "PDFE.Views.ImageSettings.textEditObject": "Edit object", + "PDFE.Views.ImageSettings.textFitPage": "Fit to page", + "PDFE.Views.ImageSettings.textFlip": "Flip", + "PDFE.Views.ImageSettings.textFromFile": "From file", + "PDFE.Views.ImageSettings.textFromStorage": "From storage", + "PDFE.Views.ImageSettings.textFromUrl": "From URL", + "PDFE.Views.ImageSettings.textHeight": "Height", + "PDFE.Views.ImageSettings.textHint270": "Rotate 90° Counterclockwise", + "PDFE.Views.ImageSettings.textHint90": "Rotate 90° Clockwise", + "PDFE.Views.ImageSettings.textHintFlipH": "Flip horizontally", + "PDFE.Views.ImageSettings.textHintFlipV": "Flip vertically", + "PDFE.Views.ImageSettings.textInsert": "Replace Image", + "PDFE.Views.ImageSettings.textOriginalSize": "Actual size", + "PDFE.Views.ImageSettings.textRecentlyUsed": "Recently used", + "PDFE.Views.ImageSettings.textRotate90": "Rotate 90°", + "PDFE.Views.ImageSettings.textRotation": "Rotation", + "PDFE.Views.ImageSettings.textSize": "Size", + "PDFE.Views.ImageSettings.textWidth": "Width", + "PDFE.Views.ImageSettingsAdvanced.textAlt": "Alternative text", + "PDFE.Views.ImageSettingsAdvanced.textAltDescription": "Description", + "PDFE.Views.ImageSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, shape, chart, or table.", + "PDFE.Views.ImageSettingsAdvanced.textAltTitle": "Title", + "PDFE.Views.ImageSettingsAdvanced.textAngle": "Angle", + "PDFE.Views.ImageSettingsAdvanced.textCenter": "Center", + "PDFE.Views.ImageSettingsAdvanced.textFlipped": "Flipped", + "PDFE.Views.ImageSettingsAdvanced.textFrom": "From", + "PDFE.Views.ImageSettingsAdvanced.textGeneral": "General", + "PDFE.Views.ImageSettingsAdvanced.textHeight": "Height", + "PDFE.Views.ImageSettingsAdvanced.textHorizontal": "Horizontal", + "PDFE.Views.ImageSettingsAdvanced.textHorizontally": "Horizontally", + "PDFE.Views.ImageSettingsAdvanced.textImageName": "Image name", + "PDFE.Views.ImageSettingsAdvanced.textKeepRatio": "Constant proportions", + "PDFE.Views.ImageSettingsAdvanced.textOriginalSize": "Actual size", + "PDFE.Views.ImageSettingsAdvanced.textPlacement": "Placement", + "PDFE.Views.ImageSettingsAdvanced.textPosition": "Position", + "PDFE.Views.ImageSettingsAdvanced.textRotation": "Rotation", + "PDFE.Views.ImageSettingsAdvanced.textSize": "Size", + "PDFE.Views.ImageSettingsAdvanced.textTitle": "Image - Advanced settings", + "PDFE.Views.ImageSettingsAdvanced.textTopLeftCorner": "Top left corner", + "PDFE.Views.ImageSettingsAdvanced.textVertical": "Vertical", + "PDFE.Views.ImageSettingsAdvanced.textVertically": "Vertically", + "PDFE.Views.ImageSettingsAdvanced.textWidth": "Width", + "PDFE.Views.InsTab.tipInsertChart": "Insert chart", + "PDFE.Views.InsTab.tipInsertEquation": "Insert equation", + "PDFE.Views.InsTab.tipInsertHorizontalText": "Insert horizontal text box", + "PDFE.Views.InsTab.tipInsertHyperlink": "Add hyperlink", + "PDFE.Views.InsTab.tipInsertImage": "Insert image", + "PDFE.Views.InsTab.tipInsertShape": "Insert shape", + "PDFE.Views.InsTab.tipInsertSymbol": "Insert symbol", + "PDFE.Views.InsTab.tipInsertTable": "Insert table", + "PDFE.Views.InsTab.tipInsertText": "Insert text box", + "PDFE.Views.InsTab.tipInsertTextArt": "Insert Text Art", + "PDFE.Views.InsTab.tipInsertVerticalText": "Insert vertical text box", + "PDFE.Views.InsTab.mniImageFromFile": "Image from File", + "PDFE.Views.InsTab.mniImageFromStorage": "Image from Storage", + "PDFE.Views.InsTab.mniImageFromUrl": "Image from URL", + "PDFE.Views.InsTab.capInsertText": "Text Box", + "PDFE.Views.InsTab.capInsertTextArt": "Text Art", + "PDFE.Views.InsTab.capInsertImage": "Image", + "PDFE.Views.InsTab.capInsertShape": "Shape", + "PDFE.Views.InsTab.capInsertTable": "Table", + "PDFE.Views.InsTab.capInsertChart": "Chart", + "PDFE.Views.InsTab.capInsertEquation": "Equation", + "PDFE.Views.InsTab.capInsertHyperlink": "Hyperlink", + "PDFE.Views.InsTab.tipPageNum": "Insert page number", + "PDFE.Views.InsTab.tipDateTime": "Insert current date and time", + "PDFE.Views.InsTab.capAddPage": "Add Page", + "PDFE.Views.InsTab.tipAddPage": "Add page", + "PDFE.Views.InsTab.capBtnDateTime": "Date & Time", + "PDFE.Views.InsTab.capBtnPageNum": "Page Number", + "PDFE.Views.InsTab.capBtnInsSmartArt": "SmartArt", + "PDFE.Views.InsTab.capBtnInsSymbol": "Symbol", + "PDFE.Views.InsTab.mniInsertSSE": "Insert Spreadsheet", + "PDFE.Views.InsTab.textMoreSymbols": "More symbols", + "PDFE.Views.InsTab.textAlpha": "Greek Small Letter Alpha", + "PDFE.Views.InsTab.textBetta": "Greek Small Letter Beta", + "PDFE.Views.InsTab.textBlackHeart": "Black heart suit", + "PDFE.Views.InsTab.textBullet": "Bullet", + "PDFE.Views.InsTab.textCopyright": "Copyright Sign", + "PDFE.Views.InsTab.textDegree": "Degree Sign", + "PDFE.Views.InsTab.textDelta": "Greek Small Letter Delta", + "PDFE.Views.InsTab.textDivision": "Division Sign", + "PDFE.Views.InsTab.textDollar": "Dollar Sign", + "PDFE.Views.InsTab.textEuro": "Euro Sign", + "PDFE.Views.InsTab.textGreaterEqual": "Greater Than Or Equal To", + "PDFE.Views.InsTab.textInfinity": "Infinity", + "PDFE.Views.InsTab.textLessEqual": "Less Than Or Equal To", + "PDFE.Views.InsTab.textLetterPi": "Greek Small Letter Pi", + "PDFE.Views.InsTab.textNotEqualTo": "Not Equal To", + "PDFE.Views.InsTab.textOneHalf": "Vulgar Fraction One Half", + "PDFE.Views.InsTab.textOneQuarter": "Vulgar Fraction One Quarter", + "PDFE.Views.InsTab.textPlusMinus": "Plus-Minus Sign", + "PDFE.Views.InsTab.textRegistered": "Registered Sign", + "PDFE.Views.InsTab.textSection": "Section Sign", + "PDFE.Views.InsTab.textSmile": "White Smiling Face", + "PDFE.Views.InsTab.textSquareRoot": "Square Root", + "PDFE.Views.InsTab.textTilde": "Tilde", + "PDFE.Views.InsTab.textTradeMark": "Trade Mark Sign", + "PDFE.Views.InsTab.textYen": "Yen Sign", + "PDFE.Views.InsTab.textRecentlyUsed": "Recently used", + "PDFE.Views.InsTab.capBtnInsHeaderFooter": "Header & Footer", + "PDFE.Views.InsTab.tipEditHeaderFooter": "Edit header or footer", "PDFE.Views.LeftMenu.tipAbout": "About", "PDFE.Views.LeftMenu.tipChat": "Chat", "PDFE.Views.LeftMenu.tipComments": "Comments", @@ -642,6 +1437,53 @@ "PDFE.Views.PageThumbnails.textPageThumbnails": "Page Thumbnails", "PDFE.Views.PageThumbnails.textThumbnailsSettings": "Thumbnails settings", "PDFE.Views.PageThumbnails.textThumbnailsSize": "Thumbnails size", + "PDFE.Views.ParagraphSettings.strLineHeight": "Line spacing", + "PDFE.Views.ParagraphSettings.strParagraphSpacing": "Paragraph spacing", + "PDFE.Views.ParagraphSettings.strSpacingAfter": "After", + "PDFE.Views.ParagraphSettings.strSpacingBefore": "Before", + "PDFE.Views.ParagraphSettings.textAdvanced": "Show advanced settings", + "PDFE.Views.ParagraphSettings.textAt": "At", + "PDFE.Views.ParagraphSettings.textAtLeast": "At least", + "PDFE.Views.ParagraphSettings.textAuto": "Multiple", + "PDFE.Views.ParagraphSettings.textExact": "Exactly", + "PDFE.Views.ParagraphSettings.txtAutoText": "Auto", + "PDFE.Views.ParagraphSettingsAdvanced.noTabs": "The specified tabs will appear in this field", + "PDFE.Views.ParagraphSettingsAdvanced.strAllCaps": "All caps", + "PDFE.Views.ParagraphSettingsAdvanced.strDoubleStrike": "Double strikethrough", + "PDFE.Views.ParagraphSettingsAdvanced.strIndent": "Indents", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Line spacing", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "After", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Before", + "PDFE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Special", + "PDFE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font", + "PDFE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Spacing", + "PDFE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps", + "PDFE.Views.ParagraphSettingsAdvanced.strSpacing": "Spacing", + "PDFE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough", + "PDFE.Views.ParagraphSettingsAdvanced.strSubscript": "Subscript", + "PDFE.Views.ParagraphSettingsAdvanced.strSuperscript": "Superscript", + "PDFE.Views.ParagraphSettingsAdvanced.strTabs": "Tabs", + "PDFE.Views.ParagraphSettingsAdvanced.textAlign": "Alignment", + "PDFE.Views.ParagraphSettingsAdvanced.textAuto": "Multiple", + "PDFE.Views.ParagraphSettingsAdvanced.textCharacterSpacing": "Character spacing", + "PDFE.Views.ParagraphSettingsAdvanced.textDefault": "Default tab", + "PDFE.Views.ParagraphSettingsAdvanced.textEffects": "Effects", + "PDFE.Views.ParagraphSettingsAdvanced.textExact": "Exactly", + "PDFE.Views.ParagraphSettingsAdvanced.textFirstLine": "First line", + "PDFE.Views.ParagraphSettingsAdvanced.textHanging": "Hanging", + "PDFE.Views.ParagraphSettingsAdvanced.textJustified": "Justified", + "PDFE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(none)", + "PDFE.Views.ParagraphSettingsAdvanced.textRemove": "Remove", + "PDFE.Views.ParagraphSettingsAdvanced.textRemoveAll": "Remove all", + "PDFE.Views.ParagraphSettingsAdvanced.textSet": "Specify", + "PDFE.Views.ParagraphSettingsAdvanced.textTabCenter": "Center", + "PDFE.Views.ParagraphSettingsAdvanced.textTabLeft": "Left", + "PDFE.Views.ParagraphSettingsAdvanced.textTabPosition": "Tab position", + "PDFE.Views.ParagraphSettingsAdvanced.textTabRight": "Right", + "PDFE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced settings", + "PDFE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto", "PDFE.Views.PrintWithPreview.textMarginsLast": "Last custom", "PDFE.Views.PrintWithPreview.textMarginsModerate": "Moderate", "PDFE.Views.PrintWithPreview.textMarginsNarrow": "Narrow", @@ -676,6 +1518,121 @@ "PDFE.Views.PrintWithPreview.txtRight": "Right", "PDFE.Views.PrintWithPreview.txtSelection": "Selection", "PDFE.Views.PrintWithPreview.txtTop": "Top", + "PDFE.Views.RightMenu.txtChartSettings": "Chart settings", + "PDFE.Views.RightMenu.txtImageSettings": "Image settings", + "PDFE.Views.RightMenu.txtParagraphSettings": "Paragraph settings", + "PDFE.Views.RightMenu.txtShapeSettings": "Shape settings", + "PDFE.Views.RightMenu.txtTableSettings": "Table settings", + "PDFE.Views.RightMenu.txtTextArtSettings": "Text Art settings", + "PDFE.Views.ShapeSettings.strBackground": "Background color", + "PDFE.Views.ShapeSettings.strChange": "Change shape", + "PDFE.Views.ShapeSettings.strColor": "Color", + "PDFE.Views.ShapeSettings.strFill": "Fill", + "PDFE.Views.ShapeSettings.strForeground": "Foreground color", + "PDFE.Views.ShapeSettings.strPattern": "Pattern", + "PDFE.Views.ShapeSettings.strShadow": "Show shadow", + "PDFE.Views.ShapeSettings.strSize": "Size", + "PDFE.Views.ShapeSettings.strStroke": "Line", + "PDFE.Views.ShapeSettings.strTransparency": "Opacity", + "PDFE.Views.ShapeSettings.strType": "Type", + "PDFE.Views.ShapeSettings.textAdvanced": "Show advanced settings", + "PDFE.Views.ShapeSettings.textAngle": "Angle", + "PDFE.Views.ShapeSettings.textBorderSizeErr": "The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.", + "PDFE.Views.ShapeSettings.textColor": "Color fill", + "PDFE.Views.ShapeSettings.textDirection": "Direction", + "PDFE.Views.ShapeSettings.textEditPoints": "Edit points", + "PDFE.Views.ShapeSettings.textEditShape": "Edit shape", + "PDFE.Views.ShapeSettings.textEmptyPattern": "No pattern", + "PDFE.Views.ShapeSettings.textFlip": "Flip", + "PDFE.Views.ShapeSettings.textFromFile": "From file", + "PDFE.Views.ShapeSettings.textFromStorage": "From storage", + "PDFE.Views.ShapeSettings.textFromUrl": "From URL", + "PDFE.Views.ShapeSettings.textGradient": "Gradient points", + "PDFE.Views.ShapeSettings.textGradientFill": "Gradient fill", + "PDFE.Views.ShapeSettings.textHint270": "Rotate 90° Counterclockwise", + "PDFE.Views.ShapeSettings.textHint90": "Rotate 90° Clockwise", + "PDFE.Views.ShapeSettings.textHintFlipH": "Flip horizontally", + "PDFE.Views.ShapeSettings.textHintFlipV": "Flip vertically", + "PDFE.Views.ShapeSettings.textImageTexture": "Picture or Texture", + "PDFE.Views.ShapeSettings.textLinear": "Linear", + "PDFE.Views.ShapeSettings.textNoFill": "No fill", + "PDFE.Views.ShapeSettings.textPatternFill": "Pattern", + "PDFE.Views.ShapeSettings.textPosition": "Position", + "PDFE.Views.ShapeSettings.textRadial": "Radial", + "PDFE.Views.ShapeSettings.textRecentlyUsed": "Recently used", + "PDFE.Views.ShapeSettings.textRotate90": "Rotate 90°", + "PDFE.Views.ShapeSettings.textRotation": "Rotation", + "PDFE.Views.ShapeSettings.textSelectImage": "Select picture", + "PDFE.Views.ShapeSettings.textSelectTexture": "Select", + "PDFE.Views.ShapeSettings.textStretch": "Stretch", + "PDFE.Views.ShapeSettings.textStyle": "Style", + "PDFE.Views.ShapeSettings.textTexture": "From texture", + "PDFE.Views.ShapeSettings.textTile": "Tile", + "PDFE.Views.ShapeSettings.tipAddGradientPoint": "Add gradient point", + "PDFE.Views.ShapeSettings.tipRemoveGradientPoint": "Remove gradient point", + "PDFE.Views.ShapeSettings.txtBrownPaper": "Brown paper", + "PDFE.Views.ShapeSettings.txtCanvas": "Canvas", + "PDFE.Views.ShapeSettings.txtCarton": "Carton", + "PDFE.Views.ShapeSettings.txtDarkFabric": "Dark fabric", + "PDFE.Views.ShapeSettings.txtGrain": "Grain", + "PDFE.Views.ShapeSettings.txtGranite": "Granite", + "PDFE.Views.ShapeSettings.txtGreyPaper": "Gray paper", + "PDFE.Views.ShapeSettings.txtKnit": "Knit", + "PDFE.Views.ShapeSettings.txtLeather": "Leather", + "PDFE.Views.ShapeSettings.txtNoBorders": "No line", + "PDFE.Views.ShapeSettings.txtPapyrus": "Papyrus", + "PDFE.Views.ShapeSettings.txtWood": "Wood", + "PDFE.Views.ShapeSettingsAdvanced.strColumns": "Columns", + "PDFE.Views.ShapeSettingsAdvanced.strMargins": "Text padding", + "PDFE.Views.ShapeSettingsAdvanced.textAlt": "Alternative text", + "PDFE.Views.ShapeSettingsAdvanced.textAltDescription": "Description", + "PDFE.Views.ShapeSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, shape, chart, or table.", + "PDFE.Views.ShapeSettingsAdvanced.textAltTitle": "Title", + "PDFE.Views.ShapeSettingsAdvanced.textAngle": "Angle", + "PDFE.Views.ShapeSettingsAdvanced.textArrows": "Arrows", + "PDFE.Views.ShapeSettingsAdvanced.textAutofit": "AutoFit", + "PDFE.Views.ShapeSettingsAdvanced.textBeginSize": "Begin size", + "PDFE.Views.ShapeSettingsAdvanced.textBeginStyle": "Begin style", + "PDFE.Views.ShapeSettingsAdvanced.textBevel": "Bevel", + "PDFE.Views.ShapeSettingsAdvanced.textBottom": "Bottom", + "PDFE.Views.ShapeSettingsAdvanced.textCapType": "Cap type", + "PDFE.Views.ShapeSettingsAdvanced.textCenter": "Center", + "PDFE.Views.ShapeSettingsAdvanced.textColNumber": "Number of columns", + "PDFE.Views.ShapeSettingsAdvanced.textEndSize": "End size", + "PDFE.Views.ShapeSettingsAdvanced.textEndStyle": "End style", + "PDFE.Views.ShapeSettingsAdvanced.textFlat": "Flat", + "PDFE.Views.ShapeSettingsAdvanced.textFlipped": "Flipped", + "PDFE.Views.ShapeSettingsAdvanced.textFrom": "From", + "PDFE.Views.ShapeSettingsAdvanced.textGeneral": "General", + "PDFE.Views.ShapeSettingsAdvanced.textHeight": "Height", + "PDFE.Views.ShapeSettingsAdvanced.textHorizontal": "Horizontal", + "PDFE.Views.ShapeSettingsAdvanced.textHorizontally": "Horizontally", + "PDFE.Views.ShapeSettingsAdvanced.textJoinType": "Join type", + "PDFE.Views.ShapeSettingsAdvanced.textKeepRatio": "Constant proportions", + "PDFE.Views.ShapeSettingsAdvanced.textLeft": "Left", + "PDFE.Views.ShapeSettingsAdvanced.textLineStyle": "Line style", + "PDFE.Views.ShapeSettingsAdvanced.textMiter": "Miter", + "PDFE.Views.ShapeSettingsAdvanced.textNofit": "Do not autofit", + "PDFE.Views.ShapeSettingsAdvanced.textPlacement": "Placement", + "PDFE.Views.ShapeSettingsAdvanced.textPosition": "Position", + "PDFE.Views.ShapeSettingsAdvanced.textResizeFit": "Resize shape to fit text", + "PDFE.Views.ShapeSettingsAdvanced.textRight": "Right", + "PDFE.Views.ShapeSettingsAdvanced.textRotation": "Rotation", + "PDFE.Views.ShapeSettingsAdvanced.textRound": "Round", + "PDFE.Views.ShapeSettingsAdvanced.textShapeName": "Shape name", + "PDFE.Views.ShapeSettingsAdvanced.textShrink": "Shrink text on overflow", + "PDFE.Views.ShapeSettingsAdvanced.textSize": "Size", + "PDFE.Views.ShapeSettingsAdvanced.textSpacing": "Spacing between columns", + "PDFE.Views.ShapeSettingsAdvanced.textSquare": "Square", + "PDFE.Views.ShapeSettingsAdvanced.textTextBox": "Text box", + "PDFE.Views.ShapeSettingsAdvanced.textTitle": "Shape - Advanced settings", + "PDFE.Views.ShapeSettingsAdvanced.textTop": "Top", + "PDFE.Views.ShapeSettingsAdvanced.textTopLeftCorner": "Top left corner", + "PDFE.Views.ShapeSettingsAdvanced.textVertical": "Vertical", + "PDFE.Views.ShapeSettingsAdvanced.textVertically": "Vertically", + "PDFE.Views.ShapeSettingsAdvanced.textWeightArrows": "Weights & Arrows", + "PDFE.Views.ShapeSettingsAdvanced.textWidth": "Width", + "PDFE.Views.ShapeSettingsAdvanced.txtNone": "None", "PDFE.Views.Statusbar.goToPageText": "Go to Page", "PDFE.Views.Statusbar.pageIndexText": "Page {0} of {1}", "PDFE.Views.Statusbar.tipFitPage": "Fit to page", @@ -688,6 +1645,135 @@ "PDFE.Views.Statusbar.tipZoomIn": "Zoom in", "PDFE.Views.Statusbar.tipZoomOut": "Zoom out", "PDFE.Views.Statusbar.txtPageNumInvalid": "Page number invalid", + "PDFE.Views.TableSettings.deleteColumnText": "Delete column", + "PDFE.Views.TableSettings.deleteRowText": "Delete row", + "PDFE.Views.TableSettings.deleteTableText": "Delete table", + "PDFE.Views.TableSettings.insertColumnLeftText": "Insert column left", + "PDFE.Views.TableSettings.insertColumnRightText": "Insert column right", + "PDFE.Views.TableSettings.insertRowAboveText": "Insert row above", + "PDFE.Views.TableSettings.insertRowBelowText": "Insert row below", + "PDFE.Views.TableSettings.mergeCellsText": "Merge cells", + "PDFE.Views.TableSettings.selectCellText": "Select cell", + "PDFE.Views.TableSettings.selectColumnText": "Select column", + "PDFE.Views.TableSettings.selectRowText": "Select row", + "PDFE.Views.TableSettings.selectTableText": "Select Table", + "PDFE.Views.TableSettings.splitCellsText": "Split cell...", + "PDFE.Views.TableSettings.splitCellTitleText": "Split cell", + "PDFE.Views.TableSettings.textAdvanced": "Show advanced settings", + "PDFE.Views.TableSettings.textBackColor": "Background color", + "PDFE.Views.TableSettings.textBanded": "Banded", + "PDFE.Views.TableSettings.textBorderColor": "Color", + "PDFE.Views.TableSettings.textBorders": "Borders Style", + "PDFE.Views.TableSettings.textCellSize": "Cell size", + "PDFE.Views.TableSettings.textColumns": "Columns", + "PDFE.Views.TableSettings.textDistributeCols": "Distribute columns", + "PDFE.Views.TableSettings.textDistributeRows": "Distribute rows", + "PDFE.Views.TableSettings.textEdit": "Rows & Columns", + "PDFE.Views.TableSettings.textEmptyTemplate": "No templates", + "PDFE.Views.TableSettings.textFirst": "First", + "PDFE.Views.TableSettings.textHeader": "Header", + "PDFE.Views.TableSettings.textHeight": "Height", + "PDFE.Views.TableSettings.textLast": "Last", + "PDFE.Views.TableSettings.textRows": "Rows", + "PDFE.Views.TableSettings.textSelectBorders": "Select borders you want to change applying style chosen above", + "PDFE.Views.TableSettings.textTemplate": "Select From Template", + "PDFE.Views.TableSettings.textTotal": "Total", + "PDFE.Views.TableSettings.textWidth": "Width", + "PDFE.Views.TableSettings.tipAll": "Set outer border and all inner lines", + "PDFE.Views.TableSettings.tipBottom": "Set outer bottom border only", + "PDFE.Views.TableSettings.tipInner": "Set inner lines only", + "PDFE.Views.TableSettings.tipInnerHor": "Set horizontal inner lines only", + "PDFE.Views.TableSettings.tipInnerVert": "Set vertical inner lines only", + "PDFE.Views.TableSettings.tipLeft": "Set outer left border only", + "PDFE.Views.TableSettings.tipNone": "Set no borders", + "PDFE.Views.TableSettings.tipOuter": "Set outer border only", + "PDFE.Views.TableSettings.tipRight": "Set outer right border only", + "PDFE.Views.TableSettings.tipTop": "Set outer top border only", + "PDFE.Views.TableSettings.txtGroupTable_Custom": "Custom", + "PDFE.Views.TableSettings.txtGroupTable_Dark": "Dark", + "PDFE.Views.TableSettings.txtGroupTable_Light": "Light", + "PDFE.Views.TableSettings.txtGroupTable_Medium": "Medium", + "PDFE.Views.TableSettings.txtGroupTable_Optimal": "Best match for document", + "PDFE.Views.TableSettings.txtNoBorders": "No borders", + "PDFE.Views.TableSettings.txtTable_Accent": "Accent", + "PDFE.Views.TableSettings.txtTable_DarkStyle": "Dark Style", + "PDFE.Views.TableSettings.txtTable_LightStyle": "Light style", + "PDFE.Views.TableSettings.txtTable_MediumStyle": "Medium style", + "PDFE.Views.TableSettings.txtTable_NoGrid": "No grid", + "PDFE.Views.TableSettings.txtTable_NoStyle": "No style", + "PDFE.Views.TableSettings.txtTable_TableGrid": "Table grid", + "PDFE.Views.TableSettings.txtTable_ThemedStyle": "Themed Style", + "PDFE.Views.TableSettingsAdvanced.textAlt": "Alternative text", + "PDFE.Views.TableSettingsAdvanced.textAltDescription": "Description", + "PDFE.Views.TableSettingsAdvanced.textAltTip": "The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, shape, chart, or table.", + "PDFE.Views.TableSettingsAdvanced.textAltTitle": "Title", + "PDFE.Views.TableSettingsAdvanced.textBottom": "Bottom", + "PDFE.Views.TableSettingsAdvanced.textCenter": "Center", + "PDFE.Views.TableSettingsAdvanced.textCheckMargins": "Use default margins", + "PDFE.Views.TableSettingsAdvanced.textDefaultMargins": "Default margins", + "PDFE.Views.TableSettingsAdvanced.textFrom": "From", + "PDFE.Views.TableSettingsAdvanced.textGeneral": "General", + "PDFE.Views.TableSettingsAdvanced.textHeight": "Height", + "PDFE.Views.TableSettingsAdvanced.textHorizontal": "Horizontal", + "PDFE.Views.TableSettingsAdvanced.textKeepRatio": "Constant proportions", + "PDFE.Views.TableSettingsAdvanced.textLeft": "Left", + "PDFE.Views.TableSettingsAdvanced.textMargins": "Cell margins", + "PDFE.Views.TableSettingsAdvanced.textPlacement": "Placement", + "PDFE.Views.TableSettingsAdvanced.textPosition": "Position", + "PDFE.Views.TableSettingsAdvanced.textRight": "Right", + "PDFE.Views.TableSettingsAdvanced.textSize": "Size", + "PDFE.Views.TableSettingsAdvanced.textTableName": "Table name", + "PDFE.Views.TableSettingsAdvanced.textTitle": "Table - Advanced settings", + "PDFE.Views.TableSettingsAdvanced.textTop": "Top", + "PDFE.Views.TableSettingsAdvanced.textTopLeftCorner": "Top left corner", + "PDFE.Views.TableSettingsAdvanced.textVertical": "Vertical", + "PDFE.Views.TableSettingsAdvanced.textWidth": "Width", + "PDFE.Views.TableSettingsAdvanced.textWidthSpaces": "Margins", + "PDFE.Views.TextArtSettings.strBackground": "Background color", + "PDFE.Views.TextArtSettings.strColor": "Color", + "PDFE.Views.TextArtSettings.strFill": "Fill", + "PDFE.Views.TextArtSettings.strForeground": "Foreground color", + "PDFE.Views.TextArtSettings.strPattern": "Pattern", + "PDFE.Views.TextArtSettings.strSize": "Size", + "PDFE.Views.TextArtSettings.strStroke": "Line", + "PDFE.Views.TextArtSettings.strTransparency": "Opacity", + "PDFE.Views.TextArtSettings.strType": "Type", + "PDFE.Views.TextArtSettings.textAngle": "Angle", + "PDFE.Views.TextArtSettings.textBorderSizeErr": "The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.", + "PDFE.Views.TextArtSettings.textColor": "Color fill", + "PDFE.Views.TextArtSettings.textDirection": "Direction", + "PDFE.Views.TextArtSettings.textEmptyPattern": "No pattern", + "PDFE.Views.TextArtSettings.textFromFile": "From file", + "PDFE.Views.TextArtSettings.textFromUrl": "From URL", + "PDFE.Views.TextArtSettings.textGradient": "Gradient points", + "PDFE.Views.TextArtSettings.textGradientFill": "Gradient fill", + "PDFE.Views.TextArtSettings.textImageTexture": "Picture or Texture", + "PDFE.Views.TextArtSettings.textLinear": "Linear", + "PDFE.Views.TextArtSettings.textNoFill": "No fill", + "PDFE.Views.TextArtSettings.textPatternFill": "Pattern", + "PDFE.Views.TextArtSettings.textPosition": "Position", + "PDFE.Views.TextArtSettings.textRadial": "Radial", + "PDFE.Views.TextArtSettings.textSelectTexture": "Select", + "PDFE.Views.TextArtSettings.textStretch": "Stretch", + "PDFE.Views.TextArtSettings.textStyle": "Style", + "PDFE.Views.TextArtSettings.textTemplate": "Template", + "PDFE.Views.TextArtSettings.textTexture": "From texture", + "PDFE.Views.TextArtSettings.textTile": "Tile", + "PDFE.Views.TextArtSettings.textTransform": "Transform", + "PDFE.Views.TextArtSettings.tipAddGradientPoint": "Add gradient point", + "PDFE.Views.TextArtSettings.tipRemoveGradientPoint": "Remove gradient point", + "PDFE.Views.TextArtSettings.txtBrownPaper": "Brown paper", + "PDFE.Views.TextArtSettings.txtCanvas": "Canvas", + "PDFE.Views.TextArtSettings.txtCarton": "Carton", + "PDFE.Views.TextArtSettings.txtDarkFabric": "Dark fabric", + "PDFE.Views.TextArtSettings.txtGrain": "Grain", + "PDFE.Views.TextArtSettings.txtGranite": "Granite", + "PDFE.Views.TextArtSettings.txtGreyPaper": "Gray paper", + "PDFE.Views.TextArtSettings.txtKnit": "Knit", + "PDFE.Views.TextArtSettings.txtLeather": "Leather", + "PDFE.Views.TextArtSettings.txtNoBorders": "No line", + "PDFE.Views.TextArtSettings.txtPapyrus": "Papyrus", + "PDFE.Views.TextArtSettings.txtWood": "Wood", "PDFE.Views.Toolbar.capBtnComment": "Comment", "PDFE.Views.Toolbar.capBtnDownloadForm": "Download As PDF", "PDFE.Views.Toolbar.capBtnHand": "Hand", @@ -734,12 +1820,82 @@ "PDFE.Views.Toolbar.tipSubmit": "Submit form", "PDFE.Views.Toolbar.tipSynchronize": "The document has been changed by another user. Please click to save your changes and reload the updates.", "PDFE.Views.Toolbar.tipUndo": "Undo", + "PDFE.Views.Toolbar.textTabEdit": "Edit", + "PDFE.Views.Toolbar.textBold": "Bold", + "PDFE.Views.Toolbar.textItalic": "Italic", + "PDFE.Views.Toolbar.textSubscript": "Subscript", + "PDFE.Views.Toolbar.textSuperscript": "Superscript", + "PDFE.Views.Toolbar.tipFontColor": "Font color", + "PDFE.Views.Toolbar.tipFontName": "Font", + "PDFE.Views.Toolbar.tipFontSize": "Font size", + "PDFE.Views.Toolbar.tipHAligh": "Horizontal align", + "PDFE.Views.Toolbar.tipVAligh": "Vertical align", + "PDFE.Views.Toolbar.textAlignBottom": "Align text to the bottom", + "PDFE.Views.Toolbar.textAlignCenter": "Center text", + "PDFE.Views.Toolbar.textAlignJust": "Justify", + "PDFE.Views.Toolbar.textAlignLeft": "Align text left", + "PDFE.Views.Toolbar.textAlignMiddle": "Align text to the middle", + "PDFE.Views.Toolbar.textAlignRight": "Align text right", + "PDFE.Views.Toolbar.textAlignTop": "Align text to the top", + "PDFE.Views.Toolbar.tipDecPrLeft": "Decrease indent", + "PDFE.Views.Toolbar.tipIncPrLeft": "Increase indent", + "PDFE.Views.Toolbar.tipLineSpace": "Line spacing", + "PDFE.Views.Toolbar.tipIncFont": "Increment font size", + "PDFE.Views.Toolbar.tipDecFont": "Decrement font size", + "PDFE.Views.Toolbar.tipColumns": "Insert columns", + "PDFE.Views.Toolbar.textColumnsCustom": "Custom columns", + "PDFE.Views.Toolbar.textColumnsOne": "One Column", + "PDFE.Views.Toolbar.textColumnsThree": "Three Columns", + "PDFE.Views.Toolbar.textColumnsTwo": "Two Columns", + "PDFE.Views.Toolbar.tipChangeCase": "Change case", + "PDFE.Views.Toolbar.mniInsertSSE": "Insert Spreadsheet", + "PDFE.Views.Toolbar.mniLowerCase": "lowercase", + "PDFE.Views.Toolbar.mniSentenceCase": "Sentence case.", + "PDFE.Views.Toolbar.mniToggleCase": "tOGGLE cASE", + "PDFE.Views.Toolbar.mniUpperCase": "UPPERCASE", + "PDFE.Views.Toolbar.mniCapitalizeWords": "Capitalize Each Word", + "PDFE.Views.Toolbar.tipHighlightColor": "Highlight color", + "PDFE.Views.Toolbar.tipMarkers": "Bullets", + "PDFE.Views.Toolbar.tipClearStyle": "Clear style", + "PDFE.Views.Toolbar.tipMarkersArrow": "Arrow bullets", + "PDFE.Views.Toolbar.tipMarkersCheckmark": "Checkmark bullets", + "PDFE.Views.Toolbar.tipMarkersDash": "Dash bullets", + "PDFE.Views.Toolbar.tipMarkersFRhombus": "Filled rhombus bullets", + "PDFE.Views.Toolbar.tipMarkersFRound": "Filled round bullets", + "PDFE.Views.Toolbar.tipMarkersFSquare": "Filled square bullets", + "PDFE.Views.Toolbar.tipMarkersHRound": "Hollow round bullets", + "PDFE.Views.Toolbar.tipMarkersStar": "Star bullets", + "PDFE.Views.Toolbar.tipNone": "None", + "PDFE.Views.Toolbar.tipNumbers": "Numbering", + "PDFE.Views.Toolbar.textListSettings": "List Settings", + "PDFE.Views.Toolbar.capBtnEditText": "Edit Text", + "PDFE.Views.Toolbar.tipEditText": "Edit text", + "PDFE.Views.Toolbar.txtPageAlign": "Align to Page", + "PDFE.Views.Toolbar.txtObjectsAlign": "Align selected objects", + "PDFE.Views.Toolbar.tipShapeAlign": "Align shape", + "PDFE.Views.Toolbar.tipShapeArrange": "Arrange shape", + "PDFE.Views.Toolbar.textShapeAlignBottom": "Align Bottom", + "PDFE.Views.Toolbar.textShapeAlignCenter": "Align Center", + "PDFE.Views.Toolbar.textShapeAlignLeft": "Align Left", + "PDFE.Views.Toolbar.textShapeAlignMiddle": "Align Middle", + "PDFE.Views.Toolbar.textShapeAlignRight": "Align Right", + "PDFE.Views.Toolbar.textShapeAlignTop": "Align top", + "PDFE.Views.Toolbar.textArrangeBack": "Send to Background", + "PDFE.Views.Toolbar.textArrangeBackward": "Send Backward", + "PDFE.Views.Toolbar.textArrangeForward": "Bring Forward", + "PDFE.Views.Toolbar.textArrangeFront": "Bring to Foreground", + "PDFE.Views.Toolbar.txtGroup": "Group", + "PDFE.Views.Toolbar.txtUngroup": "Ungroup", + "PDFE.Views.Toolbar.txtDistribHor": "Distribute horizontally", + "PDFE.Views.Toolbar.txtDistribVert": "Distribute vertically", + "PDFE.Views.Toolbar.textTabInsert": "Insert", "PDFE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar", "PDFE.Views.ViewTab.textDarkDocument": "Dark Document", "PDFE.Views.ViewTab.textFitToPage": "Fit To Page", "PDFE.Views.ViewTab.textFitToWidth": "Fit To Width", "PDFE.Views.ViewTab.textInterfaceTheme": "Interface Theme", "PDFE.Views.ViewTab.textLeftMenu": "Left Panel", + "PDFE.Views.ViewTab.textRightMenu": "Right Panel", "PDFE.Views.ViewTab.textNavigation": "Navigation", "PDFE.Views.ViewTab.textOutline": "Headings", "PDFE.Views.ViewTab.textStatusBar": "Status Bar", diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-blankpage.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-blankpage.png new file mode 100644 index 0000000000..4d2883754d Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-blankpage.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-pagenum.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-pagenum.png new file mode 100644 index 0000000000..2d4d6940ee Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-pagenum.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-callout.png new file mode 100644 index 0000000000..84a88b028d Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-comment.png new file mode 100644 index 0000000000..0aab1b4089 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/big/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-add-text.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-add-text.png new file mode 100644 index 0000000000..0585a12d0e Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-add-text.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-callout.png new file mode 100644 index 0000000000..a5495389b0 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-comment.png new file mode 100644 index 0000000000..8a8b04052f Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.25x/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-blankpage.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-blankpage.png new file mode 100644 index 0000000000..2de2d7fe57 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-blankpage.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-pagenum.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-pagenum.png new file mode 100644 index 0000000000..444fbcbf61 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-pagenum.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-callout.png new file mode 100644 index 0000000000..7dac6d6d97 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-comment.png new file mode 100644 index 0000000000..474c9da9f4 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/big/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-add-text.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-add-text.png new file mode 100644 index 0000000000..220136a9b1 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-add-text.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-callout.png new file mode 100644 index 0000000000..48bc757151 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-comment.png new file mode 100644 index 0000000000..991b391b3a Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.5x/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-blankpage.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-blankpage.png new file mode 100644 index 0000000000..009c7874f9 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-blankpage.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-pagenum.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-pagenum.png new file mode 100644 index 0000000000..3000ca9717 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-pagenum.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-callout.png new file mode 100644 index 0000000000..b99bdc23bf Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-comment.png new file mode 100644 index 0000000000..7e82069822 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/big/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-add-text.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-add-text.png new file mode 100644 index 0000000000..03ee0fc036 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-add-text.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-callout.png new file mode 100644 index 0000000000..84a88b028d Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-comment.png new file mode 100644 index 0000000000..00d29fc652 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1.75x/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-blankpage.png b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-blankpage.png new file mode 100644 index 0000000000..d3fc44aafd Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-blankpage.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-pagenum.png b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-pagenum.png new file mode 100644 index 0000000000..9476cce969 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-pagenum.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-callout.png new file mode 100644 index 0000000000..d73834206b Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-comment.png new file mode 100644 index 0000000000..abeff4f217 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/big/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/btn-add-text.png b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-add-text.png new file mode 100644 index 0000000000..4e9d0a3554 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-add-text.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-callout.png new file mode 100644 index 0000000000..0f254bd14e Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-comment.png new file mode 100644 index 0000000000..fe86950b9a Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/1x/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-blankpage.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-blankpage.svg new file mode 100644 index 0000000000..2bd0b62c42 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-blankpage.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-pagenum.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-pagenum.svg new file mode 100644 index 0000000000..40baefb144 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-pagenum.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-callout.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-callout.svg new file mode 100644 index 0000000000..2044f4c487 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-callout.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-comment.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-comment.svg new file mode 100644 index 0000000000..7a37c72379 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/big/btn-text-comment.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-add-text.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-add-text.svg new file mode 100644 index 0000000000..5621e238cb --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-add-text.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-callout.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-callout.svg new file mode 100644 index 0000000000..a3dac546b8 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-callout.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-comment.svg b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-comment.svg new file mode 100644 index 0000000000..7721c8f309 --- /dev/null +++ b/apps/pdfeditor/main/resources/img/toolbar/2.5x/btn-text-comment.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-blankpage.png b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-blankpage.png new file mode 100644 index 0000000000..7f27cc0cb2 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-blankpage.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-pagenum.png b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-pagenum.png new file mode 100644 index 0000000000..c866493e60 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-pagenum.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-callout.png new file mode 100644 index 0000000000..e3610a59f2 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-comment.png new file mode 100644 index 0000000000..676cccaf9a Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/big/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/btn-add-text.png b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-add-text.png new file mode 100644 index 0000000000..cc1f30fd42 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-add-text.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-callout.png b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-callout.png new file mode 100644 index 0000000000..abf8b852d8 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-callout.png differ diff --git a/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-comment.png b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-comment.png new file mode 100644 index 0000000000..3d7cda86d3 Binary files /dev/null and b/apps/pdfeditor/main/resources/img/toolbar/2x/btn-text-comment.png differ diff --git a/apps/pdfeditor/main/resources/less/advanced-settings.less b/apps/pdfeditor/main/resources/less/advanced-settings.less new file mode 100644 index 0000000000..0835159a66 --- /dev/null +++ b/apps/pdfeditor/main/resources/less/advanced-settings.less @@ -0,0 +1,51 @@ +#window-hyperlink-settings { + #id-dlg-hyperlink-external { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + + .rtl & { + .border-radius(@border-radius-small); + border-top-left-radius: 0; + border-bottom-left-radius: 0; + + } + } + + #id-dlg-hyperlink-internal { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + border-left-width: 0; + .margin-left(-1px); + + .rtl & { + border: @scaled-one-px-value solid @border-regular-control; + .border-radius(@border-radius-small); + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right-width: 0; + } + } +} + +#window-grid-settings { + #grid-spacing-combo { + display: inline-block; + width:86px; + } + + #grid-spacing-spin { + display: inline-block; + } +} + +#window-header-footer { + #hf-dlg-btn-slide { + border-radius: 0; + } + + #hf-dlg-btn-notes { + border-radius: 0; + .margin-left(-1px); + } +} + diff --git a/apps/pdfeditor/main/resources/less/app.less b/apps/pdfeditor/main/resources/less/app.less index 485ff9cc3d..1039c42dae 100644 --- a/apps/pdfeditor/main/resources/less/app.less +++ b/apps/pdfeditor/main/resources/less/app.less @@ -98,6 +98,7 @@ @import "../../../../common/main/resources/less/bigscaling.less"; @import "../../../../common/main/resources/less/updown-picker.less"; @import "../../../../common/main/resources/less/calendar.less"; +@import "../../../../common/main/resources/less/dimension-picker.less"; // App // -------------------------------------------------- @@ -106,9 +107,11 @@ @import "toolbar.less"; @import "statusbar.less"; @import "leftmenu.less"; +@import "rightmenu.less"; @import "filemenu.less"; @import "navigation.less"; @import "thumbnails.less"; +@import "advanced-settings"; @import "sprites/iconssmall@1x"; @import "sprites/iconsbig@1x"; diff --git a/apps/pdfeditor/main/resources/less/rightmenu.less b/apps/pdfeditor/main/resources/less/rightmenu.less new file mode 100644 index 0000000000..ece76084c6 --- /dev/null +++ b/apps/pdfeditor/main/resources/less/rightmenu.less @@ -0,0 +1,230 @@ + +.right-panel .settings-panel { + label.input-label{ + vertical-align: baseline; + } + + .btn.align-left { + .pixel-ratio__2_5 & { + display: flex; + align-items: center; + } + } + + &#id-shape-settings { + #shape-spin-transparency, #shape-line-spin-transparency { + display: inline-block; + } + + #shape-button-270, #shape-button-fliph, + #shape-button-90, #shape-button-flipv { + display: inline-block; + } + + #id-shape-menu-direction { + .dataview .item { + .rtl & { + float: left; + } + } + } + + .angle-label { + .margin-right-5(); + margin-bottom: 3px; + } + + .texture-img { + padding: 14px 20px; + border: 1px solid #AFAFAF; + border-radius: 2px; + background: #ffffff; + } + + #shape-foreground-color-btn, #shape-background-color-btn { + display: inline-block; + } + } + + &#id-image-settings { + #image-button-270, #image-button-fliph, + #image-button-90, #image-button-flipv { + display: inline-block; + } + } + + &#id-table-settings { + #id-table-menu-template { + margin: 5px 5px 5px 10px; + + .rtl & { + margin: 5px 10px 5px 5px; + } + + .group-description { + padding: 3px 0 3px 10px; + .font-weight-bold(); + + .rtl & { + padding: 3px 10px 3px 0; + } + } + } + + .border-color { + vertical-align: middle; + } + + #table-spin-cell-height, #table-spin-cell-width { + display: inline-block; + } + } + + &#id-textart-settings { + #textart-spin-transparency, #textart-line-spin-transparency { + display: inline-block; + } + + #id-textart-menu-direction { + .dataview .item { + .rtl & { + float: left; + } + } + } + + .angle-label { + .margin-right-5(); + margin-bottom: 3px; + } + + .texture-img { + padding: 14px 20px; + border: 1px solid #AFAFAF; + border-radius: 2px; + background: #ffffff; + } + + #textart-foreground-color-btn, #textart-background-color-btn { + display: inline-block; + } + } +} + +.item-wrap { + width:50px; + height:50px; + background-size: cover; +} + +.combo-pattern-item { + .background-ximage-all('right-panels/patterns.png', 112px); +} + +.combo-dataview-menu { + .form-control { + cursor: pointer; + background-color: @background-normal-ie; + background-color: @background-normal; + + &.text { + background: @background-normal-ie; + background: @background-normal; + vertical-align: bottom; + } + } +} + +.item-gradient { + width:50px; + height:50px; +} + +.item-gradient-separator { + margin-right: 62px !important; +} + +.item-shadow { + width: 48px; + height: 48px; + display: flex; + align-items: center; + justify-content: center; + + div { + width: 32px; + height: 32px; + background: white; + border-radius: 1px; + border: 1px @icon-normal-ie solid; + border: 1px @icon-normal solid; + } +} + + +#signature-requested-sign, +#signature-valid-sign, +#signature-invalid-sign { + height: 100%; + overflow: hidden; + margin: 0 -10px 0 -15px; + + .item { + display: block; + border: none; + width: 100%; + .box-shadow(none); + margin: 0; + + &:hover, + &.over { + background-color: @highlight-button-hover-ie; + background-color: @highlight-button-hover; + + .caret { + display: inline-block; + } + } + } + + .signature-item { + padding: 5px 2px 5px 15px; + text-overflow: ellipsis; + min-height: 25px; + + .name { + width: 100%; + white-space: nowrap; + overflow: hidden; + cursor: pointer; + max-width: 160px; + text-overflow: ellipsis; + } + + .caret { + margin: 9px; + display: none; + position: absolute; + right: 14px; + width: 8px; + height: 8px; + border: solid 1px @icon-normal-ie; + border: solid 1px @icon-normal; + opacity: 0.6; + border-bottom: none; + border-right: none; + background-image: none; + transform: rotate(-135deg); + filter: none; + + &.nomargin { + margin: 2px; + right: 26px; + } + } + + .rtl & { + padding: 5px 15px 5px 2px; + } + } +} \ No newline at end of file diff --git a/apps/pdfeditor/main/resources/less/toolbar.less b/apps/pdfeditor/main/resources/less/toolbar.less index e6a012c5ef..f73b31afbc 100644 --- a/apps/pdfeditor/main/resources/less/toolbar.less +++ b/apps/pdfeditor/main/resources/less/toolbar.less @@ -73,9 +73,94 @@ } #slot-field-fontname { - width: 84px; + width: 111px; } #slot-field-fontsize { - width: 45px; + width: 40px; } + +#slot-combo-insertshape .menu-insert-shape { + width: 330px; +} + +.item-markerlist { + width: 40px; + height: 40px; +} + +.item-multilevellist { + width: 80px; + height: 80px; +} + +#id-toolbar-menu-symbols { + display: inline-block; + width: 158px; + .padding-left(3px); + .item { + .box-shadow(none); + .margin-x(6px, 4px); + &:hover, &.selected{ + .box-shadow( 0 0 0 2px @border-preview-select-ie); + .box-shadow( 0 0 0 @scaled-two-px-value @border-preview-select); + } + } + .item-symbol { + font-family: @font-family-base; + font-size: 14px; + display: block; + width: 20px; + height: 20px; + text-align: center; + line-height: 20px; + vertical-align: middle; + + } +} + +#equation-container, +#text-bar-container { + position: absolute; + z-index: @zindex-dropdown - 20; + background-color: @background-toolbar-ie; + background-color: @background-toolbar; + border: @scaled-one-px-value-ie solid @border-regular-control-ie; + border: @scaled-one-px-value solid @border-regular-control; + + border-radius: 3px; + overflow: hidden; + box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.2); + .ie &, + .winxp & { + overflow: visible; + } + + &.has-open-menu { + z-index: @zindex-navbar + 1; + } +} + +#equation-container { + .separator { + height: 30px; + } + .btn-toolbar { + display: flex; + justify-content: center; + align-items: center; + width: 30px; + height: 30px; + border-radius: 0px; + } +} + +#text-bar-container { + padding: 4px; + :not(.btn-group.split) .btn-toolbar, + .btn-group.split { + display: flex; + justify-content: center; + align-items: center; + } +} \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index f956d3ac66..5bc5ce24cc 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1598,7 +1598,8 @@ define([ me.api.ShapeApply(value.shapeProps); } } - me.fireEvent('editcomplete', me); + + Common.NotificationCenter.trigger('edit:complete', me.toolbar); } }); win.show();