Commit a718059e 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@64986 954022d7-b5bf-4e40-9824-e11837661b57
parent 7ba07a95
This diff is collapsed.
......@@ -9496,7 +9496,7 @@ CDocumentContent.prototype.Accept_RevisionChanges = function(Type, bAll)
if (docpostype_DrawingObjects === this.CurPos.Type)
{
// TODO: Реализовать
//this.DrawingObjects.Accept_RevisionChanges();
//this.DrawingObjects.Accept_RevisionChanges(Type, bAll);
}
else //if (docpostype_Content === this.CurPos.Type)
{
......@@ -9519,7 +9519,7 @@ CDocumentContent.prototype.Accept_RevisionChanges = function(Type, bAll)
LastParaEnd = true;
}
if (undefined === Type)
if (undefined === Type || c_oAscRevisionsChangeType.ParaPr === Type)
{
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
......@@ -9529,13 +9529,16 @@ CDocumentContent.prototype.Accept_RevisionChanges = function(Type, bAll)
Element.Accept_PrChange();
}
}
}
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Element = this.Content[CurPos];
Element.Accept_RevisionChanges(Type, bAll);
}
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Element = this.Content[CurPos];
Element.Accept_RevisionChanges(Type, bAll);
}
if (undefined === Type || c_oAscRevisionsChangeType.ParaAdd === Type || c_oAscRevisionsChangeType.ParaRem === Type)
{
EndPos = (true === LastParaEnd ? EndPos : EndPos - 1);
for (var CurPos = EndPos; CurPos >= StartPos; CurPos--)
{
......@@ -9543,11 +9546,11 @@ CDocumentContent.prototype.Accept_RevisionChanges = function(Type, bAll)
if (type_Paragraph === Element.Get_Type())
{
var ReviewType = Element.Get_ReviewType();
if (reviewtype_Add === ReviewType)
if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.ParaAdd === Type))
{
Element.Set_ReviewType(reviewtype_Common);
}
else if (reviewtype_Remove === ReviewType)
else if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.ParaRem === Type))
{
Element.Set_ReviewType(reviewtype_Common);
this.Concat_Paragraphs(CurPos);
......@@ -9556,10 +9559,6 @@ CDocumentContent.prototype.Accept_RevisionChanges = function(Type, bAll)
}
}
}
else
{
var CurPos = this.CurPos.ContentPos;
}
}
};
CDocumentContent.prototype.Reject_RevisionChanges = function(Type, bAll)
......@@ -9567,23 +9566,30 @@ CDocumentContent.prototype.Reject_RevisionChanges = function(Type, bAll)
if (docpostype_DrawingObjects === this.CurPos.Type)
{
// TODO: Реализовать
//this.DrawingObjects.Reject_RevisionChanges();
//this.DrawingObjects.Reject_RevisionChanges(Type, bAll);
}
else //if (docpostype_Content === this.CurPos.Type)
{
if (true === this.Selection.Use)
if (true === this.Selection.Use || true === bAll)
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
EndPos = this.Selection.StartPos;
}
var LastElement = this.Content[EndPos];
var LastParaEnd = (type_Paragraph === LastElement.Get_Type() && true === LastElement.Selection_CheckParaEnd() ? true : false);
if (undefined === Type)
if (true === bAll)
{
StartPos = 0;
EndPos = this.Content.length - 1;
LastParaEnd = true;
}
if (undefined === Type || c_oAscRevisionsChangeType.ParaPr === Type)
{
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
......@@ -9593,13 +9599,16 @@ CDocumentContent.prototype.Reject_RevisionChanges = function(Type, bAll)
Element.Reject_PrChange();
}
}
}
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Element = this.Content[CurPos];
Element.Reject_RevisionChanges(Type, bAll);
}
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Element = this.Content[CurPos];
Element.Reject_RevisionChanges(Type, bAll);
}
if (undefined === Type || c_oAscRevisionsChangeType.ParaAdd === Type || c_oAscRevisionsChangeType.ParaRem === Type)
{
EndPos = (true === LastParaEnd ? EndPos : EndPos - 1);
for (var CurPos = EndPos; CurPos >= StartPos; CurPos--)
{
......@@ -9607,12 +9616,12 @@ CDocumentContent.prototype.Reject_RevisionChanges = function(Type, bAll)
if (type_Paragraph === Element.Get_Type())
{
var ReviewType = Element.Get_ReviewType();
if (reviewtype_Add === ReviewType)
if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.ParaAdd === Type))
{
Element.Set_ReviewType(reviewtype_Common);
this.Concat_Paragraphs(CurPos);
}
else if (reviewtype_Remove === ReviewType)
else if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.ParaRem === Type))
{
Element.Set_ReviewType(reviewtype_Common);
}
......@@ -9620,11 +9629,6 @@ CDocumentContent.prototype.Reject_RevisionChanges = function(Type, bAll)
}
}
}
else
{
var CurPos = this.CurPos.ContentPos;
}
}
};
CDocumentContent.prototype.Add_ToContent = function(Pos, Item)
......
......@@ -13173,6 +13173,7 @@ Paragraph.prototype.Check_RevisionsChanges = function(RevisionsManager)
EndPos = this.Get_EndPos(true);
Change = new CRevisionsChange();
Change.put_Paragraph(this);
Change.put_StartPos(StartPos);
Change.put_EndPos(EndPos);
Change.put_Type(c_oAscRevisionsChangeType.ParaPr);
......@@ -13191,6 +13192,7 @@ Paragraph.prototype.Check_RevisionsChanges = function(RevisionsManager)
EndPos = this.Get_EndPos(true);
Change = new CRevisionsChange();
Change.put_Paragraph(this);
Change.put_StartPos(StartPos);
Change.put_EndPos(EndPos);
Change.put_Type(c_oAscRevisionsChangeType.ParaAdd);
......@@ -13207,6 +13209,7 @@ Paragraph.prototype.Check_RevisionsChanges = function(RevisionsManager)
Change = new CRevisionsChange();
Change.put_Paragraph(this);
Change.put_StartPos(StartPos);
Change.put_EndPos(EndPos);
Change.put_Type(c_oAscRevisionsChangeType.ParaRem);
......@@ -14343,6 +14346,7 @@ function CParagraphTabsCounter()
function CParagraphRevisionsChangesChecker(Para, RevisionsManager)
{
this.Paragraph = Para;
this.ParaId = Para.Get_Id();
this.RevisionsManager = RevisionsManager;
......@@ -14376,6 +14380,7 @@ CParagraphRevisionsChangesChecker.prototype.Flush_AddRemoveChange = function()
{
var Change = new CRevisionsChange();
Change.put_Type(reviewtype_Add === AddRemove.ChangeType ? c_oAscRevisionsChangeType.TextAdd : c_oAscRevisionsChangeType.TextRem);
Change.put_Paragraph(this.Paragraph);
Change.put_Value(AddRemove.Value);
Change.put_StartPos(AddRemove.StartPos);
Change.put_EndPos(AddRemove.EndPos);
......@@ -14404,6 +14409,7 @@ CParagraphRevisionsChangesChecker.prototype.Flush_TextPrChange = function()
// TODO: Доделать put_Value
Change.put_Value(TextPr.Pr.Get_Description());
Change.put_Paragraph(this.Paragraph);
Change.put_StartPos(TextPr.StartPos);
Change.put_EndPos(TextPr.EndPos);
Change.put_UserId(TextPr.UserId);
......
......@@ -10003,76 +10003,14 @@ ParaRun.prototype.Accept_RevisionChanges = function(Type, bAll)
var Parent = this.Get_Parent();
var RunPos = this.private_GetPosInParent();
var ReviewType = this.Get_ReviewType();
var HavePrChange = this.Have_PrChange();
// Нет изменений в данном ране
if (reviewtype_Common === ReviewType && true !== HavePrChange)
return;
if (undefined === Type)
{
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;
}
var CenterRun = null, CenterRunPos = RunPos;
if (0 === StartPos && this.Content.length === EndPos)
{
CenterRun = this;
}
else if (StartPos > 0 && this.Content.length === EndPos)
{
CenterRun = this.Split2(StartPos, Parent, RunPos);
CenterRunPos = RunPos + 1;
}
else if (0 === StartPos && this.Content.length > EndPos)
{
CenterRun = this;
this.Split2(EndPos, Parent, RunPos);
}
else
{
this.Split2(EndPos, Parent, RunPos);
CenterRun = this.Split2(StartPos, Parent, RunPos);
CenterRunPos = RunPos + 1;
}
if (true === HavePrChange)
{
CenterRun.Remove_PrChange();
}
if (reviewtype_Add === ReviewType)
{
CenterRun.Set_ReviewType(reviewtype_Common);
}
else if (reviewtype_Remove === ReviewType)
{
Parent.Remove_FromContent(CenterRunPos, 1);
}
}
}
};
ParaRun.prototype.Reject_RevisionChanges = function(Type, bAll)
{
var Parent = this.Get_Parent();
var RunPos = this.private_GetPosInParent();
var ReviewType = this.Get_ReviewType();
var ReviewType = this.Get_ReviewType();
var HavePrChange = this.Have_PrChange();
// Нет изменений в данном ране
if (reviewtype_Common === ReviewType && true !== HavePrChange)
return;
if (undefined === Type)
if (true === this.Selection.Use)
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
......@@ -10104,21 +10042,77 @@ ParaRun.prototype.Reject_RevisionChanges = function(Type, bAll)
CenterRunPos = RunPos + 1;
}
if (true === HavePrChange)
if (true === HavePrChange && (undefined === Type || c_oAscRevisionsChangeType.TextPr === Type))
{
CenterRun.Set_Pr(CenterRun.Pr.PrChange);
CenterRun.Remove_PrChange();
}
if (reviewtype_Add === ReviewType)
if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type))
{
Parent.Remove_FromContent(CenterRunPos, 1);
CenterRun.Set_ReviewType(reviewtype_Common);
}
else if (reviewtype_Remove === ReviewType)
else if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type))
{
CenterRun.Set_ReviewType(reviewtype_Common);
Parent.Remove_FromContent(CenterRunPos, 1);
}
}
};
ParaRun.prototype.Reject_RevisionChanges = function(Type, bAll)
{
var Parent = this.Get_Parent();
var RunPos = this.private_GetPosInParent();
var ReviewType = this.Get_ReviewType();
var HavePrChange = this.Have_PrChange();
// Нет изменений в данном ране
if (reviewtype_Common === ReviewType && true !== HavePrChange)
return;
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
var CenterRun = null, CenterRunPos = RunPos;
if (0 === StartPos && this.Content.length === EndPos)
{
CenterRun = this;
}
else if (StartPos > 0 && this.Content.length === EndPos)
{
CenterRun = this.Split2(StartPos, Parent, RunPos);
CenterRunPos = RunPos + 1;
}
else if (0 === StartPos && this.Content.length > EndPos)
{
CenterRun = this;
this.Split2(EndPos, Parent, RunPos);
}
else
{
this.Split2(EndPos, Parent, RunPos);
CenterRun = this.Split2(StartPos, Parent, RunPos);
CenterRunPos = RunPos + 1;
}
if (true === HavePrChange && (undefined === Type || c_oAscRevisionsChangeType.TextPr === Type))
{
CenterRun.Set_Pr(CenterRun.Pr.PrChange);
}
if (reviewtype_Add === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextAdd === Type))
{
Parent.Remove_FromContent(CenterRunPos, 1);
}
else if (reviewtype_Remove === ReviewType && (undefined === Type || c_oAscRevisionsChangeType.TextRem === Type))
{
CenterRun.Set_ReviewType(reviewtype_Common);
}
};
ParaRun.prototype.Is_InHyperlink = function()
{
if (!this.Paragraph)
......
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