summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-02-25 00:31:29 -0900
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-03-06 19:46:06 +0100
commitfc0f1eb3f99369988cdf68344bba8a66d5d394cd (patch)
treec3f6082ee756b964f9638339a6113eb9143ed6ae
parent25043c5f18cefe6603e4aa084823b810d8a62485 (diff)
tdf#147565 Make navigate by comments skip hidden comments
Change-Id: I80f55146529505e5b6146db8cc324971fbc475e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130518 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com> (cherry picked from commit 5df0289f6af5aa7142017b56a8e17c134d54fe41) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130644 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sw/sdi/swriter.sdi1
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx57
2 files changed, 34 insertions, 24 deletions
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 0e994261c28c..265a4000c5a0 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -2494,7 +2494,6 @@ SfxVoidItem InsertAnnotation FN_POSTIT
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
- Asynchron;
AccelConfig = TRUE,
MenuConfig = TRUE,
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 8d986a6d056d..d1c3ca20620a 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -530,38 +530,48 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
{
if (m_pPostItMgr->HasNotes())
{
- rSh.EnterStdMode();
- sw::annotation::SwAnnotationWin* pPostIt = m_pPostItMgr->GetActiveSidebarWin();
- if (pPostIt)
- m_pPostItMgr->SetActiveSidebarWin(nullptr);
+ m_pPostItMgr->AssureStdModeAtShell();
+ m_pPostItMgr->SetActiveSidebarWin(nullptr);
+ GetEditWin().GrabFocus();
+ SwShellCursor* pCursor = rSh.GetCursor_();
+ SwCursorSaveState aSaveState(*pCursor);
SwFieldType* pFieldType = rSh.GetFieldType(0, SwFieldIds::Postit);
+ bool bWrapped = false;
+ bool bFound = false;
rSh.StartAction();
- if (!rSh.MoveFieldType(pFieldType, bNext))
+ while (!bFound)
{
- // no postits found in the move direction
- // wrap and try again
- SwShellCursor* pCursor = rSh.GetCursor_();
- SwCursorSaveState aSaveState(*pCursor);
- rSh.SttEndDoc(bNext);
- if (rSh.MoveFieldType(pFieldType, bNext))
+ if (!rSh.MoveFieldType(pFieldType, bNext))
{
- GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
- SvxSearchDialogWrapper::SetSearchLabel(bNext ? SearchLabel::EndWrapped :
- SearchLabel::StartWrapped);
+ if (bWrapped)
+ break;
+ bWrapped = true;
+ rSh.SttEndDoc(bNext);
+ continue;
}
- else
+ do
{
- // no visible postits
- pCursor->RestoreSavePos();
- SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NavElementNotFound);
- }
+ auto pAnnotationWin = m_pPostItMgr->GetAnnotationWin(
+ rSh.GetPostItFieldAtCursor());
+ if (pAnnotationWin && pAnnotationWin->IsVisible())
+ bFound = true;
+ } while (!bFound && rSh.MoveFieldType(pFieldType, bNext));
}
- else
+ if (!bFound)
{
- GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ pCursor->RestoreSavePos();
+ SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NavElementNotFound);
}
rSh.EndAction();
+ if (bFound)
+ {
+ GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ if (bWrapped)
+ SvxSearchDialogWrapper::SetSearchLabel(bNext ? SearchLabel::EndWrapped :
+ SearchLabel::StartWrapped);
+ else
+ SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);
+ }
}
else
SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NavElementNotFound);
@@ -597,7 +607,8 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
bNext ? rSh.GetNavigationMgr().goForward() : rSh.GetNavigationMgr().goBack();
break;
}
- m_pEditWin->GrabFocus();
+ if (NID_POSTIT != m_nMoveType)
+ m_pEditWin->GrabFocus();
delete pbNext;
}