Merge pull request #223 from ONLYOFFICE/feature/de-settings

Feature/de settings
This commit is contained in:
Julia Radzhabova 2019-08-12 10:00:49 +03:00 committed by GitHub
commit efc1070a9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 1408 additions and 443 deletions

View file

@ -46,6 +46,19 @@ var c_paragraphLinerule = {
LINERULE_EXACT: 2 LINERULE_EXACT: 2
}; };
var c_paragraphSpecial = {
NONE_SPECIAL: 0,
FIRST_LINE: 1,
HANGING: 2
};
var c_paragraphTextAlignment = {
RIGHT: 0,
LEFT: 1,
CENTERED: 2,
JUSTIFIED: 3
};
var c_pageNumPosition = { var c_pageNumPosition = {
PAGE_NUM_POSITION_TOP: 0x01, PAGE_NUM_POSITION_TOP: 0x01,
PAGE_NUM_POSITION_BOTTOM: 0x02, PAGE_NUM_POSITION_BOTTOM: 0x02,

View file

@ -1,23 +1,66 @@
<div id="id-adv-paragraph-indents" class="settings-panel active"> <div id="id-adv-paragraph-indents" class="settings-panel active">
<div class="inner-content"> <div class="inner-content">
<table cols="3" style="width: 100%;"> <div>
<tr> <div class="padding-large" style="display: inline-block;">
<td class="padding-large"> <label class="input-label"><%= scope.textAlign %></label>
<label class="input-label"><%= scope.strIndentsFirstLine %></label> <div id="paragraphadv-spin-text-alignment"></div>
<div id="paragraphadv-spin-first-line" style="width: 85px;"></div> </div>
</td> <div class="padding-large" style="display: none; float: right;">
<td class="padding-large"> <label class="input-label"><%= scope.strIndentsOutlinelevel %></label>
<div id="paragraphadv-spin-outline-level"></div>
</div>
</div>
<div><label class="header" style="padding-bottom: 4px;"><%= scope.strIndent %></label></div>
<div>
<div class="padding-large" style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsLeftText %></label> <label class="input-label"><%= scope.strIndentsLeftText %></label>
<div id="paragraphadv-spin-indent-left"></div> <div id="paragraphadv-spin-indent-left"></div>
</td> </div>
<td class="padding-large"> <div class="padding-large" style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsRightText %></label> <label class="input-label"><%= scope.strIndentsRightText %></label>
<div id="paragraphadv-spin-indent-right"></div> <div id="paragraphadv-spin-indent-right"></div>
</td> </div>
</tr> <div class="padding-large" style="display: inline-block;">
</table> <div>
<label class="input-label"><%= scope.strIndentsSpecial %></label>
</div>
<div>
<div id="paragraphadv-spin-special" style="display: inline-block;"></div>
<div id="paragraphadv-spin-special-by" style="display: inline-block;"></div>
</div>
</div>
</div>
<div><label class="header" style="padding-bottom: 4px;"><%= scope.strSpacing %></label></div>
<div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingBefore %></label>
<div id="paragraphadv-spin-spacing-before"></div>
</div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingAfter %></label>
<div id="paragraphadv-spin-spacing-after"></div>
</div>
<div style="display: inline-block;">
<div>
<label class="input-label"><%= scope.strIndentsLineSpacing %></label>
</div>
<div>
<div id="paragraphadv-spin-line-rule" style="display: inline-block;"></div>
<div id="paragraphadv-spin-line-height" style="display: inline-block;"></div>
</div>
</div>
</div>
<div class="text-only" style="padding-top: 8px;">
<div id="paragraphadv-checkbox-add-interval"></div>
</div>
<div class="padding-large" style="padding-top: 16px; display: none;">
<div style="border: 1px solid #cbcbcb; width: 350px;">
<div id="paragraphadv-indent-preview" style="height: 58px; position: relative;"></div>
</div>
</div>
</div> </div>
<div class="separator horizontal padding-large text-only"></div> </div>
<div id="id-adv-paragraph-line" class="settings-panel">
<div class="inner-content text-only" style="padding-right: 0px;" > <div class="inner-content text-only" style="padding-right: 0px;" >
<table cols="2" style="width: 100%;"> <table cols="2" style="width: 100%;">
<tr> <tr>
@ -44,15 +87,15 @@
<div style="width: 100%;" class="padding-small"> <div style="width: 100%;" class="padding-small">
<label class="input-label"><%= scope.textBorderWidth %></label> <label class="input-label"><%= scope.textBorderWidth %></label>
<div id="paragraphadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div> <div id="paragraphadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle;"> <div style="display: inline-block; vertical-align: middle; padding-left: 20px;">
<label class="input-label" ><%= scope.textBorderColor %></label> <label class="input-label" ><%= scope.textBorderColor %></label>
<div id="paragraphadv-border-color-btn" style="display: inline-block;"></div> <div id="paragraphadv-border-color-btn" style="display: inline-block;"></div>
</div> </div>
</div> </div>
<label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label> <label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label>
<div style="width: 100%;" class="padding-large"> <div style="width: 100%;" class="padding-large">
<div id="id-deparagraphstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc;"></div> <div id="id-deparagraphstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc; margin-top: 2px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle; width: 76px; text-align: right; height: 170px; padding-top: 10px;"> <div style="display: inline-block; vertical-align: top; width: 76px; text-align: right; height: 170px; padding-top: 0px; margin-left: 9px;">
<div id="paragraphadv-button-border-top" style="display: inline-block;"></div> <div id="paragraphadv-button-border-top" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-inner-hor" style="display: inline-block;"></div> <div id="paragraphadv-button-border-inner-hor" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-bottom" style="display: inline-block;"></div> <div id="paragraphadv-button-border-bottom" style="display: inline-block;"></div>
@ -70,114 +113,94 @@
</div> </div>
</div> </div>
<div id="id-adv-paragraph-font" class="settings-panel"> <div id="id-adv-paragraph-font" class="settings-panel">
<div class="inner-content"> <div class="inner-content" style="width: 100%;">
<table cols="2" style="width: 100%;"> <div class="padding-small">
<tr> <label class="header"><%= scope.textEffects %></label>
<td colspan=2 class="padding-small"> </div>
<label class="header"><%= scope.textEffects %></label> <div>
</td> <div class="padding-large" style="display: inline-block;">
</tr> <div class="padding-small" id="paragraphadv-checkbox-strike"></div>
<tr> <div class="padding-small" id="paragraphadv-checkbox-double-strike"></div>
<td class="padding-small"> <div id="paragraphadv-checkbox-superscript"></div>
<div id="paragraphadv-checkbox-strike"></div> </div>
</td> <div class="padding-large" style="display: inline-block; padding-left: 40px;">
<td class="padding-small"> <div class="padding-small" id="paragraphadv-checkbox-subscript"></div>
<div id="paragraphadv-checkbox-subscript"></div> <div class="padding-small" id="paragraphadv-checkbox-small-caps"></div>
</td> <div id="paragraphadv-checkbox-all-caps"></div>
</tr> </div>
<tr> </div>
<td class="padding-small"> <div class="padding-small">
<div id="paragraphadv-checkbox-double-strike"></div> <label class="header"><%= scope.textCharacterSpacing %></label>
</td> </div>
<td class="padding-small"> <div class="padding-large">
<div id="paragraphadv-checkbox-small-caps"></div> <div style="display: inline-block;">
</td>
</tr>
<tr>
<td class="padding-large">
<div id="paragraphadv-checkbox-superscript"></div>
</td>
<td class="padding-large">
<div id="paragraphadv-checkbox-all-caps"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textCharacterSpacing %></label>
</td>
</tr>
<tr>
<td class="padding-large" width="50%">
<label class="input-label"><%= scope.textSpacing %></label> <label class="input-label"><%= scope.textSpacing %></label>
<div id="paragraphadv-spin-spacing"></div> <div id="paragraphadv-spin-spacing"></div>
</td> </div>
<td class="padding-large text-only" width="50%"> <div class="text-only" style="display: inline-block; margin-left: 15px;">
<label class="input-label"><%= scope.textPosition %></label> <label class="input-label"><%= scope.textPosition %></label>
<div id="paragraphadv-spin-position"></div> <div id="paragraphadv-spin-position"></div>
</td> </div>
</tr> </div>
<tr> <div style="border: 1px solid #cbcbcb;">
<td colspan=2> <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative; margin: 0 auto;"></div>
<div style="border: 1px solid #cbcbcb;"> </div>
<div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>
</div>
</td>
</tr>
</table>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-tabs" class="settings-panel"> <div id="id-adv-paragraph-tabs" class="settings-panel">
<div class="inner-content"> <div class="inner-content">
<div class="padding-small" style="display: inline-block;"> <div class="padding-large">
<label class="input-label"><%= scope.textTabPosition %></label> <label class="input-label"><%= scope.textDefault %></label>
<div id="paraadv-spin-tab"></div> <div id="paraadv-spin-default-tab"></div>
</div>
<div class="padding-small" style="display: inline-block; float: right;"> </div>
<label class="input-label"><%= scope.textDefault %></label> <div>
<div id="paraadv-spin-default-tab"></div> <div class="padding-large" style="display: inline-block; margin-right: 9px;">
</div> <label class="input-label"><%= scope.textTabPosition %></label>
<div class="padding-large"> <div id="paraadv-spin-tab"></div>
<div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div> </div>
</div> <div class="padding-large" style=" display: inline-block; margin-right: 9px;">
<div class="padding-large" style="display: inline-block;margin-right: 7px;"> <label class="input-label"><%= scope.textAlign %></label>
<label class="input-label"><%= scope.textAlign %></label> <div id="paraadv-cmb-align"></div>
<div id="paraadv-cmb-align"></div> </div>
</div> <div class="padding-large" style="display: inline-block;">
<div class="padding-large" style="display: inline-block;"> <label class="input-label"><%= scope.textLeader %></label>
<label class="input-label"><%= scope.textLeader %></label> <div id="paraadv-cmb-leader"></div>
<div id="paraadv-cmb-leader"></div> </div>
</div> </div>
<div style="margin-bottom: 45px;"></div> <div>
<div> <div colspan=3 class="padding-large">
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button> <div id="paraadv-list-tabs" style="width:348px; height: 110px;"></div>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button> </div>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button> </div>
</div> <div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textRemove %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:108px;display: inline-block;"><%= scope.textRemoveAll %></button>
</div>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-margins" class="settings-panel"> <div id="id-adv-paragraph-margins" class="settings-panel">
<div class="inner-content"> <div class="inner-content">
<table cols="2" style="width: 100%;"> <div>
<tr> <div class="padding-small" style="display: inline-block;">
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textTop %></label> <label class="input-label"><%= scope.textTop %></label>
<div id="paraadv-number-margin-top"></div> <div id="paraadv-number-margin-top"></div>
</td> </div>
<td class="padding-small" width="50%"> <div class="padding-small" style="display: inline-block; padding-left: 15px;">
<label class="input-label"><%= scope.textLeft %></label> <label class="input-label"><%= scope.textLeft %></label>
<div id="paraadv-number-margin-left"></div> <div id="paraadv-number-margin-left"></div>
</td> </div>
</tr> </div>
<tr> <div>
<td class="padding-small" width="50%"> <div class="padding-small" style="display: inline-block;">
<label class="input-label"><%= scope.textBottom %></label> <label class="input-label"><%= scope.textBottom %></label>
<div id="paraadv-number-margin-bottom"></div> <div id="paraadv-number-margin-bottom"></div>
</td> </div>
<td class="padding-small" width="50%"> <div class="padding-small" style="display: inline-block; padding-left: 15px;">
<label class="input-label"><%= scope.textRight %></label> <label class="input-label"><%= scope.textRight %></label>
<div id="paraadv-number-margin-right"></div> <div id="paraadv-number-margin-right"></div>
</td> </div>
</tr> </div>
</table>
</div> </div>
</div> </div>

View file

@ -77,7 +77,7 @@ define([
AddInterval: false, AddInterval: false,
BackColor: '#000000', BackColor: '#000000',
DisabledControls: true, DisabledControls: true,
HideTextOnlySettings: false HideTextOnlySettings: false,
}; };
this.spinners = []; this.spinners = [];
this.lockedControls = []; this.lockedControls = [];
@ -183,8 +183,9 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
if (this.api) if (this.api) {
this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this)); this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this));
}
return this; return this;
}, },

