From a7b3b6fa51abc74e7e54bd51c8ff325bffcb2ff4 Mon Sep 17 00:00:00 2001
From: Julia Radzhabova <Julia.Radzhabova@onlyoffice.com>
Date: Tue, 14 Feb 2017 12:34:37 +0300
Subject: [PATCH] [SSE] Convert table to range.

---
 .../main/app/template/TableSettings.template         |  5 +++++
 .../spreadsheeteditor/main/app/view/TableSettings.js | 12 +++++++++++-
 apps/spreadsheeteditor/main/locale/en.json           |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/apps/spreadsheeteditor/main/app/template/TableSettings.template b/apps/spreadsheeteditor/main/app/template/TableSettings.template
index 76d313084..829d2ff50 100644
--- a/apps/spreadsheeteditor/main/app/template/TableSettings.template
+++ b/apps/spreadsheeteditor/main/app/template/TableSettings.template
@@ -73,6 +73,11 @@
             <div id="table-btn-edit" style="display: inline-block; float:right;"></div>
         </td>
     </tr>
+    <tr>
+        <td class="padding-small" colspan=2>
+            <button type="button" class="btn btn-text-default" id="table-btn-convert-range" style="width:100%;"><%= scope.textConvertRange %></button>
+        </td>
+    </tr>
     <tr>
         <td class="padding-small" colspan=2>
             <div class="separator horizontal"></div>
diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js
index cec45f2c9..ee0c44c74 100644
--- a/apps/spreadsheeteditor/main/app/view/TableSettings.js
+++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js
@@ -286,6 +286,15 @@ define([
             this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this));
             this.lockedControls.push(this.btnEdit);
 
+            this.btnConvertRange = new Common.UI.Button({
+                el: $('#table-btn-convert-range')
+            });
+            this.btnConvertRange.on('click', _.bind(function(btn){
+                if (this.api) this.api.asc_convertTableToRange(this._state.TableName);
+                Common.NotificationCenter.trigger('edit:complete', this);
+            }, this));
+            this.lockedControls.push(this.btnConvertRange);
+
             $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this));
 
             this._initSettings = false;
@@ -534,7 +543,8 @@ define([
         textIsLocked            : 'This element is being edited by another user.',
         notcriticalErrorTitle   : 'Warning',
         textReservedName        : 'The name you are trying to use is already referenced in cell formulas. Please use some other name.',
-        textAdvanced:   'Show advanced settings'
+        textAdvanced:   'Show advanced settings',
+        textConvertRange: 'Convert to range'
 
     }, SSE.Views.TableSettings || {}));
 });
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index 435890870..269679080 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -1458,6 +1458,7 @@
   "SSE.Views.TableSettings.textTableName": "Table Name",
   "SSE.Views.TableSettings.textTemplate": "Select From Template",
   "SSE.Views.TableSettings.textTotal": "Total",
+  "SSE.Views.TableSettings.textConvertRange": "Convert to range",
   "SSE.Views.TableSettingsAdvanced.cancelButtonText": "Cancel",
   "SSE.Views.TableSettingsAdvanced.okButtonText": "Ok",
   "SSE.Views.TableSettingsAdvanced.textAlt": "Alternative Text",