/*
* Copyright 2015 Anyware Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @private
* This class is a singleton gathering tables-relative methods that can be called from a {@link Ametys.ribbon.element.ui.ButtonController}
*/
Ext.define('Ametys.plugins.cms.editor.TablesControllerActions', {
singleton: true,
/**
* Set the cells alignment
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
alignTable: function (controller)
{
Ametys.plugins.cms.editor.Tables.alignTable(controller.getInitialConfig ('align'), controller.getInitialConfig ('valign'));
},
/**
* Align table on the text right
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
applyFloatRight: function (controller)
{
Ametys.plugins.cms.editor.Tables.applyFloatRight(false);
},
/**
* Align table on the text left
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
applyFloatLeft: function (controller)
{
Ametys.plugins.cms.editor.Tables.applyFloatLeft(false);
},
/**
* Align table with the text
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
applyNoFloat: function (controller)
{
Ametys.plugins.cms.editor.Tables.applyNoFloat(false);
},
/**
* Insert a new row before the current row
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
insertRowUp: function (controller)
{
Ametys.plugins.cms.editor.Tables.insertRowUp(false);
},
/**
* Insert a new row after the current row
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
insertRowDown: function (controller)
{
Ametys.plugins.cms.editor.Tables.insertRowDown(false);
},
/**
* Insert a new column before the current column
*/
insertColumnRight: function (controller)
{
Ametys.plugins.cms.editor.Tables.insertColumnRight(false);
},
/**
* Insert a new column after the current column
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
insertColumnLeft: function (controller)
{
Ametys.plugins.cms.editor.Tables.insertColumnLeft(false);
},
/**
* Delete the table
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
deleteTable: function (controller)
{
Ametys.plugins.cms.editor.Tables.deleteTable();
},
/**
* Delete the selected row
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
deleteRow: function (controller)
{
Ametys.plugins.cms.editor.Tables.deleteRow();
},
/**
* Delete the selected column
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function
*/
deleteCol: function (controller)
{
Ametys.plugins.cms.editor.Tables.deleteCol();
},
/**
* Merge the selected cell with the right cell
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
mergeCells: function (controller)
{
Ametys.plugins.cms.editor.Tables.mergeCells(false);
},
/**
* Slip the selected cell in two cells
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
splitCells: function (controller)
{
Ametys.plugins.cms.editor.Tables.splitCells();
},
/**
* Ajust table width to the content
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
colSizeAjustToContent: function (controller)
{
Ametys.plugins.cms.editor.Tables.colSizeAjustToContent(false);
},
/**
* Ajust table width to the page
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
colSizeAjustToWindow: function (controller)
{
Ametys.plugins.cms.editor.Tables.colSizeAjustToWindow(false);
},
/**
* Fix table width
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
colSizeFixed: function (controller)
{
Ametys.plugins.cms.editor.Tables.colSizeFixed(false);
},
/**
* Show or hide guidelines
* @param {Ametys.ribbon.element.ui.ButtonController} controller The controller button calling the function
*/
toggleVisualAid: function ()
{
Ametys.plugins.cms.editor.Tables.toggleVisualAid();
}
});