Kaydet (Commit) 0b859bf3 authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Samuel Mehrbrodt

tdf#115600 Display messages in Findbar for Headings navigation

...and make Headings navigation wrap

Change-Id: Ia06caba9b93064c63750c54c1061d781811ed62a
Reviewed-on: https://gerrit.libreoffice.org/52139Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst ec5eee5e
......@@ -86,7 +86,9 @@ enum class SearchLabel
End,
Start,
EndSheet,
NotFound
NotFound,
StartWrapped,
EndWrapped
};
class SvxSearchDialog;
......
......@@ -1252,9 +1252,11 @@
#define RID_SVXSTR_SEARCH NC_("RID_SVXSTR_SEARCH", "Search for formatting")
#define RID_SVXSTR_REPLACE NC_("RID_SVXSTR_REPLACE", "Replace with formatting")
#define RID_SVXSTR_SEARCH_END NC_("RID_SVXSTR_SEARCH_END", "Reached the end of the document")
#define RID_SVXSTR_SEARCH_END_WRAPPED NC_("RID_SVXSTR_SEARCH_END_WRAPPED", "Reached the end of the document, continued from the beginning")
#define RID_SVXSTR_SEARCH_END_SHEET NC_("RID_SVXSTR_SEARCH_END_SHEET", "Reached the end of the sheet")
#define RID_SVXSTR_SEARCH_NOT_FOUND NC_("RID_SVXSTR_SEARCH_NOT_FOUND", "Search key not found")
#define RID_SVXSTR_SEARCH_START NC_("RID_SVXSTR_SEARCH_START", "Reached the beginning of the document")
#define RID_SVXSTR_SEARCH_START_WRAPPED NC_("RID_SVXSTR_SEARCH_START_WRAPPED", "Reached the beginning of the document, continued from the end")
#define RID_SVXDLG_BMPMASK_STR_PALETTE NC_("RID_SVXDLG_BMPMASK_STR_PALETTE", "Color Palette")
......
......@@ -2440,6 +2440,10 @@ void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
sStr = SvxResId(RID_SVXSTR_SEARCH_END);
else if (rSL == SearchLabel::Start)
sStr = SvxResId(RID_SVXSTR_SEARCH_START);
else if (rSL == SearchLabel::EndWrapped)
sStr = SvxResId(RID_SVXSTR_SEARCH_END_WRAPPED);
else if (rSL == SearchLabel::StartWrapped)
sStr = SvxResId(RID_SVXSTR_SEARCH_START_WRAPPED);
else if (rSL == SearchLabel::EndSheet)
sStr = SvxResId(RID_SVXSTR_SEARCH_END_SHEET);
else if (rSL == SearchLabel::NotFound)
......
......@@ -70,6 +70,7 @@
#include <unotools/intlwrapper.hxx>
#include <vcl/window.hxx>
#include <docufld.hxx>
#include <svx/srchdlg.hxx>
using namespace ::com::sun::star;
......@@ -940,16 +941,27 @@ bool SwCursorShell::GotoOutline( const OUString& rName )
/// jump to next node with outline num.
bool SwCursorShell::GotoNextOutline()
{
SwCursor* pCursor = getShellCursor( true );
const SwNodes& rNds = GetDoc()->GetNodes();
if ( rNds.GetOutLineNds().size() == 0 )
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
return false;
}
SwCursor* pCursor = getShellCursor( true );
SwNode* pNd = &(pCursor->GetNode());
SwOutlineNodes::size_type nPos;
if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
++nPos;
if( nPos == rNds.GetOutLineNds().size() )
return false;
{
nPos = 0;
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
}
else
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
pNd = rNds.GetOutLineNds()[ nPos ];
......@@ -968,20 +980,31 @@ bool SwCursorShell::GotoNextOutline()
/// jump to previous node with outline num.
bool SwCursorShell::GotoPrevOutline()
{
SwCursor* pCursor = getShellCursor( true );
const SwNodes& rNds = GetDoc()->GetNodes();
if ( rNds.GetOutLineNds().size() == 0 )
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
return false;
}
SwCursor* pCursor = getShellCursor( true );
SwNode* pNd = &(pCursor->GetNode());
SwOutlineNodes::size_type nPos;
bool bRet = false;
(void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
if ( rNds.GetOutLineNds().Seek_Entry(pNd, &nPos) && nPos == 0 )
{
nPos = rNds.GetOutLineNds().size();
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
}
else
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
if (nPos)
{
--nPos; // before
pNd = rNds.GetOutLineNds()[ nPos ];
if( pNd->GetIndex() > pCursor->GetPoint()->nNode.GetIndex() )
return false;
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
......
......@@ -50,6 +50,7 @@
#include <svx/strings.hrc>
#include <bitmaps.hlst>
#include <toolkit/helper/vclunohelper.hxx>
#include <svx/srchdlg.hxx>
// Size check
#define NAVI_ENTRIES 20
......@@ -750,6 +751,8 @@ void NavElementBox_Impl::Select()
if ( !IsTravelSelect() )
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
sal_uInt16 nPos = GetSelectedEntryPos();
// adjust array index for Ids after NID_PREV in aNavigationInsertIds
if ( nPos >= NID_COUNT/2 - 1 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment