diff options
author | Jim Raykowski <raykowj@gmail..com> | 2020-04-01 22:20:00 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2020-06-03 04:50:16 +0200 |
commit | 021f0b4a8c556561f5b0a5fe2ecc20209d548193 (patch) | |
tree | 0a7026d3b09ebf3bbfaa91b5258c135c62c301bc /sw | |
parent | 68095e63a8ad8f6079b15e475179a14a64da36d3 (diff) |
tdf#101211 Add goto prev and next page uno commands
Change-Id: I7e195727066e47f93665fdebf1042282ecbb42b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91605
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/cmdid.h | 3 | ||||
-rw-r--r-- | sw/sdi/_viewsh.sdi | 8 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 34 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 36 |
4 files changed, 81 insertions, 0 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 6513bf5032a8..5dacd22c53c7 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -721,6 +721,9 @@ #define FN_SELECT_SENTENCE (FN_SELECTION + 94) /* select paragraph*/ +#define FN_TO_NEXT_PAGE (FN_SELECTION + 95) +#define FN_TO_PREV_PAGE (FN_SELECTION + 96) + // QUERY-Block #define FN_TXTATR_INET (FN_QUERY +29) /* INet-Attribute */ diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 55072f98ec2a..4dbc2aecffcf 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -22,6 +22,14 @@ interface BaseTextEditView [ ExecMethod = Execute ; ] + FN_TO_PREV_PAGE + [ + ExecMethod = Execute ; + ] + FN_TO_NEXT_PAGE + [ + ExecMethod = Execute ; + ] FN_PAGEUP // status(final|play) [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 851a086492d4..69dbc63205c0 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -4643,6 +4643,40 @@ SfxVoidItem PageDownSel FN_PAGEDOWN_SEL GroupId = SfxGroupId::Navigator; ] +SfxVoidItem GoToPrevPage FN_TO_PREV_PAGE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Navigator; +] + +SfxVoidItem GoToNextPage FN_TO_NEXT_PAGE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Navigator; +] + SfxUInt16Item PageOffsetDialog FN_CHANGE_PAGENUM (SfxUInt16Item nOffset FN_CHANGE_PAGENUM) [ diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 066b6d855c54..fca753fe6a20 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -134,6 +134,9 @@ #include <rootfrm.hxx> #include <frameformats.hxx> +#include <viewimp.hxx> +#include <pagefrm.hxx> + #include <memory> const char sStatusDelim[] = " : "; @@ -566,6 +569,39 @@ void SwView::Execute(SfxRequest &rReq) rTmpWin.SetUseInputLanguage( false ); } break; + case FN_TO_PREV_PAGE: + case FN_TO_NEXT_PAGE: + { + SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut()); + if (pPageFrame) + { + sal_uInt16 nPage(pPageFrame->GetPhyPageNum()); + if (nPage != 0) + { + sal_uInt16 nOldPage(nPage); + if (FN_TO_PREV_PAGE == nSlot && nPage > 1) + nPage--; + else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount()) + nPage++; + if (nPage != nOldPage) + { + m_pWrtShell->LockPaint(); + if (IsDrawMode()) + LeaveDrawCreate(); + m_pWrtShell->EnterStdMode(); + m_pWrtShell->GotoPage(nPage, true); + // set visible area (borrowed from SwView::PhyPageUp/Down) + const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y()); + Point aAlPt(AlignToPixel(aPt)); + if(aPt.Y() != aAlPt.Y()) + aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height()); + SetVisArea(aAlPt); + m_pWrtShell->UnlockPaint(); + } + } + } + } + break; case FN_REDLINE_ON: { if( pArgs && |