Commit 9bb02081 authored by Alexander.Trofimov's avatar Alexander.Trofimov

refactoring formatTablePictures

parent d830ab06
......@@ -126,22 +126,17 @@
};
/** @constructor */
function formatTablePictures (options) {
if ( !(this instanceof formatTablePictures) ) {return new formatTablePictures(options);}
this.name = options.name;
this.displayName = options.displayName;
this.type = options.type;
this.image = options.image;
function formatTablePictures () {
this.name = null;
this.displayName = null;
this.type = null;
this.image = null;
}
formatTablePictures.prototype = {
constructor: formatTablePictures,
asc_getName: function () { return this.name; },
asc_getDisplayName: function () { return this.displayName; },
asc_getType: function () { return this.type; },
asc_getImage: function () { return this.image; }
};
formatTablePictures.prototype.asc_getName = function () { return this.name; };
formatTablePictures.prototype.asc_getDisplayName = function () { return this.displayName; };
formatTablePictures.prototype.asc_getType = function () { return this.type; };
formatTablePictures.prototype.asc_getImage = function () { return this.image; };
var g_oAutoFiltersOptionsProperties = {
cellId : 0,
......
......@@ -2765,27 +2765,18 @@
var result = [];
var canvas = document.createElement('canvas');
var styleThumbnailWidth = 61, styleThumbnailHeight = 46, row = 5, col = 5;
var defaultStyles = wb.TableStyles.DefaultStyles;
var defaultStyles, styleThumbnailWidth = 61, styleThumbnailHeight, row, col = 5;
if(bPivotTable)
{
styleThumbnailHeight = 49;
row = 8;
defaultStyles = wb.TableStyles.DefaultStylesPivot;
}
var customStyles = {};
for(var i in wb.TableStyles.CustomStyles)
{
if(bPivotTable && wb.TableStyles.CustomStyles[i].pivot)
{
customStyles[i] = wb.TableStyles.CustomStyles[i];
}
else if(!bPivotTable && wb.TableStyles.CustomStyles[i].table)
else
{
customStyles[i] = wb.TableStyles.CustomStyles[i];
}
styleThumbnailHeight = 46;
row = 5;
defaultStyles = wb.TableStyles.DefaultStyles;
}
if (AscBrowser.isRetina)
......@@ -2797,23 +2788,22 @@
canvas.height = styleThumbnailHeight;
var addStyles = function(styles, type)
{
if(styles)
{
for (var i in styles)
{
var bIsAddNeedStyle = (bPivotTable && styles[i].pivot) || (!bPivotTable && styles[i].table);
if (bIsAddNeedStyle)
if ((bPivotTable && styles[i].pivot) || (!bPivotTable && styles[i].table))
{
var image = t.af_getSmallIconTable(canvas, styles[i], props, {w: styleThumbnailWidth, h: styleThumbnailHeight, row: row, col: col});
var options = {name: i, displayName: styles[i].displayName, type: type, image: image};
result.push(new AscCommonExcel.formatTablePictures(options));
}
var options = new AscCommonExcel.formatTablePictures();
options.name = i;
options.displayName = styles[i].displayName;
options.type = type;
options.image = t.af_getSmallIconTable(canvas, styles[i], props, {w: styleThumbnailWidth, h: styleThumbnailHeight, row: row, col: col});
result.push(options);
}
}
};
addStyles(customStyles, "custom");
addStyles(wb.TableStyles.CustomStyles, "custom");
addStyles(defaultStyles, "default");
return result;
......
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