Commit 070642df authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented flag whether to display resolved comments.

parent 49793a36
......@@ -469,6 +469,13 @@ CComment.prototype.GetData = function()
{
return this.Data;
};
CComment.prototype.IsSolved = function()
{
if (this.Data)
return this.Data.IsSolved();
return false;
};
var comments_NoComment = 0;
var comments_NonActiveComment = 1;
......@@ -478,7 +485,8 @@ function CComments()
{
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.m_bUse = false; // Используются ли комментарии
this.m_bUse = false; // Используются ли комментарии
this.m_bUseSolved = false; // Использовать ли разрешенные комментарии
this.m_aComments = {}; // ассоциативный массив
this.m_sCurrent = null; // текущий комментарий
......@@ -629,6 +637,14 @@ CComments.prototype.GetAllComments = function()
{
return this.m_aComments;
};
CComments.prototype.SetUseSolved = function(isUse)
{
this.m_bUseSolved = isUse;
};
CComments.prototype.IsUseSolved = function()
{
return this.m_bUseSolved;
};
//----------------------------------------------------------------------------------------------------------------------
// Класс для работы внутри параграфа
......
......@@ -7242,7 +7242,7 @@ CDocument.prototype.OnMouseUp = function(e, X, Y, PageIndex)
var Type = ( docpostype_HdrFtr === this.CurPos.Type ? comment_type_HdrFtr : comment_type_Common );
// Проверяем не попали ли мы в комментарий
var Comment = this.Comments.Get_ByXY(PageIndex, X, Y, Type);
if (null != Comment)
if (null != Comment && (this.Comments.IsUseSolved() || !Comment.IsSolved()))
{
var Comment_PageNum = Comment.m_oStartInfo.PageNum;
var Comment_Y = Comment.m_oStartInfo.Y;
......@@ -8849,15 +8849,20 @@ CDocument.prototype.Show_Comment = function(Id)
this.Api.sync_HideComment();
}
};
CDocument.prototype.Show_Comments = function()
CDocument.prototype.Show_Comments = function(isShowSolved)
{
if (false !== isShowSolved)
isShowSolved = true;
this.Comments.Set_Use(true);
this.Comments.SetUseSolved(isShowSolved);
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
};
CDocument.prototype.Hide_Comments = function()
{
this.Comments.Set_Use(false);
this.Comments.SetUseSolved(false);
this.Comments.Set_Current(null);
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
......
......@@ -1445,12 +1445,13 @@ Paragraph.prototype.Internal_Draw_3 = function(CurPage, pGraphics, Pr)
var DocumentComments = editor.WordControl.m_oLogicDocument.Comments;
var Page_abs = this.Get_AbsolutePage(CurPage);
var DrawComm = ( DocumentComments.Is_Use() && true != editor.isViewMode);
var DrawFind = editor.WordControl.m_oLogicDocument.SearchEngine.Selection;
var DrawColl = ( undefined === pGraphics.RENDERER_PDF_FLAG ? false : true );
var DrawMMFields = (this.LogicDocument && true === this.LogicDocument.Is_HightlightMailMergeFields() ? true : false);
var DrawComm = ( DocumentComments.Is_Use() && true != editor.isViewMode);
var DrawFind = editor.WordControl.m_oLogicDocument.SearchEngine.Selection;
var DrawColl = ( undefined === pGraphics.RENDERER_PDF_FLAG ? false : true );
var DrawMMFields = (this.LogicDocument && true === this.LogicDocument.Is_HightlightMailMergeFields() ? true : false);
var DrawSolvedComments = ( DocumentComments.IsUseSolved() && true != editor.isViewMode);
PDSH.Reset(this, pGraphics, DrawColl, DrawFind, DrawComm, DrawMMFields, this.Get_EndInfoByPage(CurPage - 1));
PDSH.Reset(this, pGraphics, DrawColl, DrawFind, DrawComm, DrawMMFields, this.Get_EndInfoByPage(CurPage - 1), DrawSolvedComments);
var StartLine = _Page.StartLine;
var EndLine = _Page.EndLine;
......@@ -12559,9 +12560,10 @@ function CParagraphDrawStateHightlights()
this.Shd = new CParaDrawingRangeLines();
this.MMFields = new CParaDrawingRangeLines();
this.DrawComments = true;
this.Comments = [];
this.CommentsFlag = comments_NoComment;
this.DrawComments = true;
this.DrawSolvedComments = true;
this.Comments = [];
this.CommentsFlag = comments_NoComment;
this.SearchCounter = 0;
......@@ -12577,7 +12579,7 @@ function CParagraphDrawStateHightlights()
CParagraphDrawStateHightlights.prototype =
{
Reset : function(Paragraph, Graphics, DrawColl, DrawFind, DrawComments, DrawMMFields, PageEndInfo)
Reset : function(Paragraph, Graphics, DrawColl, DrawFind, DrawComments, DrawMMFields, PageEndInfo, DrawSolvedComments)
{
this.Paragraph = Paragraph;
this.Graphics = Graphics;
......@@ -12590,11 +12592,13 @@ CParagraphDrawStateHightlights.prototype =
this.SearchCounter = 0;
this.DrawComments = DrawComments;
if ( null !== PageEndInfo )
this.Comments = PageEndInfo.Comments;
else
this.Comments = [];
this.DrawComments = DrawComments;
this.DrawSolvedComments = DrawSolvedComments;
if (null !== PageEndInfo)
this.Comments = PageEndInfo.Comments;
else
this.Comments = [];
this.Check_CommentsFlag();
},
......@@ -12619,30 +12623,36 @@ CParagraphDrawStateHightlights.prototype =
AddComment : function(Id)
{
if (true === this.DrawComments)
{
this.Comments.push(Id);
if (!this.DrawComments)
return;
this.Check_CommentsFlag();
}
var oComment = AscCommon.g_oTableId.Get_ById(Id);
if (!oComment || (!this.DrawSolvedComments && oComment.IsSolved()))
return;
this.Comments.push(Id);
this.Check_CommentsFlag();
},
Remove_Comment : function(Id)
{
if (true === this.DrawComments)
{
var CommentsLen = this.Comments.length;
for (var CurPos = 0; CurPos < CommentsLen; CurPos++)
{
if (this.Comments[CurPos] === Id)
{
this.Comments.splice(CurPos, 1);
break;
}
}
if (!this.DrawComments)
return;
this.Check_CommentsFlag();
}
var oComment = AscCommon.g_oTableId.Get_ById(Id);
if (!oComment || (!this.DrawSolvedComments && oComment.IsSolved()))
return;
for (var nIndex = 0, nCount = this.Comments.length; nIndex < nCount; ++nIndex)
{
if (this.Comments[nIndex] === Id)
{
this.Comments.splice(nIndex, 1);
break;
}
}
this.Check_CommentsFlag();
},
Check_CommentsFlag : function()
......
......@@ -5300,12 +5300,12 @@ background-repeat: no-repeat;\
};
asc_docs_api.prototype.asc_showComments = function()
asc_docs_api.prototype.asc_showComments = function(isShowSolved)
{
if (null == this.WordControl.m_oLogicDocument)
return;
this.WordControl.m_oLogicDocument.Show_Comments();
this.WordControl.m_oLogicDocument.Show_Comments(isShowSolved);
};
asc_docs_api.prototype.asc_hideComments = function()
......
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