Commit e4688b4e authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Полностью переделан селект и работа с курсором в формулах.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58907 954022d7-b5bf-4e40-9824-e11837661b57
parent bbf10095
......@@ -1693,7 +1693,7 @@ ParaHyperlink.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
//-----------------------------------------------------------------------------------
ParaHyperlink.prototype.Set_SelectionContentPos = function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
var Selection = this.State.Selection;
var Selection = this.Selection;
var OldStartPos = Selection.StartPos;
var OldEndPos = Selection.EndPos;
......@@ -1783,7 +1783,7 @@ ParaHyperlink.prototype.Selection_Stop = function()
ParaHyperlink.prototype.Selection_Remove = function()
{
var Selection = this.State.Selection;
var Selection = this.Selection;
if ( true === Selection.Use )
{
......@@ -1814,22 +1814,22 @@ ParaHyperlink.prototype.Select_All = function(Direction)
{
var ContentLen = this.Content.length;
var Selection = this.State.Selection;
var Selection = this.Selection;
Selection.Use = true;
if ( -1 === Direction )
{
Selection.StartPos = this.Content.length - 1;
Selection.StartPos = ContentLen - 1;
Selection.EndPos = 0;
}
else
{
Selection.StartPos = 0;
Selection.EndPos = this.Content.length - 1;
Selection.EndPos = ContentLen - 1;
}
for ( var CurPos = 0; CurPos < this.Content.length; CurPos++ )
for ( var CurPos = 0; CurPos < ContentLen; CurPos++ )
{
this.Content[CurPos].Select_All( Direction );
}
......
This diff is collapsed.
......@@ -12367,6 +12367,8 @@ CParagraphContentPos.prototype =
PRPos.Add( this.Data[Index] );
}
PRPos.Depth = this.Depth;
return PRPos;
},
......@@ -12669,6 +12671,7 @@ function CParagraphSearchPosXY()
this.CurX = 0;
this.CurY = 0;
this.X = 0;
this.Y = 0;
this.DiffX = 1000000; // километра для ограничения должно хватить
this.NumberingDiffX = 1000000; // километра для ограничения должно хватить
......
......@@ -644,27 +644,4 @@ CAccent.prototype.draw = function(x, y, pGraphics)
}
this.operator.draw(x, y, pGraphics);
}
CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var align = (this.size.width - this.elements[0][0].size.width - this.GapLeft - this.GapRight)/2;
SearchPos.CurX += this.GapLeft + align;
var result = this.elements[0][0].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
if(result)
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(0, Depth+1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(0, Depth + 1);
}
SearchPos.CurX += this.GapRight + align;
return result;
}
\ No newline at end of file
This diff is collapsed.
......@@ -338,29 +338,6 @@ CBorderBox.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(NewPos, PosInfo);
}
CBorderBox.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var alignLeft = this.Pr.hideLeft ? 0 : this.gapBrd,
alignRight = this.Pr.hideRight ? 0 : this.gapBrd;
SearchPos.CurX += this.GapLeft + alignLeft;
var result = this.elements[0][0].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
if(result)
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(0, Depth + 1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(0, Depth + 1);
}
SearchPos.CurX += this.GapRight + alignRight;
return result;
}
function CMathBoxPr()
{
......
......@@ -254,8 +254,8 @@ CDegree.prototype.init = function(props)
};
CDegree.prototype.fillContent = function()
{
this.iterContent = this.Content[0];
this.baseContent = this.Content[1];
this.iterContent = this.Content[1];
this.baseContent = this.Content[0];
CDegree.superclass.fillContent.apply(this, arguments);
};
......@@ -558,8 +558,16 @@ CDegreeSubSup.prototype.init = function(props)
CDegreeSubSup.prototype.fillContent = function()
{
this.baseContent = this.Content[2];
this.iters = new CIterators(this.Content[1], this.Content[0]);
if (DEGREE_SubSup === this.Pr.type)
{
this.baseContent = this.Content[0];
this.iters = new CIterators(this.Content[2], this.Content[1]);
}
else
{
this.baseContent = this.Content[2];
this.iters = new CIterators(this.Content[1], this.Content[0]);
}
CDegreeSubSup.superclass.fillContent.apply(this, arguments);
};
This diff is collapsed.
......@@ -749,39 +749,6 @@ CMathText.prototype =
return false;
},
////
// for Para Math
// for placeholder
Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
if(StartFlag == 0)
StartContentPos.Update2(0, Depth);
if(EndFlag == 0)
EndContentPos.Update2(1, Depth);
},
Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw)
{
SelectionDraw.W += this.size.width;
SelectionDraw.FindStart = false;
},
Get_ParaContentPos: function(bSelection, bStart, ContentPos)
{
if(bSelection)
{
var pos = bStart ? 0 : 1;
ContentPos.Add(pos);
}
else
ContentPos.Add(0);
},
Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.bPlaceholder = true;
},
Copy: function()
{
var NewLetter = new CMathText(this.bJDraw);
......
......@@ -417,99 +417,6 @@ CMatrixBase.prototype.getRowSpace = function(spaceRow, txtPrp)
return lineGap;
};
CMatrixBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
var X = this.ParaMath.X + this.pos.x + this.GapLeft, // this.ParaMath.X + this.pos.x совпадает с SearchPos.CurX
Y = this.ParaMath.Y + this.pos.y;
var CurrX, CurrY,
W_CurX,
Diff = 100000000;
var W = 0, H = 0;
var rX, rY,
minR;
for(var i=0; i < this.nRow; i++)
{
for(var j=0; j < this.nCol; j++)
{
if(!this.elements[i][j].IsJustDraw())
{
var x1 = SearchPos.X - X - W,
x2 = SearchPos.X - X - W - Widths[j],
y1 = SearchPos.Y - Y - H,
y2 = SearchPos.Y - Y - H - Heights[i];
var bInY = 0 < y1 && y2 < 0,
bInX = 0 < x1 && x2 < 0;
rX = x1*x1 < x2*x2 ? x1 : x2;
rY = y1*y1 < y2*y2 ? y1 : y2;
if(bInY && bInX)
minR = 0;
else if(!bInY && !bInX)
minR = rX*rX + rY*rY;
else if(bInY)
minR = rX*rX;
else
minR = rY*rY;
if(Diff > minR)
{
Diff = minR;
CurrX = i;
CurrY = j;
W_CurX = W;
}
}
W += Widths[j] + this.gaps.column[j];
}
W = 0;
H += Heights[i] + this.gaps.row[i];
}
var PrevSearchCurX = SearchPos.CurX;
SearchPos.CurX += this.GapLeft + W_CurX;
//var SearchCurX = SearchPos.CurX + this.GapLeft + W_CurX ;
if(this.kind === MATH_MATRIX)
{
SearchPos.CurX += this.align(CurrX, CurrY).x;
}
var result = this.elements[CurrX][CurrY].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
if(result)
{
SearchPos.Pos.Update2(CurrX, Depth);
SearchPos.Pos.Update2(CurrY, Depth + 1);
SearchPos.InTextPos.Update(CurrX, Depth);
SearchPos.InTextPos.Update(CurrY, Depth + 1);
}
SearchPos.CurX = PrevSearchCurX + this.size.width;
return result;
};
function CMathMatrix(props)
{
......@@ -605,18 +512,6 @@ CMathMatrix.prototype.getMetrics = function(RPI)
return {ascents: Ascents, descents: Descents, widths: Widths}
};
CMathMatrix.prototype.findDistance = function() // для получения позиции тагета
{
var w = 0, h = 0;
//кол-во элементов gap равно кол-ву элементов в строке/столбце для удобства подсчета
for(var i = 0; i < this.CurPos_X; i++)
w += this.gaps.column[i];
for(var j = 0; j < this.CurPos_Y; j++)
h += this.gaps.row[j];
return {w : w, h: h };
}
CMathMatrix.prototype.setRowGapRule = function(rule, gap)
{
this.spaceRow.rule = rule;
......
......@@ -3700,38 +3700,6 @@ CDelimiter.prototype.setPosition = function(position, PosInfo)
content.setPosition(PosContent); // CMathContent*/
}
CDelimiter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var begWidth = this.begOper.size.width,
sepWidth = this.sepOper.size.width,
endWidth = this.endOper.size.width;
SearchPos.CurX += begWidth + this.GapLeft;
var result;
for(var j = 0; j < this.nCol; j++)
{
if(this.elements[0][j].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(j, Depth+1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(j, Depth + 1);
result = true;
}
if(j < this.nCol - 1)
SearchPos.CurX += sepWidth;
}
SearchPos.CurX += endWidth + this.GapRight;
return result;
}
CDelimiter.prototype.draw = function(x, y, pGraphics)
{
......@@ -3835,29 +3803,6 @@ CCharacter.prototype.setPosition = function(pos, PosInfo)
this.operator.setPosition(PosOper);
}
}
CCharacter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var align = (this.size.width - this.elements[0][0].size.width - this.GapLeft - this.GapRight)/2;
SearchPos.CurX += this.GapLeft + align;
var result = this.elements[0][0].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
if(result)
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(0, Depth+1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(0, Depth + 1);
}
SearchPos.CurX += this.GapRight + align;
return result;
}
CCharacter.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
......
......@@ -425,9 +425,13 @@ CRadical.prototype.kind = MATH_RADICAL;
CRadical.prototype.init = function(props)
{
this.Fill_LogicalContent(2);
this.setProperties(props);
if (true === this.Pr.degHide)
this.Fill_LogicalContent(1);
else
this.Fill_LogicalContent(2);
this.fillContent();
}
CRadical.prototype.fillContent = function()
......@@ -622,61 +626,6 @@ CRadical.prototype.setPosition = function(pos, PosInfo)
this.RealBase.setPosition(PosBase, PosInfo);
}
}
CRadical.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var result = false;
if(this.Pr.type == SQUARE_RADICAL)
{
SearchPos.CurX += this.size.width - this.Base.size.width - this.GapRight;
if(this.Base.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(0, Depth + 1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(0, Depth + 1);
result = true;
}
SearchPos.CurX += this.GapRight;
}
else
{
SearchPos.CurX += this.GapLeft;
if(this.Iterator.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(0, Depth + 1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(0, Depth + 1);
result = true;
}
SearchPos.CurX += this.size.width - this.Iterator.size.width - this.Base.size.width - this.GapRight;
if(this.Base.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update2(0, Depth);
SearchPos.Pos.Update2(1, Depth + 1);
SearchPos.InTextPos.Update(0, Depth);
SearchPos.InTextPos.Update(1, Depth + 1);
result = true;
}
SearchPos.CurX += this.GapRight;
}
return result;
}
CRadical.prototype.draw = function(x, y, pGraphics)
{
this.signRadical.draw(x, y, pGraphics);
......@@ -684,7 +633,10 @@ CRadical.prototype.draw = function(x, y, pGraphics)
}
CRadical.prototype.getBase = function()
{
return this.Content[1];
if (true === this.Pr.degHide)
return this.Content[0];
else
return this.Content[1];
}
CRadical.prototype.getDegree = function()
{
......
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