Resolves: tdf#99324 accel underlines don't appear in extension option pages

because they are not widget-layout tab pages, we have to dive down
through the WB_DIALOGCONTROL widgets as well

Change-Id: I13dbf88878efd89794158ce43137381008e18890
This commit is contained in:
Caolán McNamara
2016-10-03 12:49:30 +01:00
parent 1bceb4e6ae
commit 348dcf1edb

View File

@@ -128,46 +128,47 @@ void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
}
}
namespace
{
void processChildren(vcl::Window *pParent, bool bShowAccel)
{
// go through its children
vcl::Window* pChild = firstLogicalChildOfParent(pParent);
while (pChild)
{
if (pChild->GetType() == WINDOW_TABCONTROL)
{
// find currently shown tab page
TabControl* pTabControl = static_cast<TabControl*>(pChild);
TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
processChildren(pTabPage, bShowAccel);
}
else if (pChild->GetType() == WINDOW_TABPAGE)
{
// bare tabpage without tabcontrol parent (options dialog)
processChildren(pChild, bShowAccel);
}
else if ((pChild->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL)
{
// special controls that manage their children outside of widget layout
processChildren(pChild, bShowAccel);
}
else
{
ImplHandleControlAccelerator(pChild, bShowAccel);
}
pChild = nextLogicalChildOfParent(pParent, pChild);
}
}
}
bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::Window *pWindow)
{
if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
{
const CommandModKeyData *pCData = rCEvent.GetModKeyData();
const bool bShowAccel = pCData && pCData->IsMod2();
vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
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);
}
}
else if (pGetChild->GetType() == WINDOW_TABPAGE)
{
// bare tabpage without tabcontrol parent (options dialog)
vcl::Window* pTabPageChild = firstLogicalChildOfParent( pGetChild );
// and go through its children
while ( pTabPageChild )
{
ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
pTabPageChild = nextLogicalChildOfParent(pGetChild, pTabPageChild);
}
}
ImplHandleControlAccelerator( pGetChild, bShowAccel );
pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
}
const bool bShowAccel = pCData && pCData->IsMod2();
processChildren(pWindow, bShowAccel);
return true;
}
return false;