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

Ветка Math_Menu_Features слита на транк.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68154 954022d7-b5bf-4e40-9824-e11837661b57
parent a4660615
......@@ -868,6 +868,7 @@ var historyitem_Document_Orientation = 5; // Меняем ориентац
var historyitem_Document_DefaultTab = 6; // Меняем таб по умолчанию
var historyitem_Document_EvenAndOddHeaders = 7; // Меняем настройку различия четных/нечетных колонтитулов
var historyitem_Document_DefaultLanguage = 8; // Меняем язык по умолчанию для всего документа
var historyitem_Document_MathSettings = 9; // Меняем настройки формул
// Типы изменений в классе Paragraph
var historyitem_Paragraph_AddItem = 1; // Добавляем элемент в параграф
......@@ -952,6 +953,7 @@ var historyitem_ParaRun_PrReviewInfo = 38; // Изменение инфор
var historyitem_ParaRun_ContentReviewInfo = 39; // Изменение информации о рецензировании содержимого рана
var historyitem_ParaRun_OnStartSplit = 40; // Специальное измненение для контролля позиции курсора и селекта
var historyitem_ParaRun_OnEndSplit = 41; // Специальное измненение для контролля позиции курсора и селекта
var historyitem_ParaRun_MathAlnAt = 42; // меняем alnAt в математических свойствах Run
// Типы изменений в классе ParaTextPr
......@@ -1593,9 +1595,9 @@ var historydescription_Document_SetColumnsFromRuler = 0x012f;
var historydescription_Document_SetColumnsProps = 0x0130;
var historydescription_Document_AddColumnBreak = 0x0131;
var historydescription_Document_SetSectionProps = 0x0132;
var historydescription_Document_AddTabToMath = 0x0133;
var historydescription_Document_SetMathProps = 0x0134;
var historydescription_Document_ApplyPrToMath = 0x0135;
function Get_HistoryPointStringDescription(nDescription)
{
var sString = "Unknown";
......@@ -1909,6 +1911,9 @@ function Get_HistoryPointStringDescription(nDescription)
case historydescription_Document_SetColumnsFromRuler : sString = "Document_SetColumnsFromRuler "; break;
case historydescription_Document_SetColumnsProps : sString = "Document_SetColumnsProps "; break;
case historydescription_Document_AddColumnBreak : sString = "Document_AddColumnBreak "; break;
case historydescription_Document_AddTabToMath : sString = "Document_AddTabToMath "; break;
case historydescription_Document_ApplyPrToMath : sString = "Document_ApplyPrToMath "; break;
case historydescription_Document_SetMathProps : sString = "Document_SetMathProps "; break;
case historydescription_Document_SetSectionProps : sString = "Document_SetColumnsProps "; break;
}
return sString;
......
......@@ -10250,7 +10250,18 @@ CDocument.prototype =
{
var SelectedInfo = this.Get_SelectedElementsInfo();
if ( true === SelectedInfo.Is_InTable() && true != e.CtrlKey )
if (null !== SelectedInfo.Get_Math())
{
var ParaMath = SelectedInfo.Get_Math();
var Paragraph = ParaMath.Get_Paragraph();
if (Paragraph && false === this.Document_Is_SelectionLocked(changestype_None, {Type : changestype_2_Element_and_Type, Element : Paragraph, CheckType : changestype_Paragraph_Content}))
{
this.Create_NewHistoryPoint(historydescription_Document_AddTabToMath);
ParaMath.Handle_Tab(!e.ShiftKey);
this.Recalculate();
}
}
else if ( true === SelectedInfo.Is_InTable() && true != e.CtrlKey )
{
this.Cursor_MoveToCell(true === e.ShiftKey ? false : true);
}
......@@ -13455,6 +13466,12 @@ CDocument.prototype =
this.Restart_CheckSpelling();
break;
}
case historyitem_Document_MathSettings:
{
this.Settings.MathSettings.SetPr(Data.OldPr);
break;
}
}
},
......@@ -13507,6 +13524,13 @@ CDocument.prototype =
this.Restart_CheckSpelling();
break;
}
case historyitem_Document_MathSettings:
{
this.Settings.MathSettings.SetPr(Data.NewPr);
break;
}
}
},
......@@ -13533,6 +13557,7 @@ CDocument.prototype =
case historyitem_Document_DefaultTab:
case historyitem_Document_EvenAndOddHeaders:
case historyitem_Document_MathSettings:
{
ChangePos = 0;
break;
......@@ -13860,7 +13885,12 @@ CDocument.prototype =
// Long : LanguageId
Writer.WriteLong( Data.New );
break;
}
}
case historyitem_Document_MathSettings:
{
this.Settings.MathSettings.Write_ToBinary(Writer);
break;
}
}
return Writer;
......@@ -14026,6 +14056,11 @@ CDocument.prototype =
break;
}
case historyitem_Document_MathSettings:
{
this.Settings.MathSettings.Read_FromBinary(Reader);
break;
}
}
return true;
......@@ -16300,6 +16335,24 @@ CDocument.prototype.Get_CompatibilityMode = function()
{
return this.Settings.CompatibilityMode;
};
//----------------------------------------------------------------------------------------------------------------------
// Math
//----------------------------------------------------------------------------------------------------------------------
CDocument.prototype.Set_MathProps = function(MathProps)
{
var SelectedInfo = this.Get_SelectedElementsInfo();
if (null !== SelectedInfo.Get_Math() && false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
this.Create_NewHistoryPoint(historydescription_Document_SetMathProps);
var ParaMath = SelectedInfo.Get_Math();
ParaMath.Set_MenuProps(MathProps);
this.Recalculate();
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
}
};
//-----------------------------------------------------------------------------------
// Private
//-----------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -2457,10 +2457,10 @@ function CParagraphRecalculateStateWrap(Para)
this.bFirstLine = false;
this.bNoOneBreakOperator = true; // прежде чем обновлять позицию в контент Run, учтем были ли до этого break-операторы (проверки на Word == false не достаточно, т.к. формула мб инлайновая и тогда не нужно обновлять позицию)
this.BreakBox = false;
this.bForcedBreak = false;
this.bInsideOper = false; // учитываем есть ли разбивка внутри мат объекта, чтобы случайно не вставить в конец пред оператора (при Brk_Before == false)
this.bOnlyForcedBreak = false; // учитывается, если возможна разбивка только по операторам выше уровням => в этом случае можно сделать принудительный разрыв во внутреннем контенте
this.bBoxOperator = false;
this.bBreakBox = false;
//-----------------------------//
this.bFastRecalculate = false;
......@@ -2506,10 +2506,10 @@ CParagraphRecalculateStateWrap.prototype =
this.bContainCompareOper = true;
this.bInsideOper = false;
this.bOnlyForcedBreak = false;
this.bBreakBox = false;
this.bNoOneBreakOperator = true;
this.bFastRecalculate = false;
this.bBoxOperator = false;
this.BreakBox = false;
this.bForcedBreak = false;
this.bBreakPosInLWord = true;
this.MathNotInline = null;
......@@ -2546,10 +2546,10 @@ CParagraphRecalculateStateWrap.prototype =
this.bContainCompareOper = true;
this.bInsideOper = false;
this.bOnlyForcedBreak = false;
this.bBreakBox = false;
this.bNoOneBreakOperator = true;
this.BreakBox = false;
this.bForcedBreak = false;
this.bFastRecalculate = false;
this.bBoxOperator = false;
this.bBreakPosInLWord = true;
},
......
This diff is collapsed.
......@@ -646,8 +646,31 @@ CAccent.prototype.GetLastElement = function()
{
return this.Content[0].GetLastElement();
};
CAccent.prototype.Document_UpdateInterfaceState = function(MathProps)
CAccent.prototype.Can_Delete = function()
{
MathProps.Type = c_oAscMathInterfaceType.Accent;
MathProps.Pr = null;
};
\ No newline at end of file
return true;
};
CAccent.prototype.Is_SimpleDelete = function()
{
return true;
};
CAccent.prototype.Get_InterfaceProps = function()
{
return new CMathMenuAccent(this);
};
/**
*
* @param CMathMenuAccent
* @constructor
* @extends {CMathMenuBase}
*/
function CMathMenuAccent(Accent)
{
CMathMenuAccent.superclass.constructor.call(this, Accent);
this.Type = c_oAscMathInterfaceType.Accent;
}
Asc.extendClass(CMathMenuAccent, CMathMenuBase);
window["CMathMenuAccent"] = CMathMenuAccent;
This diff is collapsed.
This diff is collapsed.
......@@ -83,7 +83,7 @@ CDegreeBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsI
this.baseContent.PreRecalc(this, ParaMath, ArgSize, RPI);
var ArgSzDegr = ArgSize.Copy();
ArgSzDegr.decrease();
ArgSzDegr.Decrease();
var RPIDegr = RPI.Copy();
RPIDegr.bDecreasedComp = true;
......@@ -437,11 +437,6 @@ CDegree.prototype.fillContent = function()
CDegree.superclass.fillContent.call(this);
};
CDegree.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Script;
MathProps.Pr = null;
};
CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = _CurLine - this.StartLine;
......@@ -504,6 +499,23 @@ CDegree.prototype.setPosition = function(pos, PosInfo)
CMathBase.prototype.setPosition.call(this, pos, PosInfo);
}
};
CDegree.prototype.Can_Delete = function()
{
return true;
};
CDegree.prototype.Is_SimpleDelete = function()
{
return true;
};
CDegree.prototype.Get_InterfaceProps = function()
{
var Type = this.Pr.type == DEGREE_SUBSCRIPT ? c_oAscMathInterfaceScript.Sub : c_oAscMathInterfaceScript.Sup;
return new CMathMenuScript(this, Type);
};
CDegree.prototype.Can_ModifyArgSize = function()
{
return this.CurPos == 1 && false === this.Is_SelectInside(); // находимся в итераторе
};
/**
*
......@@ -516,10 +528,6 @@ function CIterators(iterUp, iterDn)
{
CIterators.superclass.constructor.call(this, true);
this.lUp = 0; // центр основания
this.lD = 0; // высота - центр основания
this.upper = 0; // смещение сверху для позиции основания
this.iterUp = iterUp;
this.iterDn = iterDn;
}
......@@ -580,6 +588,31 @@ CIterators.prototype.alignIterators = function(mcJc)
{
this.alignment.wdt[0] = mcJc;
};
CIterators.prototype.setPosition = function(pos, PosInfo)
{
this.pos.x = pos.x;
this.pos.y = pos.y;
var UpIterPos = new CMathPosition();
var al = this.align(0, 0);
UpIterPos.x = this.pos.x + this.GapLeft + al.x;
UpIterPos.y = this.pos.y + this.iterUp.size.ascent;
var DownIterPos = new CMathPosition();
al = this.align(1, 0);
DownIterPos.x = this.pos.x + this.GapLeft + al.x;
DownIterPos.y = this.pos.y + this.dH + this.iterUp.size.height + this.iterDn.size.ascent;
// сначала выставляем setPosition у верхнего итератора, потом у нижнего
// такой порядок нужен для выравнивания Box по операторам (так же как в Ворде)
this.iterDn.setPosition(DownIterPos, PosInfo);
this.iterUp.setPosition(UpIterPos, PosInfo);
pos.x += this.size.width;
};
function CMathDegreeSubSupPr()
{
......@@ -662,9 +695,6 @@ CDegreeSubSupBase.prototype.fillContent = function()
oIters.init();
oIters.lUp = 0;
oIters.lD = 0;
if(this.Pr.type == DEGREE_SubSup)
{
oIters.alignIterators(MCJC_LEFT);
......@@ -903,7 +933,7 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine
}
else
{
CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
CDegreeSubSupBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
}
};
......@@ -1095,8 +1125,54 @@ CDegreeSubSup.prototype.protected_GetRangeEndPos = function(CurLine, CurRange)
return this.Need_Iters(_CurLine, _CurRange) ? 2 : 0;
};
CDegreeSubSup.prototype.Document_UpdateInterfaceState = function(MathProps)
CDegreeSubSup.prototype.Can_DeleteSubScript = function()
{
MathProps.Type = c_oAscMathInterfaceType.Script;
MathProps.Pr = null;
return this.Pr.type == DEGREE_SubSup;
};
CDegreeSubSup.prototype.Can_DeleteSuperScript = function()
{
return this.Pr.type == DEGREE_SubSup;
};
CDegreeSubSup.prototype.Can_Delete = function()
{
return this.Pr.type == DEGREE_PreSubSup;
};
CDegreeSubSup.prototype.Is_SimpleDelete = function()
{
return true;
};
CDegreeSubSup.prototype.Get_InterfaceProps = function()
{
var Type = this.Pr.type == DEGREE_PreSubSup ? c_oAscMathInterfaceScript.PreSubSup : c_oAscMathInterfaceScript.SubSup;
return new CMathMenuScript(this, Type);
};
CDegreeSubSup.prototype.Can_ModifyArgSize = function()
{
return this.CurPos !== 0 && false === this.Is_SelectInside(); // находимся в итераторе
};
/**
*
* @param CMathMenuScript
* @constructor
* @extends {CMathMenuBase}
*/
function CMathMenuScript(Script, Type)
{
CMathMenuScript.superclass.constructor.call(this, Script);
this.Type = c_oAscMathInterfaceType.Script;
if (undefined !== Type)
this.ScriptType = Type;
else
this.ScriptType = undefined;
}
Asc.extendClass(CMathMenuScript, CMathMenuBase);
CMathMenuScript.prototype.get_ScriptType = function(){return this.ScriptType;};
CMathMenuScript.prototype.put_ScriptType = function(Type){this.ScriptType = Type;};
window["CMathMenuScript"] = CMathMenuScript;
CMathMenuScript.prototype["get_ScriptType"] = CMathMenuScript.prototype.get_ScriptType;
CMathMenuScript.prototype["put_ScriptType"] = CMathMenuScript.prototype.put_ScriptType;
\ No newline at end of file
......@@ -43,8 +43,6 @@ function CFraction(props)
this.Pr = new CMathFractionPr();
this.bHideBar = false;
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -102,9 +100,9 @@ CFraction.prototype.drawBarFraction = function(PDSE)
var x1 = this.pos.x + PosLine.x + this.GapLeft,
x2 = this.pos.x + PosLine.x + this.GapLeft + width,
y1 = this.pos.y + PosLine.y + numHeight- penW;
y1 = this.pos.y + PosLine.y + numHeight - penW;
if( !this.bHideBar )
if(this.Pr.type == BAR_FRACTION)
{
PDSE.Graphics.SetFont(mgCtrPrp);
......@@ -311,7 +309,7 @@ CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInf
if(RPI.bInline == true && (this.Pr.type === BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)) // уменьшае размер числителя и знаменателя
{
ArgSzNumDen.decrease(); // для контентов числителя и знаменателя
ArgSzNumDen.Decrease(); // для контентов числителя и знаменателя
this.ArgSize.SetValue(-1); // для CtrPrp
}
else if(RPI.bDecreasedComp == true) // уменьшаем расстояние между числителем и знаменателем (размер FontSize для TxtPr ControlLetter)
......@@ -324,8 +322,6 @@ CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInf
this.ArgSize.SetValue(0);
}
this.RecalcInfo.bCtrPrp = true;
this.Set_CompiledCtrPrp(Parent, ParaMath, RPI);
this.ApplyProperties(RPI);
......@@ -466,9 +462,6 @@ CFraction.prototype.fillContent = function()
{
this.setDimension(2, 1);
if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true;
this.elements[0][0] = this.Numerator;
this.elements[1][0] = this.Denominator;
}
......@@ -485,11 +478,122 @@ CFraction.prototype.fillContent = function()
this.elements[0][1] = this.Denominator.getElement();
}
};
CFraction.prototype.Document_UpdateInterfaceState = function(MathProps)
CFraction.prototype.Apply_MenuProps = function(Props)
{
MathProps.Type = c_oAscMathInterfaceType.Fraction;
MathProps.Pr = null;
if(Props.Type == c_oAscMathInterfaceType.Fraction && Props.FractionType !== undefined)
{
var FractionType = this.Pr.type;
switch (Props.FractionType)
{
case c_oAscMathInterfaceFraction.Bar:
FractionType = BAR_FRACTION;
break;
case c_oAscMathInterfaceFraction.Skewed:
FractionType = SKEWED_FRACTION;
break;
case c_oAscMathInterfaceFraction.Linear:
FractionType = LINEAR_FRACTION;
break;
case c_oAscMathInterfaceFraction.NoBar:
FractionType = NO_BAR_FRACTION;
break;
}
if(FractionType !== this.Pr.type)
{
History.Add(this, new CChangesMathFractionType(FractionType, this.Pr.type));
this.raw_SetFractionType(FractionType);
}
}
/*var FractionType;
switch(Type)
{
case c_oAscMathMenuTypes.FractionBar:
{
FractionType = BAR_FRACTION;
break;
}
case c_oAscMathMenuTypes.FractionSkewed:
{
FractionType = SKEWED_FRACTION;
break;
}
case c_oAscMathMenuTypes.FractionLinear:
{
FractionType = LINEAR_FRACTION;
break;
}
case c_oAscMathMenuTypes.FractionNoBar:
{
FractionType = NO_BAR_FRACTION;
break;
}
}
if(FractionType !== undefined && FractionType !== this.Pr.type)
{
History.Add(this, new CChangesMathFractionType(FractionType, this.Pr.type));
this.raw_SetFractionType(FractionType);
}*/
};
CFraction.prototype.Get_InterfaceProps = function()
{
return new CMathMenuFraction(this);
};
CFraction.prototype.raw_SetFractionType = function(FractionType)
{
this.Pr.type = FractionType;
this.fillContent();
};
/**
*
* @param CMathMenuFraction
* @constructor
* @extends {CMathMenuBase}
*/
function CMathMenuFraction(Fraction)
{
CMathMenuFraction.superclass.constructor.call(this, Fraction);
this.Type = c_oAscMathInterfaceType.Fraction;
if (undefined !== Fraction)
{
this.FractionType = c_oAscMathInterfaceFraction.Bar;
switch (Fraction.Pr.type)
{
case BAR_FRACTION:
this.FractionType = c_oAscMathInterfaceFraction.Bar;
break;
case SKEWED_FRACTION:
this.FractionType = c_oAscMathInterfaceFraction.Skewed;
break;
case LINEAR_FRACTION:
this.FractionType = c_oAscMathInterfaceFraction.Linear;
break;
case NO_BAR_FRACTION:
this.FractionType = c_oAscMathInterfaceFraction.NoBar;
break;
}
}
else
{
this.FractionType = undefined;
}
}
Asc.extendClass(CMathMenuFraction, CMathMenuBase);
CMathMenuFraction.prototype.get_FractionType = function(){return this.FractionType;};
CMathMenuFraction.prototype.put_FractionType = function(Type){this.FractionType = Type;};
window["CMathMenuFraction"] = CMathMenuFraction;
CMathMenuFraction.prototype["get_FractionType"] = CMathMenuFraction.prototype.get_FractionType;
CMathMenuFraction.prototype["put_FractionType"] = CMathMenuFraction.prototype.put_FractionType;
/**
*
......
......@@ -85,7 +85,7 @@ CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, Gap
this.FName.PreRecalc(this, ParaMath, ArgSize, RPI);
var ArgSzIter = ArgSize.Copy();
ArgSzIter.decrease();
ArgSzIter.Decrease();
var NewRPI = RPI.Copy();
NewRPI.bDecreasedComp = true;
......@@ -116,7 +116,7 @@ CLimitPrimary.prototype.recalculateSize = function(oMeasure)
if(this.Type == LIMIT_LOW)
ascent = SizeFName.ascent;
else if(this.Type == LIMIT_UP)
else
ascent = SizeIter.height + this.dH + SizeFName.ascent;
......@@ -126,6 +126,42 @@ CLimitPrimary.prototype.recalculateSize = function(oMeasure)
this.size.width = width;
this.size.ascent = ascent;
};
CLimitPrimary.prototype.setPosition = function(pos, PosInfo)
{
this.pos.x = pos.x;
this.pos.y = pos.y;
var maxW = this.FName.size.width > this.Iterator.size.width ? this.FName.size.width : this.Iterator.size.width;
var alignFNameX = (maxW - this.FName.size.width)/2;
var alignIterX = (maxW - this.Iterator.size.width)/2;
var FNamePos = new CMathPosition();
var IterPos = new CMathPosition();
if(this.Type == LIMIT_LOW)
{
FNamePos.x = this.pos.x + this.GapLeft + alignFNameX;
FNamePos.y = this.pos.y + this.FName.size.ascent;
IterPos.x = this.pos.x + this.GapLeft + alignIterX;
IterPos.y = this.pos.y + this.dH + this.FName.size.height;
}
else
{
IterPos.x = this.pos.x + this.GapLeft + alignIterX;
IterPos.y = this.pos.y + this.Iterator.size.ascent;
FNamePos.x = this.pos.x + this.GapLeft + alignFNameX;
FNamePos.y = this.pos.y + this.FName.size.ascent + this.dH + this.Iterator.size.height;
}
// такой порядок нужен для выравнивания Box по операторам
this.FName.setPosition(FNamePos, PosInfo);
this.Iterator.setPosition(IterPos, PosInfo);
pos.x += this.size.width;
};
/**
*
......@@ -205,7 +241,7 @@ CLimit.prototype.ApplyProperties = function(RPI)
this.RecalcInfo.bProps = false;
}*/
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
if(this.RecalcInfo.bProps == true || (RPI != undefined && RPI.bChangeInline == true))
{
this.setDimension(1, 1);
this.elements[0][0] = new CLimitPrimary(true, this.Pr.type, this.getFName(), this.getIterator());
......@@ -213,11 +249,81 @@ CLimit.prototype.ApplyProperties = function(RPI)
}
};
CLimit.prototype.Document_UpdateInterfaceState = function(MathProps)
CLimit.prototype.Apply_MenuProps = function(Props)
{
MathProps.Type = c_oAscMathInterfaceType.Limit;
MathProps.Pr = null;
if(Props.Type == c_oAscMathInterfaceType.Limit && Props.Pos !== undefined)
{
var Type = Props.Pos == c_oAscMathInterfaceLimitPos.Bottom ? LIMIT_LOW : LIMIT_UP;
if(this.Pr.type !== Type)
{
History.Add(this, new CChangesMathLimitType(Type, this.Pr.type));
this.raw_SetType(Type);
}
}
/*if(Type == c_oAscMathMenuTypes.LimitOver && this.Pr.type == LIMIT_LOW)
{
History.Add(this, new CChangesMathLimitType(LIMIT_UP, this.Pr.type));
this.raw_SetType(LIMIT_UP);
}
else if(Type == c_oAscMathMenuTypes.LimitUnder && this.Pr.type == LIMIT_UP)
{
History.Add(this, new CChangesMathLimitType(LIMIT_LOW, this.Pr.type));
this.raw_SetType(LIMIT_LOW);
}*/
};
CLimit.prototype.Get_InterfaceProps = function()
{
return new CMathMenuLimit(this);
};
CLimit.prototype.raw_SetType = function(Value)
{
if(this.Pr.type !== Value)
{
this.Pr.type = Value;
this.RecalcInfo.bProps = true;
this.ApplyProperties();
}
};
CLimit.prototype.Can_Delete = function()
{
return true;
};
CLimit.prototype.Is_SimpleDelete = function()
{
return true;
};
CLimit.prototype.Can_ModifyArgSize = function()
{
return this.CurPos == 1 && false === this.Is_SelectInside();
};
/**
*
* @param CMathMenuLimit
* @constructor
* @extends {CMathMenuBase}
*/
function CMathMenuLimit(Limit)
{
CMathMenuLimit.superclass.constructor.call(this);
this.Type = c_oAscMathInterfaceType.Limit;
if (undefined !== Limit.Pr)
this.Pos = (LIMIT_LOW === Limit.Pr.type) ? c_oAscMathInterfaceLimitPos.Bottom : c_oAscMathInterfaceLimitPos.Top;
else
this.Pos = undefined;
}
Asc.extendClass(CMathMenuLimit, CMathMenuBase);
CMathMenuLimit.prototype.get_Pos = function(){return this.Pos;};
CMathMenuLimit.prototype.put_Pos = function(Pos){this.Pos = Pos;};
window["CMathMenuLimit"] = CMathMenuLimit;
CMathMenuLimit.prototype["get_Pos"] = CMathMenuLimit.prototype.get_Pos;
CMathMenuLimit.prototype["put_Pos"] = CMathMenuLimit.prototype.put_Pos;
/**
*
......@@ -285,8 +391,3 @@ CMathFunc.prototype.fillContent = function()
this.elements[0][0] = this.getFName();
this.elements[0][1] = this.getArgument();
};
CMathFunc.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Function;
MathProps.Pr = null;
};
This diff is collapsed.
......@@ -52,12 +52,6 @@ var NARY_TEXT_OPER = 13;
var NARY_UndOvr = 0;
var NARY_SubSup = 1;
var BOX_DIFF = 0;
var BOX_OpEmu = 1;
var BOX_ALIGN = 2;
var BOX_BREAK = 3;
var BOX_NOBREAK = 4;
////////////////////////////////////////////////////
// operators:
......@@ -164,13 +158,6 @@ var JC_CENTERGROUP = 1;
var JC_LEFT = 2;
var JC_RIGHT = 3;
var MATH_TEXT = 0;
var MATH_RUN_PRP = 1;
var MATH_COMP = 2;
var MATH_EMPTY = 3;
var MATH_PLACEHOLDER = 4;
var MATH_PARA_RUN = 5;
var LOCATION_TOP = 0;
var LOCATION_BOT = 1;
var LOCATION_LEFT = 2;
......@@ -210,4 +197,82 @@ var MATH_UPDWRAP_NEWRANGE = 1;
var MATH_UPDWRAP_UNDERFLOW = 2;
var MATH_SIZE = 0;
var MATH_BOUNDS_MEASURES = 1;
\ No newline at end of file
var MATH_BOUNDS_MEASURES = 1;
var MATH_MATRIX_ROW = 0;
var MATH_MATRIX_COLUMN = 1;
var c_oAscMathMenuTypes =
{
FractionBar: 0x001,
FractionSkewed: 0x002,
FractionLinear: 0x003,
FractionNoBar: 0x004,
RadicalHideDegree: 0x005,
NaryLimLoc: 0x006,
NaryHideUpperIterator: 0x007,
NaryHideLowerIterator: 0x008,
DelimiterHideBegOper: 0x009,
DelimiterHideEndOper: 0x00A,
DelimiterAddToLeft: 0x00B,
DelimiterAddToRight: 0x00C,
DelimiterRemoveContent: 0x00D,
DelimiterGrow: 0x00E,
DelimiterShpCentred: 0x00F,
GroupCharOver: 0x010,
GroupCharUnder: 0x011,
LimitOver: 0x012,
LimitUnder: 0x013,
BorderBoxHideTop: 0x014,
BorderBoxHideBot: 0x015,
BorderBoxHideLeft: 0x016,
BorderBoxHideRight: 0x017,
BorderBoxStrikeHor: 0x018,
BorderBoxStrikeVer: 0x019,
BorderBoxStrikeTopLTR: 0x020,
BorderBoxStrikeTopRTL: 0x021,
MatrixAddRowUnder: 0x022,
MatrixAddRowOver: 0x023,
MatrixRemoveRow: 0x024,
MatrixAddColumnToLeft: 0x025,
MatrixAddColumnToRight: 0x026,
MatrixRemoveColumn: 0x027,
MatrixBaseJcCenter: 0x028,
MatrixBaseJcTop: 0x029,
MatrixBaseJcBottom: 0x030,
MatrixColumnJcCenter: 0x031,
MatrixColumnJcLeft: 0x032,
MatrixColumnJcRight: 0x033,
MatrixRowSingleGap: 0x034,
MatrixRowOneAndHalfGap: 0x035,
MatrixRowDoubleGap: 0x036,
MatrixRowExactlyGap: 0x037,
MatrixRowMultipleGap: 0x038,
MatrixColumnSingleGap: 0x039,
MatrixColumnOneAndHalfGap: 0x040,
MatrixColumnDoubleGap: 0x041,
MatrixColumnExactlyGap: 0x042,
MatrixColumnMultipleGap: 0x043,
MatrixHidePlaceholders: 0x044,
MatrixMinColumnWidth: 0x045,
EqArrayAddRowUnder: 0x046,
EqArrayAddRowOver: 0x047,
EqArrayRemoveRow: 0x048,
EqArrayBaseJcCenter: 0x049,
EqArrayBaseJcTop: 0x050,
EqArrayBaseJcBottom: 0x051,
EqArrayRowSingleGap: 0x052,
EqArrayRowOneAndHalfGap: 0x053,
EqArrayRowDoubleGap: 0x054,
EqArrayRowExactlyGap: 0x055,
EqArrayRowMultipleGap: 0x056,
BarLineOver: 0x057,
BarLineUnder: 0x058,
DeleteElement: 0x059,
DeleteSubScript: 0x060,
DeleteSuperScript: 0x061,
IncreaseArgSize: 0x062,
DecreaseArgSize: 0x063,
AddForcedBreak: 0x064,
DeleteForcedBreak: 0x065
};
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -136,6 +136,17 @@ CSignRadical.prototype.draw = function(x, y, pGraphics, PDSE)
PDSE.Graphics.p_width(penW3*1000);
if(PDSE.Graphics.m_oCoordTransform !== undefined)
{
var CoordTransform = PDSE.Graphics.m_oCoordTransform;
var diff = CoordTransform.TransformPointX(xx5, yy5) - CoordTransform.TransformPointX(xx4, yy4);
// чтобы реже перескакивали точки при незначительном изменении ширины формулы (из-за округления на отрисовке)
// на небольших размерах приравниваем две нижние точки друг другу
if( diff < 0.3 )
xx5 = xx4;
}
PDSE.Graphics._m(xx2, yy2);
PDSE.Graphics._l(xx3, yy3);
PDSE.Graphics._l(xx4, yy4);
......@@ -296,7 +307,19 @@ CMathRadicalPr.prototype.Set_FromObject = function(Obj)
this.type = DEGREE_RADICAL;
}
};
CMathRadicalPr.prototype.ChangeType = function()
{
if(this.type == DEGREE_RADICAL)
{
this.degHide = true;
this.type = SQUARE_RADICAL;
}
else
{
this.degHide = false;
this.type = DEGREE_RADICAL;
}
};
CMathRadicalPr.prototype.Copy = function()
{
var NewPr = new CMathRadicalPr();
......@@ -650,10 +673,62 @@ CRadical.prototype.getDegree = function()
{
return this.Content[0];
};
CRadical.prototype.Document_UpdateInterfaceState = function(MathProps)
CRadical.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
{
this.Apply_TextPrToCtrPr(TextPr, IncFontSize, ApplyToAll);
this.Iterator.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
this.Base.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
};
CRadical.prototype.Apply_MenuProps = function(Props)
{
if(Props.Type == c_oAscMathInterfaceType.Radical && Props.HideDegree !== undefined)
{
if(true == this.Iterator.IsPlaceholder() && Props.HideDegree !== this.Pr.degHide)
{
History.Add(this, new CChangesMathRadicalHideDegree( Props.HideDegree, this.Pr.degHide ));
this.raw_SetHideDegree(Props.HideDegree);
}
}
};
CRadical.prototype.old_Apply_MenuProps = function(Type)
{
if(Type == c_oAscMathMenuTypes.RadicalHideDegree)
{
History.Add(this, new CChangesMathRadicalHideDegree( !this.Pr.degHide, this.Pr.degHide ));
this.raw_SetHideDegree(!this.Pr.degHide);
}
};
CRadical.prototype.Get_InterfaceProps = function()
{
MathProps.Type = c_oAscMathInterfaceType.Radical;
MathProps.Pr = null;
return new CMathMenuRadical(this);
};
CRadical.prototype.raw_SetHideDegree = function(Value)
{
if(this.Pr.degHide !== Value)
{
this.Pr.ChangeType();
this.RecalcInfo.bProps = true;
this.ApplyProperties();
if(this.Pr.type === SQUARE_RADICAL && this.CurPos == 0) // находимся в степени
{
this.CurPos = 1;
this.Base.Cursor_MoveToStartPos();
}
}
};
CRadical.prototype.Can_Delete = function()
{
return true;
};
CRadical.prototype.Is_SimpleDelete = function()
{
return true;
};
CRadical.prototype.Can_ModifyArgSize = function()
{
return this.CurPos == 0 && false === this.Is_SelectInside();
};
CRadical.prototype.Is_ContentUse = function(MathContent)
{
......@@ -664,4 +739,37 @@ CRadical.prototype.Is_ContentUse = function(MathContent)
return true;
return false;
};
\ No newline at end of file
};
/**
*
* @param CMathMenuRadical
* @constructor
* @extends {CMathMenuBase}
*/
function CMathMenuRadical(Radical)
{
CMathMenuRadical.superclass.constructor.call(this, Radical);
if (undefined !== Radical)
{
var HideDegree = undefined;
if (Radical.Iterator.IsPlaceholder())
HideDegree = Radical.Pr.degHide == true;
this.Type = c_oAscMathInterfaceType.Radical;
this.HideDegree = HideDegree;
}
else
{
this.Type = c_oAscMathInterfaceType.Radical;
this.HideDegree = undefined;
}
}
Asc.extendClass(CMathMenuRadical, CMathMenuBase);
CMathMenuRadical.prototype.get_HideDegree = function(){return this.HideDegree;};
CMathMenuRadical.prototype.put_HideDegree = function(Hide){this.HideDegree = Hide;};
window["CMathMenuRadical"] = CMathMenuRadical;
CMathMenuRadical.prototype["get_HideDegree"] = CMathMenuRadical.prototype.get_HideDegree;
CMathMenuRadical.prototype["put_HideDegree"] = CMathMenuRadical.prototype.put_HideDegree;
......@@ -1229,21 +1229,6 @@ asc_docs_api.prototype.removeDropcap = function(bDropCap)
this.WordControl.m_oLogicDocument.Remove_DropCap( bDropCap );
};
function CMathProp(obj)
{
this.Type = c_oAscMathInterfaceType.Common;
this.Pr = null;
if (obj)
{
this.Type = (undefined !== obj.Type ? obj.Type : this.Type);
this.Pr = (undefined !== obj.Pr ? obj.Pr : this.Pr);
}
}
CMathProp.prototype.get_Type = function() {return this.Type;};
// Paragraph properties
function CParagraphPropEx (obj)
{
......@@ -3212,7 +3197,7 @@ asc_docs_api.prototype.sync_PrPropCallback = function(prProp){
asc_docs_api.prototype.sync_MathPropCallback = function(MathProp)
{
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new asc_CSelectedObject(c_oAscTypeSelectElement.Math, new CMathProp(MathProp));
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new asc_CSelectedObject(c_oAscTypeSelectElement.Math, MathProp);
};
asc_docs_api.prototype.sync_EndAddShape = function()
......@@ -3251,6 +3236,15 @@ asc_docs_api.prototype.SetDrawingFreeze = function(bIsFreeze)
this.WordControl.OnScroll();
};
//----------------------------------------------------------------------------------------------------------------------
// Работаем с формулами
//----------------------------------------------------------------------------------------------------------------------
asc_docs_api.prototype.asc_SetMathProps = function(MathProps)
{
this.WordControl.m_oLogicDocument.Set_MathProps(MathProps);
};
asc_docs_api.prototype["asc_SetMathProps"] = asc_docs_api.prototype.asc_SetMathProps;
//----------------------------------------------------------------------------------------------------------------------
// Работаем с настройками секции
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -551,22 +551,101 @@ var c_oAscMathType = {
};
var c_oAscMathInterfaceType = {
Common: 0x00,
Fraction: 0x01,
Script: 0x02,
Radical: 0x03,
LargeOperator: 0x04,
Delimiter: 0x05,
Function: 0x06,
Accent: 0x07,
BorderBox: 0x08,
Bar: 0x09,
Box: 0x0a,
Limit: 0x0b,
GroupChar: 0x0c,
Matrix: 0x0d,
EqArray: 0x0e,
Phantom: 0x0f
Common : 0x00,
Fraction : 0x01,
Script : 0x02,
Radical : 0x03,
LargeOperator : 0x04,
Delimiter : 0x05,
Function : 0x06,
Accent : 0x07,
BorderBox : 0x08,
Bar : 0x09,
Box : 0x0a,
Limit : 0x0b,
GroupChar : 0x0c,
Matrix : 0x0d,
EqArray : 0x0e,
Phantom : 0x0f
};
var c_oAscMathInterfaceBarPos = {
Top : 0,
Bottom : 1
};
var c_oAscMathInterfaceScript = {
None : 0x000, // Удаление скрипта
Sup : 0x001,
Sub : 0x002,
SubSup : 0x003,
PreSubSup : 0x004
};
var c_oAscMathInterfaceFraction = {
Bar : 0x001,
Skewed : 0x002,
Linear : 0x003,
NoBar : 0x004
};
var c_oAscMathInterfaceLimitPos = {
None : -1, // Удаление предела
Top : 0,
Bottom : 1
};
var c_oAscMathInterfaceMatrixMatrixAlign = {
Top : 0,
Center : 1,
Bottom : 2
};
var c_oAscMathInterfaceMatrixColumnAlign = {
Left : 0,
Center : 1,
Right : 2
};
var c_oAscMathInterfaceMatrixRowRule = {
Single : 0x00,
OneAndHalf : 0x01,
Double : 0x02,
Exactly : 0x03,
Multiple : 0x04
};
var c_oAscMathInterfaceMatrixColumnRule = {
Single : 0x00,
OneAndHalf : 0x01,
Double : 0x02,
Exactly : 0x03,
Multiple : 0x04
};
var c_oAscMathInterfaceEqArrayAlign = {
Top : 0,
Center : 1,
Bottom : 2
};
var c_oAscMathInterfaceEqArrayLineRule = {
Single : 0x00,
OneAndHalf : 0x01,
Double : 0x02,
Exactly : 0x03,
Multiple : 0x04
};
var c_oAscMathInterfaceNaryLimitLocation = {
UndOvr : 0,
SubSup : 1
};
var c_oAscMathInterfaceGroupCharPos = {
Top : 0,
Bottom : 1
};
var c_oAscRevisionsChangeType = {
......
......@@ -520,8 +520,6 @@ asc_docs_api.prototype['asc_addComment'] = asc_docs_api.prototype.asc_addComment
asc_docs_api.prototype['asc_SetFastCollaborative'] = asc_docs_api.prototype.asc_SetFastCollaborative;
asc_docs_api.prototype['asc_isOffline'] = asc_docs_api.prototype.asc_isOffline;
asc_docs_api.prototype['asc_getUrlType'] = asc_docs_api.prototype.asc_getUrlType;
window['CMathProp'] = CMathProp;
CMathProp.prototype['get_Type'] = CMathProp.prototype.get_Type;
window['CParagraphPropEx'] = CParagraphPropEx;
CParagraphPropEx.prototype['get_ContextualSpacing'] = CParagraphPropEx.prototype.get_ContextualSpacing;
CParagraphPropEx.prototype['get_Ind'] = CParagraphPropEx.prototype.get_Ind;
......
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