View file

@ -51,17 +51,19 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
DE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ DE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 335, contentWidth: 370,
height: 394, height: 394,
toggleGroup: 'paragraph-adv-settings-group', toggleGroup: 'paragraph-adv-settings-group',
storageName: 'de-para-settings-adv-category' storageName: 'de-para-settings-adv-category'
}, },
initialize : function(options) { initialize : function(options) {
var me = this;
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: this.textTitle,
items: [ items: [
{panelId: 'id-adv-paragraph-indents', panelCaption: this.strParagraphIndents}, {panelId: 'id-adv-paragraph-indents', panelCaption: this.strParagraphIndents},
{panelId: 'id-adv-paragraph-line', panelCaption: this.strParagraphLine},
{panelId: 'id-adv-paragraph-borders', panelCaption: this.strBorders}, {panelId: 'id-adv-paragraph-borders', panelCaption: this.strBorders},
{panelId: 'id-adv-paragraph-font', panelCaption: this.strParagraphFont}, {panelId: 'id-adv-paragraph-font', panelCaption: this.strParagraphFont},
{panelId: 'id-adv-paragraph-tabs', panelCaption: this.strTabs}, {panelId: 'id-adv-paragraph-tabs', panelCaption: this.strTabs},
@ -84,6 +86,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.Margins = undefined; this.Margins = undefined;
this.FirstLine = undefined; this.FirstLine = undefined;
this.LeftIndent = undefined; this.LeftIndent = undefined;
this.Spacing = null;
this.spinners = []; this.spinners = [];
this.tableStylerRows = this.options.tableStylerRows; this.tableStylerRows = this.options.tableStylerRows;
@ -92,6 +95,63 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.api = this.options.api; this.api = this.options.api;
this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps); this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps);
this.isChart = this.options.isChart; this.isChart = this.options.isChart;
this.CurLineRuleIdx = this._originalProps.get_Spacing().get_LineRule();
this._arrLineRule = [
{displayValue: this.textAtLeast,defaultValue: 5, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'cm'},
{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'}
];
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.CurSpecial = undefined;
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._arrOutlinelevel = [
{displayValue: this.textBodyText},
{displayValue: this.textLevel + '1'},
{displayValue: this.textLevel + '2'},
{displayValue: this.textLevel + '3'},
{displayValue: this.textLevel + '4'},
{displayValue: this.textLevel + '5'},
{displayValue: this.textLevel + '6'},
{displayValue: this.textLevel + '7'},
{displayValue: this.textLevel + '8'},
{displayValue: this.textLevel + '9'}
];
this._arrTabAlign = [
{ value: 1, displayValue: this.textTabLeft },
{ value: 3, displayValue: this.textTabCenter },
{ value: 2, displayValue: this.textTabRight }
];
this._arrKeyTabAlign = [];
this._arrTabAlign.forEach(function(item) {
me._arrKeyTabAlign[item.value] = item.displayValue;
});
this._arrTabLeader = [
{ value: Asc.c_oAscTabLeader.None, displayValue: this.textNone },
{ value: Asc.c_oAscTabLeader.Dot, displayValue: '....................' },
{ value: Asc.c_oAscTabLeader.Hyphen, displayValue: '-----------------' },
{ value: Asc.c_oAscTabLeader.MiddleDot, displayValue: '·················' },
{ value: Asc.c_oAscTabLeader.Underscore,displayValue: '__________' }
];
this._arrKeyTabLeader = [];
this._arrTabLeader.forEach(function(item) {
me._arrKeyTabLeader[item.value] = item.displayValue;
});
}, },
render: function() { render: function() {
@ -101,25 +161,6 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
// Indents & Placement // Indents & Placement
this.numFirstLine = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-first-line'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.numFirstLine.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_FirstLine(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
}, this));
this.spinners.push(this.numFirstLine);
this.numIndentsLeft = new Common.UI.MetricSpinner({ this.numIndentsLeft = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-indent-left'), el: $('#paragraphadv-spin-indent-left'),
step: .1, step: .1,
@ -158,6 +199,121 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
}, this)); }, this));
this.spinners.push(this.numIndentsRight); this.spinners.push(this.numIndentsRight);
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();
}
this.Spacing.Before = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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();
}
this.Spacing.After = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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;'
});
this.cmbLineRule.setValue(this.CurLineRuleIdx);
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));
this.chAddInterval = new Common.UI.CheckBox({
el: $('#paragraphadv-checkbox-add-interval'),
labelText: this.strSomeParagraphSpace
});
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;'
});
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.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;'
});
this.cmbTextAlignment.setValue('');
this.cmbOutlinelevel = new Common.UI.ComboBox({
el: $('#paragraphadv-spin-outline-level'),
cls: 'input-group-nr',
editable: false,
data: this._arrOutlinelevel,
style: 'width: 174px;',
menuStyle : 'min-width: 174px;'
});
this.cmbOutlinelevel.setValue('');
this.cmbOutlinelevel.on('selected', _.bind(this.onOutlinelevelSelect, this));
// Line & Page Breaks
this.chBreakBefore = new Common.UI.CheckBox({ this.chBreakBefore = new Common.UI.CheckBox({
el: $('#paragraphadv-checkbox-break-before'), el: $('#paragraphadv-checkbox-break-before'),
labelText: this.strBreakBefore labelText: this.strBreakBefore
@ -326,7 +482,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numSpacing = new Common.UI.MetricSpinner({ this.numSpacing = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-spacing'), el: $('#paragraphadv-spin-spacing'),
step: .01, step: .01,
width: 100, width: 90,
defaultUnit : "cm", defaultUnit : "cm",
defaultValue : 0, defaultValue : 0,
value: '0 cm', value: '0 cm',
@ -348,7 +504,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numPosition = new Common.UI.MetricSpinner({ this.numPosition = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-position'), el: $('#paragraphadv-spin-position'),
step: .01, step: .01,
width: 100, width: 90,
defaultUnit : "cm", defaultUnit : "cm",
defaultValue : 0, defaultValue : 0,
value: '0 cm', value: '0 cm',
@ -371,7 +527,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numTab = new Common.UI.MetricSpinner({ this.numTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-tab'), el: $('#paraadv-spin-tab'),
step: .1, step: .1,
width: 180, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -382,7 +538,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numDefaultTab = new Common.UI.MetricSpinner({ this.numDefaultTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-default-tab'), el: $('#paraadv-spin-default-tab'),
step: .1, step: .1,
width: 107, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -398,7 +554,15 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.tabList = new Common.UI.ListView({ this.tabList = new Common.UI.ListView({
el: $('#paraadv-list-tabs'), el: $('#paraadv-list-tabs'),
emptyText: this.noTabs, emptyText: this.noTabs,
store: new Common.UI.DataViewStore() store: new Common.UI.DataViewStore(),
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;">',
'<div style="width:117px;display: inline-block;"><%= value %></div>',
'<div style="width:121px;display: inline-block;"><%= displayTabAlign %></div>',
'<div style="width:96px;display: inline-block;"><%= displayTabLeader %></div>',
'</div>'
].join(''))
}); });
this.tabList.store.comparator = function(rec) { this.tabList.store.comparator = function(rec) {
return rec.get("tabPos"); return rec.get("tabPos");
@ -415,31 +579,21 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.cmbAlign = new Common.UI.ComboBox({ this.cmbAlign = new Common.UI.ComboBox({
el : $('#paraadv-cmb-align'), el : $('#paraadv-cmb-align'),
style : 'width: 85px;', style : 'width: 108px;',
menuStyle : 'min-width: 85px;', menuStyle : 'min-width: 108px;',
editable : false, editable : false,
cls : 'input-group-nr', cls : 'input-group-nr',
data : [ data : this._arrTabAlign
{ value: 1, displayValue: this.textTabLeft },
{ value: 3, displayValue: this.textTabCenter },
{ value: 2, displayValue: this.textTabRight }
]
}); });
this.cmbAlign.setValue(1); this.cmbAlign.setValue(1);
this.cmbLeader = new Common.UI.ComboBox({ this.cmbLeader = new Common.UI.ComboBox({
el : $('#paraadv-cmb-leader'), el : $('#paraadv-cmb-leader'),
style : 'width: 85px;', style : 'width: 108px;',
menuStyle : 'min-width: 85px;', menuStyle : 'min-width: 108px;',
editable : false, editable : false,
cls : 'input-group-nr', cls : 'input-group-nr',
data : [ data : this._arrTabLeader
{ value: Asc.c_oAscTabLeader.None, displayValue: this.textNone },
{ value: Asc.c_oAscTabLeader.Dot, displayValue: '....................' },
{ value: Asc.c_oAscTabLeader.Hyphen, displayValue: '-----------------' },
{ value: Asc.c_oAscTabLeader.MiddleDot, displayValue: '·················' },
{ value: Asc.c_oAscTabLeader.Underscore,displayValue: '__________' }
]
}); });
this.cmbLeader.setValue(Asc.c_oAscTabLeader.None); this.cmbLeader.setValue(Asc.c_oAscTabLeader.None);
@ -600,6 +754,16 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
} }
} }
if (this.Spacing !== null) {
this._changedProps.asc_putSpacing(this.Spacing);
}
var spaceBetweenPrg = this.chAddInterval.getValue();
this._changedProps.asc_putContextualSpacing(spaceBetweenPrg == 'checked');
var horizontalAlign = this.cmbTextAlignment.getValue();
this._changedProps.asc_putJc((horizontalAlign !== undefined && horizontalAlign !== null) ? horizontalAlign : c_paragraphTextAlignment.LEFT);
return { paragraphProps: this._changedProps, borderProps: {borderSize: this.BorderSize, borderColor: this.btnBorderColor.color} }; return { paragraphProps: this._changedProps, borderProps: {borderSize: this.BorderSize, borderColor: this.btnBorderColor.color} };
}, },
@ -610,13 +774,34 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.hideTextOnlySettings(this.isChart); this.hideTextOnlySettings(this.isChart);
this.FirstLine = (props.get_Ind() !== null) ? props.get_Ind().get_FirstLine() : null; this.FirstLine = (props.get_Ind() !== null) ? props.get_Ind().get_FirstLine() : null;
this.numFirstLine.setValue(this.FirstLine!== null ? Common.Utils.Metric.fnRecalcFromMM(this.FirstLine) : '', true);
this.LeftIndent = (props.get_Ind() !== null) ? props.get_Ind().get_Left() : null; this.LeftIndent = (props.get_Ind() !== null) ? props.get_Ind().get_Left() : null;
if (this.FirstLine<0 && this.LeftIndent !== null) if (this.FirstLine<0 && this.LeftIndent !== null)
this.LeftIndent = this.LeftIndent + this.FirstLine; this.LeftIndent = this.LeftIndent + this.FirstLine;
this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', true); this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', 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.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);
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);
}
this.chAddInterval.setValue((props.get_ContextualSpacing() !== null && props.get_ContextualSpacing() !== undefined) ? props.get_ContextualSpacing() : 'indeterminate', 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);
this.cmbTextAlignment.setValue((props.get_Jc() !== undefined && props.get_Jc() !== null) ? props.get_Jc() : c_paragraphTextAlignment.LEFT, true);
this.chKeepLines.setValue((props.get_KeepLines() !== null && props.get_KeepLines() !== undefined) ? props.get_KeepLines() : 'indeterminate', true); this.chKeepLines.setValue((props.get_KeepLines() !== null && props.get_KeepLines() !== undefined) ? props.get_KeepLines() : 'indeterminate', true);
this.chBreakBefore.setValue((props.get_PageBreakBefore() !== null && props.get_PageBreakBefore() !== undefined) ? props.get_PageBreakBefore() : 'indeterminate', true); this.chBreakBefore.setValue((props.get_PageBreakBefore() !== null && props.get_PageBreakBefore() !== undefined) ? props.get_PageBreakBefore() : 'indeterminate', true);
@ -702,7 +887,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
tabPos: pos, tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.get_Value(), tabAlign: tab.get_Value(),
tabLeader: tab.asc_getLeader() tabLeader: tab.get_Leader(),
displayTabLeader: this._arrKeyTabLeader[tab.get_Leader()],
displayTabAlign: this._arrKeyTabAlign[tab.get_Value()]
}); });
arr.push(rec); arr.push(rec);
} }
@ -723,13 +910,19 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
for (var i=0; i<this.spinners.length; i++) { for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i]; var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' ) if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' || spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
} }
} }
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.pt) ? 1 : 0.01;
if (this.CurLineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step);
}
}, },
updateThemeColors: function() { updateThemeColors: function() {
@ -1095,7 +1288,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
addTab: function(btn, eOpts){ addTab: function(btn, eOpts){
var val = this.numTab.getNumberValue(), var val = this.numTab.getNumberValue(),
align = this.cmbAlign.getValue(), align = this.cmbAlign.getValue(),
leader = this.cmbLeader.getValue(); leader = this.cmbLeader.getValue(),
displayAlign = this._arrKeyTabAlign[align],
displayLeader = this._arrKeyTabLeader[leader];
var store = this.tabList.store; var store = this.tabList.store;
var rec = store.find(function(record){ var rec = store.find(function(record){
@ -1104,6 +1299,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
if (rec) { if (rec) {
rec.set('tabAlign', align); rec.set('tabAlign', align);
rec.set('tabLeader', leader); rec.set('tabLeader', leader);
rec.set('displayTabAlign', displayAlign);
rec.set('displayTabLeader', displayLeader);
this._tabListChanged = true; this._tabListChanged = true;
} else { } else {
rec = new Common.UI.DataViewModel(); rec = new Common.UI.DataViewModel();
@ -1111,7 +1308,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
tabPos: val, tabPos: val,
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align, tabAlign: align,
tabLeader: leader tabLeader: leader,
displayTabLeader: displayLeader,
displayTabAlign: displayAlign
}); });
store.add(rec); store.add(rec);
} }
@ -1158,15 +1357,90 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
hideTextOnlySettings: function(value) { hideTextOnlySettings: function(value) {
this.TextOnlySettings.toggleClass('hidden', value==true); this.TextOnlySettings.toggleClass('hidden', value==true);
this.btnsCategory[1].setVisible(!value); // Borders this.btnsCategory[1].setVisible(!value); // Line & Page Breaks
this.btnsCategory[4].setVisible(!value); // Paddings this.btnsCategory[2].setVisible(!value); // Borders
this.btnsCategory[5].setVisible(!value); // Paddings
},
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.LineRule = record.value;
if ( this.CurLineRuleIdx !== this.Spacing.LineRule ) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[record.value].defaultUnit);
this.numLineHeight.setMinValue(this._arrLineRule[record.value].minValue);
this.numLineHeight.setStep(this._arrLineRule[record.value].step);
var value = this.numLineHeight.getNumberValue();
if (this.Spacing.LineRule === c_paragraphLinerule.LINERULE_AUTO) {
this.numLineHeight.setValue(this._arrLineRule[record.value].defaultValue);
} else if (this.CurLineRuleIdx === c_paragraphLinerule.LINERULE_AUTO) {
this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[record.value].defaultValue));
} else {
this.numLineHeight.setValue(value);
}
this.CurLineRuleIdx = record.value;
}
},
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.Line = (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
},
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);
}
},
onOutlinelevelSelect: function(combo, record) {
}, },
textTitle: 'Paragraph - Advanced Settings', textTitle: 'Paragraph - Advanced Settings',
strIndentsFirstLine: 'First line', strIndentsFirstLine: 'First line',
strIndentsLeftText: 'Left', strIndentsLeftText: 'Left',
strIndentsRightText: 'Right', strIndentsRightText: 'Right',
strParagraphIndents: 'Indents & Placement', strParagraphIndents: 'Indents & Spacing',
strParagraphPosition: 'Placement', strParagraphPosition: 'Placement',
strParagraphFont: 'Font', strParagraphFont: 'Font',
strBreakBefore: 'Page break before', strBreakBefore: 'Page break before',
@ -1217,6 +1491,26 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
tipOuter: 'Set Outer Border Only', tipOuter: 'Set Outer Border Only',
noTabs: 'The specified tabs will appear in this field', noTabs: 'The specified tabs will appear in this field',
textLeader: 'Leader', textLeader: 'Leader',
textNone: 'None' textNone: 'None',
strParagraphLine: 'Line & Page Breaks',
strIndentsSpacingBefore: 'Before',
strIndentsSpacingAfter: 'After',
strIndentsLineSpacing: 'Line Spacing',
txtAutoText: 'Auto',
textAuto: 'Multiple',
textAtLeast: 'At least',
textExact: 'Exactly',
strSomeParagraphSpace: 'Don\'t add interval between paragraphs of the same style',
strIndentsSpecial: 'Special',
textNoneSpecial: '(none)',
textFirstLine: 'First line',
textHanging: 'Hanging',
textJustified: 'Justified',
textBodyText: 'BodyText',
textLevel: 'Level ',
strIndentsOutlinelevel: 'Outline level',
strIndent: 'Indents',
strSpacing: 'Spacing'
}, DE.Views.ParagraphSettingsAdvanced || {})); }, DE.Views.ParagraphSettingsAdvanced || {}));
}); });

View file

@ -1708,7 +1708,6 @@
"DE.Views.ParagraphSettingsAdvanced.strBorders": "Borders & Fill", "DE.Views.ParagraphSettingsAdvanced.strBorders": "Borders & Fill",
"DE.Views.ParagraphSettingsAdvanced.strBreakBefore": "Page break before", "DE.Views.ParagraphSettingsAdvanced.strBreakBefore": "Page break before",
"DE.Views.ParagraphSettingsAdvanced.strDoubleStrike": "Double strikethrough", "DE.Views.ParagraphSettingsAdvanced.strDoubleStrike": "Double strikethrough",
"DE.Views.ParagraphSettingsAdvanced.strIndentsFirstLine": "First Line",
"DE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left", "DE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left",
"DE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right", "DE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right",
"DE.Views.ParagraphSettingsAdvanced.strKeepLines": "Keep lines together", "DE.Views.ParagraphSettingsAdvanced.strKeepLines": "Keep lines together",
@ -1716,7 +1715,7 @@
"DE.Views.ParagraphSettingsAdvanced.strMargins": "Paddings", "DE.Views.ParagraphSettingsAdvanced.strMargins": "Paddings",
"DE.Views.ParagraphSettingsAdvanced.strOrphan": "Orphan control", "DE.Views.ParagraphSettingsAdvanced.strOrphan": "Orphan control",
"DE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font", "DE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font",
"DE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Placement", "DE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Spacing",
"DE.Views.ParagraphSettingsAdvanced.strParagraphPosition": "Placement", "DE.Views.ParagraphSettingsAdvanced.strParagraphPosition": "Placement",
"DE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps", "DE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps",
"DE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough", "DE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough",
@ -1757,6 +1756,26 @@
"DE.Views.ParagraphSettingsAdvanced.tipRight": "Set right border only", "DE.Views.ParagraphSettingsAdvanced.tipRight": "Set right border only",
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only", "DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only",
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders", "DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders",
"DE.Views.ParagraphSettingsAdvanced.strParagraphLine": "Line & Page Breaks",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Before",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "After",
"DE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Line Spacing",
"DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"DE.Views.ParagraphSettingsAdvanced.textAuto": "Multiple",
"DE.Views.ParagraphSettingsAdvanced.textAtLeast": "At least",
"DE.Views.ParagraphSettingsAdvanced.textExact": "Exactly",
"DE.Views.ParagraphSettingsAdvanced.strSomeParagraphSpace": "Don't add interval between paragraphs of the same style",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Special",
"DE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(none)",
"DE.Views.ParagraphSettingsAdvanced.textFirstLine": "First line",
"DE.Views.ParagraphSettingsAdvanced.textHanging": "Hanging",
"DE.Views.ParagraphSettingsAdvanced.textCentered": "Centered",
"DE.Views.ParagraphSettingsAdvanced.textJustified": "Justified",
"DE.Views.ParagraphSettingsAdvanced.textBodyText": "BodyText",
"DE.Views.ParagraphSettingsAdvanced.textLevel": "Level ",
"DE.Views.ParagraphSettingsAdvanced.strIndentsOutlinelevel": "Outline level",
"DE.Views.ParagraphSettingsAdvanced.strIndent": "Indents",
"DE.Views.ParagraphSettingsAdvanced.strSpacing": "Spacing",
"DE.Views.RightMenu.txtChartSettings": "Chart settings", "DE.Views.RightMenu.txtChartSettings": "Chart settings",
"DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings", "DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings",
"DE.Views.RightMenu.txtImageSettings": "Image settings", "DE.Views.RightMenu.txtImageSettings": "Image settings",

View file

@ -1713,7 +1713,8 @@
"DE.Views.ParagraphSettingsAdvanced.strMargins": "Внутренние поля", "DE.Views.ParagraphSettingsAdvanced.strMargins": "Внутренние поля",
"DE.Views.ParagraphSettingsAdvanced.strOrphan": "Запрет висячих строк", "DE.Views.ParagraphSettingsAdvanced.strOrphan": "Запрет висячих строк",
"DE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт", "DE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт",
"DE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и положение", "DE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и интервалы",
"DE.Views.ParagraphSettingsAdvanced.strParagraphLine": "Положение на странице",
"DE.Views.ParagraphSettingsAdvanced.strParagraphPosition": "Положение", "DE.Views.ParagraphSettingsAdvanced.strParagraphPosition": "Положение",
"DE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные", "DE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные",
"DE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание", "DE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание",
@ -1754,6 +1755,24 @@
"DE.Views.ParagraphSettingsAdvanced.tipRight": "Задать только правую границу", "DE.Views.ParagraphSettingsAdvanced.tipRight": "Задать только правую границу",
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Задать только верхнюю границу", "DE.Views.ParagraphSettingsAdvanced.tipTop": "Задать только верхнюю границу",
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "Без границ", "DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "Без границ",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Перед",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "После",
"DE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Междустрочный интервал",
"DE.Views.ParagraphSettingsAdvanced.txtAutoText": "Авто",
"DE.Views.ParagraphSettingsAdvanced.textAuto": "Множитель",
"DE.Views.ParagraphSettingsAdvanced.textAtLeast": "Минимум",
"DE.Views.ParagraphSettingsAdvanced.textExact": "Точно",
"DE.Views.ParagraphSettingsAdvanced.strSomeParagraphSpace": "Не добавлять интервал между абзацами одного стиля",
"DE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Первая строка",
"DE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(нет)",
"DE.Views.ParagraphSettingsAdvanced.textFirstLine": "Отступ",
"DE.Views.ParagraphSettingsAdvanced.textHanging": "Выступ",
"DE.Views.ParagraphSettingsAdvanced.textJustified": "По ширине",
"DE.Views.ParagraphSettingsAdvanced.textBodyText": "Основной текст",
"DE.Views.ParagraphSettingsAdvanced.textLevel": "Уровень ",
"DE.Views.ParagraphSettingsAdvanced.strIndentsOutlinelevel": "Уровень",
"DE.Views.ParagraphSettingsAdvanced.strIndent": "Отступы",
"DE.Views.ParagraphSettingsAdvanced.strSpacing": "Интервал между абзацами",
"DE.Views.RightMenu.txtChartSettings": "Параметры диаграммы", "DE.Views.RightMenu.txtChartSettings": "Параметры диаграммы",
"DE.Views.RightMenu.txtHeaderFooterSettings": "Параметры верхнего и нижнего колонтитулов", "DE.Views.RightMenu.txtHeaderFooterSettings": "Параметры верхнего и нижнего колонтитулов",
"DE.Views.RightMenu.txtImageSettings": "Параметры изображения", "DE.Views.RightMenu.txtImageSettings": "Параметры изображения",

View file

@ -63,6 +63,19 @@ var c_tableBorder = {
BORDER_OUTER_TABLE: 13 // table border and outer cell borders BORDER_OUTER_TABLE: 13 // table border and outer cell borders
}; };
var c_paragraphTextAlignment = {
RIGHT: 0,
LEFT: 1,
CENTERED: 2,
JUSTIFIED: 3
};
var c_paragraphSpecial = {
NONE_SPECIAL: 0,
FIRST_LINE: 1,
HANGING: 2
};
define([ define([
'core', 'core',
'presentationeditor/main/app/view/DocumentHolder' 'presentationeditor/main/app/view/DocumentHolder'

View file

@ -1,98 +1,114 @@
<div id="id-adv-paragraph-indents" class="settings-panel active"> <div id="id-adv-paragraph-indents" class="settings-panel active">
<div class="inner-content"> <div class="inner-content">
<table cols="3" style="width: 100%;"> <div>
<tr> <div class="padding-large" style="display: inline-block;">
<td class="padding-large"> <label class="input-label"><%= scope.textAlign %></label>
<label class="input-label"><%= scope.strIndentsFirstLine %></label> <div id="paragraphadv-spin-text-alignment"></div>
<div id="paragraphadv-spin-first-line" style="width: 85px;"></div> </div>
</td> </div>
<td class="padding-large"> <div style="padding-bottom: 4px;"><label class="header"><%= scope.strIndent %></label></div>
<label class="input-label"><%= scope.strIndentsLeftText %></label> <div>
<div id="paragraphadv-spin-indent-left"></div> <div class="padding-large" style="display: inline-block;">
</td> <label class="input-label"><%= scope.strIndentsLeftText %></label>
<td class="padding-large"> <div id="paragraphadv-spin-indent-left"></div>
<label class="input-label"><%= scope.strIndentsRightText %></label> </div>
<div id="paragraphadv-spin-indent-right"></div> <div class="padding-large" style="display: inline-block;">
</td> <label class="input-label"><%= scope.strIndentsRightText %></label>
</tr> <div id="paragraphadv-spin-indent-right"></div>
</table> </div>
<div class="padding-large" style="display: inline-block;">
<div>
<label class="input-label"><%= scope.strIndentsSpecial %></label>
</div>
<div>
<div id="paragraphadv-spin-special" style="display: inline-block;"></div>
<div id="paragraphadv-spin-special-by" style="display: inline-block;"></div>
</div>
</div>
</div>
<div style="padding-bottom: 4px;"><label class="header"><%= scope.strSpacing %></label></div>
<div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingBefore %></label>
<div id="paragraphadv-spin-spacing-before"></div>
</div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingAfter %></label>
<div id="paragraphadv-spin-spacing-after"></div>
</div>
<div style="display: inline-block;">
<div>
<label class="input-label"><%= scope.strIndentsLineSpacing %></label>
</div>
<div>
<div id="paragraphadv-spin-line-rule" style="display: inline-block;"></div>
<div id="paragraphadv-spin-line-height" style="display: inline-block;"></div>
</div>
</div>
</div>
<div class="padding-large" style="padding-top: 16px; display: none;">
<div style="border: 1px solid #cbcbcb; width: 350px;">
<div id="paragraphadv-indent-preview" style="height: 80px; position: relative;"></div>
</div>
</div>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-font" class="settings-panel"> <div id="id-adv-paragraph-font" class="settings-panel">
<div class="inner-content"> <div class="inner-content" style="width: 100%;">
<table cols="2" style="width: 100%;"> <div class="padding-small">
<tr> <label class="header"><%= scope.textEffects %></label>
<td colspan=2 class="padding-small"> </div>
<label class="header"><%= scope.textEffects %></label> <div>
</td> <div class="padding-large" style="display: inline-block;">
</tr> <div class="padding-small" id="paragraphadv-checkbox-strike"></div>
<tr> <div class="padding-small" id="paragraphadv-checkbox-double-strike"></div>
<td class="padding-small"> <div id="paragraphadv-checkbox-superscript"></div>
<div id="paragraphadv-checkbox-strike"></div> </div>
</td> <div class="padding-large" style="display: inline-block; padding-left: 40px;">
<td class="padding-small"> <div class="padding-small" id="paragraphadv-checkbox-subscript"></div>
<div id="paragraphadv-checkbox-subscript"></div> <div class="padding-small" id="paragraphadv-checkbox-small-caps"></div>
</td> <div id="paragraphadv-checkbox-all-caps"></div>
</tr> </div>
<tr> </div>
<td class="padding-small"> <div class="padding-small">
<div id="paragraphadv-checkbox-double-strike"></div> <label class="header"><%= scope.textCharacterSpacing %></label>
</td> </div>
<td class="padding-small"> <div class="padding-large">
<div id="paragraphadv-checkbox-small-caps"></div> <div style="display: inline-block;">
</td> <div id="paragraphadv-spin-spacing"></div>
</tr> </div>
<tr> </div>
<td class="padding-large"> <div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-checkbox-superscript"></div> <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative; margin: 0 auto;"></div>
</td> </div>
<td class="padding-large">
<div id="paragraphadv-checkbox-all-caps"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textCharacterSpacing %></label>
</td>
</tr>
<tr>
<td colspan=2 class="padding-large" width="50%">
<div id="paragraphadv-spin-spacing"></div>
</td>
</tr>
<tr>
<td colspan=2>
<div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>
</div>
</td>
</tr>
</table>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-tabs" class="settings-panel"> <div id="id-adv-paragraph-tabs" class="settings-panel">
<div class="inner-content"> <div class="inner-content">
<div class="padding-small" style="display: inline-block;"> <div class="padding-large">
<label class="input-label"><%= scope.textTabPosition %></label>
<div id="paraadv-spin-tab"></div>
</div>
<div class="padding-small" style="display: inline-block; float: right;">
<label class="input-label"><%= scope.textDefault %></label> <label class="input-label"><%= scope.textDefault %></label>
<div id="paraadv-spin-default-tab"></div> <div id="paraadv-spin-default-tab"></div>
</div>
<div class="padding-large">
<div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div>
</div>
<div class="padding-large" >
<label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>
<div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-right" style="display: block;"></div>
</div> </div>
<div> <div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button> <div class="padding-large" style="display: inline-block; margin-right: 9px;">
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button> <label class="input-label"><%= scope.textTabPosition %></label>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button> <div id="paraadv-spin-tab"></div>
</div>
<div class="padding-large" style=" display: inline-block; margin-right: 9px;">
<label class="input-label"><%= scope.textAlign %></label>
<div id="paraadv-cmb-align"></div>
</div>
</div>
<div>
<div colspan=3 class="padding-large">
<div id="paraadv-list-tabs" style="width:348px; height: 110px;"></div>
</div>
</div>
<div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textRemove %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:108px;display: inline-block;"><%= scope.textRemoveAll %></button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -49,13 +49,14 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
PE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ PE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 320, contentWidth: 370,
height: 394, height: 394,
toggleGroup: 'paragraph-adv-settings-group', toggleGroup: 'paragraph-adv-settings-group',
storageName: 'pe-para-settings-adv-category' storageName: 'pe-para-settings-adv-category'
}, },
initialize : function(options) { initialize : function(options) {
var me = this;
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: this.textTitle,
items: [ items: [
@ -74,9 +75,43 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this._noApply = true; this._noApply = true;
this._tabListChanged = false; this._tabListChanged = false;
this.spinners = []; this.spinners = [];
this.FirstLine = undefined;
this.Spacing = null;
this.api = this.options.api; this.api = this.options.api;
this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps); 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: 1, displayValue: this.textTabLeft },
{ value: 3, displayValue: this.textTabCenter },
{ value: 2, displayValue: this.textTabRight }
];
this._arrKeyTabAlign = [];
this._arrTabAlign.forEach(function(item) {
me._arrKeyTabAlign[item.value] = item.displayValue;
});
}, },
render: function() { render: function() {
@ -86,24 +121,15 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
// Indents & Placement // Indents & Placement
this.numFirstLine = new Common.UI.MetricSpinner({ this.cmbTextAlignment = new Common.UI.ComboBox({
el: $('#paragraphadv-spin-first-line'), el: $('#paragraphadv-spin-text-alignment'),
step: .1, cls: 'input-group-nr',
width: 85, editable: false,
defaultUnit : "cm", data: this._arrTextAlignment,
defaultValue : 0, style: 'width: 173px;',
value: '0 cm', menuStyle : 'min-width: 173px;'
maxValue: 55.87,
minValue: -55.87
}); });
this.numFirstLine.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.cmbTextAlignment.setValue('');
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_FirstLine(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
}, this));
this.spinners.push(this.numFirstLine);
this.numIndentsLeft = new Common.UI.MetricSpinner({ this.numIndentsLeft = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-indent-left'), el: $('#paragraphadv-spin-indent-left'),
@ -122,9 +148,6 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this._changedProps.put_Ind(new Asc.asc_CParagraphInd()); this._changedProps.put_Ind(new Asc.asc_CParagraphInd());
this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(numval)); this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(numval));
} }
this.numFirstLine.setMinValue(-numval);
if (this.numFirstLine.getNumberValue() < -numval)
this.numFirstLine.setValue(-numval);
}, this)); }, this));
this.spinners.push(this.numIndentsLeft); this.spinners.push(this.numIndentsLeft);
@ -147,6 +170,93 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
}, this)); }, this));
this.spinners.push(this.numIndentsRight); 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;'
});
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();
}
this.Spacing.Before = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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();
}
this.Spacing.After = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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;'
});
this.cmbLineRule.setValue(this.CurLineRuleIdx);
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 // Font
this.chStrike = new Common.UI.CheckBox({ this.chStrike = new Common.UI.CheckBox({
@ -211,7 +321,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.numTab = new Common.UI.MetricSpinner({ this.numTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-tab'), el: $('#paraadv-spin-tab'),
step: .1, step: .1,
width: 180, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -222,7 +332,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.numDefaultTab = new Common.UI.MetricSpinner({ this.numDefaultTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-default-tab'), el: $('#paraadv-spin-default-tab'),
step: .1, step: .1,
width: 107, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -238,7 +348,14 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.tabList = new Common.UI.ListView({ this.tabList = new Common.UI.ListView({
el: $('#paraadv-list-tabs'), el: $('#paraadv-list-tabs'),
emptyText: this.noTabs, emptyText: this.noTabs,
store: new Common.UI.DataViewStore() store: new Common.UI.DataViewStore(),
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;">',
'<div style="width: 117px;display: inline-block;"><%= value %></div>',
'<div style="display: inline-block;"><%= displayTabAlign %></div>',
'</div>'
].join(''))
}); });
this.tabList.store.comparator = function(rec) { this.tabList.store.comparator = function(rec) {
return rec.get("tabPos"); return rec.get("tabPos");
@ -253,24 +370,15 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.listenTo(this.tabList.store, 'remove', storechanged); this.listenTo(this.tabList.store, 'remove', storechanged);
this.listenTo(this.tabList.store, 'reset', storechanged); this.listenTo(this.tabList.store, 'reset', storechanged);
this.radioLeft = new Common.UI.RadioBox({ this.cmbAlign = new Common.UI.ComboBox({
el: $('#paragraphadv-radio-left'), el : $('#paraadv-cmb-align'),
labelText: this.textTabLeft, style : 'width: 108px;',
name: 'asc-radio-tab', menuStyle : 'min-width: 108px;',
checked: true editable : false,
}); cls : 'input-group-nr',
data : this._arrTabAlign
this.radioCenter = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-center'),
labelText: this.textTabCenter,
name: 'asc-radio-tab'
});
this.radioRight = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-right'),
labelText: this.textTabRight,
name: 'asc-radio-tab'
}); });
this.cmbAlign.setValue(1);
this.btnAddTab = new Common.UI.Button({ this.btnAddTab = new Common.UI.Button({
el: $('#paraadv-button-add-tab') el: $('#paraadv-button-add-tab')
@ -299,18 +407,45 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this._changedProps.get_Tabs().add_Tab(tab); this._changedProps.get_Tabs().add_Tab(tab);
}, this); }, 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 }; return { paragraphProps: this._changedProps };
}, },
_setDefaults: function(props) { _setDefaults: function(props) {
if (props ){ if (props ){
this._originalProps = new Asc.asc_CParagraphProperty(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.numIndentsLeft.setValue((props.get_Ind() !== null && props.get_Ind().get_Left() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Left()) : '', true);
this.numFirstLine.setMinValue(-this.numIndentsLeft.getNumberValue());
this.numFirstLine.setValue((props.get_Ind() !== null && props.get_Ind().get_FirstLine() !== null ) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_FirstLine()) : '', 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.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);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);
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 // Font
this._noApply = true; this._noApply = true;
this.chStrike.setValue((props.get_Strikeout() !== null && props.get_Strikeout() !== undefined) ? props.get_Strikeout() : 'indeterminate', true); this.chStrike.setValue((props.get_Strikeout() !== null && props.get_Strikeout() !== undefined) ? props.get_Strikeout() : 'indeterminate', true);
@ -339,7 +474,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
rec.set({ rec.set({
tabPos: pos, tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.get_Value() tabAlign: tab.get_Value(),
displayTabAlign: this._arrKeyTabAlign[tab.get_Value()]
}); });
arr.push(rec); arr.push(rec);
} }
@ -359,13 +495,19 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
for (var i=0; i<this.spinners.length; i++) { for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i]; var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing') if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after')
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
} }
} }
this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
this._arrLineRule[1].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01;
if (this.CurLineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step);
}
}, },
afterRender: function() { afterRender: function() {
@ -498,8 +640,9 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
}, },
addTab: function(btn, eOpts){ addTab: function(btn, eOpts){
var val = this.numTab.getNumberValue(); var val = this.numTab.getNumberValue(),
var align = this.radioLeft.getValue() ? 1 : (this.radioCenter.getValue() ? 3 : 2); align = this.cmbAlign.getValue(),
displayAlign = this._arrKeyTabAlign[align];
var store = this.tabList.store; var store = this.tabList.store;
var rec = store.find(function(record){ var rec = store.find(function(record){
@ -507,13 +650,15 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
}); });
if (rec) { if (rec) {
rec.set('tabAlign', align); rec.set('tabAlign', align);
rec.set('displayTabAlign', displayAlign);
this._tabListChanged = true; this._tabListChanged = true;
} else { } else {
rec = new Common.UI.DataViewModel(); rec = new Common.UI.DataViewModel();
rec.set({ rec.set({
tabPos: val, tabPos: val,
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align tabAlign: align,
displayTabAlign: displayAlign
}); });
store.add(rec); store.add(rec);
} }
@ -554,15 +699,83 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
rawData = record; rawData = record;
} }
this.numTab.setValue(rawData.tabPos); this.numTab.setValue(rawData.tabPos);
(rawData.tabAlign==1) ? this.radioLeft.setValue(true) : ((rawData.tabAlign==3) ? this.radioCenter.setValue(true) : this.radioRight.setValue(true)); 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.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.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.Line = (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, },
textTitle: 'Paragraph - Advanced Settings', textTitle: 'Paragraph - Advanced Settings',
strIndentsFirstLine: 'First line', strIndentsFirstLine: 'First line',
strIndentsLeftText: 'Left', strIndentsLeftText: 'Left',
strIndentsRightText: 'Right', strIndentsRightText: 'Right',
strParagraphIndents: 'Indents & Placement', strParagraphIndents: 'Indents & Spacing',
strParagraphFont: 'Font', strParagraphFont: 'Font',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
okButtonText: 'Ok', okButtonText: 'Ok',
@ -584,6 +797,19 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
textAlign: 'Alignment', textAlign: 'Alignment',
textTabPosition: 'Tab Position', textTabPosition: 'Tab Position',
textDefault: 'Default Tab', textDefault: 'Default Tab',
noTabs: 'The specified tabs will appear in this field' 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'
}, PE.Views.ParagraphSettingsAdvanced || {})); }, PE.Views.ParagraphSettingsAdvanced || {}));
}); });

View file

