Kaydet (Commit) d59e3350 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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
üst 4badca07
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
// for Toolbox-Control style // for Toolbox-Control style
#define RID_SVXTBX_STYLE (RID_SVX_START + 120) #define RID_SVXTBX_STYLE (RID_SVX_START + 120)
#define RID_SVX_STYLE_MENU (RID_SVX_START + 121) #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_SVX_MODIFY_STYLE (RID_SVX_START + 123)
#define RID_SVXDLG_COMPRESSGRAPHICS (RID_SVX_START + 142) #define RID_SVXDLG_COMPRESSGRAPHICS (RID_SVX_START + 142)
......
...@@ -45,7 +45,6 @@ private: ...@@ -45,7 +45,6 @@ private:
Link maSelectHdl; Link maSelectHdl;
SAL_DLLPRIVATE void ImplInitMenuButtonData(); SAL_DLLPRIVATE void ImplInitMenuButtonData();
SAL_DLLPRIVATE void ImplExecuteMenu();
DECL_DLLPRIVATE_LINK( ImplMenuTimeoutHdl, void* ); DECL_DLLPRIVATE_LINK( ImplMenuTimeoutHdl, void* );
// Copy assignment is forbidden and not implemented. // Copy assignment is forbidden and not implemented.
...@@ -66,6 +65,8 @@ public: ...@@ -66,6 +65,8 @@ public:
virtual void Activate() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE;
virtual void Select(); virtual void Select();
void ExecuteMenu();
void SetMenuMode( sal_uInt16 nMode ); void SetMenuMode( sal_uInt16 nMode );
sal_uInt16 GetMenuMode() const { return mnMenuMode; } sal_uInt16 GetMenuMode() const { return mnMenuMode; }
......
...@@ -345,24 +345,24 @@ void SvxStyleBox_Impl::ReleaseFocus() ...@@ -345,24 +345,24 @@ void SvxStyleBox_Impl::ReleaseFocus()
IMPL_LINK( SvxStyleBox_Impl, MenuSelectHdl, Menu*, pMenu) 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(); sal_uInt16 nMenuId = pMenu->GetCurItemId();
switch(nMenuId) { switch(nMenuId) {
case RID_SVX_APPLY_STYLE: case RID_SVX_UPDATE_STYLE:
{ {
nCurSel = GetSelectEntryPos(); SfxToolBoxControl::Dispatch( m_xDispatchProvider,
SetText(GetEntry(nCurSel)); OUString( ".uno:StyleUpdateByExample" ), aArgs );
Select();
break; break;
} }
case RID_SVX_MODIFY_STYLE: 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, SfxToolBoxControl::Dispatch( m_xDispatchProvider,
OUString( ".uno:EditStyle" ), aArgs ); OUString( ".uno:EditStyle" ), aArgs );
break; break;
...@@ -484,22 +484,18 @@ bool SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt ) ...@@ -484,22 +484,18 @@ bool SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt )
switch ( nCode ) switch ( nCode )
{ {
case KEY_RETURN: case KEY_CONTEXTMENU:
{ {
if(IsInDropDown()) if(IsInDropDown())
{ {
sal_uInt16 nItem = GetSelectEntryPos() - 1; sal_uInt16 nItem = GetSelectEntryPos() - 1;
if(nItem < MAX_STYLES_ENTRIES) if(nItem < MAX_STYLES_ENTRIES)
m_pButtons[nItem]->KeyInput(*rNEvt.GetKeyEvent()); m_pButtons[nItem]->ExecuteMenu();
nHandled = true;
}
else
{
nHandled = true; nHandled = true;
Select();
} }
break; break;
} }
case KEY_RETURN:
case KEY_TAB: case KEY_TAB:
{ {
if ( KEY_TAB == nCode ) if ( KEY_TAB == nCode )
......
...@@ -79,7 +79,7 @@ String RID_SVXSTR_LINECOLOR ...@@ -79,7 +79,7 @@ String RID_SVXSTR_LINECOLOR
ComboBox RID_SVXTBX_STYLE ComboBox RID_SVXTBX_STYLE
{ {
HelpId = HID_STYLE_LISTBOX ; HelpId = HID_STYLE_LISTBOX ;
Size = MAP_APPFONT ( 50 , 86 ) ; Size = MAP_APPFONT ( 60 , 86 ) ;
DropDown = TRUE ; DropDown = TRUE ;
Sort = TRUE ; Sort = TRUE ;
AutoHScroll = TRUE ; AutoHScroll = TRUE ;
...@@ -94,13 +94,13 @@ Menu RID_SVX_STYLE_MENU ...@@ -94,13 +94,13 @@ Menu RID_SVX_STYLE_MENU
{ {
MenuItem MenuItem
{ {
Identifier = RID_SVX_APPLY_STYLE ; Identifier = RID_SVX_UPDATE_STYLE ;
Text [ en-US ] = "Apply style" ; Text [ en-US ] = "Update Style Based on Selection" ;
}; };
MenuItem MenuItem
{ {
Identifier = RID_SVX_MODIFY_STYLE ; Identifier = RID_SVX_MODIFY_STYLE ;
Text [ en-US ] = "Modify style" ; Text [ en-US ] = "Edit Style" ;
}; };
}; };
}; };
......
...@@ -46,7 +46,7 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -46,7 +46,7 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
EnableRTL( Application::GetSettings().GetLayoutRTL() ); EnableRTL( Application::GetSettings().GetLayoutRTL() );
} }
void MenuButton::ImplExecuteMenu() void MenuButton::ExecuteMenu()
{ {
Activate(); Activate();
...@@ -93,7 +93,7 @@ IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl) ...@@ -93,7 +93,7 @@ IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl)
{ {
if ( !(GetStyle() & WB_NOPOINTERFOCUS) ) if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
GrabFocus(); GrabFocus();
ImplExecuteMenu(); ExecuteMenu();
} }
return 0; return 0;
...@@ -127,7 +127,7 @@ void MenuButton::MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -127,7 +127,7 @@ void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
{ {
if ( !(GetStyle() & WB_NOPOINTERFOCUS) ) if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
GrabFocus(); GrabFocus();
ImplExecuteMenu(); ExecuteMenu();
} }
} }
} }
...@@ -137,11 +137,11 @@ void MenuButton::KeyInput( const KeyEvent& rKEvt ) ...@@ -137,11 +137,11 @@ void MenuButton::KeyInput( const KeyEvent& rKEvt )
vcl::KeyCode aKeyCode = rKEvt.GetKeyCode(); vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
sal_uInt16 nCode = aKeyCode.GetCode(); sal_uInt16 nCode = aKeyCode.GetCode();
if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() ) if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() )
ImplExecuteMenu(); ExecuteMenu();
else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) && else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) &&
!aKeyCode.GetModifier() && !aKeyCode.GetModifier() &&
((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) ) ((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) )
ImplExecuteMenu(); ExecuteMenu();
else else
PushButton::KeyInput( rKEvt ); PushButton::KeyInput( rKEvt );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment