sw/source/uibase/docvw/AnnotationWin.cxx | 19 +++++++++++++++++-- sw/source/uibase/docvw/AnnotationWin2.cxx | 13 ++++++------- sw/source/uibase/docvw/PostItMgr.cxx | 27 ++++++++++++++++++++++++++- sw/source/uibase/shells/textfld.cxx | 4 ++-- 4 files changed, 51 insertions(+), 12 deletions(-)
New commits: commit fc0493e59be95f101d26144e622998c38ac3fd45 Author: Pranam Lashkari <[email protected]> AuthorDate: Sun Sep 13 17:30:21 2020 +0530 Commit: Andras Timar <[email protected]> CommitDate: Tue Sep 22 09:36:57 2020 +0200 changed FN_RESOLVE_NOTE behaviour to resolve single note Earlier it used to resolve the entire thread and there was no way to resolve a single comment in thread Change-Id: I471c5b575dd365d52653835be5b0d40009bb5cfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102580 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 7bd3ae6f4e3b..2c9ee46f7127 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -262,8 +262,23 @@ bool SwAnnotationWin::IsResolved() const bool SwAnnotationWin::IsThreadResolved() { - // Not const because GetTopReplyNote isn't. - return GetTopReplyNote()->IsResolved(); + // First Get the top note + // then itereate downwards checking resolved status + SwAnnotationWin *pTopNote, *TopNote; + pTopNote = TopNote = GetTopReplyNote(); + if (!pTopNote->IsResolved()) + return false; + + SwAnnotationWin* pSidebarWin = mrMgr.GetNextPostIt(KEY_PAGEDOWN, pTopNote); + + while (pSidebarWin && pSidebarWin->GetTopReplyNote() == TopNote) + { + pTopNote = pSidebarWin; + if (!pTopNote->IsResolved()) + return false; + pSidebarWin = mrMgr.GetNextPostIt(KEY_PAGEDOWN, pSidebarWin); + } + return true; } void SwAnnotationWin::UpdateData() diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index f723b7e7ac49..5ac9317ecd39 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -179,7 +179,7 @@ void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rec } sal_uInt32 boxHeight = mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height(); - boxHeight += IsThreadResolved() ? mpMetadataResolved->GetSizePixel().Height() : 0; + boxHeight += IsResolved() ? mpMetadataResolved->GetSizePixel().Height() : 0; rRenderContext.SetLineColor(); tools::Rectangle aRectangle(Point(mpMetadataAuthor->GetPosPixel().X() + mpMetadataAuthor->GetSizePixel().Width(), @@ -583,7 +583,7 @@ void SwAnnotationWin::InitControls() mpSidebarTextControl->Show(); mpMetadataAuthor->Show(); mpMetadataDate->Show(); - if(IsThreadResolved()) { mpMetadataResolved->Show(); } + if(IsResolved()) { mpMetadataResolved->Show(); } mpVScrollbar->Show(); } @@ -905,7 +905,7 @@ void SwAnnotationWin::DoResize() aHeight -= GetMetaHeight(); mpMetadataAuthor->Show(); - if(IsThreadResolved()) { mpMetadataResolved->Show(); } + if(IsResolved()) { mpMetadataResolved->Show(); } mpMetadataDate->Show(); mpSidebarTextControl->SetQuickHelpText(OUString()); unsigned int numFields = GetNumFields(); @@ -930,7 +930,7 @@ void SwAnnotationWin::DoResize() aHeight + aSizeOfMetadataControls.Height(), aSizeOfMetadataControls.Width(), aSizeOfMetadataControls.Height() ); - if(IsThreadResolved()) { + if(IsResolved()) { mpMetadataResolved->setPosSizePixel( 0, aHeight + aSizeOfMetadataControls.Height()*2, aSizeOfMetadataControls.Width(), @@ -1267,8 +1267,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true ); break; case FN_RESOLVE_NOTE: - GetTopReplyNote()->ToggleResolved(); - mrMgr.UpdateResolvedStatus(GetTopReplyNote()); + ToggleResolved(); DoResize(); Invalidate(); mrMgr.LayoutPostIts(); @@ -1392,7 +1391,7 @@ sal_Int32 SwAnnotationWin::GetMetaHeight() sal_Int32 SwAnnotationWin::GetNumFields() { - return IsThreadResolved() ? 3 : 2; + return IsResolved() ? 3 : 2; } sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta() const diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 88f917a923ea..3f0e6f530469 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1570,6 +1570,31 @@ void SwPostItMgr::Delete(sal_uInt32 nPostItId) LayoutPostIts(); } +void SwPostItMgr::ToggleResolved(sal_uInt32 nPostItId) +{ + mpWrtShell->StartAllAction(); + + SwRewriter aRewriter; + aRewriter.AddRule(UndoArg1, SwResId(STR_CONTENT_TYPE_SINGLE_POSTIT)); + + // We have no undo ID at the moment. + + IsPostitFieldWithPostitId aFilter(nPostItId); + FieldDocWatchingStack aStack(mvPostItFields, *mpView->GetDocShell(), aFilter); + const SwFormatField* pField = aStack.pop(); + // pField now contains our AnnotationWin object + if (pField) { + SwAnnotationWin* pWin = GetSidebarWin(pField); + pWin->ToggleResolved(); + } + + PrepareView(); + mpWrtShell->EndAllAction(); + mbLayout = true; + CalcRects(); + LayoutPostIts(); +} + void SwPostItMgr::ToggleResolvedForThread(sal_uInt32 nPostItId) { mpWrtShell->StartAllAction(); @@ -2443,7 +2468,7 @@ void SwPostItMgr::ShowHideResolvedNotes(bool visible) { { for(auto b = pPage->mvSidebarItems.begin(); b!= pPage->mvSidebarItems.end(); ++b) { - if ((*b)->pPostIt->IsThreadResolved()) + if ((*b)->pPostIt->IsResolved()) { (*b)->pPostIt->SetResolved(true); (*b)->pPostIt->GetSidebarItem().bShow = visible; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index c65d5d65da6a..821d1b114689 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -352,10 +352,10 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) { - GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32()); + GetView().GetPostItMgr()->ToggleResolved(pIdItem->GetValue().toUInt32()); } + break; } - break; case FN_DELETE_ALL_NOTES: if ( GetView().GetPostItMgr() ) GetView().GetPostItMgr()->Delete(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
