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>
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 0e99426..265a400 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 b85c05e..9acb7f8 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 != s_nMoveType)
m_pEditWin->GrabFocus();
delete pbNext;
}