Commit 1bca6133 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@66709 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f52915f
......@@ -2947,6 +2947,7 @@ function ReadChanges_FromBinary(Reader, Class)
case historyitem_Math_ParaJc : Changes = new CChangesMathParaJc(); break;
case historyitem_Math_CtrPrpShd : Changes = new CChangesMathShd(); break;
case historyitem_Math_AddItems_ToMathBase : Changes = new CChangesMathAddItems(); break;
case historyitem_Math_EqArrayPr : Changes = new CChangesMathEqArrayPr(); break;
case historyitem_Math_CtrPrpColor : Changes = new CChangesMathColor(); break;
case historyitem_Math_CtrPrpUnifill : Changes = new CChangesMathUnifill(); break;
case historyitem_Math_CtrPrpUnderline : Changes = new CChangesMathUnderline(); break;
......@@ -2960,6 +2961,7 @@ function ReadChanges_FromBinary(Reader, Class)
case historyitem_Math_RFontsEastAsia : Changes = new CChangesMath_RFontsEastAsia(); break;
case historyitem_Math_RFontsHint : Changes = new CChangesMath_RFontsHint(); break;
case historyitem_Math_CtrPrpHighLight : Changes = new CChangesMathHighLight(); break;
case historyitem_Math_ReviewType : Changes = new CChangesMathBaseReviewType(); break;
case historyitem_Math_CtrPrpTextFill : Changes = new CChangesMathTextFill(); break;
case historyitem_Math_CtrPrpTextOutline : Changes = new CChangesMathTextOutline(); break;
}
......
......@@ -1128,6 +1128,40 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_ContentLength = function
{
return this.Content.length;
};
CParagraphContentWithParagraphLikeContent.prototype.Get_Parent = function()
{
if (this.Parent)
return this.Parent;
if (!this.Paragraph)
return null;
var ContentPos = this.Paragraph.Get_PosByElement(this);
if (null == ContentPos || undefined == ContentPos || ContentPos.Get_Depth() < 0)
return null;
ContentPos.Decrease_Depth(1);
return this.Paragraph.Get_ElementByPos(ContentPos);
};
CParagraphContentWithParagraphLikeContent.prototype.Get_PosInParent = function(Parent)
{
var _Parent = (_Parent? Parent : this.Get_Parent());
if (!_Parent)
return -1;
for (var Pos = 0, Count = _Parent.Content.length; Pos < Count; ++Pos)
{
if (this === _Parent.Content[Pos])
return Pos;
}
return -1;
};
CParagraphContentWithParagraphLikeContent.prototype.Correct_Content = function()
{
if (this.Content.length < 0)
this.Add_ToContent(0, new ParaRun(this.Paragraph, false));
};
//----------------------------------------------------------------------------------------------------------------------
// Функции пересчета
//----------------------------------------------------------------------------------------------------------------------
......@@ -2397,11 +2431,43 @@ CParagraphContentWithParagraphLikeContent.prototype.Accept_RevisionChanges = fun
}
// Начинаем с конца, потому что при выполнении данной функции, количество элементов может изменяться
for (var CurPos = EndPos; CurPos >= StartPos; CurPos--)
if (this.Content[EndPos].Accept_RevisionChanges)
this.Content[EndPos].Accept_RevisionChanges(Type, bAll);
if (StartPos < EndPos)
{
if (this.Content[CurPos].Accept_RevisionChanges)
this.Content[CurPos].Accept_RevisionChanges(Type, bAll);
for (var CurPos = EndPos - 1; CurPos > StartPos; CurPos--)
{
var Element = this.Content[CurPos];
var ReviewType = Element.Get_ReviewType ? Element.Get_ReviewType() : reviewtype_Common;
var isGoInside = false;
if (reviewtype_Add === ReviewType)
{
if (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type)
Element.Set_ReviewType(reviewtype_Common);
isGoInside = true;
}
else if (reviewtype_Remove === ReviewType)
{
if (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type)
this.Remove_FromContent(CurPos, 1, true);
}
else if (reviewtype_Common === ReviewType)
{
isGoInside = true;
}
if (true === isGoInside && Element.Accept_RevisionChanges)
Element.Accept_RevisionChanges(Type, true);
}
if (this.Content[StartPos].Accept_RevisionChanges)
this.Content[StartPos].Accept_RevisionChanges(Type, bAll);
}
this.Correct_Content();
}
};
CParagraphContentWithParagraphLikeContent.prototype.Reject_RevisionChanges = function(Type, bAll)
......@@ -2423,11 +2489,43 @@ CParagraphContentWithParagraphLikeContent.prototype.Reject_RevisionChanges = fun
}
// Начинаем с конца, потому что при выполнении данной функции, количество элементов может изменяться
for (var CurPos = EndPos; CurPos >= StartPos; CurPos--)
if (this.Content[EndPos].Reject_RevisionChanges)
this.Content[EndPos].Reject_RevisionChanges(Type, bAll);
if (StartPos < EndPos)
{
if (this.Content[CurPos].Reject_RevisionChanges)
this.Content[CurPos].Reject_RevisionChanges(Type, bAll);
for (var CurPos = EndPos - 1; CurPos > StartPos; CurPos--)
{
var Element = this.Content[CurPos];
var ReviewType = Element.Get_ReviewType ? Element.Get_ReviewType() : reviewtype_Common;
var isGoInside = false;
if (reviewtype_Remove === ReviewType)
{
if (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type)
Element.Set_ReviewType(reviewtype_Common);
isGoInside = true;
}
else if (reviewtype_Add === ReviewType)
{
if (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type)
this.Remove_FromContent(CurPos, 1, true);
}
else if (reviewtype_Common === ReviewType)
{
isGoInside = true;
}
if (true === isGoInside && Element.Reject_RevisionChanges)
Element.Reject_RevisionChanges(Type, true);
}
if (this.Content[StartPos].Reject_RevisionChanges)
this.Content[StartPos].Reject_RevisionChanges(Type, bAll);
}
this.Correct_Content();
}
};
CParagraphContentWithParagraphLikeContent.prototype.private_UpdateTrackRevisions = function()
......
......@@ -2417,12 +2417,13 @@ CMathBase.prototype.Get_ReviewColor = function()
return REVIEW_COLOR;
};
CMathBase.prototype.Set_ReviewType = function(Type)
CMathBase.prototype.Set_ReviewType = function(Type, isSetToContent)
{
if (!this.Id)
return;
CMathBase.superclass.Set_ReviewType.apply(this, arguments);
if (false !== isSetToContent)
CMathBase.superclass.Set_ReviewType.apply(this, arguments);
if (Type !== this.ReviewType)
{
......@@ -2438,7 +2439,7 @@ CMathBase.prototype.Set_ReviewTypeWithInfo = function(ReviewType, ReviewInfo)
if (!this.Id)
return;
CMathBase.superclass.Set_ReviewType.apply(this, arguments);
CMathBase.superclass.Set_ReviewTypeWithInfo.apply(this, arguments);
History.Add(this, new CChangesMathBaseReviewType(ReviewType, ReviewInfo, this.ReviewType, this.ReviewInfo));
this.raw_SetReviewType(ReviewType, ReviewInfo);
......@@ -2496,6 +2497,56 @@ CMathBase.prototype.Check_RevisionsChanges = function(Checker, ContentPos, Depth
if (reviewtype_Common !== ReviewType)
Checker.End_CheckOnlyTextPr();
};
CMathBase.prototype.Accept_RevisionChanges = function(Type, bAll)
{
var ReviewType = this.ReviewType;
if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type))
{
this.Set_ReviewType(reviewtype_Common, false);
}
else if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type))
{
var Parent = this.Get_Parent();
var PosInParent = this.Get_PosInParent(Parent);
if (!Parent || -1 === PosInParent)
{
this.Set_ReviewType(reviewtype_Common, false);
}
else
{
Parent.Remove_FromContent(PosInParent, 1);
return;
}
}
CMathBase.superclass.Accept_RevisionChanges.apply(this, arguments);
};
CMathBase.prototype.Reject_RevisionChanges = function(Type, bAll)
{
var ReviewType = this.ReviewType;
if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type))
{
this.Set_ReviewType(reviewtype_Common, false);
}
else if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type))
{
var Parent = this.Get_Parent();
var PosInParent = this.Get_PosInParent(Parent);
if (!Parent || -1 === PosInParent)
{
this.Set_ReviewType(reviewtype_Common, false);
}
else
{
Parent.Remove_FromContent(PosInParent, 1);
return;
}
}
CMathBase.superclass.Reject_RevisionChanges.apply(this, arguments);
};
CMathBase.prototype.Math_Set_EmptyRange = CMathContent.prototype.Math_Set_EmptyRange;
CMathBase.prototype.Set_ParaMath = CMathContent.prototype.Set_ParaMath;
......
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