summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/charmapcontrol.hxx4
-rw-r--r--sfx2/source/control/charmapcontrol.cxx40
2 files changed, 37 insertions, 7 deletions
diff --git a/include/sfx2/charmapcontrol.hxx b/include/sfx2/charmapcontrol.hxx
index 9b58bdd6a4da..1c15ae77b60d 100644
--- a/include/sfx2/charmapcontrol.hxx
+++ b/include/sfx2/charmapcontrol.hxx
@@ -39,6 +39,8 @@ public:
virtual void dispose() override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+
private:
VclPtr<SvxCharViewControl> m_pRecentCharView[16];
VclPtr<SvxCharViewControl> m_pFavCharView[16];
@@ -49,7 +51,7 @@ private:
VclPtr<Button> maDlgBtn;
DECL_LINK(CharClickHdl, SvxCharViewControl*, void);
- DECL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, void);
+ DECL_STATIC_LINK(SfxCharmapCtrl, FocusHdl, Control&, void);
DECL_LINK(OpenDlgHdl, Button*, void);
void getFavCharacterList();
diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx
index 8bb684b8e9c1..7f757a7eb4df 100644
--- a/sfx2/source/control/charmapcontrol.cxx
+++ b/sfx2/source/control/charmapcontrol.cxx
@@ -20,6 +20,7 @@
#include <comphelper/dispatchcommand.hxx>
#include <officecfg/Office/Common.hxx>
#include <sfx2/charmapcontrol.hxx>
+#include <vcl/event.hxx>
using namespace css;
@@ -64,10 +65,14 @@ SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, vcl::Window* pParent, const css::
for(int i = 0; i < 16; i++)
{
+ m_pRecentCharView[i]->SetStyle(m_pRecentCharView[i]->GetStyle() | WB_GROUP);
m_pRecentCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, CharClickHdl));
- m_pRecentCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, LoseFocusHdl));
+ m_pRecentCharView[i]->SetGetFocusHdl(LINK(this,SfxCharmapCtrl, FocusHdl));
+ m_pRecentCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, FocusHdl));
+ m_pFavCharView[i]->SetStyle(m_pFavCharView[i]->GetStyle() | WB_GROUP);
m_pFavCharView[i]->setMouseClickHdl(LINK(this,SfxCharmapCtrl, CharClickHdl));
- m_pFavCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, LoseFocusHdl));
+ m_pFavCharView[i]->SetGetFocusHdl(LINK(this,SfxCharmapCtrl, FocusHdl));
+ m_pFavCharView[i]->SetLoseFocusHdl(LINK(this,SfxCharmapCtrl, FocusHdl));
}
maDlgBtn->SetClickHdl(LINK(this, SfxCharmapCtrl, OpenDlgHdl));
@@ -177,7 +182,32 @@ void SfxCharmapCtrl::updateRecentCharControl()
}
-IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void)
+bool SfxCharmapCtrl::EventNotify( NotifyEvent& rNEvt )
+{
+ static bool bNeedsInit = true;
+ if ( maDlgBtn->HasFocus() && rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+ {
+ const vcl::KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode();
+ const sal_uInt16 nCode = rKey.GetCode();
+ if ( nCode != KEY_TAB && nCode != KEY_RETURN && nCode != KEY_SPACE && nCode != KEY_ESCAPE )
+ {
+ return true;
+ }
+ if ( bNeedsInit && nCode == KEY_TAB )
+ {
+ for(int i = 0; i < 16; i++)
+ {
+ m_pRecentCharView[i]->set_property( "can-focus", "true" );
+ m_pFavCharView[i]->set_property( "can-focus", "true" );
+ }
+ bNeedsInit = false;
+ }
+ }
+ return SfxPopupWindow::EventNotify( rNEvt );
+}
+
+
+IMPL_STATIC_LINK(SfxCharmapCtrl, FocusHdl, Control&, pItem, void)
{
pItem.Invalidate();
}
@@ -185,10 +215,8 @@ IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void)
IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharViewControl*, rView, void)
{
- rView->GrabFocus();
- rView->Invalidate();
rView->InsertCharToDoc();
-
+ GrabFocusToDocument();
Close();
}