Kaydet (Commit) 0321dbb9 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#99324 let sidebar toggle auto-mnemonics on/off with alt

this returns things to passing the alt to the thing with the focus
and depends on ::Command handlers passing the alt-press/release back
up through the Command hierarchy to get to the default top-level
handler eventually

Change-Id: I869120f43810adfa2fac4670c2db143b790a1f9b
üst 6d40c515
......@@ -29,7 +29,7 @@ private:
bool m_bInClose;
bool hasPanelPendingLayout() const;
DECL_DLLPRIVATE_LINK_TYPED( ImplHandlePanelLayoutTimerHdl, Idle*, void );
DECL_DLLPRIVATE_LINK_TYPED(ImplHandlePanelLayoutTimerHdl, Idle*, void);
public:
PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
......@@ -40,7 +40,7 @@ public:
virtual Size GetOptimalSize() const override;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override;
virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
virtual bool Notify(NotifyEvent& rNEvt) override;
};
#endif
......
......@@ -1484,6 +1484,13 @@ void ScTextWnd::MouseButtonUp( const MouseEvent& rMEvt )
void ScTextWnd::Command( const CommandEvent& rCEvt )
{
//pass alt press/release to parent impl
if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
{
Window::Command(rCEvt);
return;
}
bInputMode = true;
CommandEventId nCommand = rCEvt.GetCommand();
if ( pEditView /* && nCommand == CommandEventId::StartDrag */ )
......
......@@ -2842,6 +2842,12 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
ScModule* pScMod = SC_MOD();
OSL_ENSURE( nCmd != CommandEventId::StartDrag, "ScGridWindow::Command called with CommandEventId::StartDrag" );
if (nCmd == CommandEventId::ModKeyChange)
{
Window::Command(rCEvt);
return;
}
if ( nCmd == CommandEventId::StartExtTextInput ||
nCmd == CommandEventId::EndExtTextInput ||
nCmd == CommandEventId::ExtTextInput ||
......
......@@ -261,8 +261,11 @@ void Window::MouseButtonUp(const MouseEvent& rMEvt)
void Window::Command(const CommandEvent& rCEvt)
{
if ( mpViewShell )
if (mpViewShell)
mpViewShell->Command(rCEvt, this);
//pass at least alt press/release to parent impl
if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
vcl::Window::Command(rCEvt);
}
bool Window::Notify( NotifyEvent& rNEvt )
......
......@@ -163,18 +163,6 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
// init background
SetBackground();
GetParent()->AddEventListener(LINK(this, BackingWindow, WindowEventListener));
}
IMPL_LINK_TYPED(BackingWindow, WindowEventListener, VclWindowEvent&, rEvent, void)
{
if (rEvent.GetId() != VCLEVENT_WINDOW_COMMAND)
return;
CommandEvent* pCmdEvt = static_cast<CommandEvent*>(rEvent.GetData());
if (pCmdEvt->GetCommand() != CommandEventId::ModKeyChange)
return;
Accelerator::ToggleMnemonicsOnHierarchy(*pCmdEvt, this);
}
BackingWindow::~BackingWindow()
......@@ -184,7 +172,6 @@ BackingWindow::~BackingWindow()
void BackingWindow::dispose()
{
GetParent()->RemoveEventListener(LINK(this, BackingWindow, WindowEventListener));
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
......
......@@ -106,7 +106,6 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
DECL_LINK_TYPED(CreateContextMenuHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
void initControls();
......
......@@ -335,6 +335,13 @@ void SmEditWindow::MouseButtonDown(const MouseEvent &rEvt)
void SmEditWindow::Command(const CommandEvent& rCEvt)
{
//pass alt press/release to parent impl
if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
{
Window::Command(rCEvt);
return;
}
bool bForwardEvt = true;
if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
{
......
......@@ -110,4 +110,11 @@ void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight));
}
bool PanelLayout::Notify(NotifyEvent& rNEvt)
{
if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this);
return Control::Notify( rNEvt );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -164,6 +164,9 @@ bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::W
bool SystemWindow::Notify( NotifyEvent& rNEvt )
{
if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this);
// capture KeyEvents for menu handling
if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ||
rNEvt.GetType() == MouseNotifyEvent::COMMAND)
......@@ -185,11 +188,6 @@ bool SystemWindow::Notify( NotifyEvent& rNEvt )
}
if (bDone)
return true;
if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
{
if (Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this))
return true;
}
}
return Window::Notify( rNEvt );
......
......@@ -2086,33 +2086,10 @@ static void ImplHandleSalKeyMod( vcl::Window* pWindow, SalKeyModEvent* pEvent )
// #105224# send commandevent to allow special treatment of Ctrl-LeftShift/Ctrl-RightShift etc.
// + auto-accelerator feature, tdf#92630
vcl::Window *pChild = nullptr;
// Alt pressed or released => give SystemWindow a chance to handle auto-accelerator
if ( pEvent->mnCode == KEY_MOD2 || (pEvent->mnModKeyCode & MODKEY_MOD2) != 0 )
{
// find window - first look to see a popup is open and send it there
pChild = pSVData->maWinData.mpFirstFloat.get();
if (!pChild)
{
// find window - then look to see if the system window is available
pChild = pWindow->ImplGetWindowImpl()->mpFirstChild;
while ( pChild )
{
if ( pChild->ImplGetWindowImpl()->mbSysWin )
break;
pChild = pChild->ImplGetWindowImpl()->mpNext;
}
}
}
//...if not, try to find a key input window...
if (!pChild)
pChild = ImplGetKeyInputWindow( pWindow );
//...otherwise fail safe...
if (!pChild)
pChild = pWindow;
// find window
vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
if ( !pChild )
return;
CommandModKeyData data( pEvent->mnModKeyCode );
ImplCallCommand( pChild, CommandEventId::ModKeyChange, &data );
......
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