Commit 9c979e7b authored by Ilya Kirillov's avatar Ilya Kirillov

Добавлено объединение ячеек в билдер.

parent a478385d
...@@ -11216,6 +11216,12 @@ CDocument.prototype = ...@@ -11216,6 +11216,12 @@ CDocument.prototype =
bUpdateSelection = false; bUpdateSelection = false;
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if (e.KeyCode === 113)
{
// Для теста
TEST_BUILDER();
bRetValue = keydownresult_PreventAll;
}
else if ( e.KeyCode == 121 && true === e.ShiftKey ) // Shift + F10 - контекстное меню else if ( e.KeyCode == 121 && true === e.ShiftKey ) // Shift + F10 - контекстное меню
{ {
var X_abs, Y_abs, oPosition, ConvertedPos; var X_abs, Y_abs, oPosition, ConvertedPos;
......
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2016
* *
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* *
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* *
* You can contact Ascensio System SIA by email at sales@onlyoffice.com * You can contact Ascensio System SIA by email at sales@onlyoffice.com
* *
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
* *
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains * Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic * relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute. * in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks. * Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* *
*/ */
"use strict"; "use strict";
// SectPr : Настройки секци (размеры, поля) // SectPr : Настройки секци (размеры, поля)
...@@ -86,6 +86,9 @@ CSectionPr.prototype = ...@@ -86,6 +86,9 @@ CSectionPr.prototype =
Copy : function(Other, CopyHdrFtr) Copy : function(Other, CopyHdrFtr)
{ {
if (!Other)
return;
// Тип // Тип
this.Set_Type( Other.Type ); this.Set_Type( Other.Type );
......
...@@ -9770,18 +9770,21 @@ CTable.prototype = ...@@ -9770,18 +9770,21 @@ CTable.prototype =
return { Grid_start : Grid_start, Grid_end : Grid_end, RowsInfo : RowsInfo, bCanMerge : bCanMerge }; return { Grid_start : Grid_start, Grid_end : Grid_end, RowsInfo : RowsInfo, bCanMerge : bCanMerge };
}, },
// Объединяем заселекченные ячейки /**
Cell_Merge : function() * Объединяем выделенные ячейки таблицы.
* @param isClearMerge - используем или нет рассчетные данные (true - не используем, false - default value)
*/
Cell_Merge : function(isClearMerge)
{ {
var bApplyToInnerTable = false; var bApplyToInnerTable = false;
if ( false === this.Selection.Use || ( true === this.Selection.Use && table_Selection_Text === this.Selection.Type ) ) if ( false === this.Selection.Use || ( true === this.Selection.Use && table_Selection_Text === this.Selection.Type ) )
bApplyToInnerTable = this.CurCell.Content.Table_MergeCells(); bApplyToInnerTable = this.CurCell.Content.Table_MergeCells();
if ( true === bApplyToInnerTable ) if ( true === bApplyToInnerTable )
return; return false;
if ( true != this.Selection.Use || table_Selection_Cell != this.Selection.Type || this.Selection.Data.length <= 1 ) if ( true != this.Selection.Use || table_Selection_Cell != this.Selection.Type || this.Selection.Data.length <= 1 )
return; return false;
// В массиве this.Selection.Data идет список ячеек по строкам (без разрывов) // В массиве this.Selection.Data идет список ячеек по строкам (без разрывов)
// Перед объединением мы должны проверить совпадают ли начальная и конечная колонки // Перед объединением мы должны проверить совпадают ли начальная и конечная колонки
...@@ -9793,7 +9796,7 @@ CTable.prototype = ...@@ -9793,7 +9796,7 @@ CTable.prototype =
var RowsInfo = Temp.RowsInfo; var RowsInfo = Temp.RowsInfo;
if ( false === bCanMerge ) if ( false === bCanMerge )
return; return false;
// Объединяем содержимое всех ячеек в левую верхнюю ячейку. (Все выделенные // Объединяем содержимое всех ячеек в левую верхнюю ячейку. (Все выделенные
// ячейки идут у нас последовательно, начиная с левой верхней), и объединяем // ячейки идут у нас последовательно, начиная с левой верхней), и объединяем
...@@ -9816,13 +9819,16 @@ CTable.prototype = ...@@ -9816,13 +9819,16 @@ CTable.prototype =
} }
} }
// Выставим ширину результируещей ячейки if (true !== isClearMerge)
var SumW = 0;
for (var CurGridCol = Grid_start; CurGridCol <= Grid_end; CurGridCol++)
{ {
SumW += this.TableGridCalc[CurGridCol]; // Выставим ширину результируещей ячейки
var SumW = 0;
for (var CurGridCol = Grid_start; CurGridCol <= Grid_end; CurGridCol++)
{
SumW += this.TableGridCalc[CurGridCol];
}
Cell_tl.Set_W(new CTableMeasurement(tblwidth_Mm, SumW));
} }
Cell_tl.Set_W(new CTableMeasurement(tblwidth_Mm, SumW));
// Теперь нам надо удалить лишние ячейки и добавить ячейки с // Теперь нам надо удалить лишние ячейки и добавить ячейки с
// вертикальным объединением. // вертикальным объединением.
...@@ -9856,16 +9862,9 @@ CTable.prototype = ...@@ -9856,16 +9862,9 @@ CTable.prototype =
} }
} }
// У ряда, который содержит полученную ячейку мы выставляем минимальную высоту
// сумму высот объединенных строк.
//var Summary_VMerge = this.Internal_GetVertMergeCount( Pos_tl.Row, Grid_start, Grid_end - Grid_start + 1 );
//var Summary_Height = this.RowsInfo[Pos_tl.Row + Summary_VMerge - 1].H + this.RowsInfo[Pos_tl.Row + Summary_VMerge - 1].Y - this.RowsInfo[Pos_tl.Row].Y;
// Удаляем лишние строки // Удаляем лишние строки
this.Internal_Check_TableRows(true); this.Internal_Check_TableRows(true !== isClearMerge ? true : false);
for (var PageNum = 0; PageNum < this.Pages.length - 1; PageNum++ )
var PageNum = 0;
for ( PageNum = 0; PageNum < this.Pages.length - 1; PageNum++ )
{ {
if ( Pos_tl.Row <= this.Pages[PageNum + 1].FirstRow ) if ( Pos_tl.Row <= this.Pages[PageNum + 1].FirstRow )
break; break;
...@@ -9879,9 +9878,14 @@ CTable.prototype = ...@@ -9879,9 +9878,14 @@ CTable.prototype =
this.Selection.Data = [ Pos_tl ]; this.Selection.Data = [ Pos_tl ];
this.CurCell = Cell_tl; this.CurCell = Cell_tl;
// Запускаем пересчет if (true !== isClearMerge)
this.Internal_Recalculate_1(); {
// Запускаем пересчет
this.Internal_Recalculate_1();
}
return true;
}, },
// Разделяем текущую ячейку // Разделяем текущую ячейку
...@@ -13316,6 +13320,24 @@ CTable.prototype.Is_TableFirstRowOnNewPage = function(CurRow) ...@@ -13316,6 +13320,24 @@ CTable.prototype.Is_TableFirstRowOnNewPage = function(CurRow)
return false; return false;
}; };
CTable.prototype.private_UpdateCellsGrid = function()
{
for (var nCurRow = 0, nRowsCount = this.Content.length; nCurRow < nRowsCount; ++nCurRow)
{
var Row = this.Content[nCurRow];
var BeforeInfo = Row.Get_Before();
var CurGridCol = BeforeInfo.GridBefore;
for (var nCurCell = 0, nCellsCount = Row.Get_CellsCount(); nCurCell < nCellsCount; ++nCurCell)
{
var Cell = Row.Get_Cell(nCurCell);
var GridSpan = Cell.Get_GridSpan();
Cell.Set_Metrics(CurGridCol, 0, 0, 0, 0, 0, 0);
Row.Update_CellInfo(nCurCell);
CurGridCol += GridSpan;
}
}
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Класс CTableLook // Класс CTableLook
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment