Kaydet (Commit) 545d5157 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#95729 move 'alt' accel enable/disable down to systemwindow

from dialog and send the 'alt' to the active floating window, if there
is one, before trying the menubar.

so popups like the calc autofilter one can display their accelerators
when alt is pressed

Change-Id: I52e45b72885b1b0a7362cecc30e41d218a48a58d
üst 89a5464a
......@@ -105,7 +105,6 @@ public:
private:
bool ImplStartExecuteModal();
static void ImplEndExecuteModal();
bool ImplHandleCmdEvent ( const CommandEvent& rCEvent );
public:
// Dialog::Execute replacement API
......
......@@ -179,6 +179,7 @@ public:
private:
SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window* i_pConfigureWin );
virtual void setPosSizeOnContainee(Size aSize, Window &rBox);
bool ImplHandleCmdEvent ( const CommandEvent& rCEvent );
DECL_DLLPRIVATE_LINK_TYPED( ImplHandleLayoutTimerHdl, Idle*, void );
protected:
......
......@@ -98,7 +98,7 @@ String SCSTR_MULTIPLE
String SCSTR_STDFILTER
{
Text [ en-US ] = "~Standard Filter..." ;
Text [ en-US ] = "Standard Filter..." ;
};
String SCSTR_TOP10FILTER
......
......@@ -240,16 +240,6 @@ void ImplWindowAutoMnemonic( vcl::Window* pWindow )
}
}
void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
{
Control *pControl = dynamic_cast<Control*>(pWindow->ImplGetWindow());
if (pControl && pControl->GetText().indexOf('~') != -1)
{
pControl->SetShowAccelerator( bShow );
pControl->Invalidate(InvalidateFlags::Update);
}
}
static VclButtonBox* getActionArea(Dialog *pDialog)
{
VclButtonBox *pButtonBox = nullptr;
......@@ -597,39 +587,6 @@ IMPL_LINK_NOARG_TYPED(Dialog, ImplAsyncCloseHdl, void*, void)
Close();
}
bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent )
{
if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
{
const CommandModKeyData *pCData = rCEvent.GetModKeyData ();
bool bShowAccel = pCData && pCData->IsMod2();
Window *pGetChild = firstLogicalChildOfParent(this);
while (pGetChild)
{
if ( pGetChild->GetType() == WINDOW_TABCONTROL )
{
// find currently shown tab page
TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
// and go through its children
while ( pTabPageChild )
{
ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
}
}
ImplHandleControlAccelerator( pGetChild, bShowAccel );
pGetChild = nextLogicalChildOfParent(this, pGetChild);
}
return true;
}
return false;
}
bool Dialog::Notify( NotifyEvent& rNEvt )
{
// first call the base class due to Tab control
......@@ -672,11 +629,6 @@ bool Dialog::Notify( NotifyEvent& rNEvt )
}
}
else if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
{
if (ImplHandleCmdEvent( *rNEvt.GetCommandEvent()))
return true;
}
}
return bRet;
......
......@@ -31,6 +31,9 @@
#include <vcl/syswin.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/unowrap.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/mnemonic.hxx>
#include <rtl/strbuf.hxx>
......@@ -116,6 +119,49 @@ void SystemWindow::dispose()
Window::dispose();
}
void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
{
Control *pControl = dynamic_cast<Control*>(pWindow->ImplGetWindow());
if (pControl && pControl->GetText().indexOf('~') != -1)
{
pControl->SetShowAccelerator( bShow );
pControl->Invalidate(InvalidateFlags::Update);
}
}
bool SystemWindow::ImplHandleCmdEvent( const CommandEvent& rCEvent )
{
if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
{
const CommandModKeyData *pCData = rCEvent.GetModKeyData ();
bool bShowAccel = pCData && pCData->IsMod2();
Window *pGetChild = firstLogicalChildOfParent(this);
while (pGetChild)
{
if ( pGetChild->GetType() == WINDOW_TABCONTROL )
{
// find currently shown tab page
TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
// and go through its children
while ( pTabPageChild )
{
ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
}
}
ImplHandleControlAccelerator( pGetChild, bShowAccel );
pGetChild = nextLogicalChildOfParent(this, pGetChild);
}
return true;
}
return false;
}
bool SystemWindow::Notify( NotifyEvent& rNEvt )
{
// capture KeyEvents for menu handling
......@@ -139,6 +185,11 @@ bool SystemWindow::Notify( NotifyEvent& rNEvt )
}
if (bDone)
return true;
if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
{
if (ImplHandleCmdEvent( *rNEvt.GetCommandEvent()))
return true;
}
}
return Window::Notify( rNEvt );
......
......@@ -2091,14 +2091,19 @@ static void ImplHandleSalKeyMod( vcl::Window* pWindow, SalKeyModEvent* pEvent )
// 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 if the system window is available
pChild = pWindow->ImplGetWindowImpl()->mpFirstChild;
// find window - first look to see a popup is open and send it there
pChild = pSVData->maWinData.mpFirstFloat.get();
while ( pChild )
if (!pChild)
{
if ( pChild->ImplGetWindowImpl()->mbSysWin )
break;
pChild = pChild->ImplGetWindowImpl()->mpNext;
// 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;
}
}
}
......
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