[DE] Fix Bug 37228

This commit is contained in:
Julia Radzhabova 2018-03-15 16:05:38 +03:00
parent 9d636d8367
commit 926ca217b3
2 changed files with 10 additions and 12 deletions

View file

@ -209,10 +209,10 @@ define([
}, },
onTableContents: function(type, currentTOC){ onTableContents: function(type, currentTOC){
currentTOC = !!currentTOC;
var props = this.api.asc_GetTableOfContentsPr(currentTOC);
switch (type) { switch (type) {
case 0: case 0:
var props = this.api.asc_GetTableOfContentsPr(),
hasTable = !!props;
if (!props) { if (!props) {
props = new Asc.CTableOfContentsPr(); props = new Asc.CTableOfContentsPr();
props.put_OutlineRange(1, 9); props.put_OutlineRange(1, 9);
@ -221,11 +221,9 @@ define([
props.put_ShowPageNumbers(true); props.put_ShowPageNumbers(true);
props.put_RightAlignTab(true); props.put_RightAlignTab(true);
props.put_TabLeader( Asc.c_oAscTabLeader.Dot); props.put_TabLeader( Asc.c_oAscTabLeader.Dot);
this.api.asc_AddTableOfContents(null, props); (currentTOC) ? this.api.asc_SetTableOfContentsPr(props) : this.api.asc_AddTableOfContents(null, props);
break; break;
case 1: case 1:
var props = this.api.asc_GetTableOfContentsPr(),
hasTable = !!props;
if (!props) { if (!props) {
props = new Asc.CTableOfContentsPr(); props = new Asc.CTableOfContentsPr();
props.put_OutlineRange(1, 9); props.put_OutlineRange(1, 9);
@ -233,13 +231,11 @@ define([
props.put_Hyperlink(true); props.put_Hyperlink(true);
props.put_ShowPageNumbers(false); props.put_ShowPageNumbers(false);
props.put_TabLeader( Asc.c_oAscTabLeader.None); props.put_TabLeader( Asc.c_oAscTabLeader.None);
this.api.asc_AddTableOfContents(null, props); (currentTOC) ? this.api.asc_SetTableOfContentsPr(props) : this.api.asc_AddTableOfContents(null, props);
break; break;
case 'settings': case 'settings':
currentTOC = !!currentTOC; var me = this,
var props = this.api.asc_GetTableOfContentsPr(currentTOC), win = new DE.Views.TableOfContentsSettings({
me = this;
var win = new DE.Views.TableOfContentsSettings({
api: this.api, api: this.api,
props: props, props: props,
handler: function(result, value) { handler: function(result, value) {
@ -252,7 +248,9 @@ define([
win.show(); win.show();
break; break;
case 'remove': case 'remove':
this.api.asc_RemoveTableOfContents(); if (currentTOC)
currentTOC = props.get_InternalClass();
this.api.asc_RemoveTableOfContents(currentTOC);
break; break;
} }
Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.NotificationCenter.trigger('edit:complete', this.toolbar);

View file

@ -555,7 +555,7 @@ define([
}, },
getSettings: function () { getSettings: function () {
var props = new Asc.CTableOfContentsPr(); var props = this._originalProps;
props.put_Hyperlink(this.chLinks.getValue() == 'checked'); props.put_Hyperlink(this.chLinks.getValue() == 'checked');
props.put_ShowPageNumbers(this.chPages.getValue() == 'checked'); props.put_ShowPageNumbers(this.chPages.getValue() == 'checked');