Commit f656d523 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

тормоза и рост памяти при таблице в таблице

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53440 954022d7-b5bf-4e40-9824-e11837661b57
parent 47e54a7e
...@@ -31,6 +31,9 @@ function SetHintsProps(bIsHinting, bIsSubpixHinting) ...@@ -31,6 +31,9 @@ function SetHintsProps(bIsHinting, bIsSubpixHinting)
SetHintsProps(true, true); SetHintsProps(true, true);
var _canvas_tables = null;
var _table_styles = null;
function CTableMarkup(Table) function CTableMarkup(Table)
{ {
this.Internal = this.Internal =
...@@ -1789,6 +1792,9 @@ function CDrawingDocument() ...@@ -1789,6 +1792,9 @@ function CDrawingDocument()
this.TableStylesLastLook = null; this.TableStylesLastLook = null;
this.LastParagraphMargins = null; this.LastParagraphMargins = null;
this.TableStylesSheckLook = null;
this.TableStylesSheckLookFlag = false;
// параметры для SelectShow // параметры для SelectShow
this.min_PageAddSelection = 100000; this.min_PageAddSelection = 100000;
this.max_PageAddSelection = -1; this.max_PageAddSelection = -1;
...@@ -4979,8 +4985,30 @@ function CDrawingDocument() ...@@ -4979,8 +4985,30 @@ function CDrawingDocument()
editor.isViewMode = _oldTurn; editor.isViewMode = _oldTurn;
} }
this.StartTableStylesCheck = function()
{
this.TableStylesSheckLookFlag = true;
}
this.EndTableStylesCheck = function()
{
if (this.TableStylesSheckLook != null)
{
this.CheckTableStyles(this.TableStylesSheckLook);
this.TableStylesSheckLook = null;
}
this.TableStylesSheckLookFlag = false;
}
this.CheckTableStyles = function(tableLook) this.CheckTableStyles = function(tableLook)
{ {
if (this.TableStylesSheckLookFlag)
{
this.TableStylesSheckLook = tableLook;
return;
}
// сначала проверим, подписан ли кто на этот евент // сначала проверим, подписан ли кто на этот евент
// а то во вьюере не стоит ничего посылать // а то во вьюере не стоит ничего посылать
if (!this.m_oWordControl.m_oApi.asc_checkNeedCallback("asc_onInitTableTemplates")) if (!this.m_oWordControl.m_oApi.asc_checkNeedCallback("asc_onInitTableTemplates"))
...@@ -5054,29 +5082,30 @@ function CDrawingDocument() ...@@ -5054,29 +5082,30 @@ function CDrawingDocument()
var W = (_pageW - _x_mar - _r_mar); var W = (_pageW - _x_mar - _r_mar);
var H = (_pageH - _y_mar - _b_mar); var H = (_pageH - _y_mar - _b_mar);
var Grid = [];
var Rows = 5;
var Cols = 5;
for (var i = 0; i < Cols; i++)
Grid[i] = W / Cols;
var _canvas = document.createElement('canvas'); if (_canvas_tables == null)
if (!this.m_oWordControl.bIsRetinaSupport)
{
_canvas.width = TABLE_STYLE_WIDTH_PIX;
_canvas.height = TABLE_STYLE_HEIGHT_PIX;
}
else
{ {
_canvas.width = (TABLE_STYLE_WIDTH_PIX << 1); _canvas_tables = document.createElement('canvas');
_canvas.height = (TABLE_STYLE_HEIGHT_PIX << 1);
if (!this.m_oWordControl.bIsRetinaSupport)
{
_canvas_tables.width = TABLE_STYLE_WIDTH_PIX;
_canvas_tables.height = TABLE_STYLE_HEIGHT_PIX;
}
else
{
_canvas_tables.width = (TABLE_STYLE_WIDTH_PIX << 1);
_canvas_tables.height = (TABLE_STYLE_HEIGHT_PIX << 1);
}
} }
var _canvas = _canvas_tables;
var ctx = _canvas.getContext('2d'); var ctx = _canvas.getContext('2d');
var Rows = 5;
History.TurnOff(); History.TurnOff();
g_oTableId.m_bTurnOff = true;
for (var i1 = 0; i1 < _styles_len; i1++) for (var i1 = 0; i1 < _styles_len; i1++)
{ {
var i = _styles[i1]; var i = _styles[i1];
...@@ -5085,11 +5114,30 @@ function CDrawingDocument() ...@@ -5085,11 +5114,30 @@ function CDrawingDocument()
if (!_style || _style.Type != styletype_Table) if (!_style || _style.Type != styletype_Table)
continue; continue;
var table = new CTable(this, logicDoc, true, 0, _x_mar, _y_mar, 1000, 1000, Rows, Cols, Grid); if (_table_styles == null)
table.Set_Props({TableStyle : i, TableLook : tableLook, TableLayout : c_oAscTableLayout.Fixed}); {
var Cols = 5;
var Grid = [];
for (var ii = 0; ii < Cols; ii++)
Grid[ii] = W / Cols;
_table_styles = new CTable(this, logicDoc, true, 0, _x_mar, _y_mar, 1000, 1000, Rows, Cols, Grid);
_table_styles.Set_Props({TableStyle : i, TableLook : tableLook, TableLayout : c_oAscTableLayout.Fixed});
for (var j = 0; j < Rows; j++)
_table_styles.Content[j].Set_Height(H / Rows, heightrule_AtLeast);
}
else
{
_table_styles.Set_Props({TableStyle : i, TableLook : tableLook, TableLayout : c_oAscTableLayout.Fixed, CellSelect: false});
_table_styles.Recalc_CompiledPr2();
for (var j = 0; j < Rows; j++)
_table_styles.Content[j].Set_Height(H / Rows, heightrule_AtLeast);
}
for (var j = 0; j < Rows; j++)
table.Content[j].Set_Height(H / Rows, heightrule_AtLeast);
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
ctx.fillRect(0, 0, _canvas.width, _canvas.height); ctx.fillRect(0, 0, _canvas.width, _canvas.height);
...@@ -5099,12 +5147,12 @@ function CDrawingDocument() ...@@ -5099,12 +5147,12 @@ function CDrawingDocument()
graphics.m_oFontManager = g_fontManager; graphics.m_oFontManager = g_fontManager;
graphics.transform(1,0,0,1,0,0); graphics.transform(1,0,0,1,0,0);
table.Recalculate_Page(0); _table_styles.Recalculate_Page(0);
var _old_mode = editor.isViewMode; var _old_mode = editor.isViewMode;
editor.isViewMode = true; editor.isViewMode = true;
editor.isShowTableEmptyLineAttack = true; editor.isShowTableEmptyLineAttack = true;
table.Draw(0, graphics); _table_styles.Draw(0, graphics);
editor.isShowTableEmptyLineAttack = false; editor.isShowTableEmptyLineAttack = false;
editor.isViewMode = _old_mode; editor.isViewMode = _old_mode;
...@@ -5114,6 +5162,7 @@ function CDrawingDocument() ...@@ -5114,6 +5162,7 @@ function CDrawingDocument()
_styleD.Id = i; _styleD.Id = i;
_dst_styles.push(_styleD); _dst_styles.push(_styleD);
} }
g_oTableId.m_bTurnOff = false;
History.TurnOn(); History.TurnOn();
this.m_oWordControl.m_oApi.sync_InitEditorTableStyles(_dst_styles, this.m_oWordControl.bIsRetinaSupport); this.m_oWordControl.m_oApi.sync_InitEditorTableStyles(_dst_styles, this.m_oWordControl.bIsRetinaSupport);
......
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