summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2018-04-22 23:58:22 -0800
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-04-26 16:15:41 +0200
commit3659520e3324779b6bf7c0f5a5b3f3072e8a875a (patch)
tree796d42776b44609845b9ae16e8877ef03a8bc331
parent945219f2d932646d6bf5956d6382a978f918f238 (diff)
tdf#115600 Display messages in FindBar for Bookmark navigation
...and make Bookmark navigation wrap Change-Id: I3cba18e37c4887ad68d358c10ebb9c9ff592f6ad Reviewed-on: https://gerrit.libreoffice.org/53370 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sw/source/uibase/wrtsh/wrtsh3.cxx37
1 files changed, 35 insertions, 2 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx
index 337e005470d6..7fcd2f56aaab 100644
--- a/sw/source/uibase/wrtsh/wrtsh3.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh3.cxx
@@ -25,6 +25,7 @@
#include <svx/svdview.hxx>
#include <svx/fmglob.hxx>
#include <svx/svdouno.hxx>
+#include <svx/srchdlg.hxx>
#include <com/sun/star/form/FormButtonType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <sfx2/htmlmode.hxx>
@@ -140,12 +141,44 @@ void SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark )
bool SwWrtShell::GoNextBookmark()
{
- return MoveBookMark( BOOKMARK_NEXT );
+ if ( !getIDocumentMarkAccess()->getBookmarksCount() )
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ return false;
+ }
+ LockView( true );
+ bool bRet = MoveBookMark( BOOKMARK_NEXT );
+ if ( !bRet )
+ {
+ MoveBookMark( BOOKMARK_INDEX, getIDocumentMarkAccess()->getBookmarksBegin()->get() );
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
+ }
+ else
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ LockView( false );
+ ShowCursor();
+ return true;
}
bool SwWrtShell::GoPrevBookmark()
{
- return MoveBookMark( BOOKMARK_PREV );
+ if ( !getIDocumentMarkAccess()->getBookmarksCount() )
+ {
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
+ return false;
+ }
+ LockView( true );
+ bool bRet = MoveBookMark( BOOKMARK_PREV );
+ if ( !bRet )
+ {
+ MoveBookMark( BOOKMARK_INDEX, ( getIDocumentMarkAccess()->getBookmarksEnd() - 1 )->get() );
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
+ }
+ else
+ SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+ LockView( false );
+ ShowCursor();
+ return true;
}
void SwWrtShell::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs )