Commit 3d938cbd authored by Ilya.Kirillov's avatar Ilya.Kirillov

Откатил предыдущую заливку и переделал ее заново. Теперь в конце функции...

Откатил предыдущую заливку и переделал ее заново. Теперь в конце функции Get_RecalcData можно делать дополнительные действия, например пересчитывать сетку таблицы. За счет этого также получилось ускорить вставку таблиц (баг 30513).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@65273 954022d7-b5bf-4e40-9824-e11837661b57
parent 7dba1ff3
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
* Time: 14:35 * Time: 14:35
*/ */
var historyoperation_None = 0x00;
var historyoperation_Undo = 0x01;
var historyoperation_Redo = 0x02;
var historyoperation_GetRecalcData = 0x03;
function CHistory(Document) function CHistory(Document)
{ {
this.Index = -1; this.Index = -1;
...@@ -40,8 +35,6 @@ function CHistory(Document) ...@@ -40,8 +35,6 @@ function CHistory(Document)
this.FileCheckSum = 0; this.FileCheckSum = 0;
this.FileSize = 0; this.FileSize = 0;
this.Operation = historyoperation_None;
} }
CHistory.prototype = CHistory.prototype =
...@@ -174,8 +167,6 @@ CHistory.prototype = ...@@ -174,8 +167,6 @@ CHistory.prototype =
if ( true != this.Can_Undo() ) if ( true != this.Can_Undo() )
return null; return null;
this.private_StartOperation(historyoperation_Undo);
if (editor) if (editor)
editor.setUserAlive(); editor.setUserAlive();
...@@ -219,7 +210,6 @@ CHistory.prototype = ...@@ -219,7 +210,6 @@ CHistory.prototype =
if (null != Point) if (null != Point)
this.Document.Set_SelectionState( Point.State ); this.Document.Set_SelectionState( Point.State );
this.private_EndOperation();
return this.RecalculateData; return this.RecalculateData;
}, },
...@@ -231,8 +221,6 @@ CHistory.prototype = ...@@ -231,8 +221,6 @@ CHistory.prototype =
if (editor) if (editor)
editor.setUserAlive(); editor.setUserAlive();
this.private_StartOperation(historyoperation_Redo);
this.Document.Selection_Remove(); this.Document.Selection_Remove();
...@@ -257,7 +245,6 @@ CHistory.prototype = ...@@ -257,7 +245,6 @@ CHistory.prototype =
this.Document.Set_SelectionState( State ); this.Document.Set_SelectionState( State );
this.private_EndOperation();
return this.RecalculateData; return this.RecalculateData;
}, },
...@@ -430,7 +417,9 @@ CHistory.prototype = ...@@ -430,7 +417,9 @@ CHistory.prototype =
All: false, All: false,
Map: {}, Map: {},
ThemeInfo: null ThemeInfo: null
} },
Tables : []
}; };
}, },
...@@ -527,6 +516,27 @@ CHistory.prototype = ...@@ -527,6 +516,27 @@ CHistory.prototype =
} }
}, },
Add_RecalcTableGrid : function(TableId)
{
this.RecalculateData.Tables[TableId] = true;
},
OnEnd_GetRecalcData : function()
{
// Пересчитываем таблицы
for (var TableId in this.RecalculateData.Tables)
{
var Table = g_oTableId.Get_ById(TableId);
if (null !== Table)
{
if (true === Table.Check_ChangedTableGrid())
{
Table.Refresh_RecalcData2(0, 0);
}
}
}
},
Check_UninonLastPoints : function() Check_UninonLastPoints : function()
{ {
// Не объединяем точки в истории, когда отключается пересчет. // Не объединяем точки в истории, когда отключается пересчет.
...@@ -650,6 +660,7 @@ CHistory.prototype = ...@@ -650,6 +660,7 @@ CHistory.prototype =
} }
} }
this.OnEnd_GetRecalcData();
return this.RecalculateData; return this.RecalculateData;
}, },
...@@ -839,23 +850,6 @@ CHistory.prototype = ...@@ -839,23 +850,6 @@ CHistory.prototype =
}; };
CHistory.prototype.private_StartOperation = function(Type)
{
this.Operation = Type;
};
CHistory.prototype.private_EndOperation = function(Type)
{
this.Operation = historyoperation_None;
};
CHistory.prototype.Is_UndoOperation = function()
{
return (this.Operation === historyoperation_Undo ? true : false);
};
CHistory.prototype.Is_RedoOperation = function()
{
return (this.Operation === historyoperation_Redo ? true : false);
};
var History = null; var History = null;
function CRC32() function CRC32()
......
...@@ -6356,10 +6356,8 @@ CTable.prototype = ...@@ -6356,10 +6356,8 @@ CTable.prototype =
if ( true === bNeedRecalc ) if ( true === bNeedRecalc )
{ {
if (true !== History.Is_UndoOperation() && true !== History.Is_RedoOperation()) History.Add_RecalcTableGrid(this.Get_Id());
this.Internal_RecalculateGrid(); this.Refresh_RecalcData2(nRowIndex, 0);
this.Refresh_RecalcData2( nRowIndex, 0 );
} }
}, },
...@@ -19494,7 +19492,7 @@ CTable.prototype = ...@@ -19494,7 +19492,7 @@ CTable.prototype =
return NewGrid; return NewGrid;
} }
return undefined; return [];
}, },
private_SetTableLayoutFixedAndUpdateGrid : function(nExceptColNum) private_SetTableLayoutFixedAndUpdateGrid : function(nExceptColNum)
...@@ -19743,6 +19741,22 @@ CTable.prototype.private_GetPrevCell = function(RowIndex, CellIndex) ...@@ -19743,6 +19741,22 @@ CTable.prototype.private_GetPrevCell = function(RowIndex, CellIndex)
{ {
return this.Internal_Get_PrevCell({Cell : CellIndex, Row : RowIndex}); return this.Internal_Get_PrevCell({Cell : CellIndex, Row : RowIndex});
}; };
CTable.prototype.Check_ChangedTableGrid = function()
{
var TableGrid_old = this.Internal_Copy_Grid(this.TableGridCalc);
this.Internal_RecalculateGrid();
var TableGrid_new = this.TableGridCalc;
for (var CurCol = 0, ColsCount = this.TableGridCalc.length; CurCol < ColsCount; CurCol++)
{
if (Math.abs(TableGrid_old[CurCol] - TableGrid_new[CurCol]) > 0.001)
{
this.RecalcInfo.TableBorders = true;
return true;
}
}
return false;
};
// Класс CTableRow // Класс CTableRow
function CTableRow(Table, Cols, TableGrid) function CTableRow(Table, Cols, TableGrid)
...@@ -22680,29 +22694,13 @@ CTableCell.prototype = ...@@ -22680,29 +22694,13 @@ CTableCell.prototype =
var Table = this.Row.Table; var Table = this.Row.Table;
var TablePr = Table.Get_CompiledPr(false).TablePr; var TablePr = Table.Get_CompiledPr(false).TablePr;
if (tbllayout_AutoFit === TablePr.TableLayout && true !== History.Is_UndoOperation() && true !== History.Is_RedoOperation()) if (tbllayout_AutoFit === TablePr.TableLayout)
{ {
if (this.Row.Table.Parent.Pages.length > 0) if (this.Row.Table.Parent.Pages.length > 0)
{ {
// Если изменение внутри ячейки влечет за собой изменение сетки таблицы, тогда // Если изменение внутри ячейки влечет за собой изменение сетки таблицы, тогда
// пересчитывать таблицу надо с самого начала. // пересчитывать таблицу надо с самого начала.
var CurCol; History.Add_RecalcTableGrid(Table.Get_Id());
var ColsCount = Table.TableGridCalc.length;
var TableGrid_old = [];
for (CurCol = 0; CurCol < ColsCount; CurCol++)
TableGrid_old[CurCol] = Table.TableGridCalc[CurCol];
Table.Internal_RecalculateGrid();
var TableGrid_new = Table.TableGridCalc;
for (CurCol = 0; CurCol < ColsCount; CurCol++)
{
if (Math.abs(TableGrid_old[CurCol] - TableGrid_new[CurCol]) > 0.001)
{
Table.RecalcInfo.TableBorders = true;
return Table.Refresh_RecalcData2(0, 0);
}
}
} }
else else
return Table.Refresh_RecalcData2(0, 0); return Table.Refresh_RecalcData2(0, 0);
......
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