Kaydet (Commit) cf4c1bcc authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Adolfo Jayme Barrientos

tdf#123793 Add kb tab navigation to special chars popup window

...and keep the 'More Characters...' button as first focused

Change-Id: Iab4cb00aaed9250f0cc7f35f27af48eb326f2a48
Reviewed-on: https://gerrit.libreoffice.org/71834
Tested-by: Jenkins
Reviewed-by: 's avatarJim Raykowski <raykowj@gmail.com>
(cherry picked from commit caa6de6c)
Reviewed-on: https://gerrit.libreoffice.org/72772Reviewed-by: 's avatarAdolfo Jayme Barrientos <fitojb@ubuntu.com>
üst 9fbc8648
...@@ -40,6 +40,8 @@ public: ...@@ -40,6 +40,8 @@ public:
virtual void dispose() override; virtual void dispose() override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
private: private:
VclPtr<SvxCharViewControl> m_pRecentCharView[16]; VclPtr<SvxCharViewControl> m_pRecentCharView[16];
VclPtr<SvxCharViewControl> m_pFavCharView[16]; VclPtr<SvxCharViewControl> m_pFavCharView[16];
...@@ -50,7 +52,7 @@ private: ...@@ -50,7 +52,7 @@ private:
VclPtr<Button> maDlgBtn; VclPtr<Button> maDlgBtn;
DECL_LINK(CharClickHdl, SvxCharViewControl*, void); DECL_LINK(CharClickHdl, SvxCharViewControl*, void);
DECL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, void); DECL_STATIC_LINK(SfxCharmapCtrl, FocusHdl, Control&, void);
DECL_LINK(OpenDlgHdl, Button*, void); DECL_LINK(OpenDlgHdl, Button*, void);
void getFavCharacterList(); void getFavCharacterList();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <comphelper/dispatchcommand.hxx> #include <comphelper/dispatchcommand.hxx>
#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Common.hxx>
#include <sfx2/charmapcontrol.hxx> #include <sfx2/charmapcontrol.hxx>
#include <vcl/event.hxx>
using namespace css; using namespace css;
...@@ -64,10 +65,14 @@ SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, vcl::Window* pParent, const css:: ...@@ -64,10 +65,14 @@ SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, vcl::Window* pParent, const css::
for(int i = 0; i < 16; i++) 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]->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]->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)); maDlgBtn->SetClickHdl(LINK(this, SfxCharmapCtrl, OpenDlgHdl));
...@@ -177,7 +182,32 @@ void SfxCharmapCtrl::updateRecentCharControl() ...@@ -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(); pItem.Invalidate();
} }
...@@ -185,10 +215,8 @@ IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void) ...@@ -185,10 +215,8 @@ IMPL_STATIC_LINK(SfxCharmapCtrl, LoseFocusHdl, Control&, pItem, void)
IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharViewControl*, rView, void) IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharViewControl*, rView, void)
{ {
rView->GrabFocus();
rView->Invalidate();
rView->InsertCharToDoc(); rView->InsertCharToDoc();
GrabFocusToDocument();
Close(); Close();
} }
......
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