Commit 9b1175d4 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Ускорил открытие. Теперь при открытии стили у ячеек будут сслыками (а не...

Ускорил открытие. Теперь при открытии стили у ячеек будут сслыками (а не копиями). Поэтому при смене свойств нужно делать копию.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53692 954022d7-b5bf-4e40-9824-e11837661b57
parent a97436de
......@@ -1404,7 +1404,7 @@ function BinarySharedStringsTableWriter(memory, oSharedStrings)
this.memory.WriteString2(run.text);
}
};
};
}
/** @constructor */
function BinaryStylesTableWriter(memory, wb, oBinaryWorksheetsTableWriter)
{
......@@ -2048,7 +2048,7 @@ function BinaryStylesTableWriter(memory, wb, oBinaryWorksheetsTableWriter)
this.aDxfs.push(customElement.dxf);
}
}
};
}
function BinaryWorkbookTableWriter(memory, wb)
{
this.memory = memory;
......@@ -2166,7 +2166,7 @@ function BinaryWorkbookTableWriter(memory, wb)
if (null != LocalSheetId)
this.bs.WriteItem(c_oSerDefinedNameTypes.LocalSheetId, function(){oThis.memory.WriteLong(LocalSheetId);});
};
};
}
function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aFonts, aFills, aBorders, aNums, idWorksheet, isCopyPaste)
{
this.memory = memory;
......@@ -3356,7 +3356,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
for(var i = 0, length = aReplies.length; i < length; ++i)
this.bs.WriteItem( c_oSer_CommentData.Reply, function(){oThis.WriteCommentData(aReplies[i]);});
}
};
}
/** @constructor */
function BinaryOtherTableWriter(memory, wb)
{
......@@ -3373,7 +3373,7 @@ function BinaryOtherTableWriter(memory, wb)
var oThis = this;
this.bs.WriteItem(c_oSer_OtherType.Theme, function(){window.global_pptx_content_writer.WriteTheme(oThis.memory, oThis.wb.theme);});
};
};
}
/** @constructor */
function BinaryFileWriter(wb, isCopyPaste)
{
......@@ -3485,7 +3485,7 @@ function BinaryFileWriter(wb, isCopyPaste)
this.nRealTableCount++;
}
};
}
/** @constructor */
function Binary_TableReader(stream, ws, Dxfs)
{
......@@ -4054,7 +4054,7 @@ function Binary_SharedStringTableReader(stream, wb, aSharedStrings)
res = c_oSerConstants.ReadUnknown;
return res;
};
};
}
/** @constructor */
function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
{
......@@ -4216,6 +4216,8 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
if(0 == this.aCellXfs.length)
this.oStyleManager.init(oNewXfs);
this.minimizeXfs(oNewXfs);
// При открытии стиль будет ссылкой
oNewXfs.isReference = true;
this.aCellXfs.push(oNewXfs);
}
for(var i in oStyleObject.oCustomTableStyles)
......@@ -4879,7 +4881,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
this.ReadTableCustomStyleElement = function(type, length, oNewStyleElement)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if (c_oSer_TableStyleElement.Type === type)
oNewStyleElement.Type = this.stream.GetUChar();
else if (c_oSer_TableStyleElement.Size === type)
......@@ -4890,7 +4891,7 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = c_oSerConstants.ReadUnknown;
return res;
}
};
}
/** @constructor */
function Binary_WorkbookTableReader(stream, oWorkbook)
{
......@@ -4961,7 +4962,7 @@ function Binary_WorkbookTableReader(stream, oWorkbook)
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadWorkbookView = function(type, length, BookViews)
this.ReadWorkbookView = function(type, length)
{
var res = c_oSerConstants.ReadOk;
if ( c_oSerWorkbookViewTypes.ActiveTab == type )
......@@ -5015,7 +5016,7 @@ function Binary_WorkbookTableReader(stream, oWorkbook)
res = c_oSerConstants.ReadUnknown;
return res;
};
};
}
/** @constructor */
function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, oMediaArray, copyPasteObj)
{
......@@ -5512,7 +5513,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
{
var xfs = this.aCellXfs[nStyleIndex];
if(null != xfs)
oCell.xfs = xfs.clone();
oCell.xfs = xfs; // Не делаем копию, оставляем ссылку
}
}
else if( c_oSerCellTypes.Type == type )
......@@ -6149,7 +6150,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
res = c_oSerConstants.ReadUnknown;
return res;
};
};
}
/** @constructor */
function Binary_CalcChainTableReader(stream, aCalcChain)
{
......@@ -6198,7 +6199,7 @@ function Binary_CalcChainTableReader(stream, aCalcChain)
res = c_oSerConstants.ReadUnknown;
return res;
};
};
}
/** @constructor */
function Binary_OtherTableReader(stream, oMedia, sUrlPath, wb)
{
......@@ -6369,7 +6370,7 @@ function Binary_OtherTableReader(stream, oMedia, sUrlPath, wb)
res = c_oSerConstants.ReadUnknown;
return res;
};
};
}
/** @constructor */
function BinaryFileReader(sUrlPath, isCopyPaste)
{
......@@ -6617,7 +6618,7 @@ function BinaryFileReader(sUrlPath, isCopyPaste)
}
return res;
};
};
}
function CTableStyles()
{
this.DefaultTableStyle = "TableStyleMedium2";
......
......@@ -1026,6 +1026,8 @@ function CellXfs() {
this.align = null;
this.QuotePrefix = null;
this.XfId = null;
// Является ли стиль ссылкой (При открытии все стили будут ссылками. Поэтому при смене свойств нужно делать копию)
this.isReference = false;
}
CellXfs.prototype =
{
......@@ -1469,6 +1471,12 @@ StyleManager.prototype =
g_oDefaultXfId = oDefaultXfs.XfId;
}
},
_prepareSetReference : function (oItemWithXfs)
{
// При открытии все стили будут ссылками. Поэтому при смене свойств нужно делать копию
if (oItemWithXfs.xfs.isReference)
oItemWithXfs.xfs = oItemWithXfs.xfs.clone();
},
_prepareSet : function(oItemWithXfs)
{
if(null == oItemWithXfs.xfs)
......@@ -1477,7 +1485,8 @@ StyleManager.prototype =
oItemWithXfs.xfs = oItemWithXfs.getDefaultXfs();
if(null == oItemWithXfs.xfs)
oItemWithXfs.xfs = this.oDefaultXfs.clone();
}
} else
this._prepareSetReference(oItemWithXfs);
return oItemWithXfs.xfs;
},
_prepareSetFont : function(oItemWithXfs)
......@@ -1507,8 +1516,10 @@ StyleManager.prototype =
else
oRes.oldVal = g_oDefaultXfId;
if(null == val) {
if(null != xfs)
if(null != xfs) {
this._prepareSetReference(oItemWithXfs);
xfs.XfId = g_oDefaultXfId;
}
} else {
xfs = this._prepareSetCellStyle(oItemWithXfs);
xfs.XfId = val;
......@@ -1525,9 +1536,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultNum.f;
if(null == val)
{
if(null != xfs)
if(null != xfs) {
this._prepareSetReference(oItemWithXfs);
xfs.num = null;
}
}
else
{
xfs = this._prepareSet(oItemWithXfs);
......@@ -1547,9 +1560,11 @@ StyleManager.prototype =
oRes.oldVal = null;
if(null == val)
{
if(null != xfs)
if(null != xfs) {
this._prepareSetReference(oItemWithXfs);
xfs.font = null;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1570,6 +1585,7 @@ StyleManager.prototype =
{
if(null != xfs && null != xfs.font)
{
this._prepareSetReference(oItemWithXfs);
xfs.font.fn = g_oDefaultFont.fn;
xfs.font.scheme = EFontScheme.fontschemeNone;
}
......@@ -1592,9 +1608,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.fs;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.fs = g_oDefaultFont.fs;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1612,9 +1630,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.c;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.c = g_oDefaultFont.c;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1632,9 +1652,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.b;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.b = g_oDefaultFont.b;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1652,9 +1674,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.i;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.i = g_oDefaultFont.i;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1672,9 +1696,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.u;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.u = g_oDefaultFont.u;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1692,9 +1718,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.s;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.s = g_oDefaultFont.s;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1712,9 +1740,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFont.va;
if(null == val)
{
if(null != xfs && null != xfs.font)
if(null != xfs && null != xfs.font) {
this._prepareSetReference(oItemWithXfs);
xfs.font.va = g_oDefaultFont.va;
}
}
else
{
xfs = this._prepareSetFont(oItemWithXfs);
......@@ -1732,9 +1762,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultAlign.ver;
if(null == val)
{
if(null != xfs && null != xfs.align)
if(null != xfs && null != xfs.align) {
this._prepareSetReference(oItemWithXfs);
xfs.align.ver = g_oDefaultAlign.ver;
}
}
else
{
xfs = this._prepareSetAlign(oItemWithXfs);
......@@ -1752,9 +1784,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultAlign.hor;
if(null == val)
{
if(null != xfs && null != xfs.align)
if(null != xfs && null != xfs.align) {
this._prepareSetReference(oItemWithXfs);
xfs.align.hor = g_oDefaultAlign.hor;
}
}
else
{
xfs = this._prepareSetAlign(oItemWithXfs);
......@@ -1772,9 +1806,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultFill.bg;
if(null == val)
{
if(null != xfs && null != xfs.fill)
if(null != xfs && null != xfs.fill) {
this._prepareSetReference(oItemWithXfs);
xfs.fill.bg = g_oDefaultFill.bg;
}
}
else
{
xfs = this._prepareSet(oItemWithXfs);
......@@ -1794,9 +1830,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultBorder;
if(null == val)
{
if(null != xfs && null != xfs.border)
if(null != xfs && null != xfs.border) {
this._prepareSetReference(oItemWithXfs);
xfs.border = val;
}
}
else
{
xfs = this._prepareSet(oItemWithXfs);
......@@ -1814,9 +1852,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultAlign.shrink;
if(null == val)
{
if(null != xfs && null != xfs.align)
if(null != xfs && null != xfs.align) {
this._prepareSetReference(oItemWithXfs);
xfs.align.shrink = g_oDefaultAlign.shrink;
}
}
else
{
xfs = this._prepareSetAlign(oItemWithXfs);
......@@ -1834,9 +1874,11 @@ StyleManager.prototype =
oRes.oldVal = g_oDefaultAlign.wrap;
if(null == val)
{
if(null != xfs && null != xfs.align)
if(null != xfs && null != xfs.align) {
this._prepareSetReference(oItemWithXfs);
xfs.align.wrap = g_oDefaultAlign.wrap;
}
}
else
{
xfs = this._prepareSetAlign(oItemWithXfs);
......@@ -1852,9 +1894,11 @@ StyleManager.prototype =
oRes.oldVal = xfs.QuotePrefix;
if(null == val)
{
if(null != xfs)
if(null != xfs) {
this._prepareSetReference(oItemWithXfs);
xfs.QuotePrefix = val;
}
}
else
{
xfs = this._prepareSet(oItemWithXfs);
......@@ -1873,9 +1917,11 @@ StyleManager.prototype =
oRes.oldVal = angleFormatToInterface2(g_oDefaultAlign.angle);
if(null == val)
{
if(null != xfs && null != xfs.align)
if(null != xfs && null != xfs.align) {
this._prepareSetReference(oItemWithXfs);
xfs.align.angle = g_oDefaultAlign.angle;
}
}
else
{
xfs = this._prepareSetAlign(oItemWithXfs);
......@@ -2049,7 +2095,7 @@ function Col(worksheet, index)
this.CustomWidth = null;
this.width = null;
this.xfs = null;
};
}
Col.prototype =
{
getId : function()
......
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