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>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 9ca5e13..a15e89e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -2084,6 +2084,28 @@
          <value>1</value>
        </prop>
      </node>
      <node oor:name=".uno:GoToPrevPage" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">To Previous Page</value>
        </prop>
        <prop oor:name="TooltipLabel" oor:type="xs:string">
          <value xml:lang="en-US">To Previous Page</value>
        </prop>
        <prop oor:name="Properties" oor:type="xs:int">
          <value>1</value>
        </prop>
      </node>
      <node oor:name=".uno:GoToNextPage" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">To Next Page</value>
        </prop>
        <prop oor:name="TooltipLabel" oor:type="xs:string">
          <value xml:lang="en-US">To Next Page</value>
        </prop>
        <prop oor:name="Properties" oor:type="xs:int">
          <value>1</value>
        </prop>
      </node>
      <node oor:name=".uno:SetMultiSelection" oor:op="replace">
        <prop oor:name="Label" oor:type="xs:string">
          <value xml:lang="en-US">MultiSelection On</value>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 6513bf5..5dacd22 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 55072f9..4dbc2ae 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -22,6 +22,14 @@
    [
        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 851a086..69dbc63 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -4643,6 +4643,40 @@
    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 066b6d8..fca753f 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 @@
            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 &&