Commit 7c5f77ec authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. В Root если контент пустой добавляем плейсхолдер. При удалении плейсхолдера...

1. В Root если контент пустой добавляем плейсхолдер. При удалении плейсхолдера удаляем полностью формулу, а именно делаем контент формулы пустым
2. Если из меню пришел type == undefined, это означает добавляем пустую формулу с плейсхолдером. Добавлен новый тип Default_Text для
3. Подсветка плейсхолдера для Root

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68758 954022d7-b5bf-4e40-9824-e11837661b57
parent 8d9f6db4
...@@ -670,7 +670,7 @@ function Get_WordDocumentDefaultMathSettings() ...@@ -670,7 +670,7 @@ function Get_WordDocumentDefaultMathSettings()
function MathMenu(type) function MathMenu(type)
{ {
this.Type = para_Math; this.Type = para_Math;
this.Menu = type; this.Menu = type == undefined ? c_oAscMathType.Default_Text : type;
} }
MathMenu.prototype = MathMenu.prototype =
{ {
...@@ -1119,13 +1119,7 @@ ParaMath.prototype.Get_Text = function(Text) ...@@ -1119,13 +1119,7 @@ ParaMath.prototype.Get_Text = function(Text)
ParaMath.prototype.Is_Empty = function() ParaMath.prototype.Is_Empty = function()
{ {
if (this.Root.Content.length <= 0) return this.Root.Content.length == 0;
return true;
if (1 === this.Root.Content.length)
return this.Root.Content[0].Is_Empty({SkipPlcHldr : true});
return false;
}; };
ParaMath.prototype.Is_CheckingNearestPos = function() ParaMath.prototype.Is_CheckingNearestPos = function()
...@@ -1366,7 +1360,12 @@ ParaMath.prototype.Remove = function(Direction, bOnAddText) ...@@ -1366,7 +1360,12 @@ ParaMath.prototype.Remove = function(Direction, bOnAddText)
// Если данный элемент - ран, удаляем внутри рана, если нет, тогда удаляем целиком элемент // Если данный элемент - ран, удаляем внутри рана, если нет, тогда удаляем целиком элемент
if (para_Math_Run === oElement.Type) if (para_Math_Run === oElement.Type)
{ {
if ((true === oElement.IsPlaceholder()) || (false === oElement.Remove(Direction) && true !== this.bSelectionUse)) if (true === oElement.IsPlaceholder() && oElement.Parent.bRoot == true)
{
this.Root.Remove_FromContent(0, 1);
return true;
}
else if ((true === oElement.IsPlaceholder()) || (false === oElement.Remove(Direction) && true !== this.bSelectionUse))
{ {
if ((Direction > 0 && oContent.Content.length - 1 === nStartPos) || (Direction < 0 && 0 === nStartPos)) if ((Direction > 0 && oContent.Content.length - 1 === nStartPos) || (Direction < 0 && 0 === nStartPos))
{ {
...@@ -3195,7 +3194,7 @@ ParaMath.prototype.Get_ContentSelection = function() ...@@ -3195,7 +3194,7 @@ ParaMath.prototype.Get_ContentSelection = function()
var Bounds = null; var Bounds = null;
var oContent = this.GetSelectContent().Content; var oContent = this.GetSelectContent().Content;
if (oContent.bRoot == false) if (true == oContent.Can_GetSelection())
{ {
if(oContent.bOneLine) if(oContent.bOneLine)
{ {
......
...@@ -1006,11 +1006,20 @@ CMathContent.prototype.Is_InclineLetter = function() ...@@ -1006,11 +1006,20 @@ CMathContent.prototype.Is_InclineLetter = function()
}; };
CMathContent.prototype.IsPlaceholder = function() CMathContent.prototype.IsPlaceholder = function()
{ {
var flag = false; var bPlh = false;
if(!this.bRoot && this.Content.length == 1) if(!this.bRoot && this.Content.length == 1)
flag = this.Content[0].IsPlaceholder(); bPlh = this.Content[0].IsPlaceholder();
return flag; return bPlh;
};
CMathContent.prototype.Can_GetSelection = function()
{
var bPlh = false;
if(this.Content.length == 1)
bPlh = this.Content[0].IsPlaceholder();
return bPlh || this.bRoot == false;
}; };
CMathContent.prototype.IsJustDraw = function() CMathContent.prototype.IsJustDraw = function()
{ {
...@@ -1301,7 +1310,7 @@ CMathContent.prototype.Correct_Content = function(bInnerCorrection) ...@@ -1301,7 +1310,7 @@ CMathContent.prototype.Correct_Content = function(bInnerCorrection)
} }
if(bEmptyContent && this.bRoot == false) if(bEmptyContent)
{ {
this.Content[0].fillPlaceholders(); this.Content[0].fillPlaceholders();
this.Content[0].Recalc_CompiledPr(true); this.Content[0].Recalc_CompiledPr(true);
...@@ -2224,6 +2233,8 @@ CMathContent.prototype.Load_FromMenu = function(Type, Paragraph) ...@@ -2224,6 +2233,8 @@ CMathContent.prototype.Load_FromMenu = function(Type, Paragraph)
this.private_LoadFromMenuOperator(Type, Pr); this.private_LoadFromMenuOperator(Type, Pr);
else if (MainType === c_oAscMathMainType.Matrix) else if (MainType === c_oAscMathMainType.Matrix)
this.private_LoadFromMenuMatrix(Type, Pr); this.private_LoadFromMenuMatrix(Type, Pr);
else if(MainType == c_oAscMathMainType.Empty_Content)
this.private_LoadFromMenuDefaultText(Type, Pr);
}; };
CMathContent.prototype.private_LoadFromMenuSymbol = function(Type, Pr) CMathContent.prototype.private_LoadFromMenuSymbol = function(Type, Pr)
{ {
...@@ -2861,6 +2872,10 @@ CMathContent.prototype.private_LoadFromMenuMatrix = function(Type, Pr) ...@@ -2861,6 +2872,10 @@ CMathContent.prototype.private_LoadFromMenuMatrix = function(Type, Pr)
case c_oAscMathType.Matrix_Flat_Round : this.Add_MatrixWithBrackets(null, null, Pr.ctrPrp, 3, 3, false, [null, String.fromCharCode(8943), null, String.fromCharCode(8942), String.fromCharCode(8945), String.fromCharCode(8942), null, String.fromCharCode(8943), null]); break; case c_oAscMathType.Matrix_Flat_Round : this.Add_MatrixWithBrackets(null, null, Pr.ctrPrp, 3, 3, false, [null, String.fromCharCode(8943), null, String.fromCharCode(8942), String.fromCharCode(8945), String.fromCharCode(8942), null, String.fromCharCode(8943), null]); break;
case c_oAscMathType.Matrix_Flat_Square : this.Add_MatrixWithBrackets( 91, 93, Pr.ctrPrp, 3, 3, false, [null, String.fromCharCode(8943), null, String.fromCharCode(8942), String.fromCharCode(8945), String.fromCharCode(8942), null, String.fromCharCode(8943), null]); break; case c_oAscMathType.Matrix_Flat_Square : this.Add_MatrixWithBrackets( 91, 93, Pr.ctrPrp, 3, 3, false, [null, String.fromCharCode(8943), null, String.fromCharCode(8942), String.fromCharCode(8945), String.fromCharCode(8942), null, String.fromCharCode(8943), null]); break;
} }
};
CMathContent.prototype.private_LoadFromMenuDefaultText = function(Type, Pr)
{
}; };
CMathContent.prototype.Add_Element = function(Element) CMathContent.prototype.Add_Element = function(Element)
{ {
......
...@@ -178,7 +178,8 @@ var c_oAscMathMainType = { ...@@ -178,7 +178,8 @@ var c_oAscMathMainType = {
Accent: 0x08, Accent: 0x08,
LimitLog: 0x09, LimitLog: 0x09,
Operator: 0x0a, Operator: 0x0a,
Matrix: 0x0b Matrix: 0x0b,
Empty_Content: 0x0c
}; };
var c_oAscMathMainTypeStrings = {}; var c_oAscMathMainTypeStrings = {};
...@@ -194,6 +195,7 @@ c_oAscMathMainTypeStrings[c_oAscMathMainType.Accent ] = "Accent"; ...@@ -194,6 +195,7 @@ c_oAscMathMainTypeStrings[c_oAscMathMainType.Accent ] = "Accent";
c_oAscMathMainTypeStrings[c_oAscMathMainType.LimitLog ] = "LimitLog"; c_oAscMathMainTypeStrings[c_oAscMathMainType.LimitLog ] = "LimitLog";
c_oAscMathMainTypeStrings[c_oAscMathMainType.Operator ] = "Operator"; c_oAscMathMainTypeStrings[c_oAscMathMainType.Operator ] = "Operator";
c_oAscMathMainTypeStrings[c_oAscMathMainType.Matrix ] = "Matrix"; c_oAscMathMainTypeStrings[c_oAscMathMainType.Matrix ] = "Matrix";
c_oAscMathMainTypeStrings[c_oAscMathMainType.Empty_Content] = "Empty_Content";
var c_oAscMathType = { var c_oAscMathType = {
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
...@@ -547,7 +549,9 @@ var c_oAscMathType = { ...@@ -547,7 +549,9 @@ var c_oAscMathType = {
Matrix_2_2_LineBracket: 0x0b030002, Matrix_2_2_LineBracket: 0x0b030002,
Matrix_2_2_DLineBracket: 0x0b030003, Matrix_2_2_DLineBracket: 0x0b030003,
Matrix_Flat_Round: 0x0b040000, Matrix_Flat_Round: 0x0b040000,
Matrix_Flat_Square: 0x0b040001 Matrix_Flat_Square: 0x0b040001,
//----------------------------------------------------------------------------------------------------------------------
Default_Text: 0x0c000000
}; };
var c_oAscMathInterfaceType = { var c_oAscMathInterfaceType = {
......
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