Commit 30a95c92 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@59488 954022d7-b5bf-4e40-9824-e11837661b57
parent 7e7abffc
...@@ -2387,6 +2387,42 @@ ParaHyperlink.prototype.Write_ToBinary2SpreadSheets = function(Writer) ...@@ -2387,6 +2387,42 @@ ParaHyperlink.prototype.Write_ToBinary2SpreadSheets = function(Writer)
Writer.WriteLong(0); Writer.WriteLong(0);
}; };
ParaHyperlink.prototype.Document_UpdateInterfaceState = function()
{
var HyperText = new CParagraphGetText();
this.Get_Text( HyperText );
var HyperProps = new CHyperlinkProperty(this);
HyperProps.put_Text( HyperText.Text );
editor.sync_HyperlinkPropCallback(HyperProps);
if ( true === this.Selection.Use )
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Element = this.Content[CurPos];
if (true !== Element.Selection_IsEmpty() && (para_Hyperlink === Element.Type || para_Math === Element.Type))
Element.Document_UpdateInterfaceState();
}
}
else
{
var CurType = this.Content[this.State.ContentPos].Type;
if (para_Hyperlink === CurType || para_Math === CurType)
this.Content[this.State.ContentPos].Document_UpdateInterfaceState();
}
};
function CParaHyperLinkStartState(HyperLink) function CParaHyperLinkStartState(HyperLink)
{ {
this.Value = HyperLink.Value; this.Value = HyperLink.Value;
......
...@@ -1864,6 +1864,28 @@ ParaMath.prototype.Get_Bounds = function() ...@@ -1864,6 +1864,28 @@ ParaMath.prototype.Get_Bounds = function()
} }
}; };
/**
* Обновляем состояние интерфейса.
*/
ParaMath.prototype.Document_UpdateInterfaceState = function()
{
var SelectedContent = this.GetSelectContent();
var MathContent = SelectedContent.Content;
var MathProps = new CMathProp();
if (MathContent.bRoot)
{
MathProps.Type = c_oAscMathInterfaceType.Common;
MathProps.Pr = null;
}
else if (undefined !== MathContent.ParentElement && null !== MathContent.ParentElement)
{
MathContent.ParentElement.Document_UpdateInterfaceState(MathProps);
}
editor.sync_MathPropCallback(MathProps);
};
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Классы с изменениями // Классы с изменениями
......
...@@ -8636,9 +8636,6 @@ Paragraph.prototype = ...@@ -8636,9 +8636,6 @@ Paragraph.prototype =
if ( this.bFromDocument && this.LogicDocument && true === this.LogicDocument.Spelling.Use ) if ( this.bFromDocument && this.LogicDocument && true === this.LogicDocument.Spelling.Use )
this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos ); this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos );
var Hyperlinks = [];
var Math = null;
if ( true === this.Selection.Use ) if ( true === this.Selection.Use )
{ {
var StartPos = this.Selection.StartPos; var StartPos = this.Selection.StartPos;
...@@ -8653,36 +8650,15 @@ Paragraph.prototype = ...@@ -8653,36 +8650,15 @@ Paragraph.prototype =
{ {
var Element = this.Content[CurPos]; var Element = this.Content[CurPos];
if ( true !== Element.Selection_IsEmpty() && para_Hyperlink !== Element.Type ) if (true !== Element.Selection_IsEmpty() && (para_Hyperlink === Element.Type || para_Math === Element.Type))
continue; Element.Document_UpdateInterfaceState();
else if ( true !== Element.Selection_IsEmpty() && para_Hyperlink === Element.Type )
{
Hyperlinks.push(CurPos);
}
} }
if (this.Selection.StartPos === this.Selection.EndPos && para_Math === this.Content[this.Selection.EndPos].Type )
Math = this.Content[this.Selection.EndPos];
} }
else else
{ {
if (para_Hyperlink === this.Content[this.CurPos.ContentPos].Type) var CurType = this.Content[this.CurPos.ContentPos].Type;
Hyperlinks.push(this.CurPos.ContentPos); if (para_Hyperlink === CurType || para_Math === CurType)
else if (para_Math === this.Content[this.CurPos.ContentPos].Type) this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState();
Math = this.Content[this.CurPos.ContentPos];
}
for (var HyperIndex = 0, HyperCount = Hyperlinks.length; HyperIndex < HyperCount; HyperIndex++)
{
var Hyperlink = this.Content[Hyperlinks[HyperIndex]];
var HyperText = new CParagraphGetText();
Hyperlink.Get_Text( HyperText );
var HyperProps = new CHyperlinkProperty( Hyperlink );
HyperProps.put_Text( HyperText.Text );
editor.sync_HyperlinkPropCallback( HyperProps );
} }
}, },
......
...@@ -570,4 +570,9 @@ CAccent.prototype.draw = function(x, y, pGraphics) ...@@ -570,4 +570,9 @@ CAccent.prototype.draw = function(x, y, pGraphics)
} }
this.operator.draw(x, y, pGraphics); this.operator.draw(x, y, pGraphics);
};
CAccent.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Accent;
MathProps.Pr = null;
}; };
\ No newline at end of file
...@@ -1120,6 +1120,9 @@ CMathBase.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, ...@@ -1120,6 +1120,9 @@ CMathBase.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth,
return false; return false;
}; };
CMathBase.prototype.Document_UpdateInterfaceState = function(MathProps)
{
};
function CMathBasePr() function CMathBasePr()
{ {
......
...@@ -381,6 +381,11 @@ CBorderBox.prototype.setPosition = function(pos, PosInfo) ...@@ -381,6 +381,11 @@ CBorderBox.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(NewPos, PosInfo); this.elements[0][0].setPosition(NewPos, PosInfo);
} }
CBorderBox.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.BorderBox;
MathProps.Pr = null;
};
function CMathBoxPr() function CMathBoxPr()
{ {
...@@ -519,6 +524,11 @@ CBox.prototype.getBase = function() ...@@ -519,6 +524,11 @@ CBox.prototype.getBase = function()
{ {
return this.Content[0]; return this.Content[0];
} }
CBox.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Box;
MathProps.Pr = null;
};
function CMathBarPr() function CMathBarPr()
...@@ -616,6 +626,11 @@ CBar.prototype.getAscent = function() ...@@ -616,6 +626,11 @@ CBar.prototype.getAscent = function()
return ascent; return ascent;
} }
CBar.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Bar;
MathProps.Pr = null;
};
function CMathPhantomPr() function CMathPhantomPr()
{ {
...@@ -730,4 +745,9 @@ CPhantom.prototype.fillContent = function() ...@@ -730,4 +745,9 @@ CPhantom.prototype.fillContent = function()
{ {
this.setDimension(1, 1); this.setDimension(1, 1);
this.elements[0][0] = this.getBase(); this.elements[0][0] = this.getBase();
} }
\ No newline at end of file CPhantom.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Phantom;
MathProps.Pr = null;
};
\ No newline at end of file
...@@ -276,6 +276,11 @@ CDegree.prototype.fillContent = function() ...@@ -276,6 +276,11 @@ CDegree.prototype.fillContent = function()
CDegree.superclass.fillContent.apply(this, arguments); CDegree.superclass.fillContent.apply(this, arguments);
}; };
CDegree.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Script;
MathProps.Pr = null;
};
function CIterators(iterUp, iterDn) function CIterators(iterUp, iterDn)
{ {
...@@ -598,3 +603,8 @@ CDegreeSubSup.prototype.fillContent = function() ...@@ -598,3 +603,8 @@ CDegreeSubSup.prototype.fillContent = function()
CDegreeSubSup.superclass.fillContent.apply(this, arguments); CDegreeSubSup.superclass.fillContent.apply(this, arguments);
}; };
CDegreeSubSup.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Script;
MathProps.Pr = null;
};
...@@ -419,6 +419,11 @@ CFraction.prototype.fillContent = function() ...@@ -419,6 +419,11 @@ CFraction.prototype.fillContent = function()
this.elements[0][1] = this.Denominator.getElement(); this.elements[0][1] = this.Denominator.getElement();
} }
} }
CFraction.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Fraction;
MathProps.Pr = null;
};
function CFractionBase(bInside, MathContent) function CFractionBase(bInside, MathContent)
{ {
......
...@@ -178,6 +178,12 @@ CLimit.prototype.ApplyProperties = function(RPI) ...@@ -178,6 +178,12 @@ CLimit.prototype.ApplyProperties = function(RPI)
} }
}; };
CLimit.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Limit;
MathProps.Pr = null;
};
function CMathFunc(props) function CMathFunc(props)
{ {
CMathFunc.superclass.constructor.call(this); CMathFunc.superclass.constructor.call(this);
...@@ -228,4 +234,10 @@ CMathFunc.prototype.fillContent = function() ...@@ -228,4 +234,10 @@ CMathFunc.prototype.fillContent = function()
this.elements[0][0] = this.getFName(); this.elements[0][0] = this.getFName();
this.elements[0][1] = this.getArgument(); this.elements[0][1] = this.getArgument();
}; };
CMathFunc.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Function;
MathProps.Pr = null;
};
...@@ -553,6 +553,11 @@ CMathMatrix.prototype.getColsCount = function() ...@@ -553,6 +553,11 @@ CMathMatrix.prototype.getColsCount = function()
{ {
return this.column; return this.column;
}; };
CMathMatrix.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Matrix;
MathProps.Pr = null;
};
function CMathPoint() function CMathPoint()
...@@ -882,3 +887,9 @@ CEqArray.prototype.getElementMathContent = function(Index) ...@@ -882,3 +887,9 @@ CEqArray.prototype.getElementMathContent = function(Index)
{ {
return this.Content[Index]; return this.Content[Index];
}; };
CEqArray.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.EqArray;
MathProps.Pr = null;
};
...@@ -439,6 +439,12 @@ CNary.prototype.getSubMathContent = function() ...@@ -439,6 +439,12 @@ CNary.prototype.getSubMathContent = function()
{ {
return this.LowerIterator; return this.LowerIterator;
}; };
CNary.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.LargeOperator;
MathProps.Pr = null;
};
function CNaryUnd(bInside) function CNaryUnd(bInside)
{ {
......
...@@ -3738,6 +3738,12 @@ CDelimiter.prototype.getElementMathContent = function(Index) ...@@ -3738,6 +3738,12 @@ CDelimiter.prototype.getElementMathContent = function(Index)
{ {
return this.Content[Index]; return this.Content[Index];
}; };
CDelimiter.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Delimiter;
MathProps.Pr = null;
};
function CCharacter() function CCharacter()
{ {
...@@ -4027,4 +4033,9 @@ CGroupCharacter.prototype.getAscent = function(oMeasure) ...@@ -4027,4 +4033,9 @@ CGroupCharacter.prototype.getAscent = function(oMeasure)
return ascent; return ascent;
} }
\ No newline at end of file CGroupCharacter.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.GroupChar;
MathProps.Pr = null;
};
...@@ -651,3 +651,8 @@ CRadical.prototype.getDegree = function() ...@@ -651,3 +651,8 @@ CRadical.prototype.getDegree = function()
{ {
return this.Content[0]; return this.Content[0];
} }
CRadical.prototype.Document_UpdateInterfaceState = function(MathProps)
{
MathProps.Type = c_oAscMathInterfaceType.Radical;
MathProps.Pr = null;
};
...@@ -2041,6 +2041,20 @@ asc_docs_api.prototype.removeDropcap = function(bDropCap) ...@@ -2041,6 +2041,20 @@ asc_docs_api.prototype.removeDropcap = function(bDropCap)
this.WordControl.m_oLogicDocument.Remove_DropCap( 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);
this.Pr = (undefined !== obj.Pr)
}
}
CMathProp.prototype.get_Type = function() {return this.Type;}
function CParagraphProp (obj) function CParagraphProp (obj)
{ {
if (obj) if (obj)
...@@ -4092,6 +4106,11 @@ asc_docs_api.prototype.sync_PrPropCallback = function(prProp){ ...@@ -4092,6 +4106,11 @@ asc_docs_api.prototype.sync_PrPropCallback = function(prProp){
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( c_oAscTypeSelectElement.Paragraph, new CParagraphProp( prProp ) ); this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( c_oAscTypeSelectElement.Paragraph, new CParagraphProp( prProp ) );
} }
asc_docs_api.prototype.sync_MathPropCallback = function(MathProp)
{
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject(c_oAscTypeSelectElement.Math, new CMathProp(MathProp));
}
asc_docs_api.prototype.sync_EndAddShape = function() asc_docs_api.prototype.sync_EndAddShape = function()
{ {
editor.asc_fireCallback("asc_onEndAddShape"); editor.asc_fireCallback("asc_onEndAddShape");
......
...@@ -99,16 +99,18 @@ var c_oAscError = { ...@@ -99,16 +99,18 @@ var c_oAscError = {
} }
}; };
var c_oAscTypeSelectElement = { var c_oAscTypeSelectElement =
{
Paragraph : 0, Paragraph : 0,
Table : 1, Table : 1,
Image : 2, Image : 2,
Header : 3, Header : 3,
Hyperlink : 4, Hyperlink : 4,
SpellCheck : 5, SpellCheck : 5,
Shape:6, Shape : 6,
Slide:7, Slide : 7,
Chart: 8 Chart : 8,
Math : 9
}; };
var c_oAscTableBordersType = { var c_oAscTableBordersType = {
...@@ -726,4 +728,24 @@ var c_oAscMathType = ...@@ -726,4 +728,24 @@ var c_oAscMathType =
Matrix_Flat_Square : 0x0b040001 Matrix_Flat_Square : 0x0b040001
}; };
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
};
window["flat_desine"] = false; window["flat_desine"] = false;
\ 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