[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 10 08:46:25 UTC 2020
sw/source/core/crsr/bookmrk.cxx | 3 +--
sw/source/uibase/shells/textsh1.cxx | 12 +++---------
sw/source/uibase/uiview/viewmdi.cxx | 19 ++++++++++---------
3 files changed, 14 insertions(+), 20 deletions(-)
New commits:
commit 0663d86a84199d1f5f303cf300cd64403302dbe5
Author: Jim Raykowski <raykowj at gmail..com>
AuthorDate: Sun Jan 5 23:01:08 2020 -0900
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 10 09:45:53 2020 +0100
tdf#88713 Fix navigating navigator reminders
Change-Id: I65be92eda086af2f98da723828ff965047e87227
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86256
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index e5c879b7518c..d6524a5f0072 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -336,9 +336,8 @@ namespace sw { namespace mark
}
}
- // TODO: everything else uses MarkBase::GenerateNewName ?
NavigatorReminder::NavigatorReminder(const SwPaM& rPaM)
- : MarkBase(rPaM, "__NavigatorReminder__")
+ : MarkBase(rPaM, MarkBase::GenerateNewName("__NavigatorReminder__"))
{ }
UnoMark::UnoMark(const SwPaM& aPaM)
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 2b063cee3caa..08097faf0205 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -686,8 +686,6 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
case FN_SET_REMINDER:
{
- static sal_uInt16 m_nAutoMarkIdx = 0;
-
// collect and sort navigator reminder names
IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
std::vector< OUString > vNavMarkNames;
@@ -700,17 +698,13 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
- // we are maxed out and delete one
- // nAutoMarkIdx rotates through the available MarkNames
+ // we are maxed out so delete the first one
// this assumes that IDocumentMarkAccess generates Names in ascending order
if(vNavMarkNames.size() == MAX_MARKS)
- pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[m_nAutoMarkIdx]));
+ pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[0]));
rWrtSh.SetBookmark(vcl::KeyCode(), OUString(), IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER);
- SwView::SetActMark( m_nAutoMarkIdx );
-
- if(++m_nAutoMarkIdx == MAX_MARKS)
- m_nAutoMarkIdx = 0;
+ SwView::SetActMark(vNavMarkNames.size() < MAX_MARKS ? vNavMarkNames.size() : MAX_MARKS-1);
break;
}
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 4fd706e84667..1b660148326d 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -469,26 +469,27 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
rSh.MoveCursor();
rSh.EnterStdMode();
- // collect navigator reminders
+ // collect and sort navigator reminder names
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
- std::vector< const ::sw::mark::IMark* > vNavMarks;
- for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+ std::vector< OUString > vNavMarkNames;
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
ppMark != pMarkAccess->getAllMarksEnd();
++ppMark)
{
if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER )
- vNavMarks.push_back(*ppMark);
+ vNavMarkNames.push_back((*ppMark)->GetName());
}
+ std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
// move
- if(!vNavMarks.empty())
+ if(!vNavMarkNames.empty())
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
if(bNext)
{
m_nActMark++;
- if (m_nActMark >= MAX_MARKS || m_nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
+ if (m_nActMark >= MAX_MARKS || m_nActMark >= static_cast<sal_Int32>(vNavMarkNames.size()))
{
m_nActMark = 0;
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
@@ -497,13 +498,13 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
else
{
m_nActMark--;
- if (m_nActMark < 0 || m_nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
+ if (m_nActMark < 0 || m_nActMark >= static_cast<sal_Int32>(vNavMarkNames.size()))
{
- m_nActMark = vNavMarks.size()-1;
+ m_nActMark = vNavMarkNames.size()-1;
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
}
}
- rSh.GotoMark(vNavMarks[m_nActMark]);
+ rSh.GotoMark(vNavMarkNames[m_nActMark]);
}
else
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
More information about the Libreoffice-commits
mailing list