@ -1328,7 +1328,7 @@
"PE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left", "PE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left",
"PE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right", "PE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right",
"PE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font", "PE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font",
"PE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Placement", "PE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Spacing",
"PE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps", "PE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps",
"PE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough", "PE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough",
"PE.Views.ParagraphSettingsAdvanced.strSubscript": "Subscript", "PE.Views.ParagraphSettingsAdvanced.strSubscript": "Subscript",
@ -1346,6 +1346,19 @@
"PE.Views.ParagraphSettingsAdvanced.textTabPosition": "Tab Position", "PE.Views.ParagraphSettingsAdvanced.textTabPosition": "Tab Position",
"PE.Views.ParagraphSettingsAdvanced.textTabRight": "Right", "PE.Views.ParagraphSettingsAdvanced.textTabRight": "Right",
"PE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings", "PE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings",
"PE.Views.ParagraphSettingsAdvanced.textJustified": "Justified",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Special",
"PE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(none)",
"PE.Views.ParagraphSettingsAdvanced.textFirstLine": "First line",
"PE.Views.ParagraphSettingsAdvanced.textHanging": "Hanging",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Before",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "After",
"PE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Line Spacing",
"PE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"PE.Views.ParagraphSettingsAdvanced.textAuto": "Multiple",
"PE.Views.ParagraphSettingsAdvanced.textExact": "Exactly",
"PE.Views.ParagraphSettingsAdvanced.strIndent": "Indents",
"PE.Views.ParagraphSettingsAdvanced.strSpacing": "Spacing",
"PE.Views.RightMenu.txtChartSettings": "Chart settings", "PE.Views.RightMenu.txtChartSettings": "Chart settings",
"PE.Views.RightMenu.txtImageSettings": "Image settings", "PE.Views.RightMenu.txtImageSettings": "Image settings",
"PE.Views.RightMenu.txtParagraphSettings": "Text settings", "PE.Views.RightMenu.txtParagraphSettings": "Text settings",

View file

@ -1328,7 +1328,7 @@
"PE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Слева", "PE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Слева",
"PE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Справа", "PE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Справа",
"PE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт", "PE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт",
"PE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и положение", "PE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и интервалы",
"PE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные", "PE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные",
"PE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание", "PE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание",
"PE.Views.ParagraphSettingsAdvanced.strSubscript": "Подстрочные", "PE.Views.ParagraphSettingsAdvanced.strSubscript": "Подстрочные",
@ -1346,6 +1346,19 @@
"PE.Views.ParagraphSettingsAdvanced.textTabPosition": "Позиция", "PE.Views.ParagraphSettingsAdvanced.textTabPosition": "Позиция",
"PE.Views.ParagraphSettingsAdvanced.textTabRight": "По правому краю", "PE.Views.ParagraphSettingsAdvanced.textTabRight": "По правому краю",
"PE.Views.ParagraphSettingsAdvanced.textTitle": "Абзац - дополнительные параметры", "PE.Views.ParagraphSettingsAdvanced.textTitle": "Абзац - дополнительные параметры",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Перед",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "После",
"PE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Междустрочный интервал",
"PE.Views.ParagraphSettingsAdvanced.textAuto": "Множитель",
"PE.Views.ParagraphSettingsAdvanced.txtAutoText": "Авто",
"PE.Views.ParagraphSettingsAdvanced.textExact": "Точно",
"PE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Первая строка",
"PE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(нет)",
"PE.Views.ParagraphSettingsAdvanced.textFirstLine": "Отступ",
"PE.Views.ParagraphSettingsAdvanced.textHanging": "Выступ",
"PE.Views.ParagraphSettingsAdvanced.textJustified": "По ширине",
"PE.Views.ParagraphSettingsAdvanced.strIndent": "Отступы",
"PE.Views.ParagraphSettingsAdvanced.strSpacing": "Интервал между абзацами",
"PE.Views.RightMenu.txtChartSettings": "Параметры диаграммы", "PE.Views.RightMenu.txtChartSettings": "Параметры диаграммы",
"PE.Views.RightMenu.txtImageSettings": "Параметры изображения", "PE.Views.RightMenu.txtImageSettings": "Параметры изображения",
"PE.Views.RightMenu.txtParagraphSettings": "Параметры текста", "PE.Views.RightMenu.txtParagraphSettings": "Параметры текста",

View file

