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