Commit af010445 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Прокинула TextPr для добавляемых в контент пустых ранов

2. Реализовала MathToImageConverter (конвертирование формулы в картинку base64)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56672 954022d7-b5bf-4e40-9824-e11837661b57
parent 2f832192
......@@ -814,6 +814,48 @@ ParaMath.prototype =
// Функция для работы с формулой
// в тч с дефолтными текстовыми настройками и argSize
//-----------------------------------------------------------------------------------
MathToImageConverter: function()
{
window.IsShapeToImageConverter = true;
var dKoef = g_dKoef_mm_to_pix;
var w_mm = this.Width;
var h_mm = this.Height;
var w_px = (w_mm * dKoef) >> 0;
var h_px = (h_mm * dKoef) >> 0;
var _need_pix_width = this.Width + 1;
var _need_pix_height = this.Height + 1;
var _canvas = document.createElement('canvas');
_canvas.width = w_px;
_canvas.height = h_px;
var _ctx = _canvas.getContext('2d');
var g = new CGraphics();
g.init(_ctx, w_px, h_px, w_mm, h_mm);
g.m_oFontManager = g_fontManager;
g.m_oCoordTransform.tx = 0;
g.m_oCoordTransform.ty = 0;
g.transform(1,0,0,1,0,0);
this.Root.draw( 0, 0, g);
window.IsShapeToImageConverter = false;
var _ret = { ImageNative : _canvas, ImageUrl : "" };
try
{
_ret.ImageUrl = _canvas.toDataURL("image/png");
}
catch (err)
{
_ret.ImageUrl = "";
}
return _ret;
},
ApplyArgSize : function(oWPrp, argSize)
{
var tPrp = new CTextPr();
......@@ -1453,4 +1495,14 @@ ParaMath.prototype =
this.Root = Element;
}
};
\ No newline at end of file
};
var MATH_CTX = null;
function TEST_MATH_ImageConverter()
{
var dataImg = editor.WordControl.m_oLogicDocument.Content[0].Content[0].MathToImageConverter();
console.log(dataImg.ImageUrl);
}
\ No newline at end of file
......@@ -4344,7 +4344,8 @@ ParaRun.prototype =
this.Recalc_CompiledPr(true);
// TODO: Орфография: пока сделаем так, в будущем надо будет переделать
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
if(undefined !== this.Paragraph && this.Paragraph !== null)
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
},
Apply_TextPr : function(TextPr, IncFontSize, ApplyToAll)
......
......@@ -677,7 +677,7 @@ CMathBase.prototype =
var maxH = 0;
var _h;
for(var j=0; j < this.nCol; j++)
for(var j = 0; j < this.nCol; j++)
{
_h = this.elements[pos_x][j].size.height;
maxH = ( maxH > _h ) ? maxH : _h;
......
......@@ -6079,8 +6079,8 @@ CMathContent.prototype =
if(bCurrComp && !bLeftRun) // добавление пустого Run перед мат объектом
{
var emptyRun = new ParaRun(null, true);
//var txtPrp = current.Get_TxtPrp();
//emptyRun.Set_Pr(txtPrp);
var txtPrp = current.Get_CtrPrp();
emptyRun.Set_Pr(txtPrp);
NewContent.push(emptyRun);
NewContent.push(this.content[i]); // Math Object
......@@ -6104,8 +6104,8 @@ CMathContent.prototype =
var emptyRun = new ParaRun(null, true);
//var emptyRun = new ParaRun(this.ParaMath.Paragraph, true);
//var txtPrp = current.Get_TxtPrp();
//emptyRun.Set_Pr(txtPrp);
var txtPrp = current.Get_CtrPrp();
emptyRun.Set_Pr(txtPrp);
NewContent.push(emptyRun);
}
......
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