@ -40,6 +40,24 @@
* *
*/ */
var c_paragraphLinerule = {
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([ define([
'core', 'core',
'common/main/lib/util/utils', 'common/main/lib/util/utils',

View file

@ -1,98 +1,114 @@
<div id="id-adv-paragraph-indents" class="settings-panel active"> <div id="id-adv-paragraph-indents" class="settings-panel active">
<div class="inner-content"> <div class="inner-content">
<table cols="3" style="width: 100%;"> <div>
<tr> <div class="padding-large" style="display: inline-block;">
<td class="padding-large"> <label class="input-label"><%= scope.textAlign %></label>
<label class="input-label"><%= scope.strIndentsFirstLine %></label> <div id="paragraphadv-spin-text-alignment"></div>
<div id="paragraphadv-spin-first-line" style="width: 85px;"></div> </div>
</td> </div>
<td class="padding-large"> <div style="padding-bottom: 4px;"><label class="header"><%= scope.strIndent %></label></div>
<label class="input-label"><%= scope.strIndentsLeftText %></label> <div>
<div id="paragraphadv-spin-indent-left"></div> <div class="padding-large" style="display: inline-block;">
</td> <label class="input-label"><%= scope.strIndentsLeftText %></label>
<td class="padding-large"> <div id="paragraphadv-spin-indent-left"></div>
<label class="input-label"><%= scope.strIndentsRightText %></label> </div>
<div id="paragraphadv-spin-indent-right"></div> <div class="padding-large" style="display: inline-block;">
</td> <label class="input-label"><%= scope.strIndentsRightText %></label>
</tr> <div id="paragraphadv-spin-indent-right"></div>
</table> </div>
<div class="padding-large" style="display: inline-block;">
<div>
<label class="input-label"><%= scope.strIndentsSpecial %></label>
</div>
<div>
<div id="paragraphadv-spin-special" style="display: inline-block;"></div>
<div id="paragraphadv-spin-special-by" style="display: inline-block;"></div>
</div>
</div>
</div>
<div style="padding-bottom: 4px;"><label class="header"><%= scope.strSpacing %></label></div>
<div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingBefore %></label>
<div id="paragraphadv-spin-spacing-before"></div>
</div>
<div style="display: inline-block;">
<label class="input-label"><%= scope.strIndentsSpacingAfter %></label>
<div id="paragraphadv-spin-spacing-after"></div>
</div>
<div style="display: inline-block;">
<div>
<label class="input-label"><%= scope.strIndentsLineSpacing %></label>
</div>
<div>
<div id="paragraphadv-spin-line-rule" style="display: inline-block;"></div>
<div id="paragraphadv-spin-line-height" style="display: inline-block;"></div>
</div>
</div>
</div>
<div class="padding-large" style="padding-top: 16px; display: none;">
<div style="border: 1px solid #cbcbcb; width: 350px;">
<div id="paragraphadv-indent-preview" style="height: 80px; position: relative;"></div>
</div>
</div>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-font" class="settings-panel"> <div id="id-adv-paragraph-font" class="settings-panel">
<div class="inner-content"> <div class="inner-content" style="width: 100%;">
<table cols="2" style="width: 100%;"> <div class="padding-small">
<tr> <label class="header"><%= scope.textEffects %></label>
<td colspan=2 class="padding-small"> </div>
<label class="header"><%= scope.textEffects %></label> <div>
</td> <div class="padding-large" style="display: inline-block;">
</tr> <div class="padding-small" id="paragraphadv-checkbox-strike"></div>
<tr> <div class="padding-small" id="paragraphadv-checkbox-double-strike"></div>
<td class="padding-small"> <div id="paragraphadv-checkbox-superscript"></div>
<div id="paragraphadv-checkbox-strike"></div> </div>
</td> <div class="padding-large" style="display: inline-block; padding-left: 40px;">
<td class="padding-small"> <div class="padding-small" id="paragraphadv-checkbox-subscript"></div>
<div id="paragraphadv-checkbox-subscript"></div> <div class="padding-small" id="paragraphadv-checkbox-small-caps"></div>
</td> <div id="paragraphadv-checkbox-all-caps"></div>
</tr> </div>
<tr> </div>
<td class="padding-small"> <div class="padding-small">
<div id="paragraphadv-checkbox-double-strike"></div> <label class="header"><%= scope.textCharacterSpacing %></label>
</td> </div>
<td class="padding-small"> <div class="padding-large">
<div id="paragraphadv-checkbox-small-caps"></div> <div style="display: inline-block;">
</td> <div id="paragraphadv-spin-spacing"></div>
</tr> </div>
<tr> </div>
<td class="padding-large"> <div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-checkbox-superscript"></div> <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative; margin: 0 auto;"></div>
</td> </div>
<td class="padding-large">
<div id="paragraphadv-checkbox-all-caps"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textCharacterSpacing %></label>
</td>
</tr>
<tr>
<td colspan=2 class="padding-large" width="50%">
<div id="paragraphadv-spin-spacing"></div>
</td>
</tr>
<tr>
<td colspan=2>
<div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>
</div>
</td>
</tr>
</table>
</div> </div>
</div> </div>
<div id="id-adv-paragraph-tabs" class="settings-panel"> <div id="id-adv-paragraph-tabs" class="settings-panel">
<div class="inner-content"> <div class="inner-content">
<div class="padding-small" style="display: inline-block;"> <div class="padding-large">
<label class="input-label"><%= scope.textTabPosition %></label>
<div id="paraadv-spin-tab"></div>
</div>
<div class="padding-small" style="display: inline-block; float: right;">
<label class="input-label"><%= scope.textDefault %></label> <label class="input-label"><%= scope.textDefault %></label>
<div id="paraadv-spin-default-tab"></div> <div id="paraadv-spin-default-tab"></div>
</div>
<div class="padding-large">
<div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div>
</div>
<div class="padding-large" >
<label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>
<div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-right" style="display: block;"></div>
</div> </div>
<div> <div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button> <div class="padding-large" style="display: inline-block; margin-right: 9px;">
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button> <label class="input-label"><%= scope.textTabPosition %></label>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button> <div id="paraadv-spin-tab"></div>
</div>
<div class="padding-large" style=" display: inline-block; margin-right: 9px;">
<label class="input-label"><%= scope.textAlign %></label>
<div id="paraadv-cmb-align"></div>
</div>
</div>
<div>
<div colspan=3 class="padding-large">
<div id="paraadv-list-tabs" style="width:348px; height: 110px;"></div>
</div>
</div>
<div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:108px;margin-right: 9px; display: inline-block;"><%= scope.textRemove %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:108px;display: inline-block;"><%= scope.textRemoveAll %></button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -487,16 +487,19 @@ define([
title : t.txtTitle, title : t.txtTitle,
modal : false, modal : false,
animate : false, animate : false,
items : [] items : [],
resizable : true,
minwidth : 450,
minheight : 265
}, options); }, options);
this.template = options.template || [ this.template = options.template || [
'<div class="box" style="height:' + _options.height + 'px;">', '<div class="box" style="height: 100%; display: flex; justify-content: space-between;">',
'<div class="content-panel" style="width: 250px;">', '<div class="content-panel" style="width: 100%; border-right: 1px solid #cbcbcb; display: flex; flex-direction: column; justify-content: space-between;">',
'<div class="">', '<div class="" style="display: flex; flex-direction: column; justify-content: flex-start; height: calc(100% - 40px);">',
'<div id="id-sd-cell-search" style="height:22px; margin-bottom:10px;"></div>', '<div id="id-sd-cell-search" style="height:22px; margin-bottom:10px;"></div>',
'<div class="border-values" style="">', '<div class="border-values" style="overflow: hidden; flex-grow: 1;">',
'<div id="id-dlg-filter-values" class="combo-values"/>', '<div id="id-dlg-filter-values" class="combo-values" style=""/>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="footer center">', '<div class="footer center">',
@ -504,8 +507,7 @@ define([
'<button class="btn normal dlg-btn" result="cancel">', t.cancelButtonText, '</button>', '<button class="btn normal dlg-btn" result="cancel">', t.cancelButtonText, '</button>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="separator"/>', '<div class="menu-panel" style="width: 195px; float: right;">',
'<div class="menu-panel" style="width: 195px;">',
'<div id="menu-container-filters" style=""><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', '<div id="menu-container-filters" style=""><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',
'</div>', '</div>',
'</div>' '</div>'
@ -515,10 +517,13 @@ define([
this.handler = options.handler; this.handler = options.handler;
this.throughIndexes = []; this.throughIndexes = [];
this.filteredIndexes = []; this.filteredIndexes = [];
this.curSize = null;
_options.tpl = _.template(this.template)(_options); _options.tpl = _.template(this.template)(_options);
Common.UI.Window.prototype.initialize.call(this, _options); Common.UI.Window.prototype.initialize.call(this, _options);
this.on('resize', _.bind(this.onWindowResize, this));
}, },
render: function () { render: function () {
@ -526,6 +531,12 @@ define([
Common.UI.Window.prototype.render.call(this); Common.UI.Window.prototype.render.call(this);
var $border = this.$window.find('.resize-border');
this.$window.find('.resize-border.left, .resize-border.top').css({'cursor': 'default'});
$border.removeClass('left');
$border.removeClass('top');
this.$window.find('.btn').on('click', _.bind(this.onBtnClick, this)); this.$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
this.btnOk = new Common.UI.Button({ this.btnOk = new Common.UI.Button({
@ -1359,6 +1370,19 @@ define([
return false; return false;
}, },
onWindowResize: function () {
var size = this.getSize();
if (this.curSize === null) {
this.curSize = size;
} else {
if (size[0] !== this.curSize[0] || size[1] !== this.curSize[1]) {
this.$window.find('.combo-values').css({'height': size[1] - 100 + 'px'});
this.curSize = size;
this.cellsList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true});
}
}
},
okButtonText : 'Ok', okButtonText : 'Ok',
btnCustomFilter : 'Custom Filter', btnCustomFilter : 'Custom Filter',
textSelectAll : 'Select All', textSelectAll : 'Select All',

View file

@ -49,13 +49,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
SSE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ SSE.Views.ParagraphSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 320, contentWidth: 370,
height: 394, height: 394,
toggleGroup: 'paragraph-adv-settings-group', toggleGroup: 'paragraph-adv-settings-group',
storageName: 'sse-para-settings-adv-category' storageName: 'sse-para-settings-adv-category'
}, },
initialize : function(options) { initialize : function(options) {
var me = this;
_.extend(this.options, { _.extend(this.options, {
title: this.textTitle, title: this.textTitle,
items: [ items: [
@ -74,9 +75,43 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this._noApply = true; this._noApply = true;
this._tabListChanged = false; this._tabListChanged = false;
this.spinners = []; this.spinners = [];
this.FirstLine = undefined;
this.Spacing = null;
this.api = this.options.api; this.api = this.options.api;
this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps); 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.asc_getSpacing().asc_getLineRule(),
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: 1, displayValue: this.textTabLeft },
{ value: 3, displayValue: this.textTabCenter },
{ value: 2, displayValue: this.textTabRight }
];
this._arrKeyTabAlign = [];
this._arrTabAlign.forEach(function(item) {
me._arrKeyTabAlign[item.value] = item.displayValue;
});
}, },
render: function() { render: function() {
@ -86,24 +121,15 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
// Indents & Placement // Indents & Placement
this.numFirstLine = new Common.UI.MetricSpinner({ this.cmbTextAlignment = new Common.UI.ComboBox({
el: $('#paragraphadv-spin-first-line'), el: $('#paragraphadv-spin-text-alignment'),
step: .1, cls: 'input-group-nr',
width: 85, editable: false,
defaultUnit : "cm", data: this._arrTextAlignment,
defaultValue : 0, style: 'width: 173px;',
value: '0 cm', menuStyle : 'min-width: 173px;'
maxValue: 55.87,
minValue: -55.87
}); });
this.numFirstLine.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.cmbTextAlignment.setValue('');
if (this._changedProps) {
if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===undefined)
this._changedProps.asc_putInd(new Asc.asc_CParagraphInd());
this._changedProps.asc_getInd().asc_putFirstLine(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
}, this));
this.spinners.push(this.numFirstLine);
this.numIndentsLeft = new Common.UI.MetricSpinner({ this.numIndentsLeft = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-indent-left'), el: $('#paragraphadv-spin-indent-left'),
@ -113,13 +139,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
defaultValue : 0, defaultValue : 0,
value: '0 cm', value: '0 cm',
maxValue: 55.87, maxValue: 55.87,
minValue: -55.87 minValue: 0
}); });
this.numIndentsLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.numIndentsLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){
var numval = field.getNumberValue();
if (this._changedProps) { if (this._changedProps) {
if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===undefined) if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===undefined)
this._changedProps.asc_putInd(new Asc.asc_CParagraphInd()); this._changedProps.put_Ind(new Asc.asc_CParagraphInd());
this._changedProps.asc_getInd().asc_putLeft(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this._changedProps.asc_getInd().put_Left(Common.Utils.Metric.fnRecalcToMM(numval));
} }
}, this)); }, this));
this.spinners.push(this.numIndentsLeft); this.spinners.push(this.numIndentsLeft);
@ -132,17 +159,104 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
defaultValue : 0, defaultValue : 0,
value: '0 cm', value: '0 cm',
maxValue: 55.87, maxValue: 55.87,
minValue: -55.87 minValue: 0
}); });
this.numIndentsRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.numIndentsRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (this._changedProps) { if (this._changedProps) {
if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===undefined) if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===undefined)
this._changedProps.asc_putInd(new Asc.asc_CParagraphInd()); this._changedProps.put_Ind(new Asc.asc_CParagraphInd());
this._changedProps.asc_getInd().asc_putRight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this._changedProps.asc_getInd().put_Right(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
} }
}, this)); }, this));
this.spinners.push(this.numIndentsRight); 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;'
});
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.asc_getSpacing();
}
this.Spacing.Before = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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.asc_getSpacing();
}
this.Spacing.After = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, 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;'
});
this.cmbLineRule.setValue(this.CurLineRuleIdx);
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 // Font
this.chStrike = new Common.UI.CheckBox({ this.chStrike = new Common.UI.CheckBox({
@ -207,7 +321,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.numTab = new Common.UI.MetricSpinner({ this.numTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-tab'), el: $('#paraadv-spin-tab'),
step: .1, step: .1,
width: 180, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -218,7 +332,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.numDefaultTab = new Common.UI.MetricSpinner({ this.numDefaultTab = new Common.UI.MetricSpinner({
el: $('#paraadv-spin-default-tab'), el: $('#paraadv-spin-default-tab'),
step: .1, step: .1,
width: 107, width: 108,
defaultUnit : "cm", defaultUnit : "cm",
value: '1.25 cm', value: '1.25 cm',
maxValue: 55.87, maxValue: 55.87,
@ -234,7 +348,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.tabList = new Common.UI.ListView({ this.tabList = new Common.UI.ListView({
el: $('#paraadv-list-tabs'), el: $('#paraadv-list-tabs'),
emptyText: this.noTabs, emptyText: this.noTabs,
store: new Common.UI.DataViewStore() store: new Common.UI.DataViewStore(),
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
itemTemplate: _.template([
'<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;">',
'<div style="width: 117px;display: inline-block;"><%= value %></div>',
'<div style="display: inline-block;"><%= displayTabAlign %></div>',
'</div>'
].join(''))
}); });
this.tabList.store.comparator = function(rec) { this.tabList.store.comparator = function(rec) {
return rec.get("tabPos"); return rec.get("tabPos");
@ -249,24 +370,15 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.listenTo(this.tabList.store, 'remove', storechanged); this.listenTo(this.tabList.store, 'remove', storechanged);
this.listenTo(this.tabList.store, 'reset', storechanged); this.listenTo(this.tabList.store, 'reset', storechanged);
this.radioLeft = new Common.UI.RadioBox({ this.cmbAlign = new Common.UI.ComboBox({
el: $('#paragraphadv-radio-left'), el : $('#paraadv-cmb-align'),
labelText: this.textTabLeft, style : 'width: 108px;',
name: 'asc-radio-tab', menuStyle : 'min-width: 108px;',
checked: true editable : false,
}); cls : 'input-group-nr',
data : this._arrTabAlign
this.radioCenter = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-center'),
labelText: this.textTabCenter,
name: 'asc-radio-tab'
});
this.radioRight = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-right'),
labelText: this.textTabRight,
name: 'asc-radio-tab'
}); });
this.cmbAlign.setValue(1);
this.btnAddTab = new Common.UI.Button({ this.btnAddTab = new Common.UI.Button({
el: $('#paraadv-button-add-tab') el: $('#paraadv-button-add-tab')
@ -299,17 +411,44 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this._changedProps.asc_getTabs().add_Tab(tab); this._changedProps.asc_getTabs().add_Tab(tab);
}, this); }, 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 }; return { paragraphProps: this._changedProps };
}, },
_setDefaults: function(props) { _setDefaults: function(props) {
if (props ){ if (props ){
this._originalProps = new Asc.asc_CParagraphProperty(props); this._originalProps = new Asc.asc_CParagraphProperty(props);
this.FirstLine = (props.asc_getInd() !== null) ? props.asc_getInd().asc_getFirstLine() : null;
this.numFirstLine.setValue((props.asc_getInd() !== null && props.asc_getInd().asc_getFirstLine() !== null ) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getInd().asc_getFirstLine()) : '', true);
this.numIndentsLeft.setValue((props.asc_getInd() !== null && props.asc_getInd().asc_getLeft() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getInd().asc_getLeft()) : '', true); this.numIndentsLeft.setValue((props.asc_getInd() !== null && props.asc_getInd().asc_getLeft() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getInd().asc_getLeft()) : '', true);
this.numIndentsRight.setValue((props.asc_getInd() !== null && props.asc_getInd().asc_getRight() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getInd().asc_getRight()) : '', true); this.numIndentsRight.setValue((props.asc_getInd() !== null && props.asc_getInd().asc_getRight() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getInd().asc_getRight()) : '', true);
this.cmbTextAlignment.setValue((props.asc_getJc() !== undefined && props.asc_getJc() !== null) ? props.asc_getJc() : c_paragraphTextAlignment.CENTERED, true);
if(this.CurSpecial === undefined) {
this.CurSpecial = (props.asc_getInd().asc_getFirstLine() === 0) ? c_paragraphSpecial.NONE_SPECIAL : ((props.asc_getInd().asc_getFirstLine() > 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);
this.numSpacingBefore.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getBefore() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getBefore()) : '', true);
this.numSpacingAfter.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getAfter() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getAfter()) : '', true);
var linerule = props.asc_getSpacing().asc_getLineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);
if(props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getLine() !== null) {
this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.asc_getSpacing().asc_getLine() : Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getLine()), true);
} else {
this.numLineHeight.setValue('', true);
}
// Font // Font
this._noApply = true; this._noApply = true;
this.chStrike.setValue((props.asc_getStrikeout() !== null && props.asc_getStrikeout() !== undefined) ? props.asc_getStrikeout() : 'indeterminate', true); this.chStrike.setValue((props.asc_getStrikeout() !== null && props.asc_getStrikeout() !== undefined) ? props.asc_getStrikeout() : 'indeterminate', true);
@ -338,7 +477,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
rec.set({ rec.set({
tabPos: pos, tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.asc_getValue() tabAlign: tab.asc_getValue(),
displayTabAlign: this._arrKeyTabAlign[tab.asc_getValue()]
}); });
arr.push(rec); arr.push(rec);
} }
@ -358,13 +498,19 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
for (var i=0; i<this.spinners.length; i++) { for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i]; var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' ) if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' || spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
} }
} }
this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
this._arrLineRule[1].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01;
if (this.CurLineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step);
}
}, },
afterRender: function() { afterRender: function() {
@ -497,8 +643,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
}, },
addTab: function(btn, eOpts){ addTab: function(btn, eOpts){
var val = this.numTab.getNumberValue(); var val = this.numTab.getNumberValue(),
var align = this.radioLeft.getValue() ? 1 : (this.radioCenter.getValue() ? 3 : 2); align = this.cmbAlign.getValue(),
displayAlign = this._arrKeyTabAlign[align];
var store = this.tabList.store; var store = this.tabList.store;
var rec = store.find(function(record){ var rec = store.find(function(record){
@ -506,13 +653,15 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
}); });
if (rec) { if (rec) {
rec.set('tabAlign', align); rec.set('tabAlign', align);
rec.set('displayTabAlign', displayAlign);
this._tabListChanged = true; this._tabListChanged = true;
} else { } else {
rec = new Common.UI.DataViewModel(); rec = new Common.UI.DataViewModel();
rec.set({ rec.set({
tabPos: val, tabPos: val,
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(), value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align tabAlign: align,
displayTabAlign: displayAlign
}); });
store.add(rec); store.add(rec);
} }
@ -553,15 +702,83 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
rawData = record; rawData = record;
} }
this.numTab.setValue(rawData.tabPos); this.numTab.setValue(rawData.tabPos);
(rawData.tabAlign==1) ? this.radioLeft.setValue(true) : ((rawData.tabAlign==3) ? this.radioCenter.setValue(true) : this.radioRight.setValue(true)); 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.asc_getInd()===null || this._changedProps.asc_getInd()===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.asc_getInd().put_FirstLine(value);
}
},
onFirstLineChange: function(field, newValue, oldValue, eOpts){
if (this._changedProps) {
if (this._changedProps.asc_getInd()===null || this._changedProps.asc_getInd()===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.asc_getInd().put_FirstLine(value);
}
},
onLineRuleSelect: function(combo, record) {
if (this.Spacing === null) {
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.asc_getSpacing();
}
this.Spacing.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.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.asc_getSpacing();
}
this.Spacing.Line = (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue());
}, },
textTitle: 'Paragraph - Advanced Settings', textTitle: 'Paragraph - Advanced Settings',
strIndentsFirstLine: 'First line', strIndentsFirstLine: 'First line',
strIndentsLeftText: 'Left', strIndentsLeftText: 'Left',
strIndentsRightText: 'Right', strIndentsRightText: 'Right',
strParagraphIndents: 'Indents & Placement', strParagraphIndents: 'Indents & Spacing',
strParagraphFont: 'Font', strParagraphFont: 'Font',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
okButtonText: 'Ok', okButtonText: 'Ok',
@ -583,6 +800,19 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
textAlign: 'Alignment', textAlign: 'Alignment',
textTabPosition: 'Tab Position', textTabPosition: 'Tab Position',
textDefault: 'Default Tab', textDefault: 'Default Tab',
noTabs: 'The specified tabs will appear in this field' 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'
}, SSE.Views.ParagraphSettingsAdvanced || {})); }, SSE.Views.ParagraphSettingsAdvanced || {}));
}); });

