Commit dfaea425 authored by Alexey.Musinov's avatar Alexey.Musinov

table styles

parent 1207aec9
...@@ -2336,6 +2336,7 @@ function asc_ReadAutoFiltersOptions(s, p) { ...@@ -2336,6 +2336,7 @@ function asc_ReadAutoFiltersOptions(s, p) {
} }
filter.asc_setValues(values); filter.asc_setValues(values);
break;
} }
case 255: case 255:
default: default:
...@@ -2348,22 +2349,128 @@ function asc_ReadAutoFiltersOptions(s, p) { ...@@ -2348,22 +2349,128 @@ function asc_ReadAutoFiltersOptions(s, p) {
return filter; return filter;
} }
function asc_ReadFormatTableInfo(s, p) {
var fmt = new AscCommonExcel.asc_CFormatTableInfo();
var isNull = true;
var next = true;
while (next)
{
var _attr = s[p.pos++];
switch (_attr)
{
case 0:
{
fmt.tableStyleName = s[p.pos++]; isNull = false;
break;
}
case 1:
{
fmt.tableRange = s[p.pos++]; isNull = false;
break;
}
case 2:
{
fmt.tableStyleName = s[p.pos++]; isNull = false;
break;
}
case 3:
{
fmt.bandHor = s[p.pos++]; isNull = false;
break;
}
case 4:
{
fmt.bandVer = s[p.pos++]; isNull = false;
break;
}
case 5:
{
fmt.filterButton = s[p.pos++]; isNull = false;
break;
}
case 6:
{
fmt.firstCol = s[p.pos++]; isNull = false;
break;
}
case 7:
{
fmt.firstRow = s[p.pos++]; isNull = false;
break;
}
case 8:
{
fmt.isDeleteColumn = s[p.pos++]; isNull = false;
break;
}
case 9:
{
fmt.isDeleteRow = s[p.pos++]; isNull = false;
break;
}
case 10:
{
fmt.isDeleteTable = s[p.pos++]; isNull = false;
break;
}
case 11:
{
fmt.isInsertColumnLeft = s[p.pos++]; isNull = false;
break;
}
case 12:
{
fmt.isInsertColumnRight = s[p.pos++]; isNull = false;
break;
}
case 13:
{
fmt.IsInsertRowAbove = s[p.pos++]; isNull = false;
break;
}
case 14:
{
fmt.isInsertRowBelow = s[p.pos++]; isNull = false;
break;
}
case 15:
{
fmt.lastCol = s[p.pos++]; isNull = false;
break;
}
case 16:
{
fmt.lastRow = s[p.pos++]; isNull = false;
break;
}
case 255:
default:
{
next = false;
break;
}
}
}
return isNull ? null : fmt;
}
function asc_WriteCBorder(i, c, s) { function asc_WriteCBorder(i, c, s) {
if (!c) return; if (!c) return;
s['WriteByte'](i); s['WriteByte'](i);
if (c.asc_getStyle()) { if (c.asc_getStyle()) {
s['WriteByte'](0); s['WriteByte'](0);
s['WriteString2'](c.asc_getStyle()); s['WriteString2'](c.asc_getStyle());
} }
if (c.asc_getColor()) { if (c.asc_getColor()) {
s['WriteByte'](1); s['WriteByte'](1);
s['WriteLong'](c.asc_getColor()); s['WriteLong'](c.asc_getColor());
} }
s['WriteByte'](255); s['WriteByte'](255);
} }
function asc_WriteCHyperLink(i, c, s) { function asc_WriteCHyperLink(i, c, s) {
...@@ -4755,7 +4862,7 @@ function OfflineEditor () { ...@@ -4755,7 +4862,7 @@ function OfflineEditor () {
AscCommonExcel.WorkbookView.prototype = Object.create (AscCommonExcel.WorkbookView.prototype); AscCommonExcel.WorkbookView.prototype = Object.create (AscCommonExcel.WorkbookView.prototype);
AscCommonExcel.WorkbookView.prototype.constructor = AscCommonExcel.WorkbookView; AscCommonExcel.WorkbookView.prototype.constructor = AscCommonExcel.WorkbookView;
AscCommonExcel.WorkbookView.prototype.af_getTablePictures = function(wb, fmgrGraphics, oFont) { AscCommonExcel.WorkbookView.prototype.af_getTablePictures = function(wb, fmgrGraphics, oFont, props) {
window["native"]["SetStylesType"](1); window["native"]["SetStylesType"](1);
...@@ -4768,58 +4875,58 @@ function OfflineEditor () { ...@@ -4768,58 +4875,58 @@ function OfflineEditor () {
canvas.width = styleThumbnailWidth; canvas.width = styleThumbnailWidth;
canvas.height = styleThumbnailHeight; canvas.height = styleThumbnailHeight;
var customStyles = wb.TableStyles.CustomStyles; var customStyles = wb.TableStyles.CustomStyles;
var result = []; var result = [];
var options; var options;
var n = 0; var n = 0;
if(customStyles) if (customStyles) {
{ for (var i in customStyles) {
for(var i in customStyles) if (customStyles[i].table) {
{
if(customStyles[i].table)
{
window["native"]["BeginDrawDocumentStyle"](customStyles[i].name, n); window["native"]["BeginDrawDocumentStyle"](customStyles[i].name, n);
this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont); this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont, props);
n++;
window["native"]["EndDrawStyle"](); window["native"]["EndDrawStyle"]();
n++;
} }
} }
} }
var defaultStyles = wb.TableStyles.DefaultStyles; var defaultStyles = wb.TableStyles.DefaultStyles;
if(defaultStyles) if (defaultStyles) {
{ for (var i in defaultStyles) {
for(var i in defaultStyles) if (defaultStyles[i].table) {
{
if(defaultStyles[i].table)
{
window["native"]["BeginDrawDefaultStyle"](defaultStyles[i].name, n); window["native"]["BeginDrawDefaultStyle"](defaultStyles[i].name, n);
this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont); this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont, props);
n++;
window["native"]["EndDrawStyle"](); window["native"]["EndDrawStyle"]();
n++;
} }
} }
} }
return result; return result;
}; };
AscCommonExcel.WorkbookView.prototype.af_getSmallIconTable = function(canvas, style, fmgrGraphics, oFont) { AscCommonExcel.WorkbookView.prototype.af_getSmallIconTable = function(canvas, style, fmgrGraphics, oFont, props) {
var ctx = new Asc.DrawingContext({canvas: canvas, units: 0/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont}); var ctx = new Asc.DrawingContext({canvas: canvas, units: 0/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var styleOptions = style; var styleOptions = style;
//по умолчанию ставим строку заголовка и чередующиеся строки, позже нужно будет получать параметр
var styleInfo = false; var styleInfo;
if (props) {
if(!styleInfo)
{
styleInfo = { styleInfo = {
ShowColumnStripes: false, ShowColumnStripes: props.asc_getBandVer(),
ShowFirstColumn: false, ShowFirstColumn: props.asc_getFirstCol(),
ShowLastColumn: false, ShowLastColumn: props.asc_getLastCol(),
ShowRowStripes: true, ShowRowStripes: props.asc_getBandHor(),
TotalsRowCount: 0 HeaderRowCount: props.asc_getFirstRow(),
} TotalsRowCount: props.asc_getLastRow()
};
} else {
styleInfo = {
ShowColumnStripes: false,
ShowFirstColumn: false,
ShowLastColumn: false,
ShowRowStripes: true,
HeaderRowCount: true,
TotalsRowCount: false
};
} }
var xSize = styleThumbnailWidth * pxToMM; //61 * pxToMM; var xSize = styleThumbnailWidth * pxToMM; //61 * pxToMM;
var ySize = styleThumbnailHeight * pxToMM; //45 * pxToMM; var ySize = styleThumbnailHeight * pxToMM; //45 * pxToMM;
...@@ -4830,200 +4937,186 @@ function OfflineEditor () { ...@@ -4830,200 +4937,186 @@ function OfflineEditor () {
//**draw background** //**draw background**
var defaultColorBackground; var defaultColorBackground;
if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill) if (styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill) {
defaultColorBackground = styleOptions.wholeTable.dxf.fill.bg; defaultColorBackground = styleOptions.wholeTable.dxf.fill.bg;
else } else {
defaultColorBackground = whiteColor; defaultColorBackground = whiteColor;
}
var color; var color;
if(styleOptions != undefined) if (styleOptions != undefined) {
{ if (styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg) {
if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg)
{
ctx.setFillStyle(styleOptions.wholeTable.dxf.fill.bg); ctx.setFillStyle(styleOptions.wholeTable.dxf.fill.bg);
ctx.fillRect(0,0,xSize,ySize); ctx.fillRect(0, 0, xSize, ySize);
} } else {
else
{
ctx.setFillStyle(whiteColor); ctx.setFillStyle(whiteColor);
ctx.fillRect(0,0,xSize,ySize); ctx.fillRect(0, 0, xSize, ySize);
} }
if(styleInfo.ShowColumnStripes)//column stripes if (styleInfo.ShowColumnStripes)//column stripes
{ {
for(k = 0; k < 6; k++) for (k = 0; k < 6; k++) {
{
color = defaultColorBackground; color = defaultColorBackground;
if((k)%2 == 0) if (k % 2 == 0) {
{ if (styleOptions.firstColumnStripe && styleOptions.firstColumnStripe.dxf.fill &&
if(styleOptions.firstColumnStripe && styleOptions.firstColumnStripe.dxf.fill && null != styleOptions.firstColumnStripe.dxf.fill.bg) null != styleOptions.firstColumnStripe.dxf.fill.bg) {
color = styleOptions.firstColumnStripe.dxf.fill.bg; color = styleOptions.firstColumnStripe.dxf.fill.bg;
else if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg) } else if (styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill &&
color = styleOptions.wholeTable.dxf.fill.bg; null != styleOptions.wholeTable.dxf.fill.bg) {
} color = styleOptions.wholeTable.dxf.fill.bg;
else }
{ } else {
if(styleOptions.secondColumnStripe && styleOptions.secondColumnStripe.dxf.fill && null != styleOptions.secondColumnStripe.dxf.fill.bg) if (styleOptions.secondColumnStripe && styleOptions.secondColumnStripe.dxf.fill &&
null != styleOptions.secondColumnStripe.dxf.fill.bg) {
color = styleOptions.secondColumnStripe.dxf.fill.bg; color = styleOptions.secondColumnStripe.dxf.fill.bg;
else if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg) } else if (styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill &&
color = styleOptions.wholeTable.dxf.fill.bg; null != styleOptions.wholeTable.dxf.fill.bg) {
color = styleOptions.wholeTable.dxf.fill.bg;
}
} }
ctx.setFillStyle(color); ctx.setFillStyle(color);
ctx.fillRect(k*stepX,0,stepX,ySize); ctx.fillRect(k * stepX, 0, stepX, ySize);
} }
} }
if(styleInfo.ShowRowStripes)//row stripes if (styleInfo.ShowRowStripes)//row stripes
{ {
for(k = 0; k < 6; k++) for (var k = 0; k < 6; k++) {
{
color = null; color = null;
if(styleOptions)//styleOptions.headerRow
{ if (k == 0 && styleInfo.HeaderRowCount) {
if(k ==0) continue;
k++; }
if((k)%2 != 0)
{ if (styleInfo.HeaderRowCount) {
if(styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.fill && null != styleOptions.firstRowStripe.dxf.fill.bg) if (k % 2 != 0) {
if (styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.fill &&
null != styleOptions.firstRowStripe.dxf.fill.bg) {
color = styleOptions.firstRowStripe.dxf.fill.bg; color = styleOptions.firstRowStripe.dxf.fill.bg;
} }
else } else {
{ if (styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.fill &&
if(styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.fill && null != styleOptions.secondRowStripe.dxf.fill.bg) null != styleOptions.secondRowStripe.dxf.fill.bg) {
color = styleOptions.secondRowStripe.dxf.fill.bg; color = styleOptions.secondRowStripe.dxf.fill.bg;
else if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg) }
color = styleOptions.wholeTable.dxf.fill.bg;
} }
if(color != null) } else {
{ if (k % 2 != 0) {
ctx.setFillStyle(color); if (styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.fill &&
if(k == 1) null != styleOptions.secondRowStripe.dxf.fill.bg) {
ctx.fillRect(0, k*stepY, xSize, stepY); color = styleOptions.secondRowStripe.dxf.fill.bg;
else if(k == 3) }
ctx.fillRect(0, k*stepY, xSize,stepY); } else {
else if (styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.fill &&
ctx.fillRect(0, k*stepY, xSize, stepY); null != styleOptions.firstRowStripe.dxf.fill.bg) {
//else color = styleOptions.firstRowStripe.dxf.fill.bg;
//ctx.fillRect(0,k*stepY,xSize,stepY); }
} }
} }
else
{ if (color != null) {
color = null; ctx.setFillStyle(color);
if((k+1)%2 != 0) ctx.fillRect(0, k * stepY, xSize, stepY);
{
if(styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.fill && null != styleOptions.firstRowStripe.dxf.fill.bg)
color = styleOptions.firstRowStripe.dxf.fill.bg;
}
else
{
if(styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.fill && null != styleOptions.secondRowStripe.dxf.fill.bg)
color = styleOptions.secondRowStripe.dxf.fill.bg;
else if(styleOptions.wholeTable && styleOptions.wholeTable.dxf.fill && null != styleOptions.wholeTable.dxf.fill.bg)
color = styleOptions.wholeTable.dxf.fill.bg;
}
if(color != null)
{
ctx.setFillStyle(color);
ctx.fillRect(0, k*stepY, xSize, stepY);
}
} }
} }
} }
if(styleInfo.ShowFirstColumn && styleOptions.firstColumn)//first column
if (styleInfo.ShowFirstColumn && styleOptions.firstColumn)//first column
{ {
if(styleOptions.firstColumn && styleOptions.firstColumn.dxf.fill && null != styleOptions.firstColumn.dxf.fill.bg) color = null;
ctx.setFillStyle(styleOptions.firstColumn.dxf.fill.bg); if (styleOptions.firstColumn && styleOptions.firstColumn.dxf.fill &&
else null != styleOptions.firstColumn.dxf.fill.bg) {
ctx.setFillStyle(defaultColorBackground); color = styleOptions.firstColumn.dxf.fill.bg;
ctx.fillRect(0,0,stepX,ySize); }
if (color != null) {
ctx.setFillStyle(color);
ctx.fillRect(0, 0, stepX, ySize);
}
} }
if(styleInfo.ShowLastColumn)//last column if (styleInfo.ShowLastColumn)//last column
{ {
color = null; color = null;
if(styleOptions.lastColumn && styleOptions.lastColumn.dxf.fill && null != styleOptions.lastColumn.dxf.fill.bg) if (styleOptions.lastColumn && styleOptions.lastColumn.dxf.fill &&
color =styleOptions.lastColumn.dxf.fill.bg; null != styleOptions.lastColumn.dxf.fill.bg) {
color = styleOptions.lastColumn.dxf.fill.bg;
if(color != null) }
{
if (color != null) {
ctx.setFillStyle(color); ctx.setFillStyle(color);
ctx.fillRect(4*stepX,0,stepX,ySize); ctx.fillRect(4 * stepX + 1, 0, stepX, ySize);
} }
} }
if(styleOptions)//header row if (styleInfo.HeaderRowCount)//header row
{ {
if(styleOptions.headerRow && styleOptions.headerRow.dxf.fill && null != styleOptions.headerRow.dxf.fill.bg) if (styleOptions.headerRow && styleOptions.headerRow.dxf.fill && null != styleOptions.headerRow.dxf.fill.bg) {
{
ctx.setFillStyle(styleOptions.headerRow.dxf.fill.bg); ctx.setFillStyle(styleOptions.headerRow.dxf.fill.bg);
} } else {
else
{
ctx.setFillStyle(defaultColorBackground); ctx.setFillStyle(defaultColorBackground);
} }
ctx.fillRect(0, 0, xSize, stepY); ctx.fillRect(0, 0, xSize, stepY);
} }
if(styleInfo.TotalsRowCount)//total row if (styleInfo.TotalsRowCount)//total row
{ {
color = null; color = null;
if(styleOptions.totalRow && styleOptions.totalRow.dxf.fill && null != styleOptions.totalRow.dxf.fill.bg) if (styleOptions.totalRow && styleOptions.totalRow.dxf.fill && null != styleOptions.totalRow.dxf.fill.bg) {
color = styleOptions.totalRow.dxf.fill.bg; color = styleOptions.totalRow.dxf.fill.bg;
else }
color = defaultColorBackground;
ctx.setFillStyle(color); if (color !== null) {
ctx.fillRect(0, stepY*4, xSize, stepY); ctx.setFillStyle(color);
ctx.fillRect(0, stepY * 4, xSize, stepY);
}
} }
//первая ячейка //первая ячейка
if(styleOptions.firstHeaderCell && styleInfo.ShowFirstColumn) if (styleOptions.firstHeaderCell && styleInfo.ShowFirstColumn) {
{ if (styleOptions.firstHeaderCell && styleOptions.firstHeaderCell.dxf.fill &&
if(styleOptions.firstHeaderCell && styleOptions.firstHeaderCell.dxf.fill && null != styleOptions.firstHeaderCell.dxf.fill.bg) null != styleOptions.firstHeaderCell.dxf.fill.bg) {
ctx.setFillStyle(styleOptions.firstHeaderCell.dxf.fill.bg); ctx.setFillStyle(styleOptions.firstHeaderCell.dxf.fill.bg);
else } else {
ctx.setFillStyle(defaultColorBackground); ctx.setFillStyle(defaultColorBackground);
ctx.fillRect(0,0,stepX,stepY); }
ctx.fillRect(0, 0, stepX, stepY);
} }
//последняя в первой строке //последняя в первой строке
if(styleOptions.lastHeaderCell && styleInfo.ShowLastColumn) if (styleOptions.lastHeaderCell && styleInfo.ShowLastColumn) {
{ if (styleOptions.lastHeaderCell && styleOptions.lastHeaderCell.dxf.fill &&
if(styleOptions.lastHeaderCell && styleOptions.lastHeaderCell.dxf.fill && null != styleOptions.lastHeaderCell.dxf.fill.bg) null != styleOptions.lastHeaderCell.dxf.fill.bg) {
ctx.setFillStyle(styleOptions.lastHeaderCell.dxf.fill.bg); ctx.setFillStyle(styleOptions.lastHeaderCell.dxf.fill.bg);
else } else {
ctx.setFillStyle(defaultColorBackground); ctx.setFillStyle(defaultColorBackground);
ctx.fillRect(4*stepX,0,stepX,stepY); }
ctx.fillRect(4 * stepX, 0, stepX, stepY);
} }
//первая в последней строке //первая в последней строке
if(styleOptions.firstTotalCell && styleInfo.TotalsRowCount && styleInfo.ShowFirstColumn) if (styleOptions.firstTotalCell && styleInfo.TotalsRowCount && styleInfo.ShowFirstColumn) {
{ if (styleOptions.firstTotalCell && styleOptions.firstTotalCell.dxf.fill &&
if(styleOptions.firstTotalCell && styleOptions.firstTotalCell.dxf.fill && null != styleOptions.firstTotalCell.dxf.fill.bg) null != styleOptions.firstTotalCell.dxf.fill.bg) {
ctx.setFillStyle(styleOptions.firstTotalCell.dxf.fill.bg); ctx.setFillStyle(styleOptions.firstTotalCell.dxf.fill.bg);
else } else {
ctx.setFillStyle(defaultColorBackground); ctx.setFillStyle(defaultColorBackground);
ctx.fillRect(0,4*stepY,stepX,stepY); }
ctx.fillRect(0, 4 * stepY, stepX, stepY);
} }
//последняя ячейка //последняя ячейка
if(styleOptions.lastTotalCell && styleInfo.TotalsRowCount && styleInfo.ShowLastColumn) if (styleOptions.lastTotalCell && styleInfo.TotalsRowCount && styleInfo.ShowLastColumn) {
{ if (styleOptions.lastTotalCell && styleOptions.lastTotalCell.dxf.fill &&
if(styleOptions.lastTotalCell && styleOptions.lastTotalCell.dxf.fill && null != styleOptions.lastTotalCell.dxf.fill.bg) null != styleOptions.lastTotalCell.dxf.fill.bg) {
ctx.setFillStyle(styleOptions.lastTotalCell.dxf.fill.bg); ctx.setFillStyle(styleOptions.lastTotalCell.dxf.fill.bg);
else } else {
ctx.setFillStyle(defaultColorBackground); ctx.setFillStyle(defaultColorBackground);
ctx.fillRect(4*stepX,4*stepY,stepX,ySize); }
ctx.fillRect(4 * stepX, 4 * stepY, stepX, ySize);
} }
} } else {
else
{
ctx.setFillStyle(whiteColor); ctx.setFillStyle(whiteColor);
ctx.fillRect(0,0,xSize,ySize); ctx.fillRect(0, 0, xSize, ySize);
} }
//**draw vertical and horizontal lines** //**draw vertical and horizontal lines**
if(styleOptions != undefined) if(styleOptions != undefined)
{ {
...@@ -5080,41 +5173,35 @@ function OfflineEditor () { ...@@ -5080,41 +5173,35 @@ function OfflineEditor () {
} }
var border; var border;
if(styleInfo.ShowRowStripes) if (styleInfo.ShowRowStripes) {
{ if (styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.border) {
if(styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.border)
border = styleOptions.firstRowStripe.dxf.border; border = styleOptions.firstRowStripe.dxf.border;
else if(styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.border) } else if (styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.border) {
border = styleOptions.secondRowStripe.dxf.border; border = styleOptions.secondRowStripe.dxf.border;
}
if(border)
{ if (border) {
for(n = 1; n < 5; n++) for (n = 1; n < 5; n++) {
{ ctx.lineHor(0, stepY * n, xSize);
ctx.lineHor(0, stepY*n, xSize);
} }
ctx.stroke(); ctx.stroke();
} }
} }
if(styleOptions.totalRow && styleInfo.TotalsRowCount && styleOptions.totalRow.dxf.border) if (styleOptions.totalRow && styleInfo.TotalsRowCount && styleOptions.totalRow.dxf.border) {
{
border = styleOptions.totalRow.dxf.border; border = styleOptions.totalRow.dxf.border;
if(border.t.s !== AscCommon.c_oAscBorderStyles.None) if (border.t.s !== AscCommon.c_oAscBorderStyles.None) {
{
ctx.setStrokeStyle(border.t.c); ctx.setStrokeStyle(border.t.c);
ctx.lineVer(0, xSize, ySize); ctx.lineVer(0, xSize, ySize);
} }
} }
if(styleOptions.headerRow && styleOptions.headerRow.dxf.border)//header row if (styleOptions.headerRow && styleOptions.headerRow.dxf.border && styleInfo.HeaderRowCount)//header row
{ {
border = styleOptions.headerRow.dxf.border; border = styleOptions.headerRow.dxf.border;
if(border.t.s !== AscCommon.c_oAscBorderStyles.None) if (border.t.s !== AscCommon.c_oAscBorderStyles.None) {
{
ctx.setStrokeStyle(border.t.c); ctx.setStrokeStyle(border.t.c);
ctx.lineHor(0, 0, xSize); ctx.lineHor(0, 0, xSize);
} }
if(border.b.s !== AscCommon.c_oAscBorderStyles.None) if (border.b.s !== AscCommon.c_oAscBorderStyles.None) {
{
ctx.setStrokeStyle(border.b.c); ctx.setStrokeStyle(border.b.c);
ctx.lineHor(0, stepY, xSize); ctx.lineHor(0, stepY, xSize);
} }
...@@ -5122,49 +5209,46 @@ function OfflineEditor () { ...@@ -5122,49 +5209,46 @@ function OfflineEditor () {
} }
ctx.closePath(); ctx.closePath();
} }
//**draw marks line** //**draw marks line**
var defaultColor; var defaultColor;
if(!styleOptions || !styleOptions.wholeTable || !styleOptions.wholeTable.dxf.font) if (!styleOptions || !styleOptions.wholeTable || !styleOptions.wholeTable.dxf.font) {
defaultColor = blackColor; defaultColor = blackColor;
else } else {
defaultColor = styleOptions.wholeTable.dxf.font.getColor(); defaultColor = styleOptions.wholeTable.dxf.font.getColor();
}
for(var n = 1; n < 6; n++) for (var n = 1; n < 6; n++) {
{
ctx.beginPath(); ctx.beginPath();
color = null; color = null;
if(n == 1 && styleOptions && styleOptions.headerRow && styleOptions.headerRow.dxf.font) if (n == 1 && styleOptions && styleOptions.headerRow && styleOptions.headerRow.dxf.font) {
color = styleOptions.headerRow.dxf.font.getColor(); color = styleOptions.headerRow.dxf.font.getColor();
else if(n == 5 && styleOptions && styleOptions.totalRow && styleOptions.totalRow.dxf.font) } else if (n == 5 && styleOptions && styleOptions.totalRow && styleOptions.totalRow.dxf.font) {
color = styleOptions.totalRow.dxf.font.getColor(); color = styleOptions.totalRow.dxf.font.getColor();
else if(styleOptions && styleOptions.headerRow && styleInfo.ShowRowStripes) } else if (styleOptions && styleOptions.headerRow && styleInfo.ShowRowStripes) {
{ if ((n == 2 || (n == 5 && !styleOptions.totalRow)) && styleOptions.firstRowStripe &&
if((n == 2 || (n == 5 && !styleOptions.totalRow)) && styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.font) styleOptions.firstRowStripe.dxf.font) {
color = styleOptions.firstRowStripe.dxf.font.getColor(); color = styleOptions.firstRowStripe.dxf.font.getColor();
else if(n == 3 && styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.font) } else if (n == 3 && styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.font) {
color = styleOptions.secondRowStripe.dxf.font.getColor(); color = styleOptions.secondRowStripe.dxf.font.getColor();
else } else {
color = defaultColor color = defaultColor
} }
else if(styleOptions && !styleOptions.headerRow && styleInfo.ShowRowStripes) } else if (styleOptions && !styleOptions.headerRow && styleInfo.ShowRowStripes) {
{ if ((n == 1 || n == 3 || (n == 5 && !styleOptions.totalRow)) && styleOptions.firstRowStripe &&
if((n == 1 || n == 3 || (n == 5 && !styleOptions.totalRow)) && styleOptions.firstRowStripe && styleOptions.firstRowStripe.dxf.font) styleOptions.firstRowStripe.dxf.font) {
color = styleOptions.firstRowStripe.dxf.font.getColor(); color = styleOptions.firstRowStripe.dxf.font.getColor();
else if((n == 2 || n == 4) && styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.font) } else if ((n == 2 || n == 4) && styleOptions.secondRowStripe && styleOptions.secondRowStripe.dxf.font) {
color = styleOptions.secondRowStripe.dxf.font.getColor(); color = styleOptions.secondRowStripe.dxf.font.getColor();
else } else {
color = defaultColor color = defaultColor
} }
else } else {
color = defaultColor; color = defaultColor;
}
ctx.setStrokeStyle(color); ctx.setStrokeStyle(color);
var k = 0; var k = 0;
var strY = n*stepY - stepY/2; var strY = n * stepY - stepY / 2;
while(k < 6) while (k < 6) {
{
//ctx.lineHor(k*stepX + 3 * pxToMM, strY, (k + 1)*stepX - 2 * pxToMM);
window["native"]["PD_PathMoveTo"](k*stepX + stepX * 0.25, strY); window["native"]["PD_PathMoveTo"](k*stepX + stepX * 0.25, strY);
window["native"]["PD_PathLineTo"]((k + 1)*stepX - stepX * 0.25, strY); window["native"]["PD_PathLineTo"]((k + 1)*stepX - stepX * 0.25, strY);
k++; k++;
...@@ -6444,8 +6528,9 @@ window["native"]["offline_apply_event"] = function(type,params) { ...@@ -6444,8 +6528,9 @@ window["native"]["offline_apply_event"] = function(type,params) {
case 12: // ASC_MENU_EVENT_TYPE_TABLESTYLES case 12: // ASC_MENU_EVENT_TYPE_TABLESTYLES
{ {
var wb = _api.wb; var props = asc_ReadFormatTableInfo(params, _current);
wb.getTablePictures(); // console.log(JSON.stringify(props));
_api.wb.getTablePictures(props);
break; break;
} }
...@@ -7004,7 +7089,7 @@ window["native"]["offline_apply_event"] = function(type,params) { ...@@ -7004,7 +7089,7 @@ window["native"]["offline_apply_event"] = function(type,params) {
break; break;
} }
case 3010: // ASC_SPREADSHEETS_EVENT_TYPE_FILTER_CHANGE_AUTO case 3010: // ASC_SPREADSHEETS_EVENT_TYPE_AUTO_FILTER_CHANGE
{ {
var changeFilter = asc_ReadAutoFilter(params, _current); var changeFilter = asc_ReadAutoFilter(params, _current);
...@@ -7024,7 +7109,7 @@ window["native"]["offline_apply_event"] = function(type,params) { ...@@ -7024,7 +7109,7 @@ window["native"]["offline_apply_event"] = function(type,params) {
break; break;
} }
case 3040: // ASC_SPREADSHEETS_EVENT_TYPE_FILTER_FORMAT_TABLE_OPTIONS case 3040: // ASC_SPREADSHEETS_EVENT_TYPE_AUTO_FILTER_FORMAT_TABLE_OPTIONS
{ {
var formatOptions = _api.asc_getAddFormatTableOptions(params); var formatOptions = _api.asc_getAddFormatTableOptions(params);
_stream = global_memory_stream_menu; _stream = global_memory_stream_menu;
......
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