Commit 00a081ff authored by Anna.Pavlova's avatar Anna.Pavlova

селект для плейсхолдера

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55471 954022d7-b5bf-4e40-9824-e11837661b57
parent e9ae5ba8
......@@ -826,15 +826,13 @@ ParaMath.prototype =
SearchPos.X = X;
SearchPos.Y = Y;
Result = true;
//////////
SearchPos.InText = true;
SearchPos.DiffX = 0.001; // сравниваем расстояние до ближайшего элемента
}
}
......@@ -927,6 +925,25 @@ ParaMath.prototype =
{
// TODO: ParaMath.Set_SelectionContentPos
if(StartFlag == 0)
{
var str = "";
for(var i = 0; i < StartContentPos.Data.length; i++)
str += StartContentPos.Data[i] + " ";
//console.log("StartContentPos " + str);
}
if(EndFlag == 0)
{
var str = "";
for(var i = 0; i < EndContentPos.Data.length; i++)
str += EndContentPos.Data [i]+ " ";
//console.log("EndContentPos " + str);
}
this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
this.bSelectionUse = true;
......@@ -1013,7 +1030,6 @@ ParaMath.prototype =
{
// TODO: ParaMath.Selection_IsEmpty
//return false;
return this.Root.Selection_IsEmpty();
},
......
......@@ -14326,7 +14326,7 @@ Paragraph.prototype =
var SearchPosXY = this.Get_ParaContentPosByXY( X, Y, PageIndex + this.PageNum, false, false );
if ( SearchPosXY.Pos.Compare( SelSP ) >= 0 && SearchPosXY.Pos.Compare( SelEP ) <= 0 )
if ( SearchPosXY.Pos.Compare( SelSP ) >= 0 && SearchPosXY.Pos.Compare( SelEP ) <= 0 && true !== SearchPosXY.Pos.bPlaceholder )
return true;
return false;
......@@ -22079,6 +22079,7 @@ function CParagraphContentPos()
{
this.Data = [0, 0, 0];
this.Depth = 0;
this.bPlaceholder = false;
}
CParagraphContentPos.prototype =
......
......@@ -6546,10 +6546,8 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
var width = 0,
ascent = 0, descent = 0;
//var oWPrp = this.Get_CompiledPr(true);
var oWPrp = this.Pr.Copy();
this.Parent.applyArgSize(oWPrp);
//oWPrp.Merge(RecalcInfo.Composition.DEFAULT_RUN_PRP.getTxtPrp());
oWPrp.Italic = false;
......@@ -6570,9 +6568,6 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
this.Content[Pos].Resize(g_oTextMeasurer);
var oSize = this.Content[Pos].size;
//var gps = this.Content[Pos].gaps;
//width += oSize.width + gps.left + gps.right;
width += oSize.width;
ascent = ascent > oSize.ascent ? ascent : oSize.ascent;
......
......@@ -1325,9 +1325,22 @@ CMathBase.prototype =
},
Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
var startX = StartContentPos.Get(Depth),
var startX, startY;
var bJustDraw = false;
if(StartFlag === 0)
{
startX = StartContentPos.Get(Depth);
startY = StartContentPos.Get(Depth + 1);
bJustDraw = this.elements[startX][startY].IsJustDraw();
}
else
{
startX = -2;
startY = -2;
}
this.SelectStart_X = startX;
this.SelectStart_Y = startY;
......@@ -1347,16 +1360,13 @@ CMathBase.prototype =
this.SelectEnd_X = endX;
this.SelectEnd_Y = endY;
Depth += 2;
var bJustDraw = this.elements[startX][startY].IsJustDraw();
if(startX == endX && startY == endY && !bJustDraw)
{
this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
}
else
else if(startX !== -2 && startY !== -2)
{
this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
}
......
......@@ -64,7 +64,7 @@ var SELECT_CHILD = 1;
Lang: {}
};*/
var StartTextElement = 0x2B1A; // Cambria Math
function CGaps(oSign, oEqual, oZeroOper, oLett)
{
......@@ -5718,33 +5718,6 @@ CMathContent.prototype =
Y = this.pos.y + absPos.y + this.size.ascent;
result = this.content[this.CurPos].Math_Update_Cursor(X, Y, CurPage, UpdateTarget);
//this.content[this.CurPos].Recalculate_CurPos(X, Y, true, 0, 0, true, true, true);
}
return result;
},
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
var result;
if(this.content[this.CurPos].typeObj == MATH_COMP)
{
_X += this.WidthToElement[this.CurPos];
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
else if(this.content[this.CurPos].typeObj == MATH_PARA_RUN)
{
var absPos = this.Composition.absPos;
//var X = this.pos.x + absPos.x + this.WidthToElement[this.CurPos],
// Y = this.pos.y + absPos.y + this.size.ascent;
//_X += this.WidthToElement[this.CurPos];
Y = this.pos.y + absPos.y + this.size.ascent;
_X = this.pos.x + absPos.x + this.WidthToElement[this.CurPos];
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, 0, 0, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
return result;
......@@ -6419,8 +6392,8 @@ CMathContent.prototype =
IsPlaceholder: function()
{
var flag = false;
if(!this.bRoot && this.content.length == 2)
flag = this.content[1].value.typeObj === MATH_PLACEHOLDER;
if(!this.bRoot && this.content.length == 1)
flag = this.content[0].typeObj === MATH_PLACEHOLDER;
return flag;
},
......@@ -7490,6 +7463,36 @@ CMathContent.prototype =
},
/// Position for Paragraph
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
var result;
if(this.content[this.CurPos].typeObj == MATH_COMP)
{
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
else if(this.content[this.CurPos].typeObj == MATH_PARA_RUN)
{
var absPos = this.Composition.absPos;
Y = this.pos.y + absPos.y + this.size.ascent;
_X = this.pos.x + absPos.x + this.WidthToElement[this.CurPos];
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, 0, 0, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
else
{
var absPos = this.Composition.absPos;
Y = this.pos.y + absPos.y + this.size.ascent;
_X = this.pos.x + absPos.x + this.size.width;
result = { X: _X};
}
return result;
},
Get_ParaContentPosByXY: function(SearchPos, Depth)
{
if(this.content.length > 0) // случай , если у нас контент не заполнен, не предусмотрен
......@@ -7511,6 +7514,10 @@ CMathContent.prototype =
SearchPos.CurX += this.pos.x + this.WidthToElement[pos];
this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth, 0, 0);
}
else
{
this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth);
}
}
},
......@@ -7527,8 +7534,8 @@ CMathContent.prototype =
{
ContentPos.Add(this.CurPos);
if(this.content[this.CurPos].typeObj == MATH_COMP || this.content[this.CurPos].typeObj == MATH_PARA_RUN)
this.content[this.CurPos].Get_ParaContentPos(bSelection, bStart, ContentPos);
//if(this.content[this.CurPos].typeObj == MATH_COMP || this.content[this.CurPos].typeObj == MATH_PARA_RUN)
this.content[this.CurPos].Get_ParaContentPos(bSelection, bStart, ContentPos);
}
},
Set_ParaContentPos: function(ContentPos, Depth)
......@@ -7580,8 +7587,7 @@ CMathContent.prototype =
if(this.IsPlaceholder())
{
this.SelectStartPos = 0;
this.SelectEndPos = 1;
this.content[0].Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
}
else if(posStart < this.content.length)
{
......@@ -7595,15 +7601,15 @@ CMathContent.prototype =
{
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, 1);
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, -1, EndFlag);
//if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, -1, EndFlag);
}
else
{
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, EndFlag);
//if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, EndFlag);
}
}
}
......@@ -8418,46 +8424,6 @@ CMathComposition.prototype =
//узнать зачем обе функции вызывать
editor.WordControl.m_oLogicDocument.DrawingDocument.TargetStart();
editor.WordControl.m_oLogicDocument.DrawingDocument.TargetShow();
},
old_SetTxtPrp: function(txtPrp)
{
this.SelectContent.changeTxtPrp(txtPrp, false);
//this.SelectContent.setTxtPrp(txtPrp, false);
this.Resize();
this.UpdatePosition();
this.UpdateCursor();
},
Set_SelectionState_2 : function(State)
{
this.ClearSelect();
// временно
//this.RecalculateReverse();
//this.Root.Resize();
this.Resize(g_oTextMeasurer);
this.UpdatePosition();
var stackSelect = Common_CopyObj(State.Select.stack),
stackCurrent = Common_CopyObj(State.Current.stack);
this.SelectContent = this.Root.getContent( stackSelect, false );
this.CurrentContent = this.Root.getContent( stackCurrent, true );
/*if(this.SelectContent.IsPlaceholder())
this.CheckTarget();
else if( State.Select.StartSelect !== State.Select.EndSelect )
{
this.SelectContent.setStart_Selection(State.Select.StartSelect );
this.SelectContent.setEnd_Selection(State.Select.EndSelect);
//this.SelectContent.selection.active = false;
}
else
{
this.SelectContent.setStart_Selection(State.Select.StartSelect - 1);
//this.SelectContent.selection.active = false;
this.UpdateCursor();
}*/
},
ClearSelect: function()
{
......@@ -8597,8 +8563,7 @@ CMathComposition.prototype =
this.absPos = {x: x, y: y - this.Root.size.ascent};
if(this.Root.content.length > 1)
this.Root.draw(this.absPos.x, this.absPos.y , pGraphics);
this.Root.draw(this.absPos.x, this.absPos.y , pGraphics);
},
GetFirstRPrp: function()
{
......
......@@ -13,6 +13,8 @@
// /var DIV_CENT = 0.1;
var DIV_CENT = 0.1386;
var StartTextElement = 0x2B1A; // Cambria Math
function CMathTextPrp()
{
this.FontFamily = undefined;
......@@ -51,6 +53,7 @@ CMathTextPrp.prototype =
function CMathText()
{
this.typeObj = MATH_TEXT;
this.pos = null;
this.size = null;
this.value = null;
......@@ -65,14 +68,6 @@ function CMathText()
// для Para_Run
this.Type = para_Math_Text;
//this.Parent = null;
/*this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();*/
//this.sizeSymbol = null; // размер символа без учета трансформации
// TO DO
// убрать
......@@ -432,6 +427,43 @@ CMathText.prototype =
{
this.type = type;
},
// 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)
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.bPlaceholder = true;
},
// заглушка для текста (для n-арных операторов, когда выставляется текст вместо оператора)
setComposition: 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