summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-09-30 20:37:12 +0200
committerSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-09-30 20:41:21 +0200
commitd59e33500a250824e713afacef2ea295576caba6 (patch)
tree12f95f7e51253dd33767c89907109f0c6d6d0568
parent4badca074088b1f1a70b340d53fc464ec11e3d29 (diff)
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
-rw-r--r--include/svx/dialogs.hrc2
-rw-r--r--include/vcl/menubtn.hxx3
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx32
-rw-r--r--svx/source/tbxctrls/tbcontrl.src8
-rw-r--r--vcl/source/control/menubtn.cxx10
5 files changed, 26 insertions, 29 deletions
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 65e8087944ce..d96bacb1a6dd 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 78209c818d47..83087ab98318 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 8ca31d8ee503..fe8597d16c35 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 59728c6977e0..df42dca42c4f 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 288b7abeb018..a4ffdf8482b3 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 );
}