sw/source/uibase/docvw/SidebarTxtControl.cxx |    6 +--
 sw/source/uibase/docvw/edtwin.cxx            |   42 +++++++++++++--------------
 2 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 77243143dfe8c462a3e4e74a1f5a8a1e58046635
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Sep 29 19:09:19 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Sep 29 20:55:48 2023 +0200

    Simplify a bit
    
    Change-Id: I278836e7a61ac17690e5b89e38189cfdeb5f0b45
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157409
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index d25fa9cc372b..281544a7afe5 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 ee728bd6d20c..322928eb4ead 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 )
-    {
-        m_pApplyTempl->m_pFormatClipboard->Erase();
-        SetApplyTemplate(SwApplyTemplate());
-        m_rView.GetViewFrame().GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
-    }
-    else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
-            rSh.IsHeaderFooterEdit( ) )
+    sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
+
+    if (nKey == KEY_ESCAPE)
     {
-        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 );
 

Reply via email to