Commit 72cd20da authored by Sergey.Konovalov's avatar Sergey.Konovalov

неправильно открывался default шрифт, если в документе изменена тема.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47463 954022d7-b5bf-4e40-9824-e11837661b57
parent 00166ae8
...@@ -3896,13 +3896,10 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -3896,13 +3896,10 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
oNewXfs.QuotePrefix = xfs.QuotePrefix; oNewXfs.QuotePrefix = xfs.QuotePrefix;
if(null != xfs.align) if(null != xfs.align)
oNewXfs.align = xfs.align.clone(); oNewXfs.align = xfs.align.clone();
if(0 == this.aCellXfs.length)
this.oStyleManager.init(oNewXfs);
this.minimizeXfs(oNewXfs);
this.aCellXfs.push(oNewXfs); this.aCellXfs.push(oNewXfs);
}
if(this.aCellXfs.length > 0)
{
var oFirstXfs = this.aCellXfs[0];
this.oStyleManager.oDefaultXfs = oFirstXfs;
} }
for(var i in oCustomTableStyles) for(var i in oCustomTableStyles)
{ {
...@@ -3915,7 +3912,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -3915,7 +3912,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
this.wb.TableStyles.CustomStyles[i] = style; this.wb.TableStyles.CustomStyles[i] = style;
} }
} }
this.oStyleManager.init();
} }
this.initTableStyle = function(style, elems, Dxfs) this.initTableStyle = function(style, elems, Dxfs)
{ {
...@@ -3927,6 +3923,7 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -3927,6 +3923,7 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
var Dxf = Dxfs[elem.DxfId]; var Dxf = Dxfs[elem.DxfId];
if(null != Dxf) if(null != Dxf)
{ {
this.minimizeXfs(Dxf);
var oTableStyleElement = new CTableStyleElement(); var oTableStyleElement = new CTableStyleElement();
oTableStyleElement.dxf = Dxf; oTableStyleElement.dxf = Dxf;
if(null != elem.Size) if(null != elem.Size)
...@@ -3966,6 +3963,19 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -3966,6 +3963,19 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
} }
} }
} }
this.minimizeXfs = function(xfs)
{
if(null != xfs.border && g_oDefaultBorder.isEqual(xfs.border))
xfs.border = null;
if(null != xfs.fill && g_oDefaultFill.isEqual(xfs.fill))
xfs.fill = null;
if(null != xfs.font && g_oDefaultFont.isEqual(xfs.font))
xfs.font = null;
if(null != xfs.num && g_oDefaultNum.isEqual(xfs.num))
xfs.num = null;
if(null != xfs.align && g_oDefaultAlign.isEqual(xfs.align))
xfs.align = null;
}
this.ParseNum = function(oNum, oNumFmts) this.ParseNum = function(oNum, oNumFmts)
{ {
var oRes = null; var oRes = null;
...@@ -4058,8 +4068,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -4058,8 +4068,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadBorder(t,l,oNewBorder); return oThis.ReadBorder(t,l,oNewBorder);
}); });
if(oNewBorder.isEqual(g_oDefaultBorderAbs))
oNewBorder = null;
aBorders.push(oNewBorder); aBorders.push(oNewBorder);
} }
else else
...@@ -4216,8 +4224,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -4216,8 +4224,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = this.bcr.Read2Spreadsheet(length, function(t,l){ res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadAligment(t,l,oXfs.align); return oThis.ReadAligment(t,l,oXfs.align);
}); });
if(oXfs.align.isEqual(g_oDefaultAlignAbs))
oXfs.align = null;
} }
else else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
...@@ -4276,8 +4282,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -4276,8 +4282,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadFill(t,l,oNewFill); return oThis.ReadFill(t,l,oNewFill);
}); });
if(oNewFill.isEqual(g_oDefaultFillAbs))
oNewFill = null;
aFills.push(oNewFill); aFills.push(oNewFill);
} }
else else
...@@ -4327,8 +4331,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -4327,8 +4331,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = this.bcr.Read2Spreadsheet(length, function(t,l){ res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.bssr.ReadRPr(t,l,oNewFont); return oThis.bssr.ReadRPr(t,l,oNewFont);
}); });
if(oNewFont.isEqual(g_oDefaultFont))
oNewFont = null;
aFonts.push(oNewFont); aFonts.push(oNewFont);
} }
else else
...@@ -4401,8 +4403,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs) ...@@ -4401,8 +4403,6 @@ function Binary_StylesTableReader(stream, wb, aCellXfs, Dxfs)
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadBorder(t,l,oNewBorder); return oThis.ReadBorder(t,l,oNewBorder);
}); });
if(oNewBorder.isEqual(g_oDefaultBorderAbs))
oNewBorder = null;
oDxf.border = oNewBorder; oDxf.border = oNewBorder;
} }
else if ( c_oSer_Dxf.Fill == type ) else if ( c_oSer_Dxf.Fill == type )
......
...@@ -1210,25 +1210,22 @@ function StyleManager(){ ...@@ -1210,25 +1210,22 @@ function StyleManager(){
this.oDefaultAlign = null; this.oDefaultAlign = null;
this.oDefaultQuotePrefix = null; this.oDefaultQuotePrefix = null;
//стиль ячейки по умолчанию, может содержать не все свойства //стиль ячейки по умолчанию, может содержать не все свойства
this.oDefaultXfs = null; this.oDefaultXfs = new CellXfs();
}; };
StyleManager.prototype = StyleManager.prototype =
{ {
init : function() init : function(oDefaultXfs)
{ {
if(null == this.oDefaultXfs) if(null != oDefaultXfs.font)
this.oDefaultXfs = new CellXfs(); g_oDefaultFont = oDefaultXfs.font.clone();
if(null == this.oDefaultXfs.font) if(null != oDefaultXfs.fill)
this.oDefaultXfs.font = new Font(); g_oDefaultFill = oDefaultXfs.fill.clone();
g_oDefaultFont = this.oDefaultXfs.font.clone(); if(null != oDefaultXfs.border)
if(null != this.oDefaultXfs.fill) g_oDefaultBorder = oDefaultXfs.border.clone();
g_oDefaultFill = this.oDefaultXfs.fill.clone(); if(null != oDefaultXfs.num)
if(null != this.oDefaultXfs.border) g_oDefaultNum = oDefaultXfs.num.clone();
g_oDefaultBorder = this.oDefaultXfs.border.clone(); if(null != oDefaultXfs.align)
if(null != this.oDefaultXfs.num) g_oDefaultAlign = oDefaultXfs.align.clone();
g_oDefaultNum = this.oDefaultXfs.num.clone();
if(null != this.oDefaultXfs.align)
g_oDefaultAlign = this.oDefaultXfs.align.clone();
}, },
_prepareSet : function(oItemWithXfs) _prepareSet : function(oItemWithXfs)
{ {
......
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