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

Поправлен баг с mcJc (matrix column justification)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56659 954022d7-b5bf-4e40-9824-e11837661b57
parent eec8920e
......@@ -5,8 +5,6 @@ function CMathBase()
{
this.typeObj = MATH_COMP;
// {align: {height: alpha, width: betta}} alpha & betta коэффициенты в интервале от 0 до 1, либо CENTER
this.pos = new CMathPosition();
this.size = null;
......@@ -19,18 +17,9 @@ function CMathBase()
this.CompiledCtrPrp = new CTextPr();
/////////////////
//this.RunPrp = new CMathRunPrp();
this.CurPos_X = 0;
this.CurPos_Y = 0;
/*this.selectPos =
{
startX: 0,
startY: 0
};*/
this.SelectStart_X = 0;
this.SelectStart_Y = 0;
......@@ -94,11 +83,17 @@ CMathBase.prototype =
this.alignment.hgt = [];
this.alignment.wdt = [];
for(var u = 0; u < this.nCol ; u++)
this.alignment.hgt[u] = CENTER;
/*for(var u = 0; u < this.nCol ; u++)
this.alignment.hgt[u] = MCJC_CENTER;
for(u=0; u < this.nRow; u++)
this.alignment.wdt[u] = CENTER;
this.alignment.wdt[u] = MCJC_CENTER;*/
for(var i = 0; i < this.nCol ; i++)
this.alignment.wdt[i] = MCJC_CENTER;
for(var j=0; j < this.nRow; j++)
this.alignment.hgt[j] = MCJC_CENTER;
},
///////// RunPrp, CtrPrp
setCtrPrp: function(txtPrp) // выставляем ctrPrp на чтение
......@@ -665,7 +660,7 @@ CMathBase.prototype =
{
var PosAlign = new CMathPosition();
if(this.alignment.hgt[pos_y] == CENTER)
if(this.alignment.hgt[pos_x] == MCJC_CENTER)
{
var maxAsc = 0;
var _ascent;
......@@ -684,10 +679,17 @@ CMathBase.prototype =
for(var j=0; j < this.nCol; j++)
{
var _h = this.elements[pos_x][j].size.height;
_h = this.elements[pos_x][j].size.height;
maxH = ( maxH > _h ) ? maxH : _h;
}
PosAlign.y = (maxH - this.elements[pos_x][pos_y].size.height)*this.alignment.hgt[pos_y];
var coeffHgt;
if(this.alignment.hgt[pos_x] == MCJC_RIGHT)
coeffHgt = 1;
else
coeffHgt = 0;
PosAlign.y = (maxH - this.elements[pos_x][pos_y].size.height)*coeffHgt;
}
var maxW = 0;
......@@ -697,10 +699,18 @@ CMathBase.prototype =
maxW = ( maxW > _w ) ? maxW : _w;
}
if(this.alignment.wdt[pos_x] == CENTER)
if(this.alignment.wdt[pos_y] == MCJC_CENTER)
PosAlign.x = (maxW - this.elements[pos_x][pos_y].size.width)*0.5;
else
PosAlign.x = (maxW - this.elements[pos_x][pos_y].size.width)*this.alignment.wdt[pos_x];
{
var coeffWdt;
if(this.alignment.wdt[pos_y] == MCJC_RIGHT)
coeffWdt = 1;
else
coeffWdt = 0;
PosAlign.x = (maxW - this.elements[pos_x][pos_y].size.width)*coeffWdt;
}
return PosAlign;
},
......@@ -966,11 +976,6 @@ CMathBase.prototype =
this.size = {width: width, height: height, ascent: ascent};
},
/*RecalculateReverse: function(oMeasure)
{
this.recalculateSize();
this.Parent.RecalculateReverse(oMeasure);
},*/
Resize: function(Parent, ParaMath, oMeasure)
{
this.Parent = Parent;
......@@ -989,20 +994,6 @@ CMathBase.prototype =
this.recalculateSize(oMeasure); // передаем oMeasure, для
},
old_getCenter: function(_height)
{
var res = 0;
if(this.nRow > 1)
{
res = _height || this.size.height;
res /=2;
}
else
for(var i=0; i< this.nCol; i++)
res = (this.elements[0][i].size.center > res) ? this.elements[0][i].size.center : res;
return res;
},
getAscent: function(oMeasure, _height)
{
var Ascent = 0;
......
"use strict";
var MATH_MC_JC = MCJC_CENTER;
function CMathMatrix(props)
{
this.Id = g_oIdCounter.Get_NewId();
......@@ -16,7 +19,7 @@ function CMathMatrix(props)
rSp: 0,
rSpRule: 0,
mcJc: MCJC_CENTER,
mcJc: new Array(),
baseJc: BASEJC_CENTER,
plcHide: false
};
......@@ -87,12 +90,16 @@ CMathMatrix.prototype.recalculateSize = function(oMeasure)
this.setRuleGap(this.spaceColumn, this.Pr.cGpRule, this.Pr.cGp, this.Pr.cSp);
this.setRuleGap(this.spaceRow, this.Pr.rSpRule, this.Pr.rSp);
for(var j = 0; j < this.nCol; j++)
this.alignment.wdt[j] = this.Pr.mcJc[j];
if(this.Pr.plcHide)
this.hidePlaceholder(true);
this.RecalcInfo.bProps = false;
}
var txtPrp = this.Get_CompiledCtrPrp();
var intervalCol = this.getLineGap(txtPrp);
......@@ -406,8 +413,23 @@ CMathMatrix.prototype.setProperties = function(props)
if(props.baseJc === BASEJC_CENTER || props.baseJc === BASEJC_TOP || props.baseJc === BASEJC_BOTTOM)
this.Pr.baseJc = props.baseJc;
if(props.mcJc == MCJC_CENTER || props.mcJc == MCJC_LEFT || props.mcJc == MCJC_RIGHT)
this.mcJc = props.mcJc;
if(props.mcJc.constructor.name == "Array" && props.mcJc.length == props.column)
{
for(var i = 0; i < this.nCol; i++)
{
if(props.mcJc[i] == MCJC_LEFT || props.mcJc[i] == MCJC_RIGHT || props.mcJc[i] == MCJC_CENTER)
this.Pr.mcJc[i] = props.mcJc[i];
else
this.Pr.mcJc[i] = MCJC_CENTER;
}
}
else
{
for(var j = 0; j < this.nCol; j++)
this.Pr.mcJc[j] = MCJC_CENTER;
}
this.Pr.cGpRule = props.cGpRule;
this.Pr.cGp = props.cGp;
......@@ -721,4 +743,19 @@ CEqArray.prototype.Read_FromBinary2 = function( Reader )
CEqArray.prototype.Get_Id = function()
{
return this.Id;
}
function TEST_MATH_JUCTIFICATION(mcJc)
{
MATH_MC_JC = mcJc;
editor.WordControl.m_oLogicDocument.Content[0].Content[0].Root.Resize(null, editor.WordControl.m_oLogicDocument.Content[0].Content[0] , g_oTextMeasurer);
var pos = new CMathPosition();
pos.x = 0;
pos.y = 0;
editor.WordControl.m_oLogicDocument.Content[0].Content[0].Root.setPosition(pos);
editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint();
}
\ No newline at end of file
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