diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-15 16:04:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-15 17:03:25 +0200 |
commit | 84e91157c674b0b78b792fc1d4f841fe50b1dd9b (patch) | |
tree | db214e7e289c292ca3af31af086e4a4adc963376 /sw/source/uibase/uiview | |
parent | 5518de780519ad95d2079d21255de3edf20879f3 (diff) |
sw: allow select of redline by index
Previously .uno:NextTrackedChange always worked by cursor position, but
redlines are stored in the redline table, so they have a unique index.
Allow specifying that index when invoking the command, and in that case
ignore the cursor position.
Change-Id: I7dbe8044feca8fcc48635482a22317b024f40ffa
Diffstat (limited to 'sw/source/uibase/uiview')
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 366641a76066..5d200aef812b 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -709,8 +709,20 @@ void SwView::Execute(SfxRequest &rReq) case FN_REDLINE_NEXT_CHANGE: { + // If a parameter is provided, try going to the nth change, not to + // the next one. + sal_uInt16 nRedline = USHRT_MAX; + if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) + nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + const SwRangeRedline *pCurrent = m_pWrtShell->GetCurrRedline(); - const SwRangeRedline *pNext = m_pWrtShell->SelNextRedline(); + SwDoc* pDoc = m_pWrtShell->GetDoc(); + const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRangeRedline *pNext = nullptr; + if (nRedline < rTable.size()) + pNext = m_pWrtShell->GotoRedline(nRedline, true); + else + pNext = m_pWrtShell->SelNextRedline(); // FN_REDLINE_PREV_CHANGE leaves the selection point at the start of the redline. // In such cases, SelNextRedline (which starts searching from the selection point) @@ -718,7 +730,7 @@ void SwView::Execute(SfxRequest &rReq) // This behavior means that PREV_CHANGE followed by NEXT_CHANGE would not change // the current redline, so we detect it and select the next redline again. - if (pCurrent && pCurrent == pNext) + if (pCurrent && pCurrent == pNext && nRedline == USHRT_MAX) pNext = m_pWrtShell->SelNextRedline(); if (pNext) |