Commit 5ba8a91f 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@66839 954022d7-b5bf-4e40-9824-e11837661b57
parent 30fd287e
......@@ -2836,15 +2836,13 @@ CAscMathCategory.prototype["get_W"] = function(){ return this.W; };
CAscMathCategory.prototype["get_H"] = function(){ return this.H; };
CAscMathCategory.prototype.private_Sort = function(){ this.Data.sort( function(a,b){ return a.Id- b.Id; } ); };
function CStyleImage(name, ind, type, image, uiPriority) {
function CStyleImage(name, type, image, uiPriority) {
this.name = name;
this.thumbnailOffset = ind;
this.type = type;
this.image = image;
this.uiPriority = uiPriority;
}
CStyleImage.prototype['asc_getName'] = CStyleImage.prototype['get_Name'] = function() { return this.name; };
CStyleImage.prototype['asc_getThumbnailOffset'] = CStyleImage.prototype['get_ThumbnailOffset'] = function() { return this.thumbnailOffset; };
CStyleImage.prototype['asc_getType'] = CStyleImage.prototype['get_Type'] = function() { return this.type; };
CStyleImage.prototype['asc_getImage'] = function() { return this.image; };
......
......@@ -1358,7 +1358,7 @@
// ToDo Возможно стоит переписать немного, чтобы не пробегать каждый раз по массиву custom-стилей (нужно генерировать AllStyles)
oCustomStyle = cellStylesAll.getCustomStyleByBuiltinId(oStyle.BuiltinId);
this.defaultStyles[i] = new CStyleImage(oStyle.Name, styleIndex, c_oAscStyleImage.Default);
this.defaultStyles[i] = new CStyleImage(oStyle.Name, c_oAscStyleImage.Default);
this.native.BeginDrawDefaultStyle(oStyle.Name, styleIndex);
this.drawStyle(oGraphics, stringRenderer, oCustomStyle || oStyle, oStyle.Name, styleIndex);
this.native.EndDrawStyle();
......@@ -1382,7 +1382,7 @@
oStyle = cellStyles[i];
if (oStyle.Hidden || null != oStyle.BuiltinId)
continue;
this.docStyles[styleIndex] = new CStyleImage(oStyle.Name, styleIndex, c_oAscStyleImage.Document);
this.docStyles[styleIndex] = new CStyleImage(oStyle.Name, c_oAscStyleImage.Document);
this.native.BeginDrawDocumentStyle(oStyle.Name, styleIndex);
this.drawStyle(oGraphics, stringRenderer, oStyle, oStyle.Name, styleIndex);
this.native.EndDrawStyle();
......
......@@ -1314,152 +1314,85 @@
}
/** @constructor */
function asc_CStylesPainter() {
// base64 defaultStyles image
this.defaultStylesImage = "";
this.defaultStyles = null;
// base64 docStyles image
this.docStylesImage = "";
this.docStyles = null;
this.styleThumbnailWidth = 112;
this.styleThumbnailHeight = 38;
this.styleThumbnailWidthPt = this.styleThumbnailWidth * 72 / 96;
this.styleThumbnailHeightPt = this.styleThumbnailHeight * 72 / 96;
this.styleThumbnailWidthWithRetina = this.styleThumbnailWidth;
this.styleThumbnailHeightWithRetina = this.styleThumbnailHeight;
if (AscBrowser.isRetina) {
this.styleThumbnailWidthWithRetina <<= 1;
this.styleThumbnailHeightWithRetina <<= 1;
}
}
asc_CStylesPainter.prototype = {
constructor: asc_CStylesPainter,
asc_getStyleThumbnailWidth: function () { return this.styleThumbnailWidthWithRetina; },
asc_getStyleThumbnailHeight: function () { return this.styleThumbnailHeightWithRetina; },
asc_getDefaultStyles: function () { return this.defaultStyles; },
asc_getDocStyles: function () { return this.docStyles; },
asc_getDefaultStylesImage: function () { return this.defaultStylesImage; },
asc_getDocStylesImage: function () { return this.docStylesImage; },
generateStylesAll: function (cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
this.generateDefaultStyles(cellStylesAll, fmgrGraphics, oFont, stringRenderer);
this.generateDocumentStyles(cellStylesAll, fmgrGraphics, oFont, stringRenderer);
},
generateDefaultStyles: function (cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
var nDefaultStylesCount = cellStylesAll.getDefaultStylesCount();
var cellStyles = cellStylesAll.DefaultStyles;
var nLength = cellStyles.length;
var oCanvas = document.createElement('canvas');
oCanvas.width = this.styleThumbnailWidthWithRetina;
oCanvas.height = nDefaultStylesCount * this.styleThumbnailHeightWithRetina;
var oGraphics = new asc.DrawingContext({canvas: oCanvas, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
// ToDo оставить один, когда меню добавит обработку (нарезаем по одной картинке)
var oCanvas2 = document.createElement('canvas');
oCanvas2.width = this.styleThumbnailWidthWithRetina;
oCanvas2.height = this.styleThumbnailHeightWithRetina;
var oGraphics2 = new asc.DrawingContext({canvas: oCanvas2, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var oStyle, oCustomStyle;
this.defaultStyles = [];
for (var i = 0, styleIndex = 0; i < nLength; ++i) {
oStyle = cellStyles[i];
if (oStyle.Hidden)
continue;
// ToDo Возможно стоит переписать немного, чтобы не пробегать каждый раз по массиву custom-стилей (нужно генерировать AllStyles)
oCustomStyle = cellStylesAll.getCustomStyleByBuiltinId(oStyle.BuiltinId);
this.drawStyle(oGraphics, stringRenderer, oCustomStyle || oStyle, oStyle.Name, styleIndex);
this.drawStyle2(oGraphics2, stringRenderer, oCustomStyle || oStyle, oStyle.Name);
this.defaultStyles[i] = new CStyleImage(oStyle.Name, styleIndex, c_oAscStyleImage.Default, oCanvas2.toDataURL("image/png"));
++styleIndex;
}
/** @constructor */
function asc_CStylesPainter() {
this.defaultStyles = null;
this.docStyles = null;
this.styleThumbnailWidth = 112;
this.styleThumbnailHeight = 38;
this.styleThumbnailWidthPt = this.styleThumbnailWidth * 72 / 96;
this.styleThumbnailHeightPt = this.styleThumbnailHeight * 72 / 96;
this.styleThumbnailWidthWithRetina = this.styleThumbnailWidth;
this.styleThumbnailHeightWithRetina = this.styleThumbnailHeight;
if (AscBrowser.isRetina) {
this.styleThumbnailWidthWithRetina <<= 1;
this.styleThumbnailHeightWithRetina <<= 1;
}
}
asc_CStylesPainter.prototype = {
constructor: asc_CStylesPainter,
asc_getStyleThumbnailWidth: function() {
return this.styleThumbnailWidthWithRetina;
},
asc_getStyleThumbnailHeight: function() {
return this.styleThumbnailHeightWithRetina;
},
asc_getDefaultStyles: function() {
return this.defaultStyles;
},
asc_getDocStyles: function() {
return this.docStyles;
},
generateStylesAll: function(cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
this.generateDefaultStyles(cellStylesAll, fmgrGraphics, oFont, stringRenderer);
this.generateDocumentStyles(cellStylesAll, fmgrGraphics, oFont, stringRenderer);
},
generateDefaultStyles: function(cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
var cellStyles = cellStylesAll.DefaultStyles;
var oCanvas = document.createElement('canvas');
oCanvas.width = this.styleThumbnailWidthWithRetina;
oCanvas.height = this.styleThumbnailHeightWithRetina;
var oGraphics = new asc.DrawingContext({canvas: oCanvas, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var oStyle, oCustomStyle;
this.defaultStyles = [];
for (var i = 0; i < cellStyles.length; ++i) {
oStyle = cellStyles[i];
if (oStyle.Hidden) {
continue;
}
// ToDo Возможно стоит переписать немного, чтобы не пробегать каждый раз по массиву custom-стилей (нужно генерировать AllStyles)
oCustomStyle = cellStylesAll.getCustomStyleByBuiltinId(oStyle.BuiltinId);
this.defaultStylesImage = (0 === styleIndex) ? "" : oCanvas.toDataURL("image/png");
},
generateDocumentStyles: function (cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
var nDocumentStylesCount = cellStylesAll.getCustomStylesCount();
var cellStyles = cellStylesAll.CustomStyles;
var nLength = cellStyles.length;
var oCanvas = document.createElement('canvas');
oCanvas.width = this.styleThumbnailWidthWithRetina;
oCanvas.height = nDocumentStylesCount * this.styleThumbnailHeightWithRetina;
var oGraphics = new asc.DrawingContext({canvas: oCanvas, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
// ToDo оставить один, когда меню добавит обработку (нарезаем по одной картинке)
var oCanvas2 = document.createElement('canvas');
oCanvas2.width = this.styleThumbnailWidthWithRetina;
oCanvas2.height = this.styleThumbnailHeightWithRetina;
var oGraphics2 = new asc.DrawingContext({canvas: oCanvas2, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var oStyle;
this.docStyles = [];
for (var i = 0, styleIndex = 0; i < nLength; ++i) {
oStyle = cellStyles[i];
if (oStyle.Hidden || null != oStyle.BuiltinId)
continue;
this.drawStyle(oGraphics, stringRenderer, oStyle, oStyle.Name, styleIndex);
this.drawStyle2(oGraphics2, stringRenderer, oStyle, oStyle.Name);
this.docStyles[styleIndex] = new CStyleImage(oStyle.Name, styleIndex, c_oAscStyleImage.Document, oCanvas2.toDataURL("image/png"));
++styleIndex;
}
this.drawStyle(oGraphics, stringRenderer, oCustomStyle || oStyle, oStyle.Name);
this.defaultStyles.push(new CStyleImage(oStyle.Name, c_oAscStyleImage.Default, oCanvas.toDataURL("image/png")));
}
},
generateDocumentStyles: function(cellStylesAll, fmgrGraphics, oFont, stringRenderer) {
var cellStyles = cellStylesAll.CustomStyles;
var oCanvas = document.createElement('canvas');
oCanvas.width = this.styleThumbnailWidthWithRetina;
oCanvas.height = this.styleThumbnailHeightWithRetina;
var oGraphics = new asc.DrawingContext({canvas: oCanvas, units: 1/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var oStyle;
this.docStyles = [];
for (var i = 0; i < cellStyles.length; ++i) {
oStyle = cellStyles[i];
if (oStyle.Hidden || null != oStyle.BuiltinId) {
continue;
}
this.docStylesImage = (0 === styleIndex) ? "" : oCanvas.toDataURL("image/png");
},
drawStyle: function (oGraphics, stringRenderer, oStyle, sStyleName, nIndex) {
var nOffsetY = nIndex * this.styleThumbnailHeightPt;
// Fill cell
var oColor = oStyle.getFill();
oGraphics.save().beginPath();
if (null !== oColor)
oGraphics.setFillStyle(oColor);
oGraphics.rect(0, nOffsetY, this.styleThumbnailWidthPt, this.styleThumbnailHeightPt).clip();
if (null !== oColor)
oGraphics.fill();
var drawBorder = function (b, x1, y1, x2, y2) {
if (null != b && c_oAscBorderStyles.None !== b.s) {
oGraphics.setStrokeStyle(b.c);
// ToDo поправить
oGraphics.setLineWidth(b.w).beginPath().moveTo(x1, y1).lineTo(x2, y2).stroke();
}
};
// borders
var oBorders = oStyle.getBorder();
drawBorder(oBorders.l, 0, nOffsetY, 0, nOffsetY + this.styleThumbnailHeightPt);
drawBorder(oBorders.r, this.styleThumbnailWidthPt, nOffsetY, this.styleThumbnailWidthPt, nOffsetY + this.styleThumbnailHeightPt);
drawBorder(oBorders.t, 0, nOffsetY, this.styleThumbnailWidthPt, nOffsetY);
drawBorder(oBorders.b, 0, nOffsetY + this.styleThumbnailHeightPt, this.styleThumbnailWidthPt, nOffsetY + this.styleThumbnailHeightPt);
// Draw text
var fc = oStyle.getFontColor();
var oFontColor = fc !== null ? fc : new CColor(0, 0, 0);
var format = oStyle.getFont();
// Для размера шрифта делаем ограничение для превью в 16pt (у Excel 18pt, но и высота превью больше 22px)
var oFont = new asc.FontProperties(format.fn, (16 < format.fs) ? 16 : format.fs,
format.b, format.i, format.u, format.s);
var width_padding = 3; // 4 * 72 / 96
var tm = stringRenderer.measureString(sStyleName);
// Текст будем рисовать по центру (в Excel чуть по другому реализовано, у них постоянный отступ снизу)
var textY = 0.5 * (nOffsetY + (nOffsetY + this.styleThumbnailHeightPt) - tm.height);
oGraphics.setFont(oFont);
oGraphics.setFillStyle(oFontColor);
oGraphics.fillText(sStyleName, width_padding, textY + tm.baseline);
oGraphics.restore();
},
drawStyle2: function (oGraphics, stringRenderer, oStyle, sStyleName) {
this.drawStyle(oGraphics, stringRenderer, oStyle, oStyle.Name);
this.docStyles.push(new CStyleImage(oStyle.Name, c_oAscStyleImage.Document, oCanvas.toDataURL("image/png")));
}
},
drawStyle: function(oGraphics, stringRenderer, oStyle, sStyleName) {
oGraphics.clear();
// Fill cell
var oColor = oStyle.getFill();
......@@ -1468,7 +1401,7 @@
oGraphics.fillRect(0, 0, this.styleThumbnailWidthPt, this.styleThumbnailHeightPt);
}
var drawBorder = function (b, x1, y1, x2, y2) {
var drawBorder = function(b, x1, y1, x2, y2) {
if (null != b && c_oAscBorderStyles.None !== b.s) {
oGraphics.setStrokeStyle(b.c);
......@@ -1489,8 +1422,7 @@
var oFontColor = fc !== null ? fc : new CColor(0, 0, 0);
var format = oStyle.getFont();
// Для размера шрифта делаем ограничение для превью в 16pt (у Excel 18pt, но и высота превью больше 22px)
var oFont = new asc.FontProperties(format.fn, (16 < format.fs) ? 16 : format.fs,
format.b, format.i, format.u, format.s);
var oFont = new asc.FontProperties(format.fn, (16 < format.fs) ? 16 : format.fs, format.b, format.i, format.u, format.s);
var width_padding = 3; // 4 * 72 / 96
......@@ -1501,7 +1433,7 @@
oGraphics.setFillStyle(oFontColor);
oGraphics.fillText(sStyleName, width_padding, textY + tm.baseline);
}
};
};
/** @constructor */
function asc_CSheetPr() {
......@@ -1756,8 +1688,6 @@
prot["asc_getStyleThumbnailHeight"] = prot.asc_getStyleThumbnailHeight;
prot["asc_getDefaultStyles"] = prot.asc_getDefaultStyles;
prot["asc_getDocStyles"] = prot.asc_getDocStyles;
prot["asc_getDefaultStylesImage"] = prot.asc_getDefaultStylesImage;
prot["asc_getDocStylesImage"] = prot.asc_getDocStylesImage;
window["Asc"]["asc_CSheetPr"] = window["Asc"].asc_CSheetPr = asc_CSheetPr;
......
......@@ -6952,11 +6952,7 @@ function CDrawingDocument()
}
function CStylesPainter()
{
// base64 defaultStyles image
this.defaultStylesImage = "";
this.defaultStyles = null;
this.docStylesImage = "";
this.docStyles = null;
this.mergedStyles = null;
......@@ -7041,17 +7037,11 @@ CStylesPainter.prototype =
},
GenerateDefaultStyles: function(_api, ds) {
var styles = ds;
var _count = 0;
for (var i in styles)
_count++;
var cur_index = 0;
// добавили переводы => нельзя кэшировать
var _canvas = document.createElement('canvas');
_canvas.width = this.STYLE_THUMBNAIL_WIDTH;
_canvas.height = _count * this.STYLE_THUMBNAIL_HEIGHT;
_canvas.height = this.STYLE_THUMBNAIL_HEIGHT;
var ctx = _canvas.getContext('2d');
ctx.fillStyle = "#FFFFFF";
......@@ -7065,35 +7055,15 @@ CStylesPainter.prototype =
}
graphics.m_oFontManager = g_fontManager;
var _canvas2 = document.createElement('canvas');
_canvas2.width = this.STYLE_THUMBNAIL_WIDTH;
_canvas2.height = this.STYLE_THUMBNAIL_HEIGHT;
var ctx2 = _canvas2.getContext('2d');
ctx2.fillStyle = "#FFFFFF";
ctx2.fillRect(0, 0, _canvas2.width, _canvas2.height);
var graphics2 = new CGraphics();
if (!this.IsRetinaEnabled) {
graphics2.init(ctx2, _canvas2.width, _canvas2.height, _canvas2.width * g_dKoef_pix_to_mm, _canvas2.height * g_dKoef_pix_to_mm);
} else {
graphics2.init(ctx2, _canvas2.width, _canvas2.height, _canvas2.width * g_dKoef_pix_to_mm / 2, _canvas2.height * g_dKoef_pix_to_mm / 2);
}
graphics2.m_oFontManager = g_fontManager;
var DocumentStyles = _api.WordControl.m_oLogicDocument.Get_Styles();
this.defaultStyles = [];
for (var i in styles) {
var style = styles[i];
if (true == style.qFormat && null === DocumentStyles.Get_StyleIdByName(style.Name, false)) {
this.drawStyle(graphics, style, cur_index);
this.drawStyle2(graphics2, style);
this.defaultStyles[cur_index] = new CStyleImage(style.Name, cur_index, c_oAscStyleImage.Default, _canvas2.toDataURL("image/png"), style.uiPriority);
cur_index++;
this.drawStyle(graphics, style);
this.defaultStyles.push(new CStyleImage(style.Name, c_oAscStyleImage.Default, _canvas.toDataURL("image/png"), style.uiPriority));
}
}
this.defaultStylesImage = _canvas.toDataURL("image/png");
},
GenerateDocumentStyles: function(_api) {
......@@ -7108,18 +7078,11 @@ CStylesPainter.prototype =
return;
}
var _count = 0;
for (var i in styles)
_count++;
if (0 == _count) {
return;
}
var cur_index = 0;
var _canvas = document.createElement('canvas');
_canvas.width = this.STYLE_THUMBNAIL_WIDTH;
_canvas.height = _count * this.STYLE_THUMBNAIL_HEIGHT;
_canvas.height = this.STYLE_THUMBNAIL_HEIGHT;
var ctx = _canvas.getContext('2d');
if (window["flat_desine"] !== true) {
......@@ -7135,24 +7098,6 @@ CStylesPainter.prototype =
}
graphics.m_oFontManager = g_fontManager;
var _canvas2 = document.createElement('canvas');
_canvas2.width = this.STYLE_THUMBNAIL_WIDTH;
_canvas2.height = this.STYLE_THUMBNAIL_HEIGHT;
var ctx2 = _canvas2.getContext('2d');
if (window["flat_desine"] !== true) {
ctx2.fillStyle = "#FFFFFF";
ctx2.fillRect(0, 0, _canvas2.width, _canvas2.height);
}
var graphics2 = new CGraphics();
if (!this.IsRetinaEnabled) {
graphics2.init(ctx2, _canvas2.width, _canvas2.height, _canvas2.width * g_dKoef_pix_to_mm, _canvas2.height * g_dKoef_pix_to_mm);
} else {
graphics2.init(ctx2, _canvas2.width, _canvas2.height, _canvas2.width * g_dKoef_pix_to_mm / 2, _canvas2.height * g_dKoef_pix_to_mm / 2);
}
graphics2.m_oFontManager = g_fontManager;
this.docStyles = [];
for (var i in styles) {
var style = styles[i];
......@@ -7167,9 +7112,8 @@ CStylesPainter.prototype =
_dr_style.Name = style.Name;
_dr_style.Id = i;
this.drawStyle(graphics, _dr_style, cur_index);
this.drawStyle2(graphics2, _dr_style);
this.docStyles[cur_index] = new CStyleImage(style.Name, cur_index, c_oAscStyleImage.Document, _canvas2.toDataURL("image/png"), style.uiPriority);
this.drawStyle(graphics, _dr_style);
this.docStyles[cur_index] = new CStyleImage(style.Name, c_oAscStyleImage.Document, _canvas.toDataURL("image/png"), style.uiPriority);
// алгоритм смены имени
if (style.Default) {
......@@ -7193,198 +7137,8 @@ CStylesPainter.prototype =
cur_index++;
}
}
this.docStylesImage = _canvas.toDataURL("image/png");
},
drawStyle: function(graphics, style, index)
{
var font = { FontFamily : { Name: "Times New Roman", Index : -1 }, Color : { r : 0, g : 0, b : 0 }, Bold : false, Italic : false, FontSize : 10 };
var textPr = style.TextPr;
if (textPr.FontFamily != undefined)
{
font.FontFamily.Name = textPr.FontFamily.Name;
font.FontFamily.Index = textPr.FontFamily.Index;
}
if (textPr.Bold != undefined)
font.Bold = textPr.Bold;
if (textPr.Italic != undefined)
font.Italic = textPr.Italic;
if (textPr.FontSize != undefined)
font.FontSize = textPr.FontSize;
graphics.SetFont(font);
if (textPr.Color == undefined)
graphics.b_color1(0, 0, 0, 255);
else
graphics.b_color1(textPr.Color.r, textPr.Color.g, textPr.Color.b, 255);
var dKoefToMM = g_dKoef_pix_to_mm;
if (this.IsRetinaEnabled)
dKoefToMM /= 2;
if (window["flat_desine"] !== true)
{
var y = index * dKoefToMM * this.STYLE_THUMBNAIL_HEIGHT;
var b = (index + 1) * dKoefToMM * this.STYLE_THUMBNAIL_HEIGHT;
var w = dKoefToMM * this.STYLE_THUMBNAIL_WIDTH;
graphics.transform(1,0,0,1,0,0);
graphics.save();
graphics._s();
graphics._m(-0.5, y);
graphics._l(w, y);
graphics._l(w, b);
graphics._l(0, b);
graphics._z();
graphics.clip();
graphics.t(this.CurrentTranslate.StylesText, 0.5, (y + b) / 2);
var ctx = graphics.m_oContext;
ctx.setTransform(1,0,0,1,0,0);
ctx.fillStyle = "#E8E8E8";
var _b = (index + 1) * this.STYLE_THUMBNAIL_HEIGHT - 1.5;
var _x = 2;
var _w = this.STYLE_THUMBNAIL_WIDTH - 4;
var _h = (this.STYLE_THUMBNAIL_HEIGHT / 3) >> 0;
ctx.beginPath();
ctx.moveTo(_x, _b - _h);
ctx.lineTo(_x + _w, _b - _h);
ctx.lineTo(_x + _w, _b);
ctx.lineTo(_x, _b);
ctx.closePath();
ctx.fill();
ctx.lineWidth = 1;
ctx.strokeStyle = "#D8D8D8";
ctx.beginPath();
ctx.rect(0.5, index * this.STYLE_THUMBNAIL_HEIGHT + 0.5, this.STYLE_THUMBNAIL_WIDTH - 1, this.STYLE_THUMBNAIL_HEIGHT - 1);
ctx.stroke();
graphics.restore();
}
else
{
g_oTableId.m_bTurnOff = true;
History.TurnOff();
var oldDefTabStop = Default_Tab_Stop;
Default_Tab_Stop = 1;
var hdr = new CHeaderFooter(editor.WordControl.m_oLogicDocument.HdrFtr, editor.WordControl.m_oLogicDocument, editor.WordControl.m_oDrawingDocument, hdrftr_Header);
var _dc = hdr.Content;//new CDocumentContent(editor.WordControl.m_oLogicDocument, editor.WordControl.m_oDrawingDocument, 0, 0, 0, 0, false, true, false);
var par = new Paragraph(editor.WordControl.m_oDrawingDocument, _dc, 0, 0, 0, 0, false);
var run = new ParaRun(par, false);
for (var i = 0; i < style.Name.length; i++)
{
run.Add_ToContent(i, new ParaText(style.Name.charAt(i)), false);
}
_dc.Internal_Content_Add(0, par, false);
par.Add_ToContent(0, run);
par.Style_Add(style.Id, false);
par.Set_Align(align_Left);
par.Set_Tabs(new CParaTabs());
var _brdL = style.ParaPr.Brd.Left;
if ( undefined !== _brdL && null !== _brdL )
{
var brdL = new CDocumentBorder();
brdL.Set_FromObject(_brdL);
brdL.Space = 0;
par.Set_Border(brdL, historyitem_Paragraph_Borders_Left);
}
var _brdT = style.ParaPr.Brd.Top;
if ( undefined !== _brdT && null !== _brdT )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdT);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Top);
}
var _brdB = style.ParaPr.Brd.Bottom;
if ( undefined !== _brdB && null !== _brdB )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdB);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Bottom);
}
var _brdR = style.ParaPr.Brd.Right;
if ( undefined !== _brdR && null !== _brdR )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdR);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Right);
}
var _ind = new CParaInd();
_ind.FirstLine = 0;
_ind.Left = 0;
_ind.Right = 0;
par.Set_Ind(_ind, false);
var _sp = new CParaSpacing();
_sp.Line = 1;
_sp.LineRule = linerule_Auto;
_sp.Before = 0;
_sp.BeforeAutoSpacing = false;
_sp.After = 0;
_sp.AfterAutoSpacing = false;
par.Set_Spacing(_sp, false);
_dc.Reset(0, 0, 10000, 10000);
_dc.Recalculate_Page(0, true);
_dc.Reset(0, 0, par.Lines[0].Ranges[0].W + 0.001, 10000);
_dc.Recalculate_Page(0, true);
//par.Reset(0, 0, 10000, 10000, 0);
//par.Recalculate_Page(0);
var y = index * dKoefToMM * this.STYLE_THUMBNAIL_HEIGHT;
var b = (index + 1) * dKoefToMM * this.STYLE_THUMBNAIL_HEIGHT;
var w = dKoefToMM * this.STYLE_THUMBNAIL_WIDTH;
var off = 10 * dKoefToMM;
var off2 = 5 * dKoefToMM;
var off3 = 1 * dKoefToMM;
graphics.transform(1,0,0,1,0,0);
graphics.save();
graphics._s();
graphics._m(off2, y + off3);
graphics._l(w - off, y + off3);
graphics._l(w - off, b - off3);
graphics._l(off2, b - off3);
graphics._z();
graphics.clip();
//graphics.t(style.Name, off + 0.5, y + 0.75 * (b - y));
var baseline = par.Lines[0].Y;
par.Shift(0, off + 0.5, y + 0.75 * (b - y) - baseline);
par.Draw(0, graphics);
graphics.restore();
Default_Tab_Stop = oldDefTabStop;
g_oTableId.m_bTurnOff = false;
History.TurnOn();
}
},
drawStyle2: function(graphics, style)
drawStyle: function(graphics, style)
{
var ctx = graphics.m_oContext;
ctx.fillStyle = "#FFFFFF";
......
......@@ -136,8 +136,6 @@ CHeaderProp.prototype.get_Locked = function() { return this.Locked; };
// [!dirty hack for minimizer - don't delete this comment!] function CStylesPainter ()
// [!dirty hack for minimizer - don't delete this comment!] function CFont ()
CStylesPainter.prototype.get_DefaultStylesImage = function() { return this.defaultStylesImage; };
CStylesPainter.prototype.get_DocStylesImage = function() { return this.docStylesImage; };
CStylesPainter.prototype.get_MergedStyles = function() { return this.mergedStyles; };
CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH = function() { return this.STYLE_THUMBNAIL_WIDTH; };
CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT = function() { return this.STYLE_THUMBNAIL_HEIGHT; };
......@@ -1933,7 +1931,7 @@ asc_docs_api.prototype.processSavedFile = function(url, downloadType) {
}
});
} else {
asc_docs_api.superclass.constructor.prototype.processSavedFile.call(this, url, downloadType);
asc_docs_api.superclass.processSavedFile.call(this, url, downloadType);
}
};
asc_docs_api.prototype.startGetDocInfo = function(){
......
......@@ -40,8 +40,6 @@ CHeaderProp.prototype['put_DifferentEvenOdd'] = CHeaderProp.prototype.put_Differ
CHeaderProp.prototype['get_LinkToPrevious'] = CHeaderProp.prototype.get_LinkToPrevious;
CHeaderProp.prototype['get_Locked'] = CHeaderProp.prototype.get_Locked;
window['CStylesPainter'] = CStylesPainter;
CStylesPainter.prototype['get_DefaultStylesImage'] = CStylesPainter.prototype.get_DefaultStylesImage;
CStylesPainter.prototype['get_DocStylesImage'] = CStylesPainter.prototype.get_DocStylesImage;
CStylesPainter.prototype['get_MergedStyles'] = CStylesPainter.prototype.get_MergedStyles;
CStylesPainter.prototype['get_STYLE_THUMBNAIL_WIDTH'] = CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH;
CStylesPainter.prototype['get_STYLE_THUMBNAIL_HEIGHT'] = CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT;
......
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