Реализована локализация единиц измерения (Cm, Pt).

This commit is contained in:
Julia Radzhabova 2016-04-06 16:38:54 +03:00
parent fa729d39e7
commit 63b6a59342
45 changed files with 186 additions and 137 deletions

View file

@ -94,18 +94,20 @@ define([
].join('')),
initialize : function(options) {
var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
Common.UI.ComboBox.prototype.initialize.call(this, _.extend({
editable: false,
store: new Common.UI.BordersStore(),
data: [
{displayValue: this.txtNoBorders, value: 0, pxValue: 0 },
{displayValue: '0.5 pt', value: 0.5, pxValue: 0.5, offsety: 0},
{displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20},
{displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40},
{displayValue: '2.25 pt', value: 2.25,pxValue: 3, offsety: 60},
{displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80},
{displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120}
{displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0},
{displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20},
{displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40},
{displayValue: '2.25 ' + txtPt, value: 2.25,pxValue: 3, offsety: 60},
{displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80},
{displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120}
],
menuStyle: 'min-width: 150px;'
}, options));
@ -187,19 +189,20 @@ define([
initialize : function(options) {
this.txtNoBorders = options.txtNoBorders || this.txtNoBorders;
var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
Common.UI.ComboBox.prototype.initialize.call(this, _.extend({
editable: true,
store: new Common.UI.BordersStore(),
data: [
{displayValue: this.txtNoBorders, value: 0, pxValue: 0 },
{displayValue: '0.5 pt', value: 0.5, pxValue: 0.5, offsety: 0},
{displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20},
{displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40},
{displayValue: '2.25 pt', value: 2.25,pxValue: 3, offsety: 60},
{displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80},
{displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120}
{displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0},
{displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20},
{displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40},
{displayValue: '2.25 ' + txtPt, value: 2.25,pxValue: 3, offsety: 60},
{displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80},
{displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100},
{displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120}
],
menuStyle: 'min-width: 150px;'
}, options));

View file

@ -58,7 +58,7 @@
*
*
* @property {String} defaultUnit
* Name of the unit of measurement. Can be px|em|%|en|ex|pt|in|cm|mm|pc|s|ms.
* Name of the unit of measurement. Can be px|em|%|en|ex|pt|in|cm|mm|pc|s|ms|см|мм|пт|сек|мс.
*
* defaultUnit: 'px',
*
@ -262,7 +262,7 @@ define([
var units = this.options.defaultUnit;
if ( typeof value.match !== 'undefined'){
var searchUnits = value.match(/(px|em|%|en|ex|pt|in|cm|mm|pc|s|ms)$/i);
var searchUnits = value.match(/(px|em|%|en|ex|pt|in|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);
if (null !== searchUnits && searchUnits[0]!=='undefined') {
units = searchUnits[0].toLowerCase();
}
@ -482,25 +482,25 @@ define([
},
_recalcUnits: function(value, fromUnit){
if ( fromUnit.match(/(s|ms)$/i) && this.options.defaultUnit.match(/(s|ms)$/i) ) {
if ( fromUnit.match(/(s|ms|сек|мс)$/i) && this.options.defaultUnit.match(/(s|ms|сек|мс)$/i) ) {
var v_out = value;
// to sec
if (fromUnit=='ms')
if (fromUnit=='ms' || fromUnit=='мс')
v_out = v_out/1000.;
// from sec
if (this.options.defaultUnit=='ms')
if (this.options.defaultUnit=='ms' || this.options.defaultUnit=='мс')
v_out = v_out*1000;
return v_out;
}
if ( fromUnit.match(/(pt|in|cm|mm|pc)$/i)===null || this.options.defaultUnit.match(/(pt|in|cm|mm|pc)$/i)===null)
if ( fromUnit.match(/(pt|in|cm|mm|pc|см|мм|пт)$/i)===null || this.options.defaultUnit.match(/(pt|in|cm|mm|pc|см|мм|пт)$/i)===null)
return value;
var v_out = value;
// to mm
if (fromUnit=='cm')
if (fromUnit=='cm' || fromUnit=='см')
v_out = v_out*10;
else if (fromUnit=='pt')
else if (fromUnit=='pt' || fromUnit=='пт')
v_out = v_out * 25.4 / 72.0;
else if (fromUnit=='in')
v_out = v_out * 25.4;
@ -508,9 +508,9 @@ define([
v_out = v_out * 25.4 / 6.0;
// from mm
if (this.options.defaultUnit=='cm')
if (this.options.defaultUnit=='cm' || this.options.defaultUnit=='см')
v_out = v_out/10.;
else if (this.options.defaultUnit=='pt')
else if (this.options.defaultUnit=='pt' || this.options.defaultUnit=='пт')
v_out = parseFloat((v_out * 72.0 / 25.4).toFixed(3));
else if (this.options.defaultUnit=='in')
v_out = v_out / 25.4;

View file

@ -285,9 +285,9 @@ define([
if (value.Get_FontSize() !== undefined)
proptext += (value.Get_FontSize() + ', ');
if (value.Get_Spacing() !== undefined)
proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Position() !== undefined)
proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Lang() !== undefined)
proptext += (Common.util.LanguageInfo.getLocalLanguageName(value.Get_Lang())[1] + ', ');
@ -303,11 +303,11 @@ define([
if (value.Get_ContextualSpacing())
proptext += ((value.Get_ContextualSpacing() ? me.textContextual : me.textNoContextual) + ', ');
if (value.Get_IndLeft() !== undefined)
proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_IndRight() !== undefined)
proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_IndFirstLine() !== undefined)
proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_Jc() !== undefined) {
switch (value.Get_Jc()) {
case 0:
@ -334,16 +334,16 @@ define([
if (value.Get_SpacingLineRule() !== undefined && value.Get_SpacingLine() !== undefined) {
proptext += me.textLineSpacing;
proptext += (((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_LEAST) ? me.textAtLeast : ((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_AUTO) ? me.textMultiple : me.textExact)) + ' ');
proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]) + ', ');
proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()) + ', ');
}
if (value.Get_SpacingBeforeAutoSpacing())
proptext += (me.textSpacingBefore + ' ' + me.textAuto +', ');
else if (value.Get_SpacingBefore() !== undefined)
proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_SpacingAfterAutoSpacing())
proptext += (me.textSpacingAfter + ' ' + me.textAuto +', ');
else if (value.Get_SpacingAfter() !== undefined)
proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', ');
proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
if (value.Get_WidowControl())
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
if (value.Get_Tabs() !== undefined)

View file

@ -38,7 +38,7 @@ if (Common.Utils === undefined) {
Common.Utils = {};
}
Common.Utils = new(function() {
Common.Utils = _.extend(new(function() {
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){
return regex.test(userAgent);
@ -164,7 +164,7 @@ Common.Utils = new(function() {
hostnameStrongRe: hostnameStrongRe,
documentSettingsType: documentSettingsType
}
})();
})(), Common.Utils || {});
Common.Utils.ThemeColor = new(function() {
return {
@ -249,19 +249,21 @@ Common.Utils.ThemeColor = new(function() {
}
})();
Common.Utils.Metric = new(function() {
Common.Utils.Metric = _.extend( new(function() {
var me = this;
me.c_MetricUnits = {
cm: 0,
pt: 1
};
me.currentMetric = me.c_MetricUnits.pt;
me.metricName = ['cm', 'pt'];
me.metricName = ['Cm', 'Pt'];
return {
c_MetricUnits: me.c_MetricUnits,
metricName : me.metricName,
txtCm : 'cm',
txtPt : 'pt',
setCurrentMetric: function(value) {
me.currentMetric = value;
@ -271,6 +273,14 @@ Common.Utils.Metric = new(function() {
return me.currentMetric;
},
getCurrentMetricName: function() {
return this['txt' + me.metricName[me.currentMetric]];
},
getMetricName: function(unit) {
return this['txt' + me.metricName[(unit !== undefined) ? unit : 0]];
},
fnRecalcToMM: function(value) {
// value in pt/cm. need to convert to mm
if (value!==null && value!==undefined) {
@ -295,7 +305,7 @@ Common.Utils.Metric = new(function() {
return value;
}
}
})();
})(), Common.Utils.Metric || {});
Common.Utils.RGBColor = function(colorString) {
var r, g, b;

View file

@ -105,7 +105,10 @@ define([
return;
}
var value = Common.localStorage.getItem("de-settings-fontrender");
var value = Common.localStorage.getItem('de-settings-unit');
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm);
value = Common.localStorage.getItem("de-settings-fontrender");
if (value === null)
window.devicePixelRatio > 1 ? value = '1' : '0';
@ -1047,10 +1050,7 @@ define([
toolbarView.on('insertchart', _.bind(me.onInsertChart, me));
}
var value = Common.localStorage.getItem('de-settings-unit');
Common.Utils.Metric.setCurrentMetric((value!==null) ? parseInt(value) : Common.Utils.Metric.c_MetricUnits.cm);
value = Common.localStorage.getItem('de-hidden-rulers');
var value = Common.localStorage.getItem('de-hidden-rulers');
me.api.asc_SetViewRulers(value===null || parseInt(value) === 0);
me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me));

View file

@ -311,13 +311,13 @@ define([
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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + 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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
this._state.Height = value;
}
}
@ -325,10 +325,10 @@ define([
updateMetricUnit: function() {
var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
},
createDelayedElements: function() {

View file

@ -135,20 +135,20 @@ define([
});
}, this);
var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this.cmbBorderSize = new Common.UI.ComboBorderSize({
el : $('#drop-advanced-input-bordersize'),
style : 'width: 90px;',
store : new Backbone.Collection(),
data: [
{id: Common.UI.getId(), displayValue: this.txtNoBorders, value: 0, borderstyle: ''},
{id: Common.UI.getId(), displayValue: '0.5 pt', value: 0.5, pxValue: 0.5, offsety: 0},
{id: Common.UI.getId(), displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20},
{id: Common.UI.getId(), displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40},
{id: Common.UI.getId(), displayValue: '2.25 pt', value: 2.25, pxValue: 3, offsety: 60},
{id: Common.UI.getId(), displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80},
{id: Common.UI.getId(), displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100},
{id: Common.UI.getId(), displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120}
{id: Common.UI.getId(), displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0},
{id: Common.UI.getId(), displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20},
{id: Common.UI.getId(), displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40},
{id: Common.UI.getId(), displayValue: '2.25 ' + txtPt, value: 2.25, pxValue: 3, offsety: 60},
{id: Common.UI.getId(), displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80},
{id: Common.UI.getId(), displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100},
{id: Common.UI.getId(), displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120}
]
}).on('selected', _.bind(function(combo, record) {
this.BorderSize = {ptValue: record.value, pxValue: record.pxValue};
@ -851,7 +851,7 @@ define([
me.spnX,
me.spnY
], function(spinner) {
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
});
},
@ -902,7 +902,7 @@ define([
}
} else {
value = frame_props.get_X();
this.cmbHAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.cmbHAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.getCurrentMetricName());
}
value = frame_props.get_VAnchor();
@ -924,7 +924,7 @@ define([
}
} else {
value = frame_props.get_Y();
this.cmbVAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.cmbVAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.getCurrentMetricName());
}
value = frame_props.get_Wrap();

View file

@ -234,7 +234,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}

View file

@ -160,10 +160,10 @@ define([
updateMetricUnit: function() {
var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
},
createDelayedElements: function() {
@ -204,13 +204,13 @@ define([
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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + 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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
this._state.Height = value;
}
@ -278,8 +278,8 @@ define([
var w = imgsize.get_ImageWidth();
var h = imgsize.get_ImageHeight();
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
var properties = new CImgProperty();
properties.put_Width(w);

View file

@ -1248,7 +1248,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}

View file

@ -213,7 +213,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -154,7 +154,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -407,11 +407,11 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}
this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[2].step = this._arrLineRule[0].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm) ? 0.01: 1;
if (this._state.LineRuleIdx !== null) {

View file

@ -698,7 +698,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
var rec = new Common.UI.DataViewModel();
rec.set({
tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.get_Value()
});
arr.push(rec);
@ -719,7 +719,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
else
@ -1093,7 +1093,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
rec = new Common.UI.DataViewModel();
rec.set({
tabPos: val,
value: val + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align
});
store.add(rec);

View file

@ -79,6 +79,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -1036,8 +1038,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -1483,7 +1486,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.get_width();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -1497,7 +1500,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -184,7 +184,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
this.cmbUnit.on('selected', _.bind(function(combo, record) {
if (this._changedProps) {
var maxwidth = Common.Utils.Metric.fnRecalcFromMM(558);
this.nfWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.nfWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.getCurrentMetricName());
this.nfWidth.setMaxValue(record.value ? parseFloat((100 * maxwidth/this.pageWidth).toFixed(2)) : maxwidth);
this.nfWidth.setStep((record.value || Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.1);
this.nfWidth.setValue((record.value) ? 100*this.nfWidth.getNumberValue()/this.pageWidth : this.pageWidth*this.nfWidth.getNumberValue()/100);
@ -477,7 +477,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
this.cmbPrefWidthUnit.on('selected', _.bind(function(combo, record) {
if (this._changedProps) {
var maxwidth = Common.Utils.Metric.fnRecalcFromMM(558);
this.nfPrefWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.nfPrefWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.getCurrentMetricName());
this.nfPrefWidth.setMaxValue(record.value ? parseFloat((100 * maxwidth/this.pageWidth).toFixed(2)) : maxwidth);
this.nfPrefWidth.setStep((record.value || Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.1);
this.nfPrefWidth.setValue((record.value) ? 100*this.nfPrefWidth.getNumberValue()/this.pageWidth : this.pageWidth*this.nfPrefWidth.getNumberValue()/100);
@ -1170,7 +1170,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
this.cmbUnit.store.at(0).set('displayValue', (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits['pt']) ? this.txtPt : this.txtCm);
this.cmbUnit.setValue(TableWidth<0 ? 1 : 0);
this.nfWidth.setDefaultUnit(TableWidth<0 ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.nfWidth.setDefaultUnit(TableWidth<0 ? '%' : Common.Utils.Metric.getCurrentMetricName());
if (TableWidth<0) //%
this.nfWidth.setMaxValue(parseFloat((100 * Common.Utils.Metric.fnRecalcFromMM(558)/this.pageWidth).toFixed(2)));
this.nfWidth.setStep((TableWidth<0 || Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.1);
@ -1234,7 +1234,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
this.cmbPrefWidthUnit.store.at(0).set('displayValue', (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits['pt']) ? this.txtPt : this.txtCm);
this.cmbPrefWidthUnit.setValue(cellWidth<0 ? 1 : 0);
this.nfPrefWidth.setDefaultUnit(cellWidth<0 ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
this.nfPrefWidth.setDefaultUnit(cellWidth<0 ? '%' : Common.Utils.Metric.getCurrentMetricName());
if (cellWidth<0) //%
this.nfPrefWidth.setMaxValue(parseFloat((100 * Common.Utils.Metric.fnRecalcFromMM(558)/this.pageWidth).toFixed(2)));
this.nfPrefWidth.setStep((cellWidth<0 || Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.1);
@ -2069,7 +2069,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -77,6 +77,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -730,8 +732,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -985,7 +988,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.get_width();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -999,7 +1002,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -686,10 +686,10 @@ define([
var pageMarginsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
'<% if (options.value !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
'<label style="display: block;">'+ this.textTop +'<%= parseFloat((options.value[0]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label>' +
'<label style="display: block;">'+ this.textLeft +'<%= parseFloat((options.value[1]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label></div><div style="display: inline-block;">' +
'<label style="display: block;">'+ this.textBottom +'<%= parseFloat((options.value[2]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label>'+
'<label style="display: block;">'+ this.textRight +'<%= parseFloat((options.value[3]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label></div>'+
'<label style="display: block;">'+ this.textTop +'<%= parseFloat((options.value[0]/10.).toFixed(2)) %> <%= Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm) %></label>' +
'<label style="display: block;">'+ this.textLeft +'<%= parseFloat((options.value[1]/10.).toFixed(2)) %> <%= Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm) %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">'+ this.textBottom +'<%= parseFloat((options.value[2]/10.).toFixed(2)) %> <%= Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm) %></label>'+
'<label style="display: block;">'+ this.textRight +'<%= parseFloat((options.value[3]/10.).toFixed(2)) %> <%= Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.cm) %></label></div>'+
'<% } %></a>');
this.btnPageMargins = new Common.UI.Button({

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "cm",
"Common.Utils.Metric.txtPt": "pt",
"Common.Controllers.Chat.notcriticalErrorTitle": "Warning",
"Common.Controllers.Chat.textEnterMessage": "Enter your message here",
"Common.Controllers.Chat.textUserLimit": "You are using ONLYOFFICE Free Edition.<br>Only two users can co-edit the document simultaneously.<br>Want more? Consider buying ONLYOFFICE Enterprise Edition.<br><a href=\"http://www.onlyoffice.com/free-edition.aspx\" target=\"_blank\">Read more</a>",

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "см",
"Common.Utils.Metric.txtPt": "пт",
"Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение",
"Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение",
"Common.Controllers.Chat.textUserLimit": "Вы используете бесплатную версию ONLYOFFICE.<br>Только два пользователя одновременно могут совместно редактировать документ.<br>Требуется больше? Рекомендуем приобрести корпоративную версию ONLYOFFICE.<br><a href=\"http://www.onlyoffice.com/free-edition.aspx\" target=\"_blank\">Читать дальше</a>",

View file

@ -319,7 +319,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -123,10 +123,10 @@ define([
updateMetricUnit: function() {
var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
},
createDelayedElements: function() {
@ -146,13 +146,13 @@ define([
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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + 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(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
this._state.Height = value;
}
@ -166,8 +166,8 @@ define([
var w = imgsize.get_ImageWidth();
var h = imgsize.get_ImageHeight();
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
var properties = new CImgProperty();
properties.put_Width(w);

View file

@ -233,7 +233,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -293,12 +293,12 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}
var rec = this.cmbLineRule.store.at(1);
rec.set({defaultUnit: Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm) ? 0.01: 1});

View file

@ -337,7 +337,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
var rec = new Common.UI.DataViewModel();
rec.set({
tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.get_Value()
});
arr.push(rec);
@ -357,7 +357,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing')
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
else
@ -506,7 +506,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
rec = new Common.UI.DataViewModel();
rec.set({
tabPos: val,
value: val + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align
});
store.add(rec);

View file

@ -78,6 +78,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -983,8 +985,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -1347,7 +1350,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.get_width();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -1361,7 +1364,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -528,7 +528,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}

View file

@ -506,7 +506,7 @@ define([
step: 1,
width: 65,
value: '2 s',
defaultUnit : "s",
defaultUnit : this.textSec,
maxValue: 300,
minValue: 0
});
@ -517,7 +517,7 @@ define([
step: 1,
width: 70,
value: '2 s',
defaultUnit : "s",
defaultUnit : this.textSec,
maxValue: 300,
minValue: 0,
disabled: true
@ -1565,6 +1565,7 @@ define([
textRadial: 'Radial',
textDirection: 'Direction',
textStyle: 'Style',
textGradient: 'Gradient'
textGradient: 'Gradient',
textSec: 's'
}, PE.Views.SlideSettings || {}));
});

View file

@ -201,7 +201,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -380,7 +380,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -77,6 +77,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -1013,8 +1015,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -1346,7 +1349,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.get_width();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -1360,7 +1363,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "cm",
"Common.Utils.Metric.txtPt": "pt",
"Common.Controllers.Chat.notcriticalErrorTitle": "Warning",
"Common.Controllers.Chat.textEnterMessage": "Enter your message here",
"Common.Controllers.Chat.textUserLimit": "You are using ONLYOFFICE Free Edition.<br>Only two users can co-edit the document simultaneously.<br>Want more? Consider buying ONLYOFFICE Enterprise Edition.<br><a href=\"http://www.onlyoffice.com/free-edition.aspx\" target=\"_blank\">Read more</a>",
@ -572,6 +574,7 @@
"PE.Views.SlideSettings.textRadial": "Radial",
"PE.Views.SlideSettings.textReset": "Reset Changes",
"PE.Views.SlideSettings.textRight": "Right",
"PE.Views.SlideSettings.textSec": "s",
"PE.Views.SlideSettings.textSelectTexture": "Select",
"PE.Views.SlideSettings.textSmoothly": "Smoothly",
"PE.Views.SlideSettings.textSplit": "Split",

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "см",
"Common.Utils.Metric.txtPt": "пт",
"Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение",
"Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение",
"Common.Controllers.Chat.textUserLimit": "Вы используете бесплатную версию ONLYOFFICE.<br>Только два пользователя одновременно могут совместно редактировать документ.<br>Требуется больше? Рекомендуем приобрести корпоративную версию ONLYOFFICE.<br><a href=\"http://www.onlyoffice.com/free-edition.aspx\" target=\"_blank\">Читать дальше</a>",
@ -572,6 +574,7 @@
"PE.Views.SlideSettings.textRadial": "Радиальный",
"PE.Views.SlideSettings.textReset": "Сбросить изменения",
"PE.Views.SlideSettings.textRight": "Справа",
"PE.Views.SlideSettings.textSec": "сек",
"PE.Views.SlideSettings.textSelectTexture": "Выбрать",
"PE.Views.SlideSettings.textSmoothly": "Плавно",
"PE.Views.SlideSettings.textSplit": "Панорама",

View file

@ -420,7 +420,7 @@ define([
startvalue: item.options.action == 'row-height' ? me.api.asc_getRowHeight() : me.api.asc_getColumnWidth(),
maxvalue: item.options.action == 'row-height' ? c_oAscMaxRowHeight : c_oAscMaxColumnWidth,
step: item.options.action == 'row-height' ? 0.75 : 1,
defaultUnit: item.options.action == 'row-height' ? "pt" : "sym",
defaultUnit: item.options.action == 'row-height' ? Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt) : me.textSym,
handler: function(dlg, result) {
if (result == 'ok') {
var val = dlg.getSettings();
@ -1438,7 +1438,8 @@ define([
textChangeColumnWidth : 'Column Width {0} symbols ({1} pixels)',
textChangeRowHeight : 'Row Height {0} points ({1} pixels)',
textInsertLeft : 'Insert Left',
textInsertTop : 'Insert Top'
textInsertTop : 'Insert Top',
textSym : 'sym'
}, SSE.Controllers.DocumentHolder || {}));
});

View file

@ -321,7 +321,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -379,7 +379,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -168,7 +168,7 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -298,12 +298,12 @@ define([
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}
var rec = this.cmbLineRule.store.at(1);
rec.set({defaultUnit: Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm) ? 0.01: 1});

View file

@ -336,7 +336,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
var rec = new Common.UI.DataViewModel();
rec.set({
tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.asc_getValue()
});
arr.push(rec);
@ -356,7 +356,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
else
@ -505,7 +505,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
rec = new Common.UI.DataViewModel();
rec.set({
tabPos: val,
value: val + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()],
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align
});
store.add(rec);

View file

@ -241,7 +241,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.1 : 1);
}
}

View file

@ -79,6 +79,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -998,8 +1000,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -1368,7 +1371,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.asc_getWidth();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -1382,7 +1385,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -554,7 +554,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}

View file

@ -78,6 +78,8 @@ define([
this._sendUndoPoint = true;
this._sliderChanged = false;
this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt);
this._state = {
Transparency: null,
FillType: c_oAscFill.FILL_TYPE_SOLID,
@ -1013,8 +1015,9 @@ define([
onBorderSizeChanged: function(before, combo, record, e) {
var me = this;
if (before) {
var value = parseFloat(record.value);
if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) {
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;
Common.UI.error({
msg: this.textBorderSizeErr,
@ -1349,7 +1352,7 @@ define([
if (this._state.StrokeType !== strokeType || strokeType == c_oAscStrokeType.STROKE_COLOR) {
if ( strokeType == c_oAscStrokeType.STROKE_COLOR ) {
var w = stroke.asc_getWidth();
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue()));
var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue()));
if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value ||
(this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) {
this._state.StrokeWidth = w;
@ -1363,7 +1366,7 @@ define([
if (_selectedItem)
this.cmbBorderSize.selectRecord(_selectedItem);
else {
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : '');
this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : '');
}
this.BorderSize = w;
}

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "cm",
"Common.Utils.Metric.txtPt": "pt",
"cancelButtonText": "Cancel",
"Common.Controllers.Chat.notcriticalErrorTitle": "Warning",
"Common.Controllers.Chat.textEnterMessage": "Enter your message here",
@ -91,6 +93,7 @@
"SSE.Controllers.DocumentHolder.tipIsLocked": "This element is being edited by another user.",
"SSE.Controllers.DocumentHolder.txtHeight": "Height",
"SSE.Controllers.DocumentHolder.txtRowHeight": "Row Height",
"SSE.Controllers.DocumentHolder.textSym": "sym",
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
"SSE.Controllers.LeftMenu.newDocumentTitle": "Unnamed spreadsheet",
"SSE.Controllers.LeftMenu.textByColumns": "By columns",

View file

@ -1,4 +1,6 @@
{
"Common.Utils.Metric.txtCm": "см",
"Common.Utils.Metric.txtPt": "пт",
"cancelButtonText": "Отмена",
"Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение",
"Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение",
@ -91,6 +93,7 @@
"SSE.Controllers.DocumentHolder.tipIsLocked": "Этот элемент редактируется другим пользователем.",
"SSE.Controllers.DocumentHolder.txtHeight": "Высота",
"SSE.Controllers.DocumentHolder.txtRowHeight": "Высота строки",
"SSE.Controllers.DocumentHolder.textSym": "симв",
"SSE.Controllers.DocumentHolder.txtWidth": "Ширина",
"SSE.Controllers.LeftMenu.newDocumentTitle": "Электронная таблица без имени",
"SSE.Controllers.LeftMenu.textByColumns": "По столбцам",