diff --git a/apps/common/main/lib/view/SymbolTableDialog.js b/apps/common/main/lib/view/SymbolTableDialog.js
index ab23cb3b7..adba7b7ba 100644
--- a/apps/common/main/lib/view/SymbolTableDialog.js
+++ b/apps/common/main/lib/view/SymbolTableDialog.js
@@ -453,6 +453,15 @@ define([
var init = (aFontSelects.length<1);
init && this.initFonts();
+ if (options.font) {
+ for(var i = 0; i < aFontSelects.length; ++i){
+ if(aFontSelects[i].displayValue === options.font){
+ nCurrentFont = i;
+ break;
+ }
+ }
+ }
+
if (nCurrentFont < 0)
nCurrentFont = 0;
@@ -477,6 +486,10 @@ define([
nCurrentSymbol = aRanges[0].Start;
}
+ if (options.code) {
+ nCurrentSymbol = options.code;
+ }
+
if (init && this.options.lang && this.options.lang != 'en') {
var me = this;
loadTranslation(this.options.lang, function(){
@@ -526,7 +539,6 @@ define([
for(var key in oFontsByName){
if(oFontsByName.hasOwnProperty(key)){
data.push(oFontsByName[key]);
- data[data.length-1].value = i++;
data[data.length-1].displayValue = oFontsByName[key].m_wsFontName;
}
}
@@ -534,6 +546,10 @@ define([
//initialize params
aFontSelects = data;
aFontSelects.sort(function(a, b){return (a.displayValue.toLowerCase() > b.displayValue.toLowerCase()) ? 1 : -1;});
+ for(i = 0; i < aFontSelects.length; ++i){
+ aFontSelects[i].value = i;
+ }
+
if(!oFontsByName[sInitFont]){
if(oFontsByName['Cambria Math']){
sInitFont = 'Cambria Math';
@@ -679,7 +695,7 @@ define([
var nFontId = parseInt(cellId.split('_')[2]);
sFont = aFontSelects[nFontId].displayValue;
}
- return {font: sFont, symbol: this.encodeSurrogateChar(nCurrentSymbol), updateRecents: bUpdateRecents};
+ return {font: sFont, symbol: this.encodeSurrogateChar(nCurrentSymbol), code: nCurrentSymbol, updateRecents: bUpdateRecents};
},
onBtnClick: function(event) {
@@ -927,7 +943,7 @@ define([
var settings = this.getPasteSymbol($(e.target).attr('id'));
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
settings.updateRecents && this.updateView(false, undefined, undefined, true);
- this.fireEvent('symbol:dblclick', this, settings);
+ this.fireEvent('symbol:dblclick', this, 'ok', settings);
}
},
diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index d13383bf7..0e54aee52 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -1735,7 +1735,8 @@ define([
(new DE.Views.ControlSettingsDialog({
props: props,
api: me.api,
- lang: me._state.lang,
+ controlLang: me._state.lang,
+ interfaceLang: me.mode.lang,
handler: function(result, value) {
if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, id);
@@ -2504,7 +2505,7 @@ define([
}
});
win.show();
- win.on('symbol:dblclick', function(cmp, settings) {
+ win.on('symbol:dblclick', function(cmp, result, settings) {
me.api.pluginMethod_PasteHtml("" + settings.symbol + "");
});
}
diff --git a/apps/documenteditor/main/app/template/ControlSettingsDialog.template b/apps/documenteditor/main/app/template/ControlSettingsDialog.template
index 0f48db92a..9c5d28007 100644
--- a/apps/documenteditor/main/app/template/ControlSettingsDialog.template
+++ b/apps/documenteditor/main/app/template/ControlSettingsDialog.template
@@ -115,4 +115,32 @@
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
\ No newline at end of file
diff --git a/apps/documenteditor/main/app/view/ControlSettingsDialog.js b/apps/documenteditor/main/app/view/ControlSettingsDialog.js
index 32d2b7016..8d54bf093 100644
--- a/apps/documenteditor/main/app/view/ControlSettingsDialog.js
+++ b/apps/documenteditor/main/app/view/ControlSettingsDialog.js
@@ -44,6 +44,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
'common/main/lib/component/CheckBox',
'common/main/lib/component/InputField',
'common/main/lib/view/AdvancedSettingsWindow',
+ 'common/main/lib/view/SymbolTableDialog',
'documenteditor/main/app/view/EditListItemDialog'
], function (contentTemplate) { 'use strict';
@@ -64,7 +65,8 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
{panelId: 'id-adv-control-settings-general', panelCaption: this.strGeneral},
{panelId: 'id-adv-control-settings-lock', panelCaption: this.textLock},
{panelId: 'id-adv-control-settings-list', panelCaption: this.textCombobox},
- {panelId: 'id-adv-control-settings-date', panelCaption: this.textDate}
+ {panelId: 'id-adv-control-settings-date', panelCaption: this.textDate},
+ {panelId: 'id-adv-control-settings-checkbox',panelCaption: this.textCheckbox}
],
contentTemplate: _.template(contentTemplate)({
scope: this
@@ -226,6 +228,39 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
});
// this.listFormats.on('item:select', _.bind(this.onSelectFormat, this));
+ // Check Box
+ this.txtChecked = new Common.UI.InputField({
+ el : $('#control-settings-input-checked'),
+ allowBlank : true,
+ validateOnChange: false,
+ validateOnBlur: false,
+ style : 'width: 30px;',
+ value : ''
+ });
+ this.txtChecked._input.attr('disabled', true);
+ this.txtChecked._input.css({'text-align': 'center', 'font-size': '16px'});
+
+ this.txtUnchecked = new Common.UI.InputField({
+ el : $('#control-settings-input-unchecked'),
+ allowBlank : true,
+ validateOnChange: false,
+ validateOnBlur: false,
+ style : 'width: 30px;',
+ value : ''
+ });
+ this.txtUnchecked._input.attr('disabled', true);
+ this.txtUnchecked._input.css({'text-align': 'center', 'font-size': '16px'});
+
+ this.btnEditChecked = new Common.UI.Button({
+ el: $('#control-settings-btn-checked-edit')
+ });
+ this.btnEditChecked.on('click', _.bind(this.onEditCheckbox, this, true));
+
+ this.btnEditUnchecked = new Common.UI.Button({
+ el: $('#control-settings-btn-unchecked-edit')
+ });
+ this.btnEditUnchecked.on('click', _.bind(this.onEditCheckbox, this, false));
+
this.afterRender();
},
@@ -320,7 +355,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
if (type == Asc.c_oAscContentControlSpecificType.DateTime) {
var specProps = props.get_DateTimePr();
if (specProps) {
- var lang = specProps.get_LangId() || this.options.lang;
+ var lang = specProps.get_LangId() || this.options.controlLang;
if (lang) {
var item = this.cmbLang.store.findWhere({value: lang});
item = item ? item.get('value') : 0x0409;
@@ -335,6 +370,25 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
}
}
+ // for check box
+ this.btnsCategory[4].setVisible(type == Asc.c_oAscContentControlSpecificType.CheckBox);
+ if (type == Asc.c_oAscContentControlSpecificType.CheckBox) {
+ var specProps = props.get_CheckBoxPr();
+ if (specProps) {
+ var code = specProps.get_CheckedSymbol(),
+ font = specProps.get_CheckedFont();
+ font && this.txtChecked.cmpEl.css('font-family', font);
+ code && this.txtChecked.setValue(String.fromCharCode(code));
+ this.checkedBox = {code: code, font: font};
+
+ code = specProps.get_UncheckedSymbol();
+ font = specProps.get_UncheckedFont();
+ font && this.txtUnchecked.cmpEl.css('font-family', font);
+ code && this.txtUnchecked.setValue(String.fromCharCode(code));
+ this.uncheckedBox = {code: code, font: font};
+ }
+ }
+
this.type = type;
}
},
@@ -377,6 +431,22 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
// props.set_DateFormat(rec.get('format'));
// }
+ // for check box
+ if (this.type == Asc.c_oAscContentControlSpecificType.CheckBox) {
+ if (this.checkedBox && this.checkedBox.changed || this.uncheckedBox && this.uncheckedBox.changed) {
+ var specProps = new AscCommon.CSdtCheckBoxPr();
+ if (this.checkedBox) {
+ specProps.put_CheckedSymbol(this.checkedBox.code);
+ specProps.put_CheckedFont(this.checkedBox.font);
+ }
+ if (this.uncheckedBox) {
+ specProps.put_UncheckedSymbol(this.uncheckedBox.code);
+ specProps.put_UncheckedFont(this.uncheckedBox.font);
+ }
+ props.put_CheckBoxPr(specProps);
+ }
+ }
+
return props;
},
@@ -509,6 +579,34 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
// this.onSelectFormat(this.listFormats, null, rec);
},
+ onEditCheckbox: function(checked) {
+ if (this.api) {
+ var me = this,
+ props = (checked) ? me.checkedBox : me.uncheckedBox,
+ cmp = (checked) ? me.txtChecked : me.txtUnchecked,
+ handler = function(dlg, result, settings) {
+ if (result == 'ok') {
+ props.changed = true;
+ props.code = settings.code;
+ props.font = settings.font;
+ props.font && cmp.cmpEl.css('font-family', props.font);
+ settings.symbol && cmp.setValue(settings.symbol);
+ }
+ },
+ win = new Common.Views.SymbolTableDialog({
+ api: me.api,
+ lang: me.options.interfaceLang,
+ modal: true,
+ type: 0,
+ font: props.font,
+ code: props.code,
+ handler: handler
+ });
+ win.show();
+ win.on('symbol:dblclick', handler);
+ }
+ },
+
textTitle: 'Content Control Settings',
textName: 'Title',
textTag: 'Tag',
@@ -534,7 +632,10 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
textValue: 'Value',
textDate: 'Date Format',
textLang: 'Language',
- textFormat: 'Formats'
+ textFormat: 'Formats',
+ textCheckbox: 'Check box',
+ textChecked: 'Checked symbol',
+ textUnchecked: 'Unchecked symbol'
}, DE.Views.ControlSettingsDialog || {}))
});
\ 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 4bff6451a..1d81d9480 100644
--- a/apps/presentationeditor/main/app/controller/Toolbar.js
+++ b/apps/presentationeditor/main/app/controller/Toolbar.js
@@ -1843,7 +1843,7 @@ define([
}
});
win.show();
- win.on('symbol:dblclick', function(cmp, settings) {
+ win.on('symbol:dblclick', function(cmp, result, settings) {
me.api.pluginMethod_PasteHtml("" + settings.symbol + "");
});
}
diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
index 1c6b65022..e472884d5 100644
--- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
@@ -2781,7 +2781,7 @@ define([
}
});
win.show();
- win.on('symbol:dblclick', function(cmp, settings) {
+ win.on('symbol:dblclick', function(cmp, result, settings) {
me.api.pluginMethod_PasteHtml("" + settings.symbol + "");
});
}