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

Сделано, чтобы класс ParaMath тоже был снаследован от ParagraphContentWithBase.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58448 954022d7-b5bf-4e40-9824-e11837661b57
parent d4b50240
......@@ -18,6 +18,8 @@ MathMenu.prototype =
}
function ParaMath()
{
ParaMath.superclass.constructor.call(this);
this.Id = g_oIdCounter.Get_NewId();
this.Type = para_Math;
......@@ -44,15 +46,6 @@ function ParaMath()
//this.State = new CParaRunState(); // Положение курсора и селекта для данного run
this.Paragraph = null;
this.StartLine = 0;
this.StartRange = 0;
this.Lines = []; // Массив CParaRunLine
this.Lines[0] = new CParaRunLine();
this.LinesLength = 0;
this.Range = this.Lines[0].Ranges[0];
this.NearPosArray = [];
this.Width = 0;
......@@ -84,21 +77,20 @@ function ParaMath()
g_oTableId.Add( this, this.Id );
}
Asc.extendClass(ParaMath, CParagraphContentWithContentBase)
ParaMath.prototype =
ParaMath.prototype.Get_Type = function()
{
Get_Type : function()
{
return this.Type;
},
};
Get_Id : function()
{
ParaMath.prototype.Get_Id = function()
{
return this.Id;
},
};
Copy : function(Selected)
{
ParaMath.prototype.Copy = function(Selected)
{
// TODO: ParaMath.Copy
var NewMath = new ParaMath();
......@@ -118,25 +110,25 @@ ParaMath.prototype =
/// argSize, bDot и bRoot выставить на объединении контентов
return NewMath;
},
};
Set_Paragraph : function(Paragraph)
{
ParaMath.prototype.Set_Paragraph = function(Paragraph)
{
this.Paragraph = Paragraph;
},
};
Is_Empty : function()
{
ParaMath.prototype.Is_Empty = function()
{
return this.Root.content.length == 0;
},
};
Is_StartFromNewLine : function()
{
ParaMath.prototype.Is_StartFromNewLine = function()
{
return false;
},
};
Get_TextPr : function(_ContentPos, Depth)
{
ParaMath.prototype.Get_TextPr = function(_ContentPos, Depth)
{
// TODO: ParaMath.Get_TextPr
var TextPr = new CTextPr();
......@@ -146,9 +138,10 @@ ParaMath.prototype =
return TextPr;
},
Get_CompiledTextPr : function(Copy)
{
};
ParaMath.prototype.Get_CompiledTextPr = function(Copy)
{
// TODO: ParaMath.Get_CompiledTextPr
var TextPr = new CTextPr();
......@@ -158,9 +151,10 @@ ParaMath.prototype =
TextPr.Merge( mTextPr );
return TextPr;
},
Add : function(Item)
{
};
ParaMath.prototype.Add = function(Item)
{
var Type = Item.Type;
var oContent = this.GetSelectContent();
var oStartContent = oContent.Content.content[oContent.Start];
......@@ -232,10 +226,10 @@ ParaMath.prototype =
}
oContent.Content.SetRunEmptyToContent(true);
}
},
};
Remove : function(Direction, bOnAddText)
{
ParaMath.prototype.Remove = function(Direction, bOnAddText)
{
var oContent = this.GetSelectContent();
if (oContent.Start == oContent.End)
{
......@@ -355,9 +349,9 @@ ParaMath.prototype =
else
return this.RemoveElem(oContent, Direction, bOnAddText);
},
},
RemoveElem: function(oContent, Direction, bOnAdd)
ParaMath.prototype.RemoveElem = function(oContent, Direction, bOnAdd)
{
var start = oContent.Start,
end = oContent.End,
......@@ -377,25 +371,25 @@ ParaMath.prototype =
oContent.Content.content.splice( oContent.Start, len );
History.Add(oContent.Content, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: oContent.Start});
return;
},
};
GetSelectContent: function()
{
ParaMath.prototype.GetSelectContent = function()
{
return this.Root.GetSelectContent();
},
};
Get_CurrentParaPos : function()
{
ParaMath.prototype.Get_CurrentParaPos = function()
{
//var CurPos = this.State.ContentPos;
/*if ( CurPos >= 0 && CurPos < this.Content.length )
return this.Content[CurPos].Get_CurrentParaPos();*/
return new CParaPos( this.StartRange, this.StartLine, 0, 0 );
},
};
Apply_TextPr : function(TextPr, IncFontSize, ApplyToAll)
{
ParaMath.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
{
// TODO: ParaMath.Apply_TextPr
if(ApplyToAll == true) // для ситуации, когда ApplyToAll = true, в Root формулы при этом позиции селекта не проставлены
......@@ -408,15 +402,15 @@ ParaMath.prototype =
content.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
},
};
Clear_TextPr : function()
{
ParaMath.prototype.Clear_TextPr = function()
{
},
};
Check_NearestPos : function(ParaNearPos, Depth)
{
ParaMath.prototype.Check_NearestPos = function(ParaNearPos, Depth)
{
/*var MathNearPos = new CParagraphElementNearPos();
MathNearPos.NearPos = ParaNearPos.NearPos;
MathNearPos.Depth = Depth;
......@@ -427,37 +421,37 @@ ParaMath.prototype =
var CurPos = ParaNearPos.NearPos.ContentPos.Get(Depth);
this.Content[CurPos].Check_NearestPos( ParaNearPos, Depth + 1 );*/
},
};
Get_DrawingObjectRun : function(Id)
{
ParaMath.prototype.Get_DrawingObjectRun = function(Id)
{
return null;
},
};
Get_DrawingObjectContentPos : function(Id, ContentPos, Depth)
{
ParaMath.prototype.Get_DrawingObjectContentPos = function(Id, ContentPos, Depth)
{
return false;
},
};
Get_Layout : function(DrawingLayout, UseContentPos, ContentPos, Depth)
{
},
ParaMath.prototype.Get_Layout = function(DrawingLayout, UseContentPos, ContentPos, Depth)
{
};
Get_NextRunElements : function(RunElements, UseContentPos, Depth)
{
},
ParaMath.prototype.Get_NextRunElements = function(RunElements, UseContentPos, Depth)
{
};
Get_PrevRunElements : function(RunElements, UseContentPos, Depth)
{
},
ParaMath.prototype.Get_PrevRunElements = function(RunElements, UseContentPos, Depth)
{
};
Collect_DocumentStatistics : function(ParaStats)
{
ParaMath.prototype.Collect_DocumentStatistics = function(ParaStats)
{
// TODO: ParaMath.Collect_DocumentStatistics
},
};
Create_FontMap : function(Map)
{
ParaMath.prototype.Create_FontMap = function(Map)
{
// TODO: ParaMath.Create_FontMap
// Styles.js
......@@ -465,20 +459,20 @@ ParaMath.prototype =
this.Root.Create_FontMap(Map);
},
};
Get_AllFontNames : function(AllFonts)
{
ParaMath.prototype.Get_AllFontNames = function(AllFonts)
{
// TODO: ParaMath.Get_AllFontNames
// выставить для всех шрифтов, к-ые используются в AllFonts true
AllFonts["Cambria Math"] = true;
this.Root.Get_AllFontNames(AllFonts);
},
};
Get_SelectedText : function(bAll, bClearText)
{
ParaMath.prototype.Get_SelectedText = function(bAll, bClearText)
{
if ( true === bAll || true === this.Selection_IsUse() )
{
if ( true === bClearText )
......@@ -488,50 +482,42 @@ ParaMath.prototype =
}
return "";
},
};
Clear_TextFormatting : function( DefHyper )
{
},
ParaMath.prototype.Clear_TextFormatting = function( DefHyper )
{
};
Can_AddDropCap : function()
{
ParaMath.prototype.Can_AddDropCap = function()
{
return false;
},
};
Get_TextForDropCap : function(DropCapText, UseContentPos, ContentPos, Depth)
{
ParaMath.prototype.Get_TextForDropCap = function(DropCapText, UseContentPos, ContentPos, Depth)
{
if ( true === DropCapText.Check )
DropCapText.Mixed = true;
},
};
Get_StartTabsCount : function(TabsCounter)
{
ParaMath.prototype.Get_StartTabsCount = function(TabsCounter)
{
return false;
},
};
Remove_StartTabs : function(TabsCounter)
{
ParaMath.prototype.Remove_StartTabs = function(TabsCounter)
{
return false;
},
};
Add_ToContent : function(Pos, Item, UpdatePosition)
{
ParaMath.prototype.Add_ToContent = function(Pos, Item, UpdatePosition)
{
},
};
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
Recalculate_Reset : function(StartRange, StartLine)
{
this.StartLine = StartLine;
this.StartRange = StartRange;
this.LinesLength = 0;
},
Recalculate_Range : function(PRS, ParaPr, Depth)
{
ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{
// TODO: Пока у нас контент здесь состоит из 1 элемента (всего элемента Math). Поэтому у нас в данном
// контенте есть 2 позиции 0 и 1, т.е. до или после Math.
......@@ -584,20 +570,8 @@ ParaMath.prototype =
// переделать с разбиванием на строки.
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// Если это первый отрезок в данной строке, тогда нам надо добавить строку (первую строку не добавляем,
// т.к. она всегда есть)
if ( 0 === CurRange )
{
if ( 0 !== CurLine )
{
this.Lines[CurLine] = new CParaRunLine();
this.LinesLength = CurLine + 1;
}
else
{
this.LinesLength = CurLine + 1;
}
}
var RangeStartPos = this.protected_AddRange(CurLine, CurRange);
var RangeEndPos = 0;
// Отмечаем, что началось слово
PRS.StartWord = true;
......@@ -675,21 +649,10 @@ ParaMath.prototype =
}
}
var RangeStartPos = 0;
var RangeEndPos = 0;
if ( true !== PRS.NewRange )
{
RangeEndPos = this.Root.content.length; // RangeEndPos = 1; to RangeEndPos = this.Content.length;
// Удаляем лишние строки, оставшиеся после предыдущего пересчета в самом конце
if ( this.Lines.length > this.LinesLength )
this.Lines.length = this.LinesLength;
// Обновляем метрику строки
if ( PRS.LineAscent < this.Ascent )
PRS.LineAscent = this.Ascent;
......@@ -698,41 +661,26 @@ ParaMath.prototype =
PRS.LineDescent = this.Descent;
}
if ( 0 === CurLine && 0 === CurRange )
{
this.Range.StartPos = RangeStartPos;
this.Range.EndPos = RangeEndPos;
/*this.Lines[0].RangesLength = 1;
this.Lines[0].Ranges.length = this.Content.length - 1;*/
this.Lines[0].RangesLength = 1;
if ( this.Lines[0].Ranges.length > 1 )
this.Lines[0].Ranges.length = 1;
}
else
this.Lines[CurLine].Add_Range( CurRange, RangeStartPos, RangeEndPos );
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
},
};
Recalculate_Set_RangeEndPos : function(PRS, PRP, Depth)
{
ParaMath.prototype.Recalculate_Set_RangeEndPos = function(PRS, PRP, Depth)
{
var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
var CurPos = PRP.Get(Depth);
this.Lines[CurLine].Ranges[CurRange].EndPos = CurPos;
},
this.protected_FillRangeEndPos(CurLine, CurRange, CurPos);
};
Recalculate_Range_Width : function(PRSC, _CurLine, _CurRange)
{
ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
......@@ -757,15 +705,15 @@ ParaMath.prototype =
PRSC.SpacesCount = 0;
}
},
};
Recalculate_Range_Spaces : function(PRSA, _CurLine, _CurRange, _CurPage)
{
ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, _CurPage)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
......@@ -785,52 +733,48 @@ ParaMath.prototype =
PRSA.X += this.WidthVisible;
PRSA.LastW = this.WidthVisible;
}
},
};
Recalculate_PageEndInfo : function(PRSI, _CurLine, _CurRange)
{
},
ParaMath.prototype.Recalculate_PageEndInfo = function(PRSI, _CurLine, _CurRange)
{
};
Save_RecalculateObject : function(Copy)
{
ParaMath.prototype.Save_RecalculateObject = function(Copy)
{
var RecalcObj = new CRunRecalculateObject(this.StartLine, this.StartRange);
RecalcObj.Save_Lines( this, Copy );
// TODO: Сделать сохранение пересчета у формулы
return RecalcObj;
},
};
Load_RecalculateObject : function(RecalcObj)
{
ParaMath.prototype.Load_RecalculateObject = function(RecalcObj)
{
RecalcObj.Load_Lines(this);
},
Prepare_RecalculateObject : function()
{
this.Lines = [];
this.Lines[0] = new CParaRunLine();
this.LinesLength = 0;
};
this.Range = this.Lines[0].Ranges[0];
},
ParaMath.prototype.Prepare_RecalculateObject = function()
{
this.protected_ClearLines();
};
Is_EmptyRange : function(_CurLine, _CurRange)
{
ParaMath.prototype.Is_EmptyRange = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
return false;
return true;
},
};
Check_Range_OnlyMath : function(Checker, CurRange, CurLine)
{
ParaMath.prototype.Check_Range_OnlyMath = function(Checker, CurRange, CurLine)
{
if (null !== Checker.Math)
{
Checker.Math = null;
......@@ -838,59 +782,60 @@ ParaMath.prototype =
}
else
Checker.Math = this;
},
};
Check_MathPara : function(Checker)
{
ParaMath.prototype.Check_MathPara = function(Checker)
{
Checker.Found = true;
Checker.Result = false;
},
};
Check_PageBreak : function()
{
ParaMath.prototype.Check_PageBreak = function()
{
return false;
},
};
Check_BreakPageInRange : function(_CurLine, _CurRange)
{
ParaMath.prototype.Check_BreakPageInRange = function(_CurLine, _CurRange)
{
return false;
},
};
Check_BreakPageEnd : function(PBChecker)
{
ParaMath.prototype.Check_BreakPageEnd = function(PBChecker)
{
return false;
},
};
Get_ParaPosByContentPos : function(ContentPos, Depth)
{
ParaMath.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth)
{
var Pos = ContentPos.Get(Depth);
var CurLine = 0;
var CurRange = 0;
var LinesCount = this.LinesLength;
var LinesCount = this.protected_GetLinesCount();
for ( ; CurLine < LinesCount; CurLine++ )
{
var RangesCount = this.Lines[CurLine].RangesLength;
var RangesCount = this.protected_GetRangesCount(CurLine);
for ( CurRange = 0; CurRange < RangesCount; CurRange++ )
{
var Range = this.Lines[CurLine].Ranges[CurRange];
if ( Pos < Range.EndPos && Pos >= Range.StartPos )
return new CParaPos( ( CurLine === 0 ? CurRange + this.StartRange : CurRange ), CurLine + this.StartLine, 0, 0 );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (Pos < EndPos && Pos >= StartPos)
return new CParaPos((CurLine === 0 ? CurRange + this.StartRange : CurRange), CurLine + this.StartLine, 0, 0);
}
}
return new CParaPos( ( LinesCount === 1 ? this.Lines[0].RangesLength - 1 + this.StartRange : this.Lines[0].RangesLength - 1 ), LinesCount - 1 + this.StartLine, 0, 0 );
},
return new CParaPos((LinesCount === 1 ? this.protected_GetRangesCount(0) - 1 + this.StartRange : this.protected_GetRangesCount(0) - 1), LinesCount - 1 + this.StartLine, 0, 0);
};
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
ParaMath.prototype.Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
//var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var result = {X: _X + this.Root.size.width};
......@@ -902,20 +847,20 @@ ParaMath.prototype =
return result;
},
};
Refresh_RecalcData : function(Data)
{
ParaMath.prototype.Refresh_RecalcData = function(Data)
{
this.Paragraph.Refresh_RecalcData2(0);
},
};
Refresh_RecalcData2 : function(Data)
{
ParaMath.prototype.Refresh_RecalcData2 = function(Data)
{
this.Paragraph.Refresh_RecalcData2(0);
},
};
Recalculate_MinMaxContentWidth : function(MinMax)
{
ParaMath.prototype.Recalculate_MinMaxContentWidth = function(MinMax)
{
// TODO: Если формула не измерена, тогда здесь её надо измерить
if ( false === MinMax.bWord )
......@@ -935,41 +880,41 @@ ParaMath.prototype =
}
MinMax.nCurMaxWidth += this.Width;
},
};
Get_Range_VisibleWidth : function(RangeW, _CurLine, _CurRange)
{
ParaMath.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
RangeW.W += this.Width;
}
},
};
Shift_Range : function(Dx, Dy, _CurLine, _CurRange)
{
ParaMath.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
// TODO: Сделать смещение на Dx, Dy
}
},
};
//-----------------------------------------------------------------------------------
// Функция для работы с формулой
// в тч с дефолтными текстовыми настройками и argSize
//-----------------------------------------------------------------------------------
MathToImageConverter: function()
{
ParaMath.prototype.MathToImageConverter= function()
{
window.IsShapeToImageConverter = true;
var dKoef = g_dKoef_mm_to_pix;
......@@ -1006,9 +951,10 @@ ParaMath.prototype =
_ret.ImageUrl = "";
}
return _ret;
},
ApplyArgSize : function(oWPrp, argSize)
{
};
ParaMath.prototype.ApplyArgSize = function(oWPrp, argSize)
{
var tPrp = new CTextPr();
tPrp.Merge(this.DefaultTextPr);
......@@ -1033,8 +979,9 @@ ParaMath.prototype =
oWPrp.Merge(tPrp);
},
/*GetDefaultTxtPrp: function()
};
/*ParaMath.prototype.GetDefaultTxtPrp= function()
{
var txtPrp = new CTextPr();
......@@ -1049,20 +996,23 @@ ParaMath.prototype =
txtPrp.Set_FromObject(defaultTxtPr);
return txtPrp;
},*/
GetFirstRPrp: function()
{
};*/
ParaMath.prototype.GetFirstRPrp = function()
{
return this.Root.getFirstRPrp(this);
},
GetShiftCenter: function(oMeasure, font)
{
};
ParaMath.prototype.GetShiftCenter = function(oMeasure, font)
{
oMeasure.SetFont(font);
var metrics = oMeasure.Measure2Code(0x2217); // "+"
return 0.6*metrics.Height;
},
SetMathProperties: function(props)
{
};
ParaMath.prototype.SetMathProperties = function(props)
{
//***** FOR FORMULA *****//
// В документации везде, где нет примера использования свояства, означает, что Word не поддерживает это свойство !
......@@ -1153,13 +1103,15 @@ ParaMath.prototype =
// RichEdit Hot Keys
// http://blogs.msdn.com/b/murrays/archive/2013/10/30/richedit-hot-keys.aspx
},
GetMathPr: function()
{
};
ParaMath.prototype.GetMathPr = function()
{
return this.MathPr;
},
Get_Default_TPrp: function()
{
};
ParaMath.prototype.Get_Default_TPrp = function()
{
/*var TextPrp = new CTextPr();
TextPrp.Init_Default();
......@@ -1199,36 +1151,37 @@ ParaMath.prototype =
DefaultTextPrp.Italic = false;
return DefaultTextPrp;
},
Set_Select_ToMComp: function(Direction)
{
};
ParaMath.prototype.Set_Select_ToMComp = function(Direction)
{
this.bSelectionUse = true;
this.Root.Set_Select_ToMComp(Direction);
},
};
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
Draw_HighLights : function(PDSH)
{
ParaMath.prototype.Draw_HighLights = function(PDSH)
{
var CurLine = PDSH.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSH.Range - this.StartRange : PDSH.Range );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
PDSH.X += this.Width;
}
},
};
Draw_Elements : function(PDSE)
{
ParaMath.prototype.Draw_Elements = function(PDSE)
{
var CurLine = PDSE.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSE.Range - this.StartRange : PDSE.Range );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
/*PDSE.Graphics.p_color(255,0,0, 255);
PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/
......@@ -1249,66 +1202,66 @@ ParaMath.prototype =
/*PDSE.Graphics.p_color(255,0,0, 255);
PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent + this.Height, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/
},
};
Draw_Lines : function(PDSL)
{
ParaMath.prototype.Draw_Lines = function(PDSL)
{
var CurLine = PDSL.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSL.Range - this.StartRange : PDSL.Range );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
PDSL.X += this.Width;
}
},
};
//-----------------------------------------------------------------------------------
// Функции для работы с курсором
//-----------------------------------------------------------------------------------
Is_CursorPlaceable : function()
{
ParaMath.prototype.Is_CursorPlaceable = function()
{
return true;
},
};
Cursor_Is_Start : function()
{
ParaMath.prototype.Cursor_Is_Start = function()
{
// TODO: ParaMath.Cursor_Is_Start
return this.Root.Cursor_Is_Start();
},
};
Cursor_Is_NeededCorrectPos : function()
{
ParaMath.prototype.Cursor_Is_NeededCorrectPos = function()
{
return false;
},
};
Cursor_Is_End : function()
{
ParaMath.prototype.Cursor_Is_End = function()
{
// TODO: ParaMath.Cursor_Is_End
return this.Root.Cursor_Is_End();
},
};
Cursor_MoveToStartPos : function()
{
ParaMath.prototype.Cursor_MoveToStartPos = function()
{
// TODO: ParaMath.Cursor_MoveToStartPos
this.Root.Cursor_MoveToStartPos();
},
};
Cursor_MoveToEndPos : function(SelectFromEnd)
{
ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd)
{
// TODO: ParaMath.Cursor_MoveToEndPos
this.Root.Cursor_MoveToEndPos(SelectFromEnd);
},
};
Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{
ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{
// TODO: ParaMath.Get_ParaContentPosByXY
var Result = false;
......@@ -1316,9 +1269,8 @@ ParaMath.prototype =
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); // если находимся в нулевой строке (для текущей позиции), то CurRange мб ненулевой
var Range = this.Lines[CurLine].Ranges[CurRange];
var StartPos = Range.StartPos; // 0
var EndPos = Range.EndPos; // this.content.length
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
// TODO: реализовать поиск по Y (для случая, когда формула занимает больше одной строки)
......@@ -1343,19 +1295,20 @@ ParaMath.prototype =
return Result;
},
};
Get_ParaContentPos : function(bSelection, bStart, ContentPos) // получить текущую логическую позицию
{
ParaMath.prototype.Get_ParaContentPos = function(bSelection, bStart, ContentPos) // получить текущую логическую позицию
{
// TODO: ParaMath.Get_ParaContentPos
this.Root.Get_ParaContentPos(bSelection, bStart, ContentPos);
return ContentPos;
},
Set_ParaContentPos : function(ContentPos, Depth) // выставить логическую позицию в контенте
{
};
ParaMath.prototype.Set_ParaContentPos = function(ContentPos, Depth) // выставить логическую позицию в контенте
{
// TODO: ParaMath.Set_ParaContentPos
//this.State.ContentPos = ContentPos.Get(Depth);
......@@ -1373,68 +1326,69 @@ ParaMath.prototype =
this.Root.Set_ParaContentPos(ContentPos, Depth);
},
Get_PosByElement : function(Class, ContentPos, Depth, UseRange, Range, Line)
{
};
ParaMath.prototype.Get_PosByElement = function(Class, ContentPos, Depth, UseRange, Range, Line)
{
if ( this === Class )
return true;
// TODO: ParaMath.Get_PosByElement
},
};
Get_PosByDrawing : function(Id, ContentPos, Depth)
{
ParaMath.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth)
{
return false;
},
};
Get_RunElementByPos : function(ContentPos, Depth)
{
ParaMath.prototype.Get_RunElementByPos = function(ContentPos, Depth)
{
return null;
},
};
Get_LastRunInRange : function(_CurLine, _CurRange)
{
ParaMath.prototype.Get_LastRunInRange = function(_CurLine, _CurRange)
{
return null;
},
};
Get_LeftPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
ParaMath.prototype.Get_LeftPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
// TODO: ParaMath.Get_LeftPos
return this.Root.Get_LeftPos(SearchPos, ContentPos, Depth, UseContentPos, false);
},
};
Get_RightPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
ParaMath.prototype.Get_RightPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
// TODO: ParaMath.Get_RightPos
return this.Root.Get_RightPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false);
},
};
Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
ParaMath.prototype.Get_WordStartPos = function(SearchPos, ContentPos, Depth, UseContentPos)
{
// TODO: ParaMath.Get_StartEndPos
this.Root.Get_WordStartPos(SearchPos, ContentPos, Depth, UseContentPos, false);
},
};
Get_WordEndPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
ParaMath.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
// TODO: ParaMath.Get_WordEndPos
this.Root.Get_WordEndPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false);
},
};
Get_EndRangePos : function(_CurLine, _CurRange, SearchPos, Depth)
{
ParaMath.prototype.Get_EndRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
// TODO: ParaMath.Get_EndRangePos
// Сделать для случая, когда формула будет занимать несколько строк
return this.Root.Get_EndRangePos(_CurLine, _CurRange, SearchPos, Depth);
},
};
Get_StartRangePos : function(_CurLine, _CurRange, SearchPos, Depth)
{
ParaMath.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
// TODO: ParaMath.Get_StartRangePos
// Сделать для случая, когда формула будет занимать несколько строк, переделать
......@@ -1442,74 +1396,75 @@ ParaMath.prototype =
return this.Root.Get_StartRangePos(_CurLine, _CurRange, SearchPos, Depth);
//this.Root.Get_StartPos(SearchPos.Pos, Depth);
},
};
Get_StartRangePos2 : function(_CurLine, _CurRange, ContentPos, Depth)
{
ParaMath.prototype.Get_StartRangePos2 = function(_CurLine, _CurRange, ContentPos, Depth)
{
// TODO: ParaMath.Get_StartRangePos2
// Сделать для случая, когда формула будет занимать несколько строк, переделать
this.Root.Get_StartRangePos2(_CurLine, _CurRange, ContentPos, Depth);
},
};
Get_StartPos : function(ContentPos, Depth)
{
ParaMath.prototype.Get_StartPos = function(ContentPos, Depth)
{
// TODO: ParaMath.Get_StartPos
this.Root.Get_StartPos(ContentPos, Depth);
},
};
Get_EndPos : function(BehindEnd, ContentPos, Depth)
{
ParaMath.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
{
// TODO: ParaMath.Get_EndPos
this.Root.Get_EndPos(BehindEnd, ContentPos, Depth);
},
};
//-----------------------------------------------------------------------------------
// Функции для работы с селектом
//-----------------------------------------------------------------------------------
Set_SelectionContentPos : function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
ParaMath.prototype.Set_SelectionContentPos = function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
// TODO: ParaMath.Set_SelectionContentPos
this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
this.bSelectionUse = true;
},
};
Selection_IsUse : function()
{
ParaMath.prototype.Selection_IsUse = function()
{
// TODO: ParaMath.Selection_IsUse
return this.bSelectionUse;
},
};
Selection_Stop : function()
{
ParaMath.prototype.Selection_Stop = function()
{
},
Selection_Remove : function()
{
};
ParaMath.prototype.Selection_Remove = function()
{
// TODO: ParaMath.Selection_Remove
this.bSelectionUse = false;
this.Root.Selection_Remove();
},
Select_All : function(Direction)
{
};
ParaMath.prototype.Select_All = function(Direction)
{
// TODO: ParaMath.Select_All
this.bSelectionUse = true;
this.Root.Select_All();
},
};
Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw)
{
ParaMath.prototype.Selection_DrawRange = function(_CurLine, _CurRange, SelectionDraw)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
......@@ -1563,16 +1518,17 @@ ParaMath.prototype =
}
},
};
Selection_IsEmpty : function(CheckEnd)
{
ParaMath.prototype.Selection_IsEmpty = function(CheckEnd)
{
// TODO: ParaMath.Selection_IsEmpty
return this.Root.Selection_IsEmpty();
},
Selection_IsPlaceholder : function()
{
};
ParaMath.prototype.Selection_IsPlaceholder = function()
{
var bPlaceholder = false;
var result = this.GetSelectContent(),
SelectContent = result.Content;
......@@ -1585,52 +1541,54 @@ ParaMath.prototype =
}
return bPlaceholder;
},
Selection_CheckParaEnd : function()
{
};
ParaMath.prototype.Selection_CheckParaEnd = function()
{
return false;
},
};
Is_SelectedAll : function(Props)
{
ParaMath.prototype.Is_SelectedAll = function(Props)
{
// TODO: ParaMath.Is_SelectedAll
return this.Root.Is_SelectedAll(Props);
},
};
Selection_CorrectLeftPos : function(Direction)
{
ParaMath.prototype.Selection_CorrectLeftPos = function(Direction)
{
return false;
},
};
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
Save_Changes : function(Data, Writer)
{
ParaMath.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong( historyitem_type_Math );
},
};
Load_Changes : function(Reader)
{
ParaMath.prototype.Load_Changes = function(Reader)
{
},
Write_ToBinary : function(Writer)
{
};
ParaMath.prototype.Write_ToBinary = function(Writer)
{
// Long : Type
// String : Id
Writer.WriteLong( this.Type );
Writer.WriteString2( this.Id );
},
Write_ToBinary2 : function(Writer)
{
};
ParaMath.prototype.Write_ToBinary2 = function(Writer)
{
Writer.WriteLong( historyitem_type_Math );
Writer.WriteString2( this.Root.Id );
},
};
Read_FromBinary2 : function(Reader)
{
ParaMath.prototype.Read_FromBinary2 = function(Reader)
{
var Element = g_oTableId.Get_ById( Reader.GetString2() );
Element.bRoot = true;
this.Root = Element;
}
};
\ 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