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 @@
// 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)
......
......@@ -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; }
......
......@@ -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 )
......
......@@ -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" ;
};
};
};
......
......@@ -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 );
}
......
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