[DE] Watermark: save language settings

This commit is contained in:
Julia Radzhabova 2019-06-18 16:20:52 +03:00
parent 8e37e78638
commit 45a82b8442
4 changed files with 41 additions and 12 deletions

View file

@ -493,4 +493,5 @@
.button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-bookmarks', 56, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-bookmarks', 56, @toolbar-big-icon-size);
.button-normal-icon(btn-blankpage, 57, @toolbar-big-icon-size); .button-normal-icon(btn-blankpage, 57, @toolbar-big-icon-size);
.button-normal-icon(btn-print-area, 58, @toolbar-big-icon-size); .button-normal-icon(btn-print-area, 58, @toolbar-big-icon-size);
.button-normal-icon(btn-watermark, 63, @toolbar-big-icon-size);

View file

@ -134,6 +134,7 @@
<span class="btn-slot text x-huge" id="slot-img-movebkwd"></span> <span class="btn-slot text x-huge" id="slot-img-movebkwd"></span>
<span class="btn-slot text x-huge" id="slot-img-wrapping"></span> <span class="btn-slot text x-huge" id="slot-img-wrapping"></span>
</div> </div>
<div class="separator long"></div>
<div class="group"> <div class="group">
<span class="btn-slot text x-huge" id="slot-btn-watermark"></span> <span class="btn-slot text x-huge" id="slot-btn-watermark"></span>
</div> </div>

View file

@ -1018,7 +1018,7 @@ define([
me.btnWatermark = new Common.UI.Button({ me.btnWatermark = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-pageorient', iconCls: 'btn-watermark',
caption: me.capBtnWatermark, caption: me.capBtnWatermark,
menu: new Common.UI.Menu({ menu: new Common.UI.Menu({
cls: 'ppm-toolbar', cls: 'ppm-toolbar',
@ -2457,7 +2457,7 @@ define([
txtMarginAlign: 'Align to Margin', txtMarginAlign: 'Align to Margin',
txtObjectsAlign: 'Align Selected Objects', txtObjectsAlign: 'Align Selected Objects',
capBtnWatermark: 'Watermark', capBtnWatermark: 'Watermark',
textEditWatermark: 'Settings', textEditWatermark: 'Custom Watermark',
textRemWatermark: 'Remove Watermark', textRemWatermark: 'Remove Watermark',
tipWatermark: 'Edit watermark' tipWatermark: 'Edit watermark'
} }

View file

@ -114,6 +114,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
this.textControls = []; this.textControls = [];
this.imageControls = []; this.imageControls = [];
this.fontName = 'Arial'; this.fontName = 'Arial';
this.lang = 'en';
this.isAutoColor = false; this.isAutoColor = false;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
@ -206,9 +207,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
menuStyle : 'min-width: 100%;max-height: 210px;', menuStyle : 'min-width: 100%;max-height: 210px;',
scrollAlwaysVisible: true, scrollAlwaysVisible: true,
data : [] data : []
}).on('selected', _.bind(function(combo, record) { }).on('selected', _.bind(this.onSelectLang, this));
this.loadWMText(record);
}, this));
this.textControls.push(this.cmbLang); this.textControls.push(this.cmbLang);
this.cmbText = new Common.UI.ComboBox({ this.cmbText = new Common.UI.ComboBox({
@ -414,19 +413,40 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
}); });
this.cmbLang.setData(data); this.cmbLang.setData(data);
if (data.length) { if (data.length) {
this.cmbLang.setValue('en', data[0].value); var item = this.cmbLang.store.findWhere({value: this.lang}) || this.cmbLang.store.at(0);
this.loadWMText(this.cmbLang.getSelectedRecord()); this.cmbLang.setValue(this.lang);
this.onSelectLang(this.cmbLang, item.toJSON());
} else } else
this.cmbLang.setDisabled(true); this.cmbLang.setDisabled(true);
}, },
loadWMText: function(record) { onSelectLang: function(combo, record) {
if (!record) return; if (!record) return;
var data = []; var data = [];
record.wmtext.forEach(function(item) { record.wmtext.forEach(function(item) {
data.push({value: item}); data.push({value: item});
}); });
this.lang = record.value;
this.cmbText.setData(data);
this.cmbText.setValue(data[0].value);
},
loadWMText: function(lang) {
if (!lang) return;
var data = [];
var item = this.cmbLang.store.findWhere({value: lang});
if (!item)
item = this.cmbLang.store.findWhere({value: lang.split(/[\-\_]/)[0]});
if (!item)
item = this.cmbLang.store.findWhere({value: 'en'});
if (!item)
item = this.cmbLang.store.at(0);
item && item.get('wmtext').forEach(function(item) {
data.push({value: item});
});
this.cmbText.setData(data); this.cmbText.setData(data);
this.cmbText.setValue(data[0].value); this.cmbText.setValue(data[0].value);
}, },
@ -460,13 +480,16 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
this.cmbScale.setValue((val<0) ? -1 : Math.round(val*100), Math.round(val*100) + ' %'); this.cmbScale.setValue((val<0) ? -1 : Math.round(val*100), Math.round(val*100) + ' %');
} else { } else {
this.radioText.setValue(true); this.radioText.setValue(true);
val = props.get_Text();
val && this.cmbText.setValue(val);
!props.get_IsDiagonal() && this.radioHor.setValue(true); !props.get_IsDiagonal() && this.radioHor.setValue(true);
this.chTransparency.setValue(props.get_Opacity()<255); this.chTransparency.setValue(props.get_Opacity()<255);
val = props.get_TextPr(); val = props.get_TextPr();
if (val) { if (val) {
var lang = Common.util.LanguageInfo.getLocalLanguageName(val.get_Lang());
this.lang = lang[0];
this.cmbLang.setValue(lang[1]);
this.loadWMText(lang[0]);
var font = val.get_FontFamily().get_Name(); var font = val.get_FontFamily().get_Name();
if (font) { if (font) {
var rec = this.cmbFonts.store.findWhere({name: font}); var rec = this.cmbFonts.store.findWhere({name: font});
@ -510,8 +533,10 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
} }
} }
this.btnTextColor.currentColor = clr; this.btnTextColor.currentColor = clr;
$('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + clr); $('.btn-color-value-line', this.btnTextColor.cmpEl).css('background-color', '#' + ((typeof(clr) == 'object') ? clr.color : clr));
} }
val = props.get_Text();
val && this.cmbText.setValue(val);
} }
} }
}, },
@ -540,6 +565,8 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
val.put_Underline(this.btnUnderline.pressed); val.put_Underline(this.btnUnderline.pressed);
val.put_Strikeout(this.btnStrikeout.pressed); val.put_Strikeout(this.btnStrikeout.pressed);
val.put_Lang(parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.lang)));
var color = new Asc.asc_CColor(); var color = new Asc.asc_CColor();
if (this.isAutoColor) { if (this.isAutoColor) {
color.put_auto(true); color.put_auto(true);