From 5f3d992f121685456ca9906a25cc29564ade6596 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Jan 2018 12:32:12 +0300 Subject: [PATCH] [DE] Show settings for table of contents. --- .../main/app/controller/Links.js | 8 ++- .../main/app/view/TableOfContentsSettings.js | 69 ++++++++++++------- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 194360771..bb62c9d71 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -204,17 +204,18 @@ define([ onTableContents: function(type){ switch (type) { case 0: - this.api.asc_addTableOfContents(); break; + this.api.asc_AddTableOfContents(); break; case 1: - this.api.asc_addTableOfContents(); break; + this.api.asc_AddTableOfContents(); break; case 'settings': var props, me = this; var win = new DE.Views.TableOfContentsSettings({ api: this.api, - props: props, + props: this.api.asc_GetTableOfContentsPr(), handler: function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); + me.api.asc_SetTableOfContentsPr(props); } Common.NotificationCenter.trigger('edit:complete', me.toolbar); @@ -223,6 +224,7 @@ define([ win.show(); break; case 'remove': + this.api.asc_RemoveTableOfContents(); break; } }, diff --git a/apps/documenteditor/main/app/view/TableOfContentsSettings.js b/apps/documenteditor/main/app/view/TableOfContentsSettings.js index e3684197c..a8ee22cdb 100644 --- a/apps/documenteditor/main/app/view/TableOfContentsSettings.js +++ b/apps/documenteditor/main/app/view/TableOfContentsSettings.js @@ -49,7 +49,7 @@ define([ DE.Views.TableOfContentsSettings = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 500, - height: 430 + height: 455 }, initialize : function(options) { @@ -106,8 +106,8 @@ define([ '', '', '', - '', - '
', + '', + '
', '', '', '', @@ -171,7 +171,7 @@ define([ { value: Asc.c_oAscTabLeader.Underscore,displayValue: '__________' } ] }); - this.cmbLeader.setValue(Asc.c_oAscTabLeader.None); + this.cmbLeader.setValue(Asc.c_oAscTabLeader.Dot); this.chLinks = new Common.UI.CheckBox({ el: $('#tableofcontents-chb-links'), @@ -275,30 +275,49 @@ define([ }, _setDefaults: function (props) { + var styles = []; + _.each(window.styles.get_MergedStyles(), function (style) { + styles.push(new Common.UI.DataViewModel({ + name: style.get_Name(), + allowSelected: false, + checked: false, + value: '' + })); + }); + if (props) { + var value = props.get_Hyperlink(); + this.chLinks.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); + + var start = props.get_OutlineStart(), + end = props.get_OutlineEnd(); + + this.spnLevels.setValue((start<0 || end<0) ? 0 : end); + this.spnLevels.setDisabled(start>1); + + var count = props.get_StylesCount(); + for (var i=0; i