View file

@ -1818,7 +1818,7 @@
"SSE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left", "SSE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Left",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right", "SSE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Right",
"SSE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font", "SSE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Font",
"SSE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Placement", "SSE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Indents & Spacing",
"SSE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps", "SSE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Small caps",
"SSE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough", "SSE.Views.ParagraphSettingsAdvanced.strStrike": "Strikethrough",
"SSE.Views.ParagraphSettingsAdvanced.strSubscript": "Subscript", "SSE.Views.ParagraphSettingsAdvanced.strSubscript": "Subscript",
@ -1836,6 +1836,20 @@
"SSE.Views.ParagraphSettingsAdvanced.textTabPosition": "Tab Position", "SSE.Views.ParagraphSettingsAdvanced.textTabPosition": "Tab Position",
"SSE.Views.ParagraphSettingsAdvanced.textTabRight": "Right", "SSE.Views.ParagraphSettingsAdvanced.textTabRight": "Right",
"SSE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings", "SSE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced Settings",
"SSE.Views.ParagraphSettingsAdvanced.textJustified": "Justified",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Special",
"SSE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(none)",
"SSE.Views.ParagraphSettingsAdvanced.textFirstLine": "First line",
"SSE.Views.ParagraphSettingsAdvanced.textHanging": "Hanging",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpecialBy": "By",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Before",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "After",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Line Spacing",
"SSE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
"SSE.Views.ParagraphSettingsAdvanced.textAuto": "Multiple",
"SSE.Views.ParagraphSettingsAdvanced.textExact": "Exactly",
"SSE.Views.ParagraphSettingsAdvanced.strIndent": "Indents",
"SSE.Views.ParagraphSettingsAdvanced.strSpacing": "Spacing",
"SSE.Views.PivotSettings.notcriticalErrorTitle": "Warning", "SSE.Views.PivotSettings.notcriticalErrorTitle": "Warning",
"SSE.Views.PivotSettings.textAdvanced": "Show advanced settings", "SSE.Views.PivotSettings.textAdvanced": "Show advanced settings",
"SSE.Views.PivotSettings.textCancel": "Cancel", "SSE.Views.PivotSettings.textCancel": "Cancel",

View file

@ -1816,7 +1816,7 @@
"SSE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Слева", "SSE.Views.ParagraphSettingsAdvanced.strIndentsLeftText": "Слева",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Справа", "SSE.Views.ParagraphSettingsAdvanced.strIndentsRightText": "Справа",
"SSE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт", "SSE.Views.ParagraphSettingsAdvanced.strParagraphFont": "Шрифт",
"SSE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и положение", "SSE.Views.ParagraphSettingsAdvanced.strParagraphIndents": "Отступы и интервалы",
"SSE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные", "SSE.Views.ParagraphSettingsAdvanced.strSmallCaps": "Малые прописные",
"SSE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание", "SSE.Views.ParagraphSettingsAdvanced.strStrike": "Зачёркивание",
"SSE.Views.ParagraphSettingsAdvanced.strSubscript": "Подстрочные", "SSE.Views.ParagraphSettingsAdvanced.strSubscript": "Подстрочные",
@ -1834,6 +1834,19 @@
"SSE.Views.ParagraphSettingsAdvanced.textTabPosition": "Позиция", "SSE.Views.ParagraphSettingsAdvanced.textTabPosition": "Позиция",
"SSE.Views.ParagraphSettingsAdvanced.textTabRight": "По правому краю", "SSE.Views.ParagraphSettingsAdvanced.textTabRight": "По правому краю",
"SSE.Views.ParagraphSettingsAdvanced.textTitle": "Абзац - дополнительные параметры", "SSE.Views.ParagraphSettingsAdvanced.textTitle": "Абзац - дополнительные параметры",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpacingBefore": "Перед",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpacingAfter": "После",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsLineSpacing": "Междустрочный интервал",
"SSE.Views.ParagraphSettingsAdvanced.textAuto": "Множитель",
"SSE.Views.ParagraphSettingsAdvanced.txtAutoText": "Авто",
"SSE.Views.ParagraphSettingsAdvanced.textExact": "Точно",
"SSE.Views.ParagraphSettingsAdvanced.strIndentsSpecial": "Первая строка",
"SSE.Views.ParagraphSettingsAdvanced.textNoneSpecial": "(нет)",
"SSE.Views.ParagraphSettingsAdvanced.textFirstLine": "Отступ",
"SSE.Views.ParagraphSettingsAdvanced.textHanging": "Выступ",
"SSE.Views.ParagraphSettingsAdvanced.textJustified": "По ширине",
"SSE.Views.ParagraphSettingsAdvanced.strIndent": "Отступы",
"SSE.Views.ParagraphSettingsAdvanced.strSpacing": "Интервал между абзацами",
"SSE.Views.PivotSettings.notcriticalErrorTitle": "Внимание", "SSE.Views.PivotSettings.notcriticalErrorTitle": "Внимание",
"SSE.Views.PivotSettings.textAdvanced": "Дополнительные параметры", "SSE.Views.PivotSettings.textAdvanced": "Дополнительные параметры",
"SSE.Views.PivotSettings.textCancel": "Отмена", "SSE.Views.PivotSettings.textCancel": "Отмена",