From 74bce86ddd4f4600b12931ac05d83fe63ea971e1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 25 Feb 2020 16:47:53 +0300 Subject: [PATCH] [DE][SSE] Add autofit settings for shape --- .../template/ImageSettingsAdvanced.template | 18 ++++++++++++++++ .../main/app/view/ImageSettingsAdvanced.js | 19 +++++++++++++++-- apps/documenteditor/main/locale/en.json | 3 +++ .../template/ShapeSettingsAdvanced.template | 18 ++++++++++++++++ .../main/app/view/ShapeSettingsAdvanced.js | 21 +++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 3 +++ 6 files changed, 78 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template b/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template index 3b1df3d24..b549d867e 100644 --- a/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template +++ b/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template @@ -327,7 +327,25 @@
+ + + + + + + +
+ +
+
+
+
+ + +
+ +
diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index ef99d4253..ed324b137 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -68,7 +68,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat {panelId: 'id-adv-image-wrap', panelCaption: this.textBtnWrap}, {panelId: 'id-adv-image-position', panelCaption: this.textPosition}, {panelId: 'id-adv-image-shape', panelCaption: this.textWeightArrows}, - {panelId: 'id-adv-image-margins', panelCaption: this.strMargins}, + {panelId: 'id-adv-image-margins', panelCaption: this.textTextBox}, {panelId: 'id-adv-image-alttext', panelCaption: this.textAlt} ], contentTemplate: _.template(contentTemplate)({ @@ -914,6 +914,16 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat }, this)); this.spinners.push(this.spnMarginRight); + this.chAutofit = new Common.UI.CheckBox({ + el: $('#shape-checkbox-autofit'), + labelText: this.textResizeFit + }); + this.chAutofit.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedShapeProps) { + this._changedShapeProps.asc_putTextFitType(field.getValue()=='checked' ? AscFormat.text_fit_Auto : AscFormat.text_fit_No); + } + }, this)); + // Shape this._arrCapType = [ {displayValue: this.textFlat, value: Asc.c_oAscLineCapType.Flat}, @@ -1367,6 +1377,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this.spnMarginBottom.setValue((null !== val && undefined !== val) ? Common.Utils.Metric.fnRecalcFromMM(val) : '', true); } + this.chAutofit.setValue(shapeprops.asc_getTextFitType()==AscFormat.text_fit_Auto); + this.btnsCategory[6].setDisabled(null === margins); // Margins this.btnsCategory[5].setDisabled(shapeprops.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_NONE); // Weights & Arrows @@ -2083,7 +2095,10 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat textAngle: 'Angle', textFlipped: 'Flipped', textHorizontally: 'Horizontally', - textVertically: 'Vertically' + textVertically: 'Vertically', + textTextBox: 'Text Box', + textAutofit: 'AutoFit', + textResizeFit: 'Resize shape to fit text' }, DE.Views.ImageSettingsAdvanced || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index ca5f8d54e..738daa43e 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1662,6 +1662,9 @@ "DE.Views.ImageSettingsAdvanced.textWrapThroughTooltip": "Through", "DE.Views.ImageSettingsAdvanced.textWrapTightTooltip": "Tight", "DE.Views.ImageSettingsAdvanced.textWrapTopbottomTooltip": "Top and bottom", + "DE.Views.ImageSettingsAdvanced.textTextBox": "Text Box", + "DE.Views.ImageSettingsAdvanced.textAutofit": "AutoFit", + "DE.Views.ImageSettingsAdvanced.textResizeFit": "Resize shape to fit text", "DE.Views.LeftMenu.tipAbout": "About", "DE.Views.LeftMenu.tipChat": "Chat", "DE.Views.LeftMenu.tipComments": "Comments", diff --git a/apps/spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template b/apps/spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template index b864cb1c4..3da3762bc 100644 --- a/apps/spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template +++ b/apps/spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template @@ -96,7 +96,25 @@
+ + + + + + + +
+ +
+
+
+
+ + +
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js index 0cbe4acd8..aad2ae64a 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js @@ -64,7 +64,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp {panelId: 'id-adv-shape-width', panelCaption: this.textSize}, {panelId: 'id-adv-shape-rotate', panelCaption: this.textRotation}, {panelId: 'id-adv-shape-shape', panelCaption: this.textWeightArrows}, - {panelId: 'id-adv-shape-margins', panelCaption: this.strMargins}, + {panelId: 'id-adv-shape-margins', panelCaption: this.textTextBox}, {panelId: 'id-adv-shape-columns', panelCaption: this.strColumns}, {panelId: 'id-adv-shape-snap', panelCaption: this.textSnap}, {panelId: 'id-adv-shape-alttext', panelCaption: this.textAlt} @@ -249,6 +249,18 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp }, this)); this.spinners.push(this.spnMarginRight); + this.chAutofit = new Common.UI.CheckBox({ + el: $('#shape-checkbox-autofit'), + labelText: this.textResizeFit + }); + this.chAutofit.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.asc_getShapeProperties()===null || this._changedProps.asc_getShapeProperties()===undefined) + this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty()); + this._changedProps.asc_getShapeProperties().asc_putTextFitType(field.getValue()=='checked' ? AscFormat.text_fit_Auto : AscFormat.text_fit_No); + } + }, this)); + // Rotation this.spnAngle = new Common.UI.MetricSpinner({ el: $('#shape-advanced-spin-angle'), @@ -588,6 +600,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp } this.btnsCategory[3].setDisabled(null === margins); // Margins + this.chAutofit.setValue(shapeprops.asc_getTextFitType()==AscFormat.text_fit_Auto); + var shapetype = shapeprops.asc_getType(); this.btnsCategory[4].setDisabled(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' @@ -863,7 +877,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp textSnap: 'Cell Snapping', textAbsolute: 'Don\'t move or size with cells', textOneCell: 'Move but don\'t size with cells', - textTwoCell: 'Move and size with cells' + textTwoCell: 'Move and size with cells', + textTextBox: 'Text Box', + textAutofit: 'AutoFit', + textResizeFit: 'Resize shape to fit text' }, SSE.Views.ShapeSettingsAdvanced || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index b5f160188..5f54ba613 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2072,6 +2072,9 @@ "SSE.Views.ShapeSettingsAdvanced.textVertically": "Vertically", "SSE.Views.ShapeSettingsAdvanced.textWeightArrows": "Weights & Arrows", "SSE.Views.ShapeSettingsAdvanced.textWidth": "Width", + "SSE.Views.ShapeSettingsAdvanced.textTextBox": "Text Box", + "SSE.Views.ShapeSettingsAdvanced.textAutofit": "AutoFit", + "SSE.Views.ShapeSettingsAdvanced.textResizeFit": "Resize shape to fit text", "SSE.Views.SignatureSettings.notcriticalErrorTitle": "Warning", "SSE.Views.SignatureSettings.strDelete": "Remove Signature", "SSE.Views.SignatureSettings.strDetails": "Signature Details",