summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2020-09-13 17:30:21 +0530
committerAndras Timar <andras.timar@collabora.com>2020-09-15 22:04:10 +0200
commit0b03e1898a32488e91cd6e0a947a13be1eb6d295 (patch)
treee54c5ff5c1dd501a18ec25990634c7fa83b45c3d /sw
parent6780e9c9b3224e5c0088110f02fdd88073fbdad4 (diff)
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/+/102778 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx19
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx13
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx27
-rw-r--r--sw/source/uibase/shells/textfld.cxx4
4 files changed, 51 insertions, 12 deletions
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 51b30e542766..2701a46cca2e 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -257,8 +257,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 c9ba97fd5adc..ae3bf7ac5501 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -174,7 +174,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(),
@@ -578,7 +578,7 @@ void SwAnnotationWin::InitControls()
mpSidebarTextControl->Show();
mpMetadataAuthor->Show();
mpMetadataDate->Show();
- if(IsThreadResolved()) { mpMetadataResolved->Show(); }
+ if(IsResolved()) { mpMetadataResolved->Show(); }
mpVScrollbar->Show();
}
@@ -900,7 +900,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();
@@ -925,7 +925,7 @@ void SwAnnotationWin::DoResize()
aHeight + aSizeOfMetadataControls.Height(),
aSizeOfMetadataControls.Width(),
aSizeOfMetadataControls.Height() );
- if(IsThreadResolved()) {
+ if(IsResolved()) {
mpMetadataResolved->setPosSizePixel( 0,
aHeight + aSizeOfMetadataControls.Height()*2,
aSizeOfMetadataControls.Width(),
@@ -1262,8 +1262,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();
@@ -1387,7 +1386,7 @@ sal_Int32 SwAnnotationWin::GetMetaHeight()
sal_Int32 SwAnnotationWin::GetNumFields()
{
- return IsThreadResolved() ? 3 : 2;
+ return IsResolved() ? 3 : 2;
}
sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta()
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 95e79f62cb67..22a62e07cc54 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1583,6 +1583,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();
@@ -2456,7 +2481,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 1d61b0f95785..a06d7ecc6b02 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -347,10 +347,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();