Simplify a bit

Change-Id: I278836e7a61ac17690e5b89e38189cfdeb5f0b45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157409
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index d25fa9c..281544a 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -284,7 +284,9 @@ void SidebarTextControl::MakeVisible()

bool SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
{
    if (getenv("SW_DEBUG") && rKeyEvt.GetKeyCode().GetCode() == KEY_F12)
    const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
    const sal_uInt16 nKey = rKeyCode.GetCode();
    if (nKey == KEY_F12 && getenv("SW_DEBUG"))
    {
        if (rKeyEvt.GetKeyCode().IsShift())
        {
@@ -295,8 +297,6 @@ bool SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )

    bool bDone = false;

    const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
    sal_uInt16 nKey = rKeyCode.GetCode();
    if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
         ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
    {
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index ee728bd..322928e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1381,22 +1381,25 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
        }
    }

    if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
        m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard )
    sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();

    if (nKey == KEY_ESCAPE)
    {
        m_pApplyTempl->m_pFormatClipboard->Erase();
        SetApplyTemplate(SwApplyTemplate());
        m_rView.GetViewFrame().GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
    }
    else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
            rSh.IsHeaderFooterEdit( ) )
    {
        bool bHeader = bool(FrameTypeFlags::HEADER & rSh.GetFrameType(nullptr,false));
        if ( bHeader )
            rSh.SttPg();
        else
            rSh.EndPg();
        rSh.ToggleHeaderFooterEdit();
        if (m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard)
        {
            m_pApplyTempl->m_pFormatClipboard->Erase();
            SetApplyTemplate(SwApplyTemplate());
            m_rView.GetViewFrame().GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
        }
        else if (rSh.IsHeaderFooterEdit())
        {
            bool bHeader = bool(FrameTypeFlags::HEADER & rSh.GetFrameType(nullptr, false));
            if (bHeader)
                rSh.SttPg();
            else
                rSh.EndPg();
            rSh.ToggleHeaderFooterEdit();
        }
    }

    SfxObjectShell *pObjSh = m_rView.GetViewFrame().GetObjectShell();
@@ -1447,27 +1450,24 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
    bool bAppendSpace = s_pQuickHlpData->m_bAppendSpace;
    s_pQuickHlpData->m_bAppendSpace = false;

    if ( getenv("SW_DEBUG") && rKEvt.GetKeyCode().GetCode() == KEY_F12 )
    if (nKey == KEY_F12 && getenv("SW_DEBUG"))
    {
        if( rKEvt.GetKeyCode().IsShift())
        {
            GetView().GetDocShell()->GetDoc()->dumpAsXml();
            return;
        }
        else
        {
            SwRootFrame* pLayout = GetView().GetDocShell()->GetWrtShell()->GetLayout();
            pLayout->dumpAsXml( );
            return;
        }
        return;
    }

    KeyEvent aKeyEvent( rKEvt );
    // look for vertical mappings
    if( !bIsDocReadOnly && !rSh.IsSelFrameMode() && !rSh.IsObjSelected() )
    {
        sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();

        if( KEY_UP == nKey || KEY_DOWN == nKey ||
            KEY_LEFT == nKey || KEY_RIGHT == nKey )
        {
@@ -2817,7 +2817,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
    }

    // update the page number in the statusbar
    sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
    nKey = rKEvt.GetKeyCode().GetCode();
    if( KEY_UP == nKey || KEY_DOWN == nKey || KEY_PAGEUP == nKey || KEY_PAGEDOWN == nKey )
        GetView().GetViewFrame().GetBindings().Update( FN_STAT_PAGE );