[Libreoffice-commits] core.git: include/svx include/vcl svx/source vcl/source

Samuel Mehrbrodt s.mehrbrodt at gmail.com
Tue Sep 30 11:41:49 PDT 2014


 include/svx/dialogs.hrc          |    2 +-
 include/vcl/menubtn.hxx          |    3 ++-
 svx/source/tbxctrls/tbcontrl.cxx |   32 ++++++++++++++------------------
 svx/source/tbxctrls/tbcontrl.src |    8 ++++----
 vcl/source/control/menubtn.cxx   |   10 +++++-----
 5 files changed, 26 insertions(+), 29 deletions(-)

New commits:
commit d59e33500a250824e713afacef2ea295576caba6
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date:   Tue Sep 30 20:37:12 2014 +0200

    fdo#62081 Improve split menu on style dropdown
    
    * Remove "Apply style"
    * Add "Update Style Based on Selection"
    * A11y:
      * Context menu key: Open submenu
      * Return key: Apply style
    
    Change-Id: Ib2960baa1412a05ea00b0e214d1af0a3d119e852

diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 65e8087..d96bacb 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -185,7 +185,7 @@
 // for Toolbox-Control style
 #define RID_SVXTBX_STYLE                    (RID_SVX_START + 120)
 #define RID_SVX_STYLE_MENU                  (RID_SVX_START + 121)
-#define RID_SVX_APPLY_STYLE                 (RID_SVX_START + 122)
+#define RID_SVX_UPDATE_STYLE                (RID_SVX_START + 122)
 #define RID_SVX_MODIFY_STYLE                (RID_SVX_START + 123)
 
 #define RID_SVXDLG_COMPRESSGRAPHICS         (RID_SVX_START + 142)
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 78209c8..83087ab 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -45,7 +45,6 @@ private:
     Link            maSelectHdl;
 
     SAL_DLLPRIVATE void    ImplInitMenuButtonData();
-    SAL_DLLPRIVATE void    ImplExecuteMenu();
     DECL_DLLPRIVATE_LINK(  ImplMenuTimeoutHdl, void* );
 
     // Copy assignment is forbidden and not implemented.
@@ -66,6 +65,8 @@ public:
     virtual void    Activate() SAL_OVERRIDE;
     virtual void    Select();
 
+    void            ExecuteMenu();
+
     void            SetMenuMode( sal_uInt16 nMode );
     sal_uInt16      GetMenuMode() const { return mnMenuMode; }
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8ca31d8..fe8597d 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -345,24 +345,24 @@ void SvxStyleBox_Impl::ReleaseFocus()
 
 IMPL_LINK( SvxStyleBox_Impl, MenuSelectHdl, Menu*, pMenu)
 {
+    ReleaseFocus();
+    OUString sEntry = OUString( (GetEntry(GetSelectEntryPos())) );
+    Sequence< PropertyValue > aArgs( 2 );
+    aArgs[0].Name   = "Param";
+    aArgs[0].Value  = makeAny( sEntry );
+    aArgs[1].Name   = "Family";
+    aArgs[1].Value  = makeAny( sal_Int16( eStyleFamily ));
+
     sal_uInt16 nMenuId = pMenu->GetCurItemId();
     switch(nMenuId) {
-        case RID_SVX_APPLY_STYLE:
+        case RID_SVX_UPDATE_STYLE:
         {
-            nCurSel = GetSelectEntryPos();
-            SetText(GetEntry(nCurSel));
-            Select();
+            SfxToolBoxControl::Dispatch( m_xDispatchProvider,
+                OUString( ".uno:StyleUpdateByExample" ), aArgs );
             break;
         }
         case RID_SVX_MODIFY_STYLE:
         {
-            OUString sEntry = OUString( (GetEntry(GetSelectEntryPos())) );
-            ReleaseFocus();
-            Sequence< PropertyValue > aArgs( 2 );
-            aArgs[0].Name   = "Param";
-            aArgs[0].Value  = makeAny( sEntry );
-            aArgs[1].Name   = "Family";
-            aArgs[1].Value  = makeAny( sal_Int16( eStyleFamily ));
             SfxToolBoxControl::Dispatch( m_xDispatchProvider,
                 OUString( ".uno:EditStyle" ), aArgs );
             break;
@@ -484,22 +484,18 @@ bool SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt )
 
         switch ( nCode )
         {
-            case KEY_RETURN:
+            case KEY_CONTEXTMENU:
             {
                 if(IsInDropDown())
                 {
                     sal_uInt16 nItem = GetSelectEntryPos() - 1;
                     if(nItem < MAX_STYLES_ENTRIES)
-                        m_pButtons[nItem]->KeyInput(*rNEvt.GetKeyEvent());
-                    nHandled = true;
-                }
-                else
-                {
+                        m_pButtons[nItem]->ExecuteMenu();
                     nHandled = true;
-                    Select();
                 }
                 break;
             }
+            case KEY_RETURN:
             case KEY_TAB:
             {
                 if ( KEY_TAB == nCode )
diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src
index 59728c6..df42dca 100644
--- a/svx/source/tbxctrls/tbcontrl.src
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -79,7 +79,7 @@ String RID_SVXSTR_LINECOLOR
 ComboBox RID_SVXTBX_STYLE
 {
     HelpId = HID_STYLE_LISTBOX ;
-    Size = MAP_APPFONT ( 50 , 86 ) ;
+    Size = MAP_APPFONT ( 60 , 86 ) ;
     DropDown = TRUE ;
     Sort = TRUE ;
     AutoHScroll = TRUE ;
@@ -94,13 +94,13 @@ Menu RID_SVX_STYLE_MENU
     {
         MenuItem
         {
-            Identifier = RID_SVX_APPLY_STYLE ;
-            Text [ en-US ] = "Apply style" ;
+            Identifier = RID_SVX_UPDATE_STYLE ;
+            Text [ en-US ] = "Update Style Based on Selection" ;
         };
         MenuItem
         {
             Identifier = RID_SVX_MODIFY_STYLE ;
-            Text [ en-US ] = "Modify style" ;
+            Text [ en-US ] = "Edit Style" ;
         };
     };
 };
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 288b7ab..a4ffdf8 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -46,7 +46,7 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
     EnableRTL( Application::GetSettings().GetLayoutRTL() );
 }
 
-void MenuButton::ImplExecuteMenu()
+void MenuButton::ExecuteMenu()
 {
     Activate();
 
@@ -93,7 +93,7 @@ IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl)
     {
         if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
             GrabFocus();
-        ImplExecuteMenu();
+        ExecuteMenu();
     }
 
     return 0;
@@ -127,7 +127,7 @@ void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
         {
             if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
                 GrabFocus();
-            ImplExecuteMenu();
+            ExecuteMenu();
         }
     }
 }
@@ -137,11 +137,11 @@ void MenuButton::KeyInput( const KeyEvent& rKEvt )
     vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
     sal_uInt16 nCode = aKeyCode.GetCode();
     if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() )
-        ImplExecuteMenu();
+        ExecuteMenu();
     else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) &&
               !aKeyCode.GetModifier() &&
               ((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) )
-        ImplExecuteMenu();
+        ExecuteMenu();
     else
         PushButton::KeyInput( rKEvt );
 }


More information about the Libreoffice-commits